308 namespace RestHandler {
419 abstract string name();
476 "body":
"not implemented",
485 "OPTIONS":
"options",
491 "serialize": \makeJSONString(),
492 "deserialize": \parseJSON(),
495 "serialize": \makeYAML(),
496 "deserialize": \parseYAML(),
500 "serialize": \makeYAML(),
501 "deserialize": \parseYAML(),
504 "serialize": \makeXMLRPCValueString(),
505 "deserialize": \parseXMLRPCValue(),
508 "serialize":
string (any $body) {
return sprintf(
"<pre>%N</pre>", $body); },
logError(string fmt)
default implementation is empty; this method is called with error log messages; reimplement in subcla...
string sprintf(string fmt,...)
const Err501
a hash for a 501 Unimplemented error message
Definition: RestHandler.qm.dox.h:474
hash ch
class hash: name -> AbstractRestClass
Definition: RestHandler.qm.dox.h:516
constructor(hash cx, *hash ah)
creates the object with the given arguments
string name()
returns the name of the root REST class
*AbstractAuthenticator auth
static hash makeResponse(int code, any body, *hash hdr)
creates a hash for an HTTP response with the response code and a literal response message body ...
logDebug(string fmt)
default implementation is empty; this method is called with debug log messages; reimplement in subcla...
AbstractHttpRequestHandler handler
const MimeDataTypes
supported mime types for de/serializing responses
Definition: RestHandler.qm.dox.h:489
removeRootPath(reference path)
default implementation is empty
requestDeserializationError(hash hdr, hash cx, string body)
default implementation is empty
responseSerializationError(hash cx, *hash aih, hash rv)
default implementation is empty
addClass(AbstractRestClass cls)
adds a REST class to the handler
logInfo(string fmt)
default implementation is empty; this method is called with informational log messages; reimplement i...
private nothing recvImpl(hash v)
callback method for receiving chunked data; this calls RestHandler::AbstractRestStreamRequestHandler:...
hash handleRequest(HttpListener 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 ...
*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 "...
the base abstract class for REST stream request handlers
Definition: RestHandler.qm.dox.h:311
the base abstract class for REST handler classes
Definition: RestHandler.qm.dox.h:408
private hash getResponseHeaderMessageImpl()
const Methods
supported HTTP methods
Definition: RestHandler.qm.dox.h:480
the base class for handling HTTP chunked requests and responses within the RestHandler infrastructure...
Definition: RestHandler.qm.dox.h:359
hash getResponseHeaderMessage()
this method returns the response message description hash by calling getResponseHeaderMessageImpl() ...
private any sendImpl()
callback method for sending chunked data; this calls RestHandler::AbstractRestStreamRequestHandler::s...
constructor(*AbstractAuthenticator auth)
create the object optionally with the given AbstractAuthenticator
hash handleRequest(HttpListener listener, Socket s, hash cx, hash hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
abstract string name()
this provides the name of the REST class
private hash dispatchStream(HttpListener listener, RestHandler rh, Socket s, string mn, *hash ah, hash cx)
this method is called to dispatch streamed requests on the given object
private hash unknownSubClassError(string name)
throws a "REST-CLASS-ERROR" exception when a request tries to access an unknown subclass ...
private hash dispatch(RestHandler rh, string mn, *hash ah, hash cx)
this method is called to dispatch requests on the given object
hash rhdr
headers to add in the response
Definition: RestHandler.qm.dox.h:323
this is the main handler class to be registered with the HttpServer
Definition: RestHandler.qm.dox.h:469
constructor(RestHandler::AbstractRestStreamRequestHandler rsh, HttpListener listener, AbstractHttpRequestHandler handler, Socket s, hash cx, hash hdr, any body)
creates the object with the given attributes
hash ah
call argument hash
Definition: RestHandler.qm.dox.h:320