public class JsonRpcHttpClient extends JsonRpcClient implements IJsonRpcClient
JsonRpcClient.RequestListener
Constructor and Description |
---|
JsonRpcHttpClient(com.fasterxml.jackson.databind.ObjectMapper mapper,
java.net.URL serviceUrl,
java.util.Map<java.lang.String,java.lang.String> headers)
Creates the
JsonRpcHttpClient bound to the given serviceUrl . |
JsonRpcHttpClient(java.net.URL serviceUrl)
Creates the
JsonRpcHttpClient bound to the given serviceUrl . |
JsonRpcHttpClient(java.net.URL serviceUrl,
java.util.Map<java.lang.String,java.lang.String> headers)
Creates the
JsonRpcHttpClient bound to the given serviceUrl . |
Modifier and Type | Method and Description |
---|---|
java.net.Proxy |
getConnectionProxy() |
int |
getConnectionTimeoutMillis() |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
int |
getReadTimeoutMillis() |
java.net.URL |
getServiceUrl() |
void |
invoke(java.lang.String methodName,
java.lang.Object argument)
Invokes the given method with the given argument.
|
<T> T |
invoke(java.lang.String methodName,
java.lang.Object argument,
java.lang.Class<T> clazz)
Invokes the given method with the given arguments and returns
an object of the given type, or null if void.
|
<T> T |
invoke(java.lang.String methodName,
java.lang.Object argument,
java.lang.Class<T> clazz,
java.util.Map<java.lang.String,java.lang.String> extraHeaders)
Invokes the given method with the given arguments and returns
an object of the given type, or null if void.
|
java.lang.Object |
invoke(java.lang.String methodName,
java.lang.Object argument,
java.lang.reflect.Type returnType)
Invokes the given method with the given arguments and returns
an object of the given type, or null if void.
|
java.lang.Object |
invoke(java.lang.String methodName,
java.lang.Object argument,
java.lang.reflect.Type returnType,
java.util.Map<java.lang.String,java.lang.String> extraHeaders)
Invokes the given method with the given arguments and returns
an object of the given type, or null if void.
|
void |
setConnectionProxy(java.net.Proxy connectionProxy) |
void |
setConnectionTimeoutMillis(int connectionTimeoutMillis) |
void |
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers) |
void |
setHostNameVerifier(javax.net.ssl.HostnameVerifier hostNameVerifier) |
void |
setReadTimeoutMillis(int readTimeoutMillis) |
void |
setServiceUrl(java.net.URL serviceUrl) |
void |
setSslContext(javax.net.ssl.SSLContext sslContext) |
createRequest, createRequest, getAdditionalJsonContent, getObjectMapper, handleErrorResponse, hasError, invoke, invokeAndReadResponse, invokeAndReadResponse, invokeAndReadResponse, invokeNotification, readResponse, readResponse, readResponse, readResponse, setAdditionalJsonContent, setExceptionResolver, setRequestListener, writeNotification
public JsonRpcHttpClient(java.net.URL serviceUrl, java.util.Map<java.lang.String,java.lang.String> headers)
JsonRpcHttpClient
bound to the given serviceUrl
.
The headers provided in the headers
map are added to every request
made to the serviceUrl
.serviceUrl
- the service end-point URLheaders
- the headerspublic JsonRpcHttpClient(com.fasterxml.jackson.databind.ObjectMapper mapper, java.net.URL serviceUrl, java.util.Map<java.lang.String,java.lang.String> headers)
JsonRpcHttpClient
bound to the given serviceUrl
.
The headers provided in the headers
map are added to every request
made to the serviceUrl
.mapper
- the ObjectMapper
to use for json<->java conversionserviceUrl
- the service end-point URLheaders
- the headerspublic JsonRpcHttpClient(java.net.URL serviceUrl)
JsonRpcHttpClient
bound to the given serviceUrl
.
The headers provided in the headers
map are added to every request
made to the serviceUrl
.serviceUrl
- the service end-point URLpublic void invoke(java.lang.String methodName, java.lang.Object argument) throws java.lang.Throwable
invoke
in interface IJsonRpcClient
methodName
- the name of the method to invokeargument
- the argument to the methodjava.lang.Throwable
- on errorpublic java.lang.Object invoke(java.lang.String methodName, java.lang.Object argument, java.lang.reflect.Type returnType) throws java.lang.Throwable
invoke
in interface IJsonRpcClient
methodName
- the name of the method to invokeargument
- the argument to the methodreturnType
- the return typejava.lang.Throwable
- on errorpublic java.lang.Object invoke(java.lang.String methodName, java.lang.Object argument, java.lang.reflect.Type returnType, java.util.Map<java.lang.String,java.lang.String> extraHeaders) throws java.lang.Throwable
invoke
in interface IJsonRpcClient
methodName
- the name of the method to invokeargument
- the argument to the methodreturnType
- the return typeextraHeaders
- extra headers to add to the requestjava.lang.Throwable
- on errorpublic <T> T invoke(java.lang.String methodName, java.lang.Object argument, java.lang.Class<T> clazz) throws java.lang.Throwable
invoke
in interface IJsonRpcClient
T
- the return typemethodName
- the name of the method to invokeargument
- the argument to the methodclazz
- the return typejava.lang.Throwable
- on errorpublic <T> T invoke(java.lang.String methodName, java.lang.Object argument, java.lang.Class<T> clazz, java.util.Map<java.lang.String,java.lang.String> extraHeaders) throws java.lang.Throwable
invoke
in interface IJsonRpcClient
T
- the return typemethodName
- the name of the method to invokeargument
- the argument to the methodclazz
- the return typeextraHeaders
- extra headers to add to the requestjava.lang.Throwable
- on errorpublic java.net.URL getServiceUrl()
public void setServiceUrl(java.net.URL serviceUrl)
serviceUrl
- the serviceUrl to setpublic java.net.Proxy getConnectionProxy()
public void setConnectionProxy(java.net.Proxy connectionProxy)
connectionProxy
- the connectionProxy to setpublic int getConnectionTimeoutMillis()
public void setConnectionTimeoutMillis(int connectionTimeoutMillis)
connectionTimeoutMillis
- the connectionTimeoutMillis to setpublic int getReadTimeoutMillis()
public void setReadTimeoutMillis(int readTimeoutMillis)
readTimeoutMillis
- the readTimeoutMillis to setpublic java.util.Map<java.lang.String,java.lang.String> getHeaders()
public void setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
headers
- the headers to setpublic void setSslContext(javax.net.ssl.SSLContext sslContext)
sslContext
- the sslContext to setpublic void setHostNameVerifier(javax.net.ssl.HostnameVerifier hostNameVerifier)
hostNameVerifier
- the hostNameVerifier to set