Barracuda Application Server C/C++ Reference
HttpDir Struct Reference

An instance of the HttpDir class, which is a collection of zero or more resources, serves as one directory entry in the virtual file system. More...

#include <HttpServer.h>

Inheritance diagram for HttpDir:

Public Member Functions

 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...
 

Static Public Member Functions

static HttpDirfindDir (HttpDir *iter, const char *name, unsigned int nameLen)
 Searches for a sub-directory in this directory node. More...
 

Detailed Description

An instance of the HttpDir class, which is a collection of zero or more resources, serves as one directory entry in the virtual file system.

An instance of HttpDir class installed in the virtual file system searches for the next directory and delegates the request to the directory if found. The HttpDir class also delegates requests to HttpPage instances installed in the directory.

The HttpDir class can be sub-classed and the functionality can be extended. The HttpDir instance is an ideal building block when designing Representational State Transfer (RESTful) based applications.

In a true RESTful application, every resource is uniquely addressable through the resource's URL. The URL can point to physical objects such as files handled by the HttpResMgr or to virtual resources created on demand from the URL itself.

See also
HttpPage