Qore HttpServer Module Reference  0.3.7
 All Classes Namespaces Functions Variables Groups Pages
HttpServer::AbstractUrlHandler Class Reference

abstract class for HTTP request handlers anchored at a specific URL More...

Inheritance diagram for HttpServer::AbstractUrlHandler:

Public Member Functions

 constructor (string url_root, *AbstractAuthenticator auth)
 creates the object based on the URL root and optional authenticator More...
 
string getRelativePath (string path)
 returns the relative path anchored from the url_root if possible; URI query arguments are stripped off, if the url_root cannot be matched then the path is returned with URI query arguments removed
 
- Public Member Functions inherited from HttpServer::AbstractHttpRequestHandler
 constructor (*AbstractAuthenticator auth)
 create the object optionally with the given AbstractAuthenticator More...
 
hash handleRequest (hash cx, hash hdr, *data body)
 will be called when a request is received that should be directed to the handler More...
 
 restoreThreadLocalData (*hash data)
 called after handleRequest() with any data returned from saveThreadData() More...
 
*hash saveThreadLocalData ()
 called before handleRequest() any data returned here will be given to restoreThreadLocalData() after the handleRequest() call More...
 

Public Attributes

string url_root
 root part of URL for matching requests
 
- Public Attributes inherited from HttpServer::AbstractHttpRequestHandler
*AbstractAuthenticator auth
 the optional AbstractAuthenticator for requests to this handler
 
bool decompress = True
 if POSTed data should be decompressed automatically if there is content-encoding
 
bool decompress_to_string = True
 if automatically decompressed POSTed data should be converted to a string (if False, then it will be decompressed to a binary)
 

Additional Inherited Members

- Static Public Member Functions inherited from HttpServer::AbstractHttpRequestHandler
static *string getLogMessage (hash cx, hash api, reference params, *reference args)
 helper method for handling log messages More...
 
static hash make400 (string fmt)
 creates a hash for an HTTP 400 error response with the response message body as a string
 
static hash make400 (hash hdr, string fmt)
 creates a hash for an HTTP 400 error response with the response message body as a string
 
static hash make501 (string fmt)
 creates a hash for an HTTP 501 error response with the response message body as a string
 
static hash make501 (hash hdr, string fmt)
 creates a hash for an HTTP 501 error response with the response message body as a string
 
static hash makeResponse (int code, string fmt)
 creates a hash for an HTTP response with the response code and the response message body as a formatted string
 
static hash makeResponse (hash hdr, int code, string fmt)
 creates a hash for an HTTP response with the response code and the response message body as a formatted string
 
static hash makeResponse (int code, *data body, *hash hdr)
 creates a hash for an HTTP response with the response code and a literal response message body
 
static hash redirect (hash cx, hash hdr, string path)
 generates a redirect hash for the given path
 

Detailed Description

abstract class for HTTP request handlers anchored at a specific URL

Member Function Documentation

HttpServer::AbstractUrlHandler::constructor ( string  url_root,
*AbstractAuthenticator  auth 
)

creates the object based on the URL root and optional authenticator

Parameters
url_rootthe root part of the URL path without the leading "/"
auththe authentication object to use to authenticate connections (see AbstractAuthenticator); if no AbstractAuthenticator object is passed, then by default no authentication will be required