Single instance HTTP Server using WiFly Interface.
HttpServer Class Reference
This is the non-blocking HTTP Server class. More...
|Structure which will allow to order the stored handlers according to their associated path. More...|
|void||HandleRequest (HTTPConnection::HTTPMessage *msg)|
|Internal function which processes a request and which will try to find the matching handler function for the given request. |
|template<typename T >|
|void||addHandler (const char *path)|
|Adds a request handler to the handlers list. |
|void||addErrorHandler (HTTPRequestHandlerFunction hdlFunc)|
|Replaces the standard error Handler. |
|static void||StdErrorHandler (HTTPConnection::HTTPMessage &msg)|
|The standard error handler function. |
|static map< string, |
char *, const char
&), handlersComp >
|Map of handler objects. |
This is the non-blocking HTTP Server class.
The idea behind this class is as follows: the user may instantiate the class and initialize it. Once the server is setup and listening, the server will stay in an endless loop and keep on listening for new connections and for new HTTP requests. Once a request is received it will be placed in a queue. The queue itself will be handled in a separate task.
Member Function Documentation
|void addErrorHandler||(||HTTPRequestHandlerFunction||hdlFunc )|
|void addHandler||(||const char *||path )|
Adds a request handler to the handlers list.
You will have to use one of the existing implementations. With each handler a
path is associated. Whenever a request is received the server will walk through all registered handlers and check which
path is matching.
T : class which will be instanciated to serve these requests for the associated path. path : request uri starting with this
pathwill be served using this handler.
|void HandleRequest||(||HTTPConnection::HTTPMessage *||msg )|
Internal function which processes a request and which will try to find the matching handler function for the given request.
Please note that the function will search through the list of handlers, iterating from longest to shortest
paths. If the registered
path is a subset of the request the associated handler is considered as being a match.
msg : Request message data. Contains the requested logical
tcp : Socket to be used for communication with the client.
|void StdErrorHandler||(||HTTPConnection::HTTPMessage &||msg )||
|map< string, HTTPRequestHandler *(*)(const char *, const char *, HTTPConnection::HTTPMessage &), HttpServer::handlersComp > m_lpHandlers
Generated on Mon Dec 17 2018 19:36:52 by 1.7.2