Qore HttpServer Module Reference
0.3.6
|
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 | |
hash | handleRequest (hash cx, hash hdr, *data body) |
will be called when a request is received that should be directed to the handler | |
*hash | saveThreadLocalData () |
called before handleRequest() any data returned here will be given to restoreThreadLocalData() after the handleRequest() call | |
restoreThreadLocalData (*hash data) | |
called after handleRequest() with any data returned from saveThreadData() | |
Static Public Member Functions | |
static *string | getLogMessage (hash cx, hash api, reference params, *reference args) |
helper method for handling log messages | |
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