Barracuda Application Server C/C++ Reference
NO
HttpMuxDir Struct Reference

Detailed Description

HttpMuxDir HttpDir Multiplexer captures many muxResource requests and feeds all muxResource 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 not writing anything to the response. The virtual file system will, in this case, continue searching for the muxResource.

#include <HttpMuxDir.h>

Inheritance diagram for HttpMuxDir:

Public Member Functions

 HttpMuxDir (const char *name, HttpDir *startDir, const char *muxResource, S8 priority=0)
 
- Public Member Functions inherited from HttpDir
 HttpDir ()
 Constructor for creating a root dir, a root dir has no name.
 
 HttpDir (const char *name, S8 priority=0)
 Constructor for creating a sub-directory. More...
 
int insertDir (HttpDir *dir)
 Insert a sub-directory. More...
 
int insertPage (HttpPage *page)
 Insert a page in the directory. More...
 
HttpPagegetFirstPage ()
 Returns the first page.
 
HttpDirgetFirstDir ()
 Returns the first sub-directory.
 
HttpDirgetDir (const char *name)
 Returns the first directory with the name given or NULL if not found.
 
HttpPagegetPage (const char *name)
 Returns the page with the name given or NULL if not found.
 
HttpDirgetNext ()
 Returns the next dir in the parent list. More...
 
HttpPagefindPage (HttpPage *iter, const char *name)
 Searches for a page in this directory node. More...
 
HttpDircreateOrGet (const char *name)
 Returns a sub-directory with the given name. More...
 
const char * getName () const
 Returns the directory name.
 
HttpDirgetParent () const
 Returns the parent directory or NULL if no parent.
 
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 overloadService (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.
 
int unlink ()
 Unlinks/removes the directory from the parent directory.
 
void setAuthenticator (struct AuthenticatorIntf *authenticator, struct AuthorizerIntf *authorizer=0)
 Set the optional authenticator and/or the 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 HttpDirfindDir (HttpDir *iter, const char *name, unsigned int nameLen)
 Searches for a sub-directory in this directory node. More...
 

Constructor & Destructor Documentation

◆ HttpMuxDir()

HttpMuxDir::HttpMuxDir ( const char *  name,
HttpDir startDir,
const char *  muxResource,
S8  priority = 0 
)
Parameters
namethe HttpDir name.
startDirthe directory where we search for the mux muxResource.
muxResourceis the relative path from 'startDir' to the mux muxResource, which is normally a CSP or LSP page.
prioritythe page priority. See HttpDir for more information.