|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
HttpMuxDir HttpDir Multiplexer captures many resource requests and feeds all resource requests to one page.
The HttpMuxDir class makes it possible to have an LSP or CSP page handle multiple URL's. The HttpMuxDir class is typically used in Representational State Transfer (REST) design. Another use for this class is to design a template based page design, where all pages use a common header and footer.
The page can get the full URI by calling:
C/C++ code HttpResponse::getRequestURI.
LSP: request:uri()
The URI is typically used as a path for opening HTML page fragments or for searching in a database.
The page can signal that it did not handle the request by leaving the response untouched: no output operation, no committed response, and status code still 200. The virtual file system will, in this case, continue searching for the requested resource.
#include <HttpMuxDir.h>

Public Member Functions | |
| HttpMuxDir (const char *name, HttpDir *startDir, const char *muxResource, S8 priority=0) | |
| Create an HttpMuxDir instance. More... | |
Public Member Functions inherited from HttpDir | |
| HttpDir () | |
| Constructor for creating a root dir, a root dir has no name. More... | |
| HttpDir (const char *name, S8 priority=0) | |
| Constructor for creating a sub-directory. More... | |
| ~HttpDir () | |
| Unlink this directory and notify all child pages/directories through their service callbacks with NULL request arguments. More... | |
| int | insertDir (HttpDir *dir) |
| Insert a sub-directory. More... | |
| int | insertPage (HttpPage *page) |
| Insert a page in the directory. More... | |
| HttpPage * | getFirstPage () |
| Returns the first page. More... | |
| HttpDir * | getFirstDir () |
| Returns the first sub-directory. More... | |
| HttpDir * | getDir (const char *name) |
| Returns the first directory with the name given or NULL if not found. More... | |
| HttpPage * | getPage (const char *name) |
| Returns the page with the name given or NULL if not found. More... | |
| HttpDir * | getNext () |
| Returns the next dir in the parent list. More... | |
| HttpPage * | findPage (HttpPage *iter, const char *name) |
| Searches for a page in this directory node. More... | |
| HttpDir * | createOrGet (const char *name) |
| Returns a sub-directory with the given name. More... | |
| const char * | getName () const |
| Returns the directory name. More... | |
| HttpDir * | getParent () const |
| Returns the parent directory or NULL if no parent. More... | |
| char * | makeAbsPath (const char *relPath, int relPathLen) |
| Makes an absolute path based on where the HttpDir instance is installed in the virtual file system and the provided relative path. More... | |
| char * | getRootPath () |
| Calculates the root of where the HttpDir instance is installed in the virtual file system. More... | |
| HttpDir_Service | setService (HttpDir_Service s) |
| Replace the original service function in HttpDir with your own. More... | |
| void | p403 (const char *p403) |
| Set a 403 denied request handler. More... | |
| bool | isLinked () |
| Returns true if this directory node is installed into a parent directory. More... | |
| int | unlink () |
| Unlinks/removes the directory from the parent directory. More... | |
| void | setAuthenticator (struct AuthenticatorIntf *authenticator, struct AuthorizerIntf *authorizer=0) |
| Set the optional authenticator and optional AuthorizerIntf. More... | |
| bool | authenticateAndAuthorize (HttpCommand *cmd, const char *path) |
| Authenticate and authorize the user. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from HttpDir | |
| static HttpDir * | findDir (HttpDir *iter, const char *name, unsigned int nameLen) |
| Searches for a sub-directory in this directory node. More... | |
| HttpMuxDir::HttpMuxDir | ( | const char * | name, |
| HttpDir * | startDir, | ||
| const char * | muxResource, | ||
| S8 | priority = 0 |
||
| ) |
Create an HttpMuxDir instance.
| name | Borrowed NUL-terminated HttpDir name, valid throughout use; NULL selects an empty name. |
| startDir | Required borrowed directory from which to resolve the target. It must outlive this multiplexer. |
| muxResource | Required borrowed NUL-terminated path from startDir to a CSP or LSP page. One leading slash is ignored. Keep this string valid and unchanged for the lifetime of the multiplexer. |
| priority | Signed directory priority, default zero; see HttpDir. Construction does not resolve the target or report whether it exists. |