557 abstract string name();
635 const Err501 =
new hash<HttpResponseInfo>((
637 "body":
"not implemented",
646 "OPTIONS":
"options",
651 const MimeDataTypes = (
653 "serialize": \make_json(),
654 "deserialize": \parse_json(),
657 "serialize": \make_yaml(),
658 "deserialize": \parse_yaml(),
662 "serialize": \make_yaml(),
663 "deserialize": \parse_yaml(),
666 "serialize": \make_xmlrpc_value(),
667 "deserialize": \parse_xmlrpc_value(),
670 "serialize":
string (
auto v) {
671 switch (v.typeCode());
673 return make_xml((
"value": v));
675 "deserialize":
hash (
string xml) {
677 return parse_xmlrpc_value(xml);
679 catch (hash<ExceptionInfo> ex);
688 "serialize":
string (
auto body) {
return sprintf(
"<pre>%N</pre>", body); },
739 auto handleExternalRequest(
string method,
string path, *
hash body,
hash cx = {});
767 hash<HttpResponseInfo> handleRequest(HttpListenerInterface listener, Socket s,
hash cx,
hash hdr, *data b);
771 removeRootPath(reference<string> path);
775 requestDeserializationError(
hash hdr,
hash cx,
string body);
779 responseSerializationError(
hash cx, *
hash aih,
hash rv);
787 logError(
string fmt);
791 logDebug(
string fmt);
803 static hash makeResponse(
int code,
auto body, *
hash hdr);
810 class DummyListenerInterface :
public HttpListenerInterface {
813 addUserThreadContext(
hash uctx);
816 auto removeUserThreadContext(*
string k);
822 logError(
string fmt);
string sprintf(string fmt,...)
hash ch
class hash: name -> AbstractRestClass
Definition: RestHandler.qm.dox.h:696
*int getTimeout()
returns the timeout in milliseconds or NOTHING if no timeout is set
nothing recvImpl(hash v)
callback method for receiving chunked data; this calls RestHandler::AbstractRestStreamRequestHandler:...
streamError(hash n_ex)
registers stream errors in the send operation with the stream handler if no error is already present ...
hash cx
call context hash
Definition: RestHandler.qm.dox.h:363
string mime_get_form_urlencoded_string(hash h)
hash< HttpServer::HttpHandlerResponseInfo > getResponseHeaderMessage()
this method returns the response message description hash by calling getResponseHeaderMessageImpl() ...
the RestHandler namespace contains all the objects in the RestHandler module
Definition: RestHandler.qm.dox.h:345
AbstractHttpRequestHandler handler
destructor()
destroys the object and updates the request handler about the status of the persistent connection ...
hash< HttpServer::HttpHandlerResponseInfo > handleRequest(HttpListenerInterface listener, RestHandler rh, Socket s, *list cl, string mn, hash cx, *hash args)
this method is called by the RestHandler class to match the right object with incoming requests ...
auto sendImpl()
callback method for sending chunked data; this calls RestHandler::AbstractRestStreamRequestHandler::s...
const MimeTypeFormUrlEncoded
nothing recv(hash v)
this method provides the callback method for receiving chunked data by calling recvImpl() ...
*AbstractRestClass subClass(string name, hash cx, *hash args)
this method will be called to find a sub-class (ie with GET /invoices/1 - if this class represents "i...
abstract auto sendImpl()
abstract callback method for sending chunked data
*hash ah
call argument hash
Definition: RestHandler.qm.dox.h:369
the base abstract class for REST stream request handlers
Definition: RestHandler.qm.dox.h:354
HttpListenerInterface listener
the base abstract class for REST handler classes
Definition: RestHandler.qm.dox.h:546
the base class for handling HTTP chunked requests and responses within the RestHandler infrastructure...
Definition: RestHandler.qm.dox.h:484
RestSchemaValidator::AbstractRestSchemaValidator validator
REST schema validator.
Definition: RestHandler.qm.dox.h:702
auto send()
this method provides the callback method for sending chunked data by calling sendImpl() ...
*int timeout_ms
socket I/O timeout in milliseconds
Definition: RestHandler.qm.dox.h:375
*code getPersistentClosedNotification()
returns a callable value in case a persistent connection is in progress; NOTHING if not; this method ...
bool isPersistent()
returns True if the connection is persistent; this method in the base class returns False by default ...
Definition: RestHandler.qm.dox.h:808
abstract string name()
this provides the name of the REST class
abstract hash getResponseHeaderMessageImpl()
this method should return the response message description hash
constructor(RestHandler::AbstractRestStreamRequestHandler n_stream, HttpServer::HttpListenerInterface listener, HttpServer::AbstractHttpRequestHandler handler, Socket s, hash cx, hash hdr, auto body)
creates the object with the given attributes
hash< HttpServer::HttpHandlerResponseInfo > dispatch(RestHandler rh, string mn, *hash ah, hash cx)
this method is called to dispatch requests on the given object
hash< HttpServer::HttpHandlerResponseInfo > getResponseHeaderMessageImpl()
*hash ex
if an exception is raised in a callback then the exception hash is saved here
Definition: RestHandler.qm.dox.h:366
hash rhdr
headers to add in the response
Definition: RestHandler.qm.dox.h:372
abstract nothing recvImpl(hash v)
abstract callback method for receiving chunked data
constructor(hash n_cx, *hash n_ah)
creates the object with the given arguments
hash< HttpServer::HttpHandlerResponseInfo > unknownSubClassError(string n_name)
returns a 404 Not Found response when a request tries to access an unknown subclass ...
hash< auto > mime_parse_form_urlencoded_string(string str)
hash< HttpServer::HttpHandlerResponseInfo > dispatchStream(HttpListenerInterface listener, RestHandler rh, Socket s, string mn, *hash ah, hash cx)
this method is called to dispatch streamed requests on the given object
setTimeout(timeout n_timeout_ms)
sets the internal socket I/O timeout value in ms