308 namespace RestHandler {
322 abstract string name();
375 "body":
"not implemented",
384 "OPTIONS":
"options",
390 "serialize": \makeJSONString(),
391 "deserialize": \parseJSON(),
394 "serialize": \makeYAML(),
395 "deserialize": \parseYAML(),
399 "serialize": \makeYAML(),
400 "deserialize": \parseYAML(),
403 "serialize": \makeXMLRPCValueString(),
404 "deserialize": \parseXMLRPCValue(),
407 "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...
private hash dispatch(RestHandler rh, *string oname, string mn, *hash ah, hash cx)
this method is called to dispatch requests on the given object
string sprintf(string fmt,...)
const Err501
a hash for a 501 Unimplemented error message
Definition: RestHandler.qm.dox.h:373
hash ch
class hash: name -> AbstractRestClass
Definition: RestHandler.qm.dox.h:415
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...
const MimeDataTypes
supported mime types for de/serializing responses
Definition: RestHandler.qm.dox.h:388
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...
*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 "...
hash handleRequest(RestHandler rh, *list cl, string mn, hash cx, *hash args)
this method is called by the RestHandler class to match the right object with incoming requests ...
the base abstract class for REST handler classes
Definition: RestHandler.qm.dox.h:311
const Methods
supported HTTP methods
Definition: RestHandler.qm.dox.h:379
constructor(*AbstractAuthenticator auth)
create the object optionally with the given AbstractAuthenticator
hash handleRequest(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 unknownSubClassError(string name)
throws a "REST-CLASS-ERROR" exception when a request tries to access an unknown subclass ...
this is the main handler class to be registered with the HttpServer
Definition: RestHandler.qm.dox.h:368