@ThreadSafe public class AmazonHttpClient extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AmazonHttpClient.Builder |
static interface |
AmazonHttpClient.RequestExecutionBuilder
Interface to configure a request execution and execute the request.
|
Modifier and Type | Field and Description |
---|---|
static String |
HEADER_SDK_RETRY_INFO |
static String |
HEADER_SDK_TRANSACTION_ID |
static String |
HEADER_USER_AGENT |
static org.apache.commons.logging.Log |
requestLog
Logger providing detailed information on requests/responses.
|
Constructor and Description |
---|
AmazonHttpClient(ClientConfiguration config)
Constructs a new AWS client using the specified client configuration options (ex: max retry
attempts, proxy httpClientSettings, etc).
|
AmazonHttpClient(ClientConfiguration clientConfig,
ConnectionManagerAwareHttpClient httpClient,
RequestMetricCollector requestMetricCollector,
TokenBucket tokenBucket)
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 httpClientSettings, etc), and request metric collector.
|
AmazonHttpClient(ClientConfiguration config,
RequestMetricCollector requestMetricCollector,
boolean useBrowserCompatibleHostNameVerifier)
Constructs a new AWS client using the specified client configuration options (ex: max retry
attempts, proxy httpClientSettings, etc), and request metric collector.
|
AmazonHttpClient(ClientConfiguration config,
RequestMetricCollector requestMetricCollector,
boolean useBrowserCompatibleHostNameVerifier,
boolean calculateCRC32FromCompressedData)
Constructs a new AWS client using the specified client configuration options (ex: max retry
attempts, proxy httpClientSettings, etc), and request metric collector.
|
Modifier and Type | Method and Description |
---|---|
static AmazonHttpClient.Builder |
builder() |
<T> Response<T> |
execute(Request<?> request,
HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
HttpResponseHandler<AmazonServiceException> errorResponseHandler,
ExecutionContext executionContext)
Deprecated.
Use
requestExecutionBuilder() to configure and execute a HTTP request. |
<T> Response<T> |
execute(Request<?> request,
HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
HttpResponseHandler<AmazonServiceException> errorResponseHandler,
ExecutionContext executionContext,
RequestConfig requestConfig) |
ClientExecutionTimer |
getClientExecutionTimer()
Package protected for unit-testing
|
HttpRequestTimer |
getHttpRequestTimer()
Package protected for unit-testing
|
RequestMetricCollector |
getRequestMetricCollector()
Returns the httpClientSettings 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.
|
AmazonHttpClient.RequestExecutionBuilder |
requestExecutionBuilder() |
void |
shutdown()
Shuts down this HTTP client object, releasing any resources that might be held open.
|
public static final String HEADER_USER_AGENT
public static final String HEADER_SDK_TRANSACTION_ID
public static final String HEADER_SDK_RETRY_INFO
public static final org.apache.commons.logging.Log requestLog
public AmazonHttpClient(ClientConfiguration config)
config
- Configuration options specifying how this client will communicate with AWS (ex:
proxy httpClientSettings, retry count, etc.).public AmazonHttpClient(ClientConfiguration config, RequestMetricCollector requestMetricCollector)
config
- Configuration options specifying how this client will
communicate with AWS (ex: proxy httpClientSettings, 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 config, RequestMetricCollector requestMetricCollector, boolean useBrowserCompatibleHostNameVerifier)
config
- Configuration options specifying how this client will
communicate with AWS (ex: proxy httpClientSettings, 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 config, RequestMetricCollector requestMetricCollector, boolean useBrowserCompatibleHostNameVerifier, boolean calculateCRC32FromCompressedData)
config
- Configuration options specifying how this client will
communicate with AWS (ex: proxy httpClientSettings,
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.calculateCRC32FromCompressedData
- The flag indicating whether the CRC32 checksum is
calculated from compressed data or not. It is only
applicable when the header "x-amz-crc32" is set in
the response.public AmazonHttpClient(ClientConfiguration clientConfig, ConnectionManagerAwareHttpClient httpClient, RequestMetricCollector requestMetricCollector, TokenBucket tokenBucket)
public static AmazonHttpClient.Builder builder()
public void shutdown()
public HttpRequestTimer getHttpRequestTimer()
public ClientExecutionTimer getClientExecutionTimer()
public ResponseMetadata getResponseMetadataForRequest(AmazonWebServiceRequest request)
request
- A previously executed AmazonWebServiceRequest object, whose response metadata
is desired.public RequestMetricCollector getRequestMetricCollector()
public int getTimeOffset()
@Deprecated public <T> Response<T> execute(Request<?> request, HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler, HttpResponseHandler<AmazonServiceException> errorResponseHandler, ExecutionContext executionContext)
requestExecutionBuilder()
to configure and execute a HTTP request.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> execute(Request<?> request, HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler, HttpResponseHandler<AmazonServiceException> errorResponseHandler, ExecutionContext executionContext, RequestConfig requestConfig)
public AmazonHttpClient.RequestExecutionBuilder requestExecutionBuilder()