fastdo  0.6.8
eiennet::old_v1::HttpServer类 参考

HTTP服务器 更多...

#include <eiennet_httpserv.hpp>

类 eiennet::old_v1::HttpServer 继承关系图:
eiennet::old_v1::HttpServer 的协作图:

Public 类型

using ResponseHandlerFunction = std::function< void(eiennet::old_v1::HttpServer::ClientCtxSharedPointer &clientCtxPtr, http::Header const &reqHdr, http::Url const &url, http::Header &rspHdr, std::ostream &rspOut) >
 
- Public 类型 继承自 eiennet::old_v1::Server< HttpClientCtx >
using ClientCtxSharedPointer = winux::SharedPointer< HttpClientCtx >
 
using StartupHandlerFunction = std::function< void(ClientCtxSharedPointer clientCtxPtr) >
 

Public 成员函数

 HttpServer (HttpServerConfig const &confObj)
 构造函数1,需要一个配置对象 更多...
 
 HttpServer (winux::String const &serverIp, winux::ushort port, int threadCount=4, int listenBacklog=10, double durationSec=0.1)
 构造函数2 更多...
 
void setHandler (winux::String const &urlPath, ResponseHandlerFunction handler)
 设置动态页面处理 更多...
 
- Public 成员函数 继承自 eiennet::old_v1::Server< HttpClientCtx >
 Server (ip::EndPoint const &ep, int threadCount=4, int backlog=0)
 构造函数1 更多...
 
virtual ~Server ()
 
virtual int run ()
 
void stop (bool b=true)
 是否停止服务运行 更多...
 
size_t getClientsCount () const
 
void onStartupHandler (StartupHandlerFunction handler)
 
void removeClient (winux::uint64 clientId)
 

Public 属性

HttpServerConfig config
 配置参数 更多...
 

Protected 成员函数

virtual void onStartup (ClientCtxSharedPointer clientCtxPtr) override
 
void _doRecvRequestHeaderTask (ClientCtxSharedPointer clientCtxPtr)
 
void _doRecvRequestBodyTask (ClientCtxSharedPointer clientCtxPtr)
 
void _doRequestTask (ClientCtxSharedPointer clientCtxPtr)
 
void _webProcess (ClientCtxSharedPointer &clientCtxPtr, http::Header const &reqHdr, http::Url const &url, http::Header &rspHdr, std::ostream &rspOut)
 
- Protected 成员函数 继承自 eiennet::old_v1::Server< HttpClientCtx >
ClientCtxSharedPointer_addClient (ip::EndPoint const &clientEp, winux::SharedPointer< ip::tcp::Socket > clientSockPtr)
 

友元

class HttpClientCtx
 

额外继承的成员函数

- Protected 属性 继承自 eiennet::old_v1::Server< HttpClientCtx >
winux::uint64 _cumulativeClientId
 
bool _stop
 
winux::ThreadPool _pool
 
winux::Mutex _mtxServer
 
ip::tcp::Socket _servSock
 
std::map< winux::uint64, ClientCtxSharedPointer_clients
 
StartupHandlerFunction _startupHandler
 

详细描述

HTTP服务器

在文件 eiennet_httpserv.hpp212 行定义.

成员类型定义说明

using eiennet::old_v1::HttpServer::ResponseHandlerFunction = std::function< void ( eiennet::old_v1::HttpServer::ClientCtxSharedPointer & clientCtxPtr, http::Header const & reqHdr, http::Url const & url, http::Header & rspHdr, std::ostream & rspOut ) >

在文件 eiennet_httpserv.hpp218 行定义.

构造及析构函数说明

eiennet::old_v1::HttpServer::HttpServer ( HttpServerConfig const &  confObj)

构造函数1,需要一个配置对象

eiennet::old_v1::HttpServer::HttpServer ( winux::String const &  serverIp,
winux::ushort  port,
int  threadCount = 4,
int  listenBacklog = 10,
double  durationSec = 0.1 
)

构造函数2

成员函数说明

void eiennet::old_v1::HttpServer::_doRecvRequestBodyTask ( ClientCtxSharedPointer  clientCtxPtr)
protected
void eiennet::old_v1::HttpServer::_doRecvRequestHeaderTask ( ClientCtxSharedPointer  clientCtxPtr)
protected
void eiennet::old_v1::HttpServer::_doRequestTask ( ClientCtxSharedPointer  clientCtxPtr)
protected
void eiennet::old_v1::HttpServer::_webProcess ( ClientCtxSharedPointer clientCtxPtr,
http::Header const &  reqHdr,
http::Url const &  url,
http::Header rspHdr,
std::ostream &  rspOut 
)
protected
virtual void eiennet::old_v1::HttpServer::onStartup ( ClientCtxSharedPointer  clientCtxPtr)
overrideprotectedvirtual
void eiennet::old_v1::HttpServer::setHandler ( winux::String const &  urlPath,
ResponseHandlerFunction  handler 
)
inline

设置动态页面处理

在文件 eiennet_httpserv.hpp225 行定义.

友元及相关函数文档

friend class HttpClientCtx
friend

在文件 eiennet_httpserv.hpp247 行定义.

类成员变量说明

HttpServerConfig eiennet::old_v1::HttpServer::config

配置参数

在文件 eiennet_httpserv.hpp215 行定义.


该类的文档由以下文件生成: