Qore RestHandler Module Reference  1.1
RestHandler::AbstractRestStreamRequestHandler Class Reference

the base abstract class for REST stream request handlers More...

Inheritance diagram for RestHandler::AbstractRestStreamRequestHandler:

Public Member Functions

 constructor (hash cx, *hash ah)
 creates the object with the given arguments More...
 
hash getResponseHeaderMessage ()
 this method returns the response message description hash by calling getResponseHeaderMessageImpl() More...
 

Private Attributes

*hash ah
 call argument hash
 
hash rhdr
 headers to add in the response
 

Detailed Description

the base abstract class for REST stream request handlers

Member Function Documentation

RestHandler::AbstractRestStreamRequestHandler::constructor ( hash  cx,
*hash  ah 
)

creates the object with the given arguments

Parameters
cxcall 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
ahany URI arguments in the request
hash RestHandler::AbstractRestStreamRequestHandler::getResponseHeaderMessage ( )

this method returns the response message description hash by calling getResponseHeaderMessageImpl()

Returns
a hash with the following keys:
  • "code": the HTTP return code (see HttpServer::HttpCodes)
  • "body": the message body to return in the response; if this key is returned, then the reply is sent immediately; a chunked reply is not made, and send() and sendImpl() are not called
  • "close": (optional) set this key to True if the connection should be unconditionally closed when the handler returns
  • "hdr": (optional) set this key to a hash of extra header information to be returned with the response
Note
this method is called after the message body has been received