![]()  | 
  
    Qore RestHandler Module Reference
    1.5.2
    
   | 
 
the base abstract class for REST handler classes More...

Public Member Methods | |
| addClass (AbstractRestClass cls) | |
| adds a REST class to the handler  | |
| private 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  More... | |
| private 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  | |
| abstract string | name () | 
| this provides the name of the REST class  | |
| *AbstractRestClass | subClass (string name, hash< auto > cx, *hash< auto > args) | 
| this method will be called to find a sub-class (ie with GET /invoices/1 - if this class represents "invoices", then subClass("1") will be called to return invoice 1; return NOTHING if the object doesn't exist  More... | |
| *AbstractRestClass | subClassImpl (string name, hash< auto > cx, *hash< auto > args) | 
| this method will be called to find a sub-class (ie with GET /invoices/1 - if this class represents "invoices", then subClass("1") will be called to return invoice 1; return NOTHING if the object doesn't exist  More... | |
Public Attributes | |
| hash< string, AbstractRestClass > | class_hash | 
| class hash: name -> AbstractRestClass  | |
| const | RestBasicMethodSet = map {$1: True} | 
| set of REST class method names based on basic HTTP methods  | |
Private Member Methods | |
| *hash< string, bool > | doGetPossibleSubClasses (hash< auto > cx) | 
| returns a set of possible subclasses for a particular request  More... | |
| hash< HttpServer::HttpHandlerResponseInfo > | unknownSubClassError (string cls_name, hash< auto > cx) | 
| returns a 404 Not Found response when a request tries to access an unknown subclass  More... | |
the base abstract class for REST handler classes
      
  | 
  inline | 
this method is called to dispatch requests on the given object
| rh | the RestHandler object | 
| mn | the method name | 
| ah | the holds URI and / or message body arguments for the REST call; if a request has both URI query arguments and message body arguments, then this value will be a combination of URI query arguments and deserialized message body arguments with URI query arguments taking precedence over the message body arguments | 
| cx | call context hash; this hash will have the following keys:
  | 
      
  | 
  private | 
returns a set of possible subclasses for a particular request
| cx | the HTTP call context hash | 
| *AbstractRestClass RestHandler::AbstractRestClass::subClass | ( | string | name, | 
| hash< auto > | cx, | ||
| *hash< auto > | args | ||
| ) | 
this method will be called to find a sub-class (ie with GET /invoices/1 - if this class represents "invoices", then subClass("1") will be called to return invoice 1; return NOTHING if the object doesn't exist
| name | the name of the subclass | 
| cx | call context hash; this hash will have the following keys:
  | 
| args | the holds URI and / or message body arguments for the REST call; if a request has both URI query arguments and message body arguments, then this value will be a combination of URI query arguments and deserialized message body arguments with URI query arguments taking precedence over the message body arguments | 
name argument or NOTHING if none can be matchedThis method first looks for a static subclass in the class_hash member (as populated by addClass() for example), and then if no match is found calls subClassImpl() for a potential dynamic lookup.
| *AbstractRestClass RestHandler::AbstractRestClass::subClassImpl | ( | string | name, | 
| hash< auto > | cx, | ||
| *hash< auto > | args | ||
| ) | 
this method will be called to find a sub-class (ie with GET /invoices/1 - if this class represents "invoices", then subClass("1") will be called to return invoice 1; return NOTHING if the object doesn't exist
| name | the name of the subclass | 
| cx | call context hash; this hash will have the following keys:
  | 
| args | the holds URI and / or message body arguments for the REST call; if a request has both URI query arguments and message body arguments, then this value will be a combination of URI query arguments and deserialized message body arguments with URI query arguments taking precedence over the message body arguments | 
name argument or NOTHING if none can be matched; this base class method returns NOTHING by default; override in subclasses to provide programmatic support for REST subclasses
      
  | 
  private | 
returns a 404 Not Found response when a request tries to access an unknown subclass
| cls_name | the URI path element that could not be matched to a REST subclass | 
| cx | the HTTP call context hash |