Library: RemotingNG/JSONRPC
Package: JSONRPC
Header: Poco/RemotingNG/JSONRPC/Transport.h
The Transport implementation for RemotingNG JSONRPC.
This transport implements the JSON-RPC 2.0 protocol (see <http://www.jsonrpc.org/specification> for the specification).
Parameters are always passed by-name through an object, passing by position (array) is not supported. Furthermore, batched requests are not supported.
The transport supports HTTP Basic and HTTP Digest authentication. Please note that for HTTP Digest authentication to work, chunked transfer encoding must be disabled. Also, HTTP Digest authentication is not supported for one-way requests.
Direct Base Classes: Poco::RemotingNG::Transport
All Base Classes: Poco::RefCountedObject, Poco::RemotingNG::AttributedObject, Poco::RemotingNG::Transport
Member Functions: beginMessage, beginRequest, connect, connected, disconnect, enableChunkedTransferEncoding, enableCompression, enableKeepAlive, endPoint, endRequest, getAuthentication, getKeepAliveTimeout, getPassword, getTimeout, getUserAgent, getUsername, httpSessionFactory, isChunkedTransferEncodingEnabled, isCompressionEnabled, isKeepAliveEnabled, prepareRequest, requireSession, sendMessage, sendRequest, setAuthentication, setKeepAliveTimeout, setPassword, setTimeout, setUserAgent, setUsername
Inherited Functions: beginMessage, beginRequest, connect, connected, disconnect, duplicate, endPoint, endRequest, getAttribute, hasAttribute, referenceCount, release, sendMessage, sendRequest, setAttribute
Authentication mode.
AUTH_NONE = 0
No authentication.
AUTH_BASIC = 1
HTTP Basic Authentication only (credentials are always sent).
AUTH_DIGEST = 2
HTTP Digest Authentication only.
AUTH_ANY = 3
HTTP Basic or Digest authentication (whichever the server requests).
Transport();
Creates a Transport for JSON-RPC 2.0.
~Transport();
Destroys the Transport.
Poco::RemotingNG::Serializer & beginMessage(
const Poco::RemotingNG::Identifiable::ObjectId & oid,
const Poco::RemotingNG::Identifiable::TypeId & tid,
const std::string & messageName,
Poco::RemotingNG::SerializerBase::MessageType messageType
);
Poco::RemotingNG::Serializer & beginRequest(
const Poco::RemotingNG::Identifiable::ObjectId & oid,
const Poco::RemotingNG::Identifiable::TypeId & tid,
const std::string & messageName,
Poco::RemotingNG::SerializerBase::MessageType messageType
);
void connect(
const std::string & endPoint
);
See also: Poco::RemotingNG::Transport::connect()
bool connected() const;
See also: Poco::RemotingNG::Transport::connected()
void disconnect();
void enableChunkedTransferEncoding(
bool enable = true
);
Enables or disables chunked transfer encoding for HTTP requests. This is normally enabled. However, some poorly implemented HTTP stacks cannot handle chunked HTTP messages. Also, chunked transfer encoding must be disabled if AUTH_DIGEST or AUTH_ANY authentication is used.
Regardless of this setting, chunked transfer encoding is always supported for responses sent by the server.
void enableCompression(
bool enable
);
Enables or disables HTTP compression via GZIP Content-Encoding for requests. This is normally disabled, due to a lack of support by most servers.
Note that chunked transfer encoding must also be enabled in order to allow compression.
Regardless of this setting, server responses can always be compressed using GZIP Content-Encoding.
void enableKeepAlive(
bool enable
);
Enables or disables HTTP/1.1 persistent connections.
The Transport must be connected, otherwise a Poco::IllegalStateException will be thrown.
const std::string & endPoint() const;
See also: Poco::RemotingNG::Transport::endPoint()
void endRequest();
AuthMode getAuthentication() const;
Returns the authentication mode.
Poco::Timespan getKeepAliveTimeout() const;
Returns the timeout for HTTP/1.1 persistent connections.
The Transport must be connected, otherwise a Poco::IllegalStateException will be thrown.
const std::string & getPassword() const;
Returns the password for HTTP authentication.
Poco::Timespan getTimeout() const;
Returns the HTTP timeout.
The Transport must be connected, otherwise a Poco::IllegalStateException will be thrown.
const std::string & getUserAgent() const;
Returns the value of the User-Agent header sent with SOAP HTTP requests, or an empty string if no User-Agent value has been set.
const std::string & getUsername() const;
Returns the username for HTTP authentication.
static Poco::Net::HTTPSessionFactory & httpSessionFactory();
Returns the Poco::Net::HTTPSessionFactory instance used by the transport.
bool isChunkedTransferEncodingEnabled() const;
Returns true if and only if chunked transfer encoding is enabled, which is the default unless enableChunkedTransferEncoding(false) has been called.
bool isCompressionEnabled() const;
Returns true if and only if HTTP compression (GZIP) is enabled for requests. Default is disabled.
bool isKeepAliveEnabled() const;
Returns true if and only if HTTP/1.1 persistent connections are enabled.
The Transport must be connected, otherwise a Poco::IllegalStateException will be thrown.
void sendMessage(
const Poco::RemotingNG::Identifiable::ObjectId & oid,
const Poco::RemotingNG::Identifiable::TypeId & tid,
const std::string & messageName,
Poco::RemotingNG::SerializerBase::MessageType messageType
);
Poco::RemotingNG::Deserializer & sendRequest(
const Poco::RemotingNG::Identifiable::ObjectId & oid,
const Poco::RemotingNG::Identifiable::TypeId & tid,
const std::string & messageName,
Poco::RemotingNG::SerializerBase::MessageType messageType
);
void setAuthentication(
AuthMode authMode
);
Sets the authentication mode.
Please note that for AUTH_DIGEST or AUTH_ANY, chunked transfer encoding must be disabled.
void setKeepAliveTimeout(
const Poco::Timespan & timeout
);
Sets the timeout for HTTP/1.1 persistent connections.
The Transport must be connected, otherwise a Poco::IllegalStateException will be thrown.
void setPassword(
const std::string & password
);
Sets the password for HTTP authentication.
void setTimeout(
const Poco::Timespan & timeout
);
Sets the HTTP timeout.
The Transport must be connected, otherwise a Poco::IllegalStateException will be thrown.
void setUserAgent(
const std::string & userAgent
);
Sets the value of the User-Agent header sent with SOAP HTTP requests. If an empty string is given (default), no User-Agent header is included in the request.
void setUsername(
const std::string & username
);
Sets the username for HTTP authentication.
void prepareRequest(
Poco::Net::HTTPRequest & request,
const std::string & messageName
);
const Poco::Net::HTTPClientSession & requireSession() const;
Poco::Net::HTTPClientSession & requireSession();
static const std::string CONTENT_TYPE;
static const std::string PROTOCOL;
static const std::string USER_AGENT;