784 hash<HttpServer::HttpHandlerResponseInfo>
handleRequest(HttpListenerInterface listener,
RestHandler rh, Socket s, *list<string> cl,
string mn, hash<auto> cx, *hash<auto> args);
789 hash<HttpServer::HttpHandlerResponseInfo>
dispatchStream(HttpListenerInterface listener,
RestHandler rh, Socket s,
string mn, *hash<auto> ah, hash<auto> cx);
821 hash<HttpServer::HttpHandlerResponseInfo>
dispatch(
RestHandler rh,
string mn, *hash<auto> ah, hash<auto> cx);
856 hash<HttpServer::HttpHandlerResponseInfo>
unknownSubClassError(
string cls_name, hash<auto> cx, *hash<auto> ah);
910 const Err501 =
new hash<HttpResponseInfo>({
912 "body":
"not implemented",
921 "OPTIONS":
"options",
1026 hash<HttpResponseInfo>
handleRequest(HttpListenerInterface listener, Socket s, hash<auto> cx, hash<auto> hdr, *data b);
1039 hash<HttpHandlerResponseInfo>
dispatchRequest(HttpListenerInterface listener, Socket s, *list<string> class_list,
string method_name,
string path, hash<auto> cx, *hash<auto> args);
1059 hash<auto>
get(hash<auto> cx, *hash<auto> ah);
1093 static hash<HttpHandlerResponseInfo>
make200(
string fmt);
1096 static hash<HttpHandlerResponseInfo>
make200(hash<auto> hdr,
string fmt);
1099 static hash<HttpHandlerResponseInfo>
make400(
string fmt);
1102 static hash<HttpHandlerResponseInfo>
make400(hash<auto> hdr,
string fmt);
1105 static hash<HttpHandlerResponseInfo>
makeResponse(
int code,
auto body, *hash<auto> hdr);
1108 static hash<HttpHandlerResponseInfo>
make500(
string fmt);
1111 static hash<HttpHandlerResponseInfo>
make500(hash<auto> hdr,
string fmt);
1114 static hash<HttpHandlerResponseInfo>
make501(
string fmt);
1117 static hash<HttpHandlerResponseInfo>
make501(hash<auto> hdr,
string fmt);
1124class DummyListenerInterface :
public HttpListenerInterface {
1127 addUserThreadContext(hash<auto> uctx);
1130 auto removeUserThreadContext(*
string k);
1133 log(
string fmt, ...);
1136 logError(
string fmt, ...);
AbstractHttpRequestHandler handler
HttpListenerInterface listener
the base abstract class for REST handler classes
Definition: RestHandler.qm.dox.h:689
hash< HttpServer::HttpHandlerResponseInfo > unknownSubClassError(string cls_name, hash< auto > cx, *hash< auto > ah)
returns a 404 Not Found response when a request tries to access an unknown subclass
abstract string name()
this provides the name of the REST class
hash< HttpServer::HttpHandlerResponseInfo > dispatchStream(HttpListenerInterface listener, RestHandler rh, Socket s, string mn, *hash< auto > ah, hash< auto > cx)
this method is called to dispatch streamed requests on the given object
hash< HttpServer::HttpHandlerResponseInfo > handleRequest(HttpListenerInterface listener, RestHandler rh, Socket s, *list< string > cl, string mn, hash< auto > cx, *hash< auto > args)
this method is called by the RestHandler class to match the right object with incoming requests
addClass(AbstractRestClass cls)
adds a REST class to the handler
*AbstractRestClass subClassImpl(string name, hash< auto > cx, *hash< auto > args)
this method will be called to find a sub-class
*hash< string, bool > doGetPossibleSubClasses(hash< auto > cx, *hash< auto > ah)
returns a set of possible subclasses for a particular request
hash< string, AbstractRestClass > class_hash
class hash: name -> AbstractRestClass
Definition: RestHandler.qm.dox.h:693
*AbstractRestClass subClass(string name, hash< auto > cx, *hash< auto > args)
this method will be called to find a sub-class
const RestBasicMethodSet
set of REST class method names based on basic HTTP methods
Definition: RestHandler.qm.dox.h:696
hash< HttpServer::HttpHandlerResponseInfo > dispatch(RestHandler rh, string mn, *hash< auto > ah, hash< auto > cx)
this method is called to dispatch requests on the given object
the base abstract class for REST stream request handlers
Definition: RestHandler.qm.dox.h:484
hash< auto > rhdr
headers to add in the response
Definition: RestHandler.qm.dox.h:500
auto send()
this method provides the callback method for sending chunked data by calling sendImpl()
abstract auto sendImpl()
abstract callback method for sending chunked data
hash< auto > cx
call context hash
Definition: RestHandler.qm.dox.h:491
nothing recv(hash< auto > v)
this method provides the callback method for receiving chunked data by calling recvImpl()
*int getTimeout()
returns the timeout in milliseconds or NOTHING if no timeout is set
*hash< auto > ah
call argument hash
Definition: RestHandler.qm.dox.h:497
hash< HttpServer::HttpHandlerResponseInfo > getResponseHeaderMessage()
this method returns the response message description hash by calling getResponseHeaderMessageImpl()
bool isPersistent()
returns True if the connection is persistent; this method in the base class returns False by default
abstract hash< auto > getResponseHeaderMessageImpl()
this method should return the response message description hash
*int timeout_ms
socket I/O timeout in milliseconds
Definition: RestHandler.qm.dox.h:503
setTimeout(timeout n_timeout_ms)
sets the internal socket I/O timeout value in ms
constructor(hash< auto > cx, *hash< auto > ah)
creates the object with the given arguments
streamError(hash< auto > n_ex)
registers stream errors in the send operation with the stream handler if no error is already present
*hash< auto > ex
if an exception is raised in a callback then the exception hash is saved here
Definition: RestHandler.qm.dox.h:494
*code getPersistentClosedNotification()
returns a callable value in case a persistent connection is in progress; NOTHING if not; this method ...
abstract nothing recvImpl(hash< auto > v)
abstract callback method for receiving chunked data
auto handleExternalRequest(string method, string path, *hash< auto > body, hash< auto > cx={})
processes REST API calls outside the HTTP server
responseSerializationError(hash< auto > cx, *hash< auto > aih, hash< auto > rv)
default implementation is empty
static hash< HttpHandlerResponseInfo > make500(hash< auto > hdr, string fmt)
creates a hash for an HTTP 500 error response with the response message body as a string
setLogger(*Logger::LoggerInterface logger)
Sets a new logger.
const Methods
supported HTTP methods
Definition: RestHandler.qm.dox.h:916
RestSchemaValidator::AbstractRestSchemaValidator validator
REST schema validator.
Definition: RestHandler.qm.dox.h:927
removeRootPath(reference< string > path)
default implementation is empty
hash< HttpResponseInfo > handleRequest(HttpListenerInterface listener, Socket s, hash< auto > cx, hash< auto > hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
hash< HttpHandlerResponseInfo > dispatchRequest(HttpListenerInterface listener, Socket s, *list< string > class_list, string method_name, string path, hash< auto > cx, *hash< auto > args)
Dispatches the request and returns the response.
static hash< HttpHandlerResponseInfo > make501(hash< auto > hdr, string fmt)
creates a hash for an HTTP 501 error response with the response message body as a string
static hash< HttpHandlerResponseInfo > make200(hash< auto > hdr, string fmt)
creates a hash for an HTTP 200 OK error response with the response message body as a string
logInfo(string fmt)
This method is called with informational log messages.
checkExceptionSerializable(reference< hash< ExceptionInfo > > ex)
Recursively ensure that exception arguments are serializable.
static hash< HttpHandlerResponseInfo > make501(string fmt)
creates a hash for an HTTP 501 error response with the response message body as a string
static hash< HttpHandlerResponseInfo > makeResponse(int code, auto body, *hash< auto > hdr)
creates a hash for an HTTP response with the response code and a literal response message body
hash< HttpHandlerResponseInfo > returnRestException(hash< ExceptionInfo > ex)
method that determines how exceptions handling REST requests are returned
logError(string fmt)
This method is called with error log messages.
constructor(Logger::LoggerInterface logger, *HttpServer::AbstractAuthenticator auth, RestSchemaValidator::AbstractRestSchemaValidator validator=new NullRestSchemaValidator(logger))
create the object optionally with the given Logger and authenticator
constructor(*HttpServer::AbstractAuthenticator auth, RestSchemaValidator::AbstractRestSchemaValidator validator=new NullRestSchemaValidator())
create the object optionally with the given HttpServer::AbstractAuthenticator
static hash< HttpHandlerResponseInfo > make400(hash< auto > hdr, string fmt)
creates a hash for an HTTP 400 error response with the response message body as a string
logDebug(string fmt)
This method is called with debug log messages.
string name()
returns the name of the root REST class
*hash< auto > errorResponseHeaders(hash< auto > cx)
Retrieves headers for an error response.
hash< auto > get(hash< auto > cx, *hash< auto > ah)
default get handler for the base handler class
static hash< HttpHandlerResponseInfo > make500(string fmt)
creates a hash for an HTTP 500 error response with the response message body as a string
static hash< HttpHandlerResponseInfo > make200(string fmt)
creates a hash for an HTTP 200 OK error response with the response message body as a string
requestDeserializationError(hash< auto > hdr, hash< auto > cx, string body)
default implementation is empty
static hash< HttpHandlerResponseInfo > make400(string fmt)
creates a hash for an HTTP 400 error response with the response message body as a string
the base class for handling HTTP chunked requests and responses within the RestHandler infrastructure
Definition: RestHandler.qm.dox.h:629
nothing recvImpl(hash< auto > v)
callback method for receiving chunked data; this calls RestHandler::AbstractRestStreamRequestHandler:...
hash< HttpServer::HttpHandlerResponseInfo > getResponseHeaderMessageImpl()
destructor()
destroys the object and updates the request handler about the status of the persistent connection
constructor(RestHandler::AbstractRestStreamRequestHandler n_stream, HttpServer::HttpListenerInterface listener, HttpServer::AbstractHttpRequestHandler handler, Socket s, hash< auto > cx, hash< auto > hdr, auto body)
creates the object with the given attributes
auto sendImpl()
callback method for sending chunked data; this calls RestHandler::AbstractRestStreamRequestHandler::s...
the RestHandler namespace contains all the objects in the RestHandler module
Definition: RestHandler.qm.dox.h:475