Abstract base class of HTTP web application handlers. More...
#include <HttpWebApp.hpp>
Static Public Member Functions | |
| static EmptyResponse | createBadRequestHeadResponse (HttpSession &session, const StringRequest &request) |
| Create a bad request response for a head request. More... | |
| static StringResponse | createBadRequestResponse (HttpSession &session, const StringRequest &request, std::string_view errorMessage) |
| Create a bad request response. More... | |
| static EmptyResponse | createNotFoundHeadResponse (HttpSession &session, const StringRequest &request) |
| Create a not found response for a head request. More... | |
| static StringResponse | createNotFoundStringResponse (HttpSession &session, const StringRequest &request) |
| Create a not found response. More... | |
| static EmptyResponse | createOkHeadResponse (HttpSession &session, const StringRequest &request) |
| Create an empty 200 response for a head request. More... | |
| static StringResponse | createOkResponse (HttpSession &session, const StringRequest &request) |
| Create an empty 200 response. More... | |
| static EmptyResponse | createPermanentRedirectResponse (HttpSession &session, const StringRequest &request, std::string_view location) |
| Create a permanent redirect response. More... | |
| static EmptyResponse | createRedirectResponse (HttpSession &session, const StringRequest &request, std::string_view location) |
| Create a redirect response. More... | |
| static EmptyResponse | createServerErrorHeadResponse (HttpSession &session, const StringRequest &request) |
| Create a server error response for a head request. More... | |
| static StringResponse | createServerErrorResponse (HttpSession &session, const StringRequest &request, std::string_view errorMessage) |
| Create a server error response. More... | |
| template<typename WebAppT > | |
| static void | registerHttpWebApp (const std::string &name) |
| Register an HTTP web application. More... | |
Public Member Functions | |
| virtual | ~HttpWebApp ()=default |
| Destroy the HTTP web application instance. More... | |
| virtual void | handleGetRequest (HttpSession &session, const StringRequest &request, std::map< std::string, std::string > &variables)=0 |
| Handle a GET request. More... | |
| virtual void | handleHeadRequest (HttpSession &session, const StringRequest &request, std::map< std::string, std::string > &variables)=0 |
| Handle a HEAD request. More... | |
| virtual void | handlePostRequest (HttpSession &session, const StringRequest &request, std::map< std::string, std::string > &variables)=0 |
| Handle a POST request. More... | |
Abstract base class of HTTP web application handlers.
All concrete HTTP web applications must have a constructor of the following signature:
const EnvironmentProperties & configuration
This constructor will be used to instantiate the web application during initialisation of the HTTP server.
This class also contains some canned responses for use in handler implementations.
|
virtualdefault |
Destroy the HTTP web application instance.
|
static |
Create a bad request response for a head request.
|
static |
Create a bad request response.
|
static |
Create a not found response for a head request.
|
static |
Create a not found response.
|
static |
Create an empty 200 response for a head request.
|
static |
Create an empty 200 response.
|
static |
Create a permanent redirect response.
|
static |
Create a redirect response.
|
static |
Create a server error response for a head request.
|
static |
Create a server error response.
|
pure virtual |
Handle a GET request.
The supplied session provides shared server state and the sendResponse method.
| session | the HTTP session object, also containing the client session |
| request | the HTTP request object |
| variables | the request variables that are generated and consumed during the request |
Implemented in EmailSendingHttpWebApp, RoutingHttpWebApp, CannedHttpWebApp, RedirectingHttpWebApp, FileServingHttpWebApp, and ConfigurationWebApp.
|
pure virtual |
Handle a HEAD request.
The supplied session provides shared server state and the sendResponse method.
| session | the HTTP session object, also containing the client session |
| request | the HTTP request object |
| variables | the request variables that are generated and consumed during the request |
Implemented in EmailSendingHttpWebApp, RoutingHttpWebApp, CannedHttpWebApp, RedirectingHttpWebApp, FileServingHttpWebApp, and ConfigurationWebApp.
|
pure virtual |
Handle a POST request.
The supplied session provides shared server state and the sendResponse method.
| session | the HTTP session object, also containing the client session |
| request | the HTTP request object |
| variables | the request variables that are generated and consumed during the request |
Implemented in EmailSendingHttpWebApp, RoutingHttpWebApp, CannedHttpWebApp, RedirectingHttpWebApp, FileServingHttpWebApp, and ConfigurationWebApp.
|
inlinestatic |
Register an HTTP web application.
| the | HTTP web application type |
| name | the name of the composite property that provides the web app's configuration |