#include <Pt/JsonRpc/Responder.h>
Dispatches JSON-RPC requests to a service procedure.
Inherits Responder.
|
|
| Responder (const ServiceDeclaration &decl, Remoting::ServiceDefinition &def) |
| | Construct with ServiceDeclaration and ServiceDefinition.
|
|
virtual | ~Responder () |
| | Destructor.
|
|
bool | isFailed () const |
| | Indicates if the procedure has failed.
|
|
void | cancel () |
| | Resets to initial state.
|
|
const ServiceProcedure * | activeProcedure () const |
| | The currently executing procedure.
|
|
| virtual void | onReady () |
| | The service procedure has finished.
|
| virtual void | onCancel () |
| | Cancels all operations.
|
| virtual void | onFault (const Fault &fault)=0 |
| | The service procedure has failed.
|
| virtual void | onResult ()=0 |
| | The service procedure has finished.
|
|
void | beginMessage (std::istream &is) |
| | Begin parsing a JSON-RPC request from a stream.
|
| bool | parseMessage () |
| | Parse available data from the input stream.
|
|
void | finishMessage (System::EventLoop &loop) |
| | Execute the service procedure after parsing completes.
|
|
void | finishMessage () |
| | Execute the service procedure synchronously.
|
|
void | beginResult (std::ostream &os) |
| | Begin formatting a JSON-RPC success response.
|
|
void | beginFault (std::ostream &os, const Fault &fault) |
| | Begin formatting a JSON-RPC error response.
|
| bool | advanceResult () |
| | Continue formatting the result.
|
|
void | finishResult () |
| | Finish formatting the result response.
|
|
void | setFault (int rc, const char *msg) |
| | Mark the procedure as failed.
|
|
Pt::Composer ** | setProcedure (const std::string &name) |
| | Sets the service procedure.
|
|
void | beginCall (System::EventLoop &loop) |
| | Begins the service procedure call.
|
|
Pt::Decomposer * | endCall () |
| | Ends the service procedure call.
|
|
Pt::Decomposer * | call () |
| | Synchronous call without EventLoop.
|
◆ onReady()
◆ onCancel()
| virtual void onCancel |
( |
| ) |
|
|
protectedvirtual |
Derived responders implement this method to cancel all operations.
Implements Responder.
◆ onFault()
| virtual void onFault |
( |
const Fault & | fault | ) |
|
|
protectedpure virtual |
Derived responders implement this method to format and send the JSON-RPC error response. Use beginFault() to format the response.
◆ onResult()
| virtual void onResult |
( |
| ) |
|
|
protectedpure virtual |
◆ parseMessage()
Each call consumes available data. Returns true if parsing is complete (success or error).
◆ advanceResult()
- Returns
- true if the result is fully formatted.