#include <HttpServer.h>
HTTP Server
- Note
- Invocation priority: Filter > Mount Point (Filter) > Controller = Servlet, independent and non-convertible
◆ regController()
template<class CTL , class... ARGS>
void sese::service::http::HttpServer::regController |
( |
ARGS &&... | args | ) |
|
Register controller
- Template Parameters
-
CTL | Controller type |
ARGS | Instantiation parameter types |
- Parameters
-
args | Instantiation parameters |
References controllers, and servlets.
◆ regFilter()
Register filter
- Parameters
-
uri_prefix | URI prefix |
callback | Callback function. If the function returns true, it needs further processing, i.e., continue to determine subsequent mount points, controllers, etc. Otherwise, intercept the current request and respond directly. |
References callback(), and filters.
◆ regMountPoint()
void HttpServer::regMountPoint |
( |
const std::string & | uri_prefix, |
|
|
const std::string & | local ) |
Register file system mount point
- Parameters
-
uri_prefix | URI prefix |
local | Local path |
References mount_points.
◆ regService()
Register HTTP service
- Parameters
-
address | Listening address |
context | SSL service context, if null, SSL is not enabled |
References connection_callback, sese::service::http::HttpService::create(), filters, keepalive, mount_points, name, services, servlets, and tail_filter.
◆ regServlet()
◆ regTailFilter()
This method is used to register a post-processing filter that will be executed after other all servlets, controllers, and mount points process exceptions. If you need to finally modify or process the response (e.g., custom 404 pages), you can use this feature. The return value indicates whether the interception has been processed. After interception, the response type will change to Controller and accept the relevant processing.
- Parameters
-
tail_filter | The post-processing HTTP filter to register, used to handle requests |
References tail_filter.
◆ setConnectionCallback()
Set connection callback function, the function will be called before the connection object is created, and the SSL connection has not yet been established
- Parameters
-
callback | Connection callback function. If the function returns true, normal processing will continue, otherwise the connection will be discarded directly. |
References callback(), and connection_callback.
◆ setKeepalive()
void HttpServer::setKeepalive |
( |
uint32_t | seconds | ) |
|
Set keepalive
- Parameters
-
seconds | Keepalive duration, minimum value is 5 |
References keepalive.
◆ setName()
void HttpServer::setName |
( |
const std::string & | name | ) |
|
Set server name
- Parameters
-
References name.
◆ shutdown()
bool HttpServer::shutdown |
( |
| ) |
const |
◆ startup()
bool HttpServer::startup |
( |
| ) |
const |
◆ connection_callback
◆ controllers
◆ filters
◆ keepalive
uint32_t sese::service::http::HttpServer::keepalive = 5 |
|
private |
◆ mount_points
◆ name
std::string sese::service::http::HttpServer::name |
|
private |
◆ services
◆ servlets
◆ tail_filter
The documentation for this class was generated from the following files: