30 #ifndef PT_JSONRPC_RESPONDER_H
31 #define PT_JSONRPC_RESPONDER_H
33 #include <Pt/JsonRpc/Api.h>
34 #include <Pt/JsonRpc/Fault.h>
35 #include <Pt/JsonRpc/Formatter.h>
36 #include <Pt/Remoting/Responder.h>
37 #include <Pt/Json/JsonReader.h>
38 #include <Pt/Json/JsonWriter.h>
39 #include <Pt/TextStream.h>
40 #include <Pt/NonCopyable.h>
41 #include <Pt/Utf8Codec.h>
48 class ProcedureDeclaration;
49 class ServiceDeclaration;
161 std::string _methodName;
178 #endif // PT_JSONRPC_RESPONDER_H
Core module.
Definition: Allocator.h:33
Manages the decomposition of types during serialization.
Definition: Decomposer.h:44
void finishMessage(System::EventLoop &loop)
Execute the service procedure after parsing completes.
virtual void onReady()
The service procedure has finished.
bool isFailed() const
Indicates if the procedure has failed.
void beginResult(std::ostream &os)
Begin formatting a JSON-RPC success response.
Convert between unicode and UTF-8.
Definition: Utf8Codec.h:44
void setFault(int rc, const char *msg)
Mark the procedure as failed.
Maps parameter names to positional indices for named parameters.
Definition: ProcedureDeclaration.h:49
Declares named parameter mappings for JSON-RPC procedures.
Definition: ServiceDeclaration.h:49
Remote service definition.
Definition: Api-ServiceDefinition.h:22
JSON document node.
Definition: Node.h:52
void finishMessage()
Execute the service procedure synchronously.
Reads JSON as a Stream of Nodes.
Definition: JsonReader.h:51
void beginFault(std::ostream &os, const Fault &fault)
Begin formatting a JSON-RPC error response.
virtual void onFault(const Fault &fault)=0
The service procedure has failed.
Dispatches requests to a service procedure.
Definition: Responder.h:50
void beginMessage(std::istream &is)
Begin parsing a JSON-RPC request from a stream.
Dispatches JSON-RPC requests to a service procedure.
Definition: Responder.h:54
virtual void onCancel()
Cancels all operations.
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:83
Responder(const ServiceDeclaration &decl, Remoting::ServiceDefinition &def)
Construct with ServiceDeclaration and ServiceDefinition.
Composes types during serialization.
Definition: Composer.h:43
bool parseMessage()
Parse available data from the input stream.
virtual ~Responder()
Destructor.
JSON-RPC fault exception.
Definition: Fault.h:44
void finishResult()
Finish formatting the result response.
virtual void onResult()=0
The service procedure has finished.
bool advanceResult()
Continue formatting the result.
Writes JSON to a text stream.
Definition: JsonWriter.h:46