A class for listening and processing HTTP requests at a specific URI.
More...
#include <http_listener.h>
A class for listening and processing HTTP requests at a specific URI.
web::http::experimental::listener::http_listener::http_listener |
( |
http::uri |
address | ) |
|
|
inline |
Create a listener from a URI.
The listener will not have been opened when returned.
- Parameters
-
address | URI at which the listener should accept requests. |
Create a listener with specified URI and configuration.
- Parameters
-
address | URI at which the listener should accept requests. |
config | Configuration to create listener with. |
web::http::experimental::listener::http_listener::http_listener |
( |
| ) |
|
|
inline |
Default constructor.
The resulting listener cannot be used for anything, but is useful to initialize a variable that will later be overwritten with a real listener instance.
_ASYNCRTIMP web::http::experimental::listener::http_listener::~http_listener |
( |
| ) |
|
Destructor frees any held resources.
Call close() before allowing a listener to be destroyed.
web::http::experimental::listener::http_listener::http_listener |
( |
http_listener && |
other | ) |
|
|
inline |
Move constructor.
- Parameters
-
pplx::task<void> web::http::experimental::listener::http_listener::close |
( |
| ) |
|
|
inline |
Asynchronously stop accepting requests and close all connections.
- Returns
- A task that will be completed once this listener is actually closed, no longer accepting requests.
This function will stop accepting requests and wait for all outstanding handler calls to finish before completing the task. Waiting on the task returned from close() within a handler and blocking waiting for its result will result in a deadlock.
Call close() before allowing a listener to be destroyed.
const http_listener_config& web::http::experimental::listener::http_listener::configuration |
( |
| ) |
const |
|
inline |
Get the configuration of this listener.
- Returns
- Configuration this listener was constructed with.
pplx::task<void> web::http::experimental::listener::http_listener::open |
( |
| ) |
|
|
inline |
Asynchronously open the listener, i.e. start accepting requests.
- Returns
- A task that will be completed once this listener is actually opened, accepting requests.
Move assignment operator.
- Parameters
-
void web::http::experimental::listener::http_listener::support |
( |
const std::function< void(http_request)> & |
handler | ) |
|
|
inline |
Add a general handler to support all requests.
- Parameters
-
handler | Function object to be called for all requests. |
void web::http::experimental::listener::http_listener::support |
( |
const http::method & |
method, |
|
|
const std::function< void(http_request)> & |
handler |
|
) |
| |
|
inline |
Add support for a specific HTTP method.
- Parameters
-
method | An HTTP method. |
handler | Function object to be called for all requests for the given HTTP method. |
const http::uri& web::http::experimental::listener::http_listener::uri |
( |
| ) |
const |
|
inline |
Get the URI of the listener.
- Returns
- The URI this listener is for.
The documentation for this class was generated from the following file: