Qore RestHandler Module Reference: RestHandler::AbstractRestClass Class Reference

Qore RestHandler Module Reference 1.1

- Main Page
- Related Pages
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
RestHandler::AbstractRestClass Class Referenceabstract

the base abstract class for REST handler classes More...

Inheritance diagram for RestHandler::AbstractRestClass:
[legend]

## Public Member Functions
private hash | dispatch (RestHandler rh, string mn, *hash ah, hash cx)
| this method is called to dispatch requests on the given object
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
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
abstract string | name ()
| this provides the name of the REST class
*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 "invoices", then subClass("1") will be called to return invoice 1; return NOTHING if the object doesn't exist More...
private hash | unknownSubClassError (string name)
| throws a `"REST-CLASS-ERROR"` exception when a request tries to access an unknown subclass

## Detailed Description

the base abstract class for REST handler classes

## Member Function Documentation

*AbstractRestClass RestHandler::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 "invoices", then subClass("1") will be called to return invoice 1; return NOTHING if the object doesn't exist

Parameters

  name | the name of the subclass
  cx | call context hash; this hash will have the following keys: `socket:` the bind address used to bind the listener (`"socket-info"` provides more detailed information) `socket-info`: a hash of socket information for the listening socket (as returned by Qore::Socket::getSocketInfo()) `peer-info`: a hash of socket information for the remote socket (as returned by Qore::Socket::getPeerInfo()) `url:` a hash of broken-down URL information (as returned from parseURL()) `id:` the unique HTTP connection ID `listener-id`: the HTTP server listener ID (see HttpServer::getListenerInfo()) `user:` the current RBAC username (if any) `hdr:` a hash of header information as returned by Qore::Socket::readHTTPHeader() `body:` the deserialized message body `aih:` a hash of `"Accept"` values
  args | any URI arguments in the request

Returns
  an object corresponding to the `name` argument or NOTHING if none can be matched