this class implements a chunked request handler supporting the DataStream protocol
More...
Inherits AbstractRestStreamRequestHandler.
|
| constructor (hash cx, *hash ah) |
| creates the chunked request handler according to the arguments
|
|
*hash | getErrorResponse () |
| if an error occurred, then return a hash giving an error response, otherwise return nothing More...
|
|
hash | getResponseHeaderMessageImpl () |
| returns the response header to the request More...
|
|
nothing | recvImpl (hash v) |
| calls the receive callback as returned by the DataStreamUtil module, which in turn calls recvDataImpl() to deliver deserialized data
|
|
any | sendImpl () |
| calls the send callback as returned by the DataStreamUtil module, which in turn calls sendDataImpl() to get the data to serialize and encode and send as a response
|
|
private nothing | recvDataDone (*string err) |
| this method is called when all data has been received
|
|
private nothing | recvData (any data) |
| This is the concrete method called when data is received; it calls recvDataImpl() in turn. More...
|
|
private any | sendData () |
| This is the concrete method called when data is received; it calls recvDataImpl() in turn. More...
|
|
private nothing | recvDataDoneImpl (*string err) |
| this method is called when all data has been received
|
|
abstract private nothing | recvDataImpl (any data) |
| reimplement this method in subclasses to receive decoded and deserialized data More...
|
|
abstract private any | sendDataImpl () |
| reimplement this method in subclasses to support streamed data transfers; when this method returns no value, it signifies the end of the streamed data transfer More...
|
|
|
code | rcb |
| the receive callback as returned by the DataStreamUtil module
|
|
code | scb |
| the send callback as returned by the DataStreamUtil module
|
|
bool | recv_done = False |
| flag for when all data has been received
|
|
bool | send_done = False |
| flag for when all data has been sent
|
|
int | err |
| HTTP status code for error response sent.
|
|
*string | send_error |
| send error string received
|
|
this class implements a chunked request handler supporting the DataStream protocol
this class must be subclassed and then the recvDataImpl() and sendDataImpl() methods reimplemented to provide data receiving and sending support, respectively.
*hash DataStreamRequestHandler::AbstractDataStreamRequestHandler::getErrorResponse |
( |
| ) |
|
if an error occurred, then return a hash giving an error response, otherwise return nothing
this method is meant to be called by getResponseHeaderMessageImpl()
hash DataStreamRequestHandler::AbstractDataStreamRequestHandler::getResponseHeaderMessageImpl |
( |
| ) |
|
returns the response header to the request
- 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
private nothing DataStreamRequestHandler::AbstractDataStreamRequestHandler::recvData |
( |
any |
data | ) |
|
This is the concrete method called when data is received; it calls recvDataImpl() in turn.
- Parameters
-
abstract private nothing DataStreamRequestHandler::AbstractDataStreamRequestHandler::recvDataImpl |
( |
any |
data | ) |
|
|
pure virtual |
reimplement this method in subclasses to receive decoded and deserialized data
- Parameters
-
data | the argument passed to this callback is the decoded and deserialized data in the message |
private any DataStreamRequestHandler::AbstractDataStreamRequestHandler::sendData |
( |
| ) |
|
This is the concrete method called when data is received; it calls recvDataImpl() in turn.
- Returns
- data the data to be sent over the link
abstract private any DataStreamRequestHandler::AbstractDataStreamRequestHandler::sendDataImpl |
( |
| ) |
|
|
pure virtual |
reimplement this method in subclasses to support streamed data transfers; when this method returns no value, it signifies the end of the streamed data transfer
- Returns
- the data returned by this callback will be serialized to YAML and send via the DataStream protocol to the remote HTTP REST server in HTTP chunked format; when all data has been send then this callback should return nothing, which will close the chunked message and terminate the request