Qore HttpServer Module Reference
0.3.7
|
abstract class that all HTTP request handler objects must inherit from More...
Public Member Functions | |
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... | |
Static Public Member Functions | |
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 | |
Public Attributes | |
*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) | |
abstract class that all HTTP request handler objects must inherit from
reimplement handleRequest() in subclasses
HttpServer::AbstractHttpRequestHandler::constructor | ( | *AbstractAuthenticator | auth | ) |
create the object optionally with the given AbstractAuthenticator
auth | the authentication object to use to authenticate connections (see AbstractAuthenticator); if no AbstractAuthenticator object is passed, then by default no authentication will be required |
|
static |
helper method for handling log messages
cx | the call context hash |
api | the API description hash |
params | a reference to the call parameters; the call context hash will be added as the first argument |
args | an optional reference to a string describing the arguments |
will be called when a request is received that should be directed to the handler
cx | call context hash; this hash will have the following keys:
|
hdr | incoming header hash; all keys will be converted to lower-case, additionally the following keys will be present:
|
body | message body, if any |
"code"
: the HTTP return code (see HttpServer::HttpCodes)"body"
: the message body to return in the response"close"
: (optional) set this key to True if the connection should be unconditionally closed when the handler returns"hdr"
: (optional) set this key to a hash of extra header information to be returned with the responseHttpServer::AbstractHttpRequestHandler::restoreThreadLocalData | ( | *hash | data | ) |
called after handleRequest() with any data returned from saveThreadData()
*hash HttpServer::AbstractHttpRequestHandler::saveThreadLocalData | ( | ) |
called before handleRequest() any data returned here will be given to restoreThreadLocalData() after the handleRequest() call