fastdo  0.6.16
webx_HttpApp.hpp
浏览该文件的文档.
1 #pragma once
2 
3 namespace eienwebx
4 {
7 {
11 };
12 
13 class HttpRequestCtx;
14 
18 class EIENWEBX_DLL HttpApp : public App, public http::HttpServer
19 {
20 public:
22 
24  static void InitPrivateData();
25 
34 
40 
42  HttpApp();
43 
48  HttpApp( winux::ConfigureSettings const & settings, AppServerExternalData * externalData );
49 
61  HttpApp(
62  winux::ConfigureSettings const & settings,
63  AppServerExternalData * externalData,
64  eiennet::ip::EndPoint const & ep,
65  int threadCount = 4,
66  int backlog = 0,
67  double serverWait = 0.002,
68  double verboseInterval = 0.01,
70  int cacheLifeTime = 86400
71  );
72 
80  bool init( winux::ConfigureSettings const & settings, AppServerExternalData * externalData );
81 
96  bool init(
97  winux::ConfigureSettings const & settings,
98  AppServerExternalData * externalData,
99  eiennet::ip::EndPoint const & ep,
100  int threadCount = 4,
101  int backlog = 0,
102  double serverWait = 0.002,
103  double verboseInterval = 0.01,
105  int cacheLifeTime = 86400
106  );
107 
113  void crossRoute( winux::String const & method, winux::String const & path, CrossRouteHandlerFunction handler );
114 
120  void route( winux::String const & method, winux::String const & path, RouteHandlerFunction handler );
121 
125  virtual int run( void * runParam ) override;
126 
127 protected:
128  virtual eiennet::ClientCtx * onCreateClient( winux::uint64 clientId, winux::String const & clientEpStr, winux::SharedPointer<eiennet::ip::tcp::Socket> clientSockPtr ) override;
129  virtual http::Response * onCreateResponse( http::Request & req, winux::SimplePointer<http::RspOutputMgr> outputMgr ) override;
130  virtual bool _beginHttpRequest( winux::SharedPointer<http::HttpRequestCtx> requestCtxPtr, http::UrlPathPartData * urlData ) override;
131  virtual bool onExtensionHandling( winux::String const & extName, winux::String const & fullPath, winux::SharedPointer<http::Request> requestPtr, http::Response & rsp ) override;
132 
133  friend class HttpRequestCtx;
134 };
135 
136 } // namespace eienwebx
std::function< bool(winux::SharedPointer< _ReqClass > requestPtr, _RspClass &rsp, winux::StringArray const &urlPathPartArr, size_t i) > CrossRouteHandlerFunctionT
过径路由处理函数类型
基础客户场景类
处理URL路径部分时的一些中间变量
Definition: http_misc.hpp:12
HTTP客户请求场景
#define EIENWEBX_DLL
HTTP服务器应用
XString< tchar > String
Definition: utilities.hpp:261
Web功能的相关封装
更强大的配置文件类
Definition: archives.hpp:71
std::function< void(winux::SharedPointer< _ReqClass > requestPtr, _RspClass &rsp) > RouteHandlerFunctionT
普通路由处理函数类型
在控制台输出
RouteHandlerFunctionT< HttpRequestCtx, Response > RouteHandlerFunction
普通路由处理函数类型
HTTP服务器
HTTP请求
Definition: http_Request.hpp:8
App类,内部有Do文件载入/执行功能
Definition: webx_App.hpp:13
引用计数共享指针
Definition: smartptr.hpp:456
winux::String exeFile
可执行文件(目录+文件名)
Definition: webx_HttpApp.hpp:8
winux::String exeTitle
可执行文件名标题(不带扩展名)
HttpApp私有数据
Definition: webx_HttpApp.hpp:6
VerboseOutputType
冗余信息输出类型
static HttpAppPrivateData PrivateData
HTTP响应
CrossRouteHandlerFunctionT< HttpRequestCtx, Response > CrossRouteHandlerFunction
过径路由处理函数类型
unsigned __int64 uint64
Definition: utilities.hpp:230
App服务器外部定义的公开数据
Definition: appserv.hpp:7
winux::String exeDirPath
可执行文件目录路径
Definition: webx_HttpApp.hpp:9