@@ -46,7 +46,7 @@ RewriteRule . index.html
4646
4747Contains base handler:
4848```
49- WSJCppLightWebHttpHandlerRewriteFolder (sPrefixPath, sDirPath)
49+ WsjcppLightWebHttpHandlerRewriteFolder (sPrefixPath, sDirPath)
5050```
5151Where
5252* sPrefixPath - like "/app1/" -> "http://localhost:1234/app1/ "
@@ -61,10 +61,10 @@ Example init, add handler and start server
6161#include <wsjcpp_light_web_http_handler_rewrite_folder.h>
6262
6363...
64- WSJCppLightWebServer httpServer;
64+ WsjcppLightWebServer httpServer;
6565httpServer.setPort(1234);
6666httpServer.setMaxWorkers(1);
67- httpServer.addHandler((WSJCppLightWebHttpHandlerBase *)new WSJCppLightWebHttpHandlerRewriteFolder ("/app1/", "./web"));
67+ httpServer.addHandler((WsjcppLightWebHttpHandlerBase *)new WsjcppLightWebHttpHandlerRewriteFolder ("/app1/", "./web"));
6868httpServer.startSync(); // this method will be hold current thread, if you with you can call just start/stop command
6969```
7070
@@ -74,7 +74,7 @@ After compile and start will be available on `http://localhost:1234/app1/`
7474
7575Contains base handler:
7676```
77- WSJCppLightWebHttpHandlerWebFolder (sPrefixPath, sDirPath)
77+ WsjcppLightWebHttpHandlerWebFolder (sPrefixPath, sDirPath)
7878```
7979
8080Where
@@ -88,10 +88,10 @@ Example init, add handler and start server
8888#include <wsjcpp_light_web_http_handler_web_folder.h>
8989
9090...
91- WSJCppLightWebServer httpServer;
91+ WsjcppLightWebServer httpServer;
9292httpServer.setPort(1234);
9393httpServer.setMaxWorkers(1);
94- httpServer.addHandler((WSJCppLightWebHttpHandlerBase *)new WSJCppLightWebHttpHandlerWebFolder ("/app2/", "./web"));
94+ httpServer.addHandler((WsjcppLightWebHttpHandlerBase *)new WsjcppLightWebHttpHandlerWebFolder ("/app2/", "./web"));
9595httpServer.startSync(); // this method will be hold current thread, if you with you can call just start/stop command
9696```
9797
@@ -108,11 +108,11 @@ header-file `http_handler_custom.h`:
108108
109109#include <wsjcpp_light_web_server.h>
110110
111- class HttpHandlerCustom : WSJCppLightWebHttpHandlerBase {
111+ class HttpHandlerCustom : WsjcppLightWebHttpHandlerBase {
112112 public:
113113 HttpHandlerCustom();
114- virtual bool canHandle(const std::string &sWorkerId, WSJCppLightWebHttpRequest *pRequest);
115- virtual bool handle(const std::string &sWorkerId, WSJCppLightWebHttpRequest *pRequest);
114+ virtual bool canHandle(const std::string &sWorkerId, WsjcppLightWebHttpRequest *pRequest);
115+ virtual bool handle(const std::string &sWorkerId, WsjcppLightWebHttpRequest *pRequest);
116116
117117 private:
118118 std::string TAG;
@@ -128,13 +128,13 @@ source-file `http_handler_custom.cpp`:
128128// ----------------------------------------------------------------------
129129
130130HttpHandlerCustom::HttpHandlerCustom()
131- : WSJCppLightWebHttpHandlerBase ("custom") {
131+ : WsjcppLightWebHttpHandlerBase ("custom") {
132132 TAG = "HttpHandlerCustom";
133133}
134134
135135// ----------------------------------------------------------------------
136136
137- bool HttpHandlerCustom::canHandle(const std::string &sWorkerId, WSJCppLightWebHttpRequest *pRequest) {
137+ bool HttpHandlerCustom::canHandle(const std::string &sWorkerId, WsjcppLightWebHttpRequest *pRequest) {
138138 std::string _tag = TAG + "-" + sWorkerId;
139139 std::string sRequestPath = pRequest->getRequestPath();
140140
@@ -149,12 +149,12 @@ bool HttpHandlerCustom::canHandle(const std::string &sWorkerId, WSJCppLightWebHt
149149
150150// ----------------------------------------------------------------------
151151
152- bool HttpHandlerCustom::handle(const std::string &sWorkerId, WSJCppLightWebHttpRequest *pRequest) {
152+ bool HttpHandlerCustom::handle(const std::string &sWorkerId, WsjcppLightWebHttpRequest *pRequest) {
153153 std::string _tag = TAG + "-" + sWorkerId;
154154 std::string sRequestPath = pRequest->getRequestPath();
155- // WSJCppLog ::warn(_tag, sRequestPath);
155+ // WsjcppLog ::warn(_tag, sRequestPath);
156156
157- WSJCppLightWebHttpResponse resp(pRequest->getSockFd());
157+ WsjcppLightWebHttpResponse resp(pRequest->getSockFd());
158158 if (sRequestPath == "/custom" || sRequestPath == "/custom/") {
159159 resp.cacheSec(60).ok().sendText(
160160 "<h1>This is custom</h1>"
@@ -175,10 +175,10 @@ bool HttpHandlerCustom::handle(const std::string &sWorkerId, WSJCppLightWebHttpR
175175Example init, add handler and start server
176176__ order is important! Server will call canHandle & handle in same order as addHandler called__
177177```
178- WSJCppLightWebServer httpServer;
178+ WsjcppLightWebServer httpServer;
179179httpServer.setPort(1234);
180180httpServer.setMaxWorkers(1);
181- httpServer.addHandler((WSJCppLightWebHttpHandlerBase *)new HttpHandlerCustom());
182- httpServer.addHandler((WSJCppLightWebHttpHandlerBase *)new WSJCppLightWebHttpHandlerRewriteFolder ("/", "./web"));
181+ httpServer.addHandler((WsjcppLightWebHttpHandlerBase *)new HttpHandlerCustom());
182+ httpServer.addHandler((WsjcppLightWebHttpHandlerBase *)new WsjcppLightWebHttpHandlerRewriteFolder ("/", "./web"));
183183httpServer.startSync(); // this method will be hold current thread, if you with you can call just start/stop command
184184```
0 commit comments