|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
Route and process HTTP requests using a borrowed dispatcher. More...
#include <HttpServer.h>
Public Member Functions | |
| HttpServer (SoDisp *dispatcher, HttpServerConfig *cfg=0) | |
| Create a Web Server object. More... | |
| ~HttpServer () | |
| Stop using the server before destruction. More... | |
| int | insertRootDir (HttpDir *dir) |
| Insert a root directory node. More... | |
| int | insertDir (const char *virtualDirRootPath, HttpDir *dir) |
| Insert a directory node into the virtual file system. More... | |
| int | insertCSP (CspInit cspInit, const char *virtualDirRootPath, struct CspReader *reader) |
| Insert and initialize a CSP Virtual Directory. More... | |
| ThreadMutex * | getMutex () |
| Get the dispatcher mutex. More... | |
| SoDisp * | getDispatcher () |
| Returns the dispatcher object. More... | |
| HttpDir * | getFirstRootDir () |
| Returns the first root directory. More... | |
| HttpSessionContainer * | getSessionContainer () |
| Get the HttpSessionContainer. More... | |
| HttpSession * | getSession (U32 id) |
| Returns the HttpSession associated with id or NULL if not found. More... | |
| void | set404Page (const char *page404) |
| Set a more user friendly 404 page. More... | |
| const char * | get404Page () |
| Returns a pointer to the current 404 page, if any. More... | |
Static Public Member Functions | |
| static void | initStatic (void) |
| The only purpose with this function is to clean all static variables that are in the BSS section; i.e., you do not need to call this function if you properly clear your static uninitialized variables. More... | |
| static void | setErrHnd (UserDefinedErrHandler e) |
| You can set your own user defined error handler for the web-server. More... | |
| static const char * | getStatusCode (int code) |
| Return a short description for common HTTP error codes. More... | |
Route and process HTTP requests using a borrowed dispatcher.
Create the port mutex and SoDisp first, optionally initialize HttpServerConfig, and then construct the server. Install routes and listeners before dispatching requests. The server borrows the dispatcher for its lifetime; configuration is consumed during construction. See the constructor for mutation and failure behavior.
Calls from application threads must follow The SoDisp mutex.. Stop incoming work and worker activity before destroying the server. Its destructor cleans owned commands, connections, sessions, and installed routes; retain callback dependencies through cleanup and release borrowed port objects later.
C entry point: HttpServer_constructor(). See Start a native web server for a complete supplied project and the C/C++ mapping.