fastdo
0.6.16
|
HTTP服务器 更多...
#include <http_HttpServer.hpp>
Public 成员函数 | |
HttpServer () | |
构造函数0 更多... | |
HttpServer (winux::ConfigureSettings const &settings) | |
构造函数1 更多... | |
HttpServer (winux::ConfigureSettings const &settings, eiennet::ip::EndPoint const &ep, int threadCount=4, int backlog=0, double serverWait=0.002, double verboseInterval=0.01, eiennet::VerboseOutputType verbose=eiennet::votConsole, int cacheLifeTime=86400) | |
构造函数2 更多... | |
bool | init (winux::ConfigureSettings const &settings) |
初始化1 更多... | |
bool | init (winux::ConfigureSettings const &settings, eiennet::ip::EndPoint const &ep, int threadCount=4, int backlog=0, double serverWait=0.002, double verboseInterval=0.01, eiennet::VerboseOutputType verbose=eiennet::votConsole, int cacheLifeTime=86400) |
初始化2 更多... | |
void | crossRoute (winux::String const &method, winux::String const &path, CrossRouteHandlerFunction handler) |
注册过径路由处理器 更多... | |
void | route (winux::String const &method, winux::String const &path, RouteHandlerFunction handler) |
注册普通路由处理器 更多... | |
virtual int | run (void *runParam) override |
运行 更多... | |
void | onCreateResponseHandler (CreateResponseHandlerFunction handler) |
![]() | |
Server () | |
构造函数0,不会启动服务,必须手动调用startup() 更多... | |
Server (bool autoReadData, ip::EndPoint const &ep, int threadCount=4, int backlog=0, double serverWait=0.002, double verboseInterval=0.01, VerboseOutputType verbose=votConsole) | |
构造函数1,会启动服务 更多... | |
virtual | ~Server () |
bool | startup (bool autoReadData, ip::EndPoint const &ep, int threadCount=4, int backlog=0, double serverWait=0.002, double verboseInterval=0.01, VerboseOutputType verbose=votConsole) |
启动服务器 更多... | |
void | stop (bool b=true) |
是否停止服务运行 更多... | |
size_t | getClientsCount () const |
获取客户连接数 更多... | |
void | removeClient (winux::uint64 clientId) |
移除客户连接 更多... | |
void | onClientDataNotifyHandler (ClientDataNotifyHandlerFunction handler) |
void | onClientDataArrivedHandler (ClientDataArrivedHandlerFunction handler) |
void | onCreateClientHandler (CreateClientHandlerFunction handler) |
![]() | |
UrlRouter (http::HttpServerConfig *httpConfig=nullptr) | |
构造函数 更多... | |
virtual | ~UrlRouter () |
析构函数 更多... | |
bool | init (http::HttpServerConfig *httpConfig) |
初始化 更多... | |
void | crossRoute (winux::String const &method, winux::String const &path, CrossRouteHandlerFunction handler) |
注册过径路由处理器 更多... | |
void | route (winux::String const &method, winux::String const &path, RouteHandlerFunction handler) |
注册普通路由处理器 更多... | |
void | onWebMainHandler (WebMainHandlerFunction handler) |
void | onExtensionHandlingHandler (ExtensionHandlingHandlerFunction handler) |
Public 属性 | |
HttpServerConfig | httpConfig |
HTTP服务器配置对象 更多... | |
友元 | |
class | HttpRequestCtx |
HTTP服务器
在文件 http_HttpServer.hpp 第 6 行定义.
using http::HttpServer::CrossRouteHandlerFunction = CrossRouteHandlerFunctionT<HttpRequestCtx, Response> |
过径路由处理函数类型
requestCtxPtr | 请求场景对象 |
rsp | 响应对象 |
urlPathPartArr | URL路径部分数组 |
i | 当前URL路径部分的索引 |
false | 终止过径路由继续 |
true | 继续检测其他路由响应 |
在文件 http_HttpServer.hpp 第 18 行定义.
using http::HttpServer::CreateResponseHandlerFunction = std::function< Response * ( Request & req, winux::SimplePointer<RspOutputMgr> outputMgr ) > |
http::HttpServer::HttpServer | ( | ) |
构造函数0
http::HttpServer::HttpServer | ( | winux::ConfigureSettings const & | settings | ) |
构造函数1
settings | 配置设置 |
http::HttpServer::HttpServer | ( | winux::ConfigureSettings const & | settings, |
eiennet::ip::EndPoint const & | ep, | ||
int | threadCount = 4 , |
||
int | backlog = 0 , |
||
double | serverWait = 0.002 , |
||
double | verboseInterval = 0.01 , |
||
eiennet::VerboseOutputType | verbose = eiennet::votConsole , |
||
int | cacheLifeTime = 86400 |
||
) |
构造函数2
settings | 配置设置 |
ep | 服务监听的EndPoint |
threadCount | 线程池线程数量 |
backlog | listen(backlog) |
serverWait | 服务器IO等待时间 |
verboseInterval | verbose信息刷新间隔 |
verbose | 是否显示提示信息 |
cacheLifeTime | 静态文件缓存时间 |
bool http::HttpServer::init | ( | winux::ConfigureSettings const & | settings | ) |
初始化1
settings | 配置设置 |
bool http::HttpServer::init | ( | winux::ConfigureSettings const & | settings, |
eiennet::ip::EndPoint const & | ep, | ||
int | threadCount = 4 , |
||
int | backlog = 0 , |
||
double | serverWait = 0.002 , |
||
double | verboseInterval = 0.01 , |
||
eiennet::VerboseOutputType | verbose = eiennet::votConsole , |
||
int | cacheLifeTime = 86400 |
||
) |
初始化2
settings | 配置设置 |
ep | 服务监听的EndPoint |
threadCount | 线程池线程数量 |
backlog | listen(backlog) |
serverWait | 服务器IO等待时间 |
verboseInterval | verbose信息刷新间隔 |
verbose | 是否显示提示信息 |
cacheLifeTime | 静态文件缓存时间 |
void http::HttpServer::crossRoute | ( | winux::String const & | method, |
winux::String const & | path, | ||
CrossRouteHandlerFunction | handler | ||
) |
注册过径路由处理器
method | method为半角逗号','分隔的HTTP方法名字符串,可以是"*"表示通配所有HTTP方法 |
path | path需以'/'开头 |
handler | 处理器函数 |
void http::HttpServer::route | ( | winux::String const & | method, |
winux::String const & | path, | ||
RouteHandlerFunction | handler | ||
) |
注册普通路由处理器
method | method为半角逗号','分隔的HTTP方法名字符串,可以是"*"表示通配所有HTTP方法 |
path | path需以'/'开头 |
handler | 处理器函数 |
|
overridevirtual |
|
overrideprotectedvirtual |
重载 eiennet::Server .
被 eienwebx::HttpApp 重载.
|
overrideprotectedvirtual |
重载 eiennet::Server .
|
protected |
处理一次HTTP请求
|
protectedvirtual |
开始HTTP请求处理,初始化一些数据
被 eienwebx::HttpApp 重载.
|
protectedvirtual |
HTTP请求处理完,进行一些收尾
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
结束路由
在文件 http_HttpServer.hpp 第 117 行定义.
|
protectedvirtual |
下一次要做的任务
|
protectedvirtual |
执行客户任务
|
protected |
接收请求头任务
|
protected |
接收请求体任务
|
inline |
在文件 http_HttpServer.hpp 第 140 行定义.
|
protectedvirtual |
被 eienwebx::HttpApp 重载.
|
friend |
在文件 http_HttpServer.hpp 第 142 行定义.
HttpServerConfig http::HttpServer::httpConfig |
HTTP服务器配置对象
在文件 http_HttpServer.hpp 第 101 行定义.
|
protected |
在文件 http_HttpServer.hpp 第 140 行定义.