@ThreadSafe public class AmazonHttpClient extends Object
Constructor and Description |
---|
AmazonHttpClient(ClientConfiguration config)
Constructs a new AWS client using the specified client configuration options (ex: max retry
attempts, proxy settings, etc).
|
AmazonHttpClient(ClientConfiguration clientConfig,
org.apache.http.client.HttpClient httpClient,
RequestMetricCollector requestMetricCollector)
Package-protected constructor for unit test purposes.
|
AmazonHttpClient(ClientConfiguration config,
RequestMetricCollector requestMetricCollector)
Constructs a new AWS client using the specified client configuration options (ex: max retry
attempts, proxy settings, etc), and request metric collector.
|
Modifier and Type | Method and Description |
---|---|
void |
disableStrictHostnameVerification()
Disables the default strict hostname verification in this client and instead uses a browser
compatible hostname verification strategy (i.e.
|
<T> Response<T> |
execute(Request<?> request,
HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
HttpResponseHandler<AmazonServiceException> errorResponseHandler,
ExecutionContext executionContext)
Executes the request and returns the result.
|
<T> Response<T> |
executeWithTimer(Request<?> request,
HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
HttpResponseHandler<AmazonServiceException> errorResponseHandler,
ExecutionContext executionContext)
Start and end client execution timer around the execution of the request.
|
protected void |
finalize() |
ClientExecutionTimer |
getClientExecutionTimer()
Package protected for unit-testing
|
HttpRequestTimer |
getHttpRequestTimer()
Package protected for unit-testing
|
RequestMetricCollector |
getRequestMetricCollector()
Returns the http client specific request metric collector; or null if there is none.
|
ResponseMetadata |
getResponseMetadataForRequest(AmazonWebServiceRequest request)
Returns additional response metadata for an executed request.
|
int |
getTimeOffset()
Returns the time difference in seconds between this client and AWS.
|
void |
shutdown()
Shuts down this HTTP client object, releasing any resources that might be held open.
|
public AmazonHttpClient(ClientConfiguration config)
config
- Configuration options specifying how this client will communicate with AWS (ex:
proxy settings, retry count, etc.).public AmazonHttpClient(ClientConfiguration config, RequestMetricCollector requestMetricCollector)
config
- Configuration options specifying how this client will communicate with AWS (ex:
proxy settings, retry count, etc.).requestMetricCollector
- client specific request metric collector, which takes precedence over the one at
the AWS SDK level; or null if there is none.public AmazonHttpClient(ClientConfiguration clientConfig, org.apache.http.client.HttpClient httpClient, RequestMetricCollector requestMetricCollector)
public HttpRequestTimer getHttpRequestTimer()
public ClientExecutionTimer getClientExecutionTimer()
public ResponseMetadata getResponseMetadataForRequest(AmazonWebServiceRequest request)
request
- A previously executed AmazonWebServiceRequest object, whose response metadata is
desired.public void disableStrictHostnameVerification()
public <T> Response<T> execute(Request<?> request, HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler, HttpResponseHandler<AmazonServiceException> errorResponseHandler, ExecutionContext executionContext)
request
- The AmazonWebServices request to send to the remote serverresponseHandler
- A response handler to accept a successful response from the remote servererrorResponseHandler
- A response handler to accept an unsuccessful response from the remote serverexecutionContext
- Additional information about the context of this web service callpublic <T> Response<T> executeWithTimer(Request<?> request, HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler, HttpResponseHandler<AmazonServiceException> errorResponseHandler, ExecutionContext executionContext) throws InterruptedException
execute(Request, HttpResponseHandler, HttpResponseHandler, ExecutionContext)
so the
interrupt status doesn't leak out to the callers codeInterruptedException
public void shutdown()
protected void finalize() throws Throwable
public RequestMetricCollector getRequestMetricCollector()
public int getTimeOffset()
Copyright © 2016. All rights reserved.