public abstract class ApiWebServiceClient<T extends ApiWebServiceClient<T>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected HttpAuthClient |
client
Low level client for sending request to services.
|
protected ClientConfiguration |
configuration
The client configuration.
|
protected java.net.URI |
endpoint
the service endpoint to which this client will send request.
|
protected java.util.List<RequestHandler> |
requestHandlers
Optional request handlers for additional request processing.
|
protected int |
timeOffset
Optional offset (in seconds) to use when signing request.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ApiWebServiceClient(ClientConfiguration configuration)
Constructs a ApiWebServiceClient object using the specified configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRequestHandler(RequestHandler requestHandler)
Appends a request handler to the list of registered handlers that are
run as part of a request's lifecycle.
|
protected ExecutionContext |
createExecutionContext() |
protected HttpAuthClient |
createHttpAuthClient(ClientConfiguration configuration) |
int |
getTimeOffset() |
ApiWebServiceClient<T> |
removeRequestHandler(RequestHandler requestHandler)
Removes the request handler from the list of registered handlers and
returns the updated client object.
|
void |
setConfiguration(ClientConfiguration configuration)
Sets the client configuration.
|
void |
setEndpoint(java.lang.String endpoint)
Overrides the default endpoint for this client.
|
void |
setTimeOffset(int timeOffset)
Sets the optional value for time offset for this client.
|
void |
shutdown()
Shutdown this client object, release any resources that might be held
open.
|
ApiWebServiceClient<T> |
withConfiguration(ClientConfiguration configuration)
Sets the client configuration and returns the updated client object.
|
ApiWebServiceClient<T> |
withRequestHandler(RequestHandler requestHandler)
Appends a request handler to the list of registered handlers that are
run as part of a request's lifecycle and return the updated client
object.
|
ApiWebServiceClient<T> |
withTimeOffset(int timeOffset)
Sets the optional value for time offset for this client.
|
protected java.net.URI endpoint
protected ClientConfiguration configuration
protected HttpAuthClient client
protected final java.util.List<RequestHandler> requestHandlers
protected int timeOffset
protected ApiWebServiceClient(ClientConfiguration configuration)
configuration - the client configuration for this client.public void setEndpoint(java.lang.String endpoint)
throws java.lang.IllegalArgumentException
endpoint - The endpoint or a full URL, including the protocol of
specified endpoint this client will communicate with.java.lang.IllegalArgumentException - If any problems are detected with the
specified endpoint.public void setConfiguration(ClientConfiguration configuration)
configuration - the client configuration to set.public ApiWebServiceClient<T> withConfiguration(ClientConfiguration configuration)
configuration - the client configuration to set.public void shutdown()
public void addRequestHandler(RequestHandler requestHandler)
requestHandler - The new handler to add to the current list of
request handlers.public ApiWebServiceClient<T> withRequestHandler(RequestHandler requestHandler)
requestHandler - The new handler to add to the current list of
request handlers.public ApiWebServiceClient<T> removeRequestHandler(RequestHandler requestHandler)
requestHandler - the handler to remove from the current list of
request handlers.public void setTimeOffset(int timeOffset)
timeOffset - The optional value for time offset (in seconds)
for this client.public ApiWebServiceClient<T> withTimeOffset(int timeOffset)
timeOffset - The optional value of time offset (in seconds)
for this client.public int getTimeOffset()
protected ExecutionContext createExecutionContext()
protected HttpAuthClient createHttpAuthClient(ClientConfiguration configuration)
configuration - configurationHttpAuthClient from the given configuration.