public class JSONRPC2ServiceConnector extends Object
Supports:
com.thetransactioncompany.jsonrpc2.server.RequestHandler
interface.
Constructor | Description |
---|---|
JSONRPC2ServiceConnector(com.thetransactioncompany.jsonrpc2.server.RequestHandler jsonrpc2Service,
String apiKey) |
Creates a new local JSON-RPC 2.0 service connector.
|
JSONRPC2ServiceConnector(URL url,
boolean trustSelfSignedCerts,
String apiKey,
int connectTimeout,
int readTimeout) |
Creates a new remote (HTTP) JSON-RPC 2.0 service connector.
|
Modifier and Type | Method | Description |
---|---|---|
String |
getAPIKey() |
Gets the optional API key for service access.
|
long |
getNextRequestID() |
Gets the next JSON-RPC 2.0 request ID from the atomic counter.
|
boolean |
isLocal() |
Returns
true if the connector is to a local service
instance. |
boolean |
isRemote() |
Returns
false if the connector is to a remote (HTTP) service
instance. |
com.thetransactioncompany.jsonrpc2.JSONRPC2Response |
send(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request) |
Sends the specified JSON-RPC 2.0 request to the service (local or
remote).
|
public JSONRPC2ServiceConnector(com.thetransactioncompany.jsonrpc2.server.RequestHandler jsonrpc2Service, String apiKey)
jsonrpc2Service
- The JSON-RPC 2.0 service accessible through a
local request handler interface. Must not be
null
.apiKey
- Optional API key for service access,
null
if not required.public JSONRPC2ServiceConnector(URL url, boolean trustSelfSignedCerts, String apiKey, int connectTimeout, int readTimeout)
url
- The JSON-RPC 2.0 service HTTP(S) URL.
Must not be null
.trustSelfSignedCerts
- Determines the trust of self-signed
X.509 certificates presented by the
service (for HTTPS connections).apiKey
- Optional API key for service access,
null
if not required.connectTimeout
- Connect timeout for HTTP requests, in
milliseconds. Zero disables the option.readTimeout
- Read timeout for HTTP requests, in
milliseconds. Zero disables the option.public String getAPIKey()
null
if not
provided.public long getNextRequestID()
public boolean isLocal()
true
if the connector is to a local service
instance.true
if this is a local service connector.public boolean isRemote()
false
if the connector is to a remote (HTTP) service
instance.true
if this is a remote (HTTP) service connector.public com.thetransactioncompany.jsonrpc2.JSONRPC2Response send(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request) throws com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
request
- The JSON-RPC 2.0 request to send. Must not be
null
.com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
- If the request call failed due to a
service connection or other
exception.Copyright © 2018 Connect2id. All rights reserved.