Class AmazonHttpClient


  • public class AmazonHttpClient
    extends Object
    • Constructor Detail

      • AmazonHttpClient

        public AmazonHttpClient​(ClientConfiguration config)
        Constructs a new AWS client using the specified client configuration options (ex: max retry attempts, proxy httpClientSettings, etc).
        Parameters:
        config - Configuration options specifying how this client will communicate with AWS (ex: proxy httpClientSettings, retry count, etc.).
      • AmazonHttpClient

        public 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.
        Parameters:
        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.
      • AmazonHttpClient

        public 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.
        Parameters:
        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.
    • Method Detail

      • getHttpRequestTimer

        public HttpRequestTimer getHttpRequestTimer()
        Package protected for unit-testing
      • getClientExecutionTimer

        public ClientExecutionTimer getClientExecutionTimer()
        Package protected for unit-testing
      • getResponseMetadataForRequest

        public ResponseMetadata getResponseMetadataForRequest​(AmazonWebServiceRequest request)
        Returns additional response metadata for an executed request. Response metadata isn't considered part of the standard results returned by an operation, so it's accessed instead through this diagnostic interface. Response metadata is typically used for troubleshooting issues with AWS support staff when services aren't acting as expected.
        Parameters:
        request - A previously executed AmazonWebServiceRequest object, whose response metadata is desired.
        Returns:
        The response metadata for the specified request, otherwise null if there is no response metadata available for the request.
      • execute

        public <T> Response<T> execute​(Request<?> request,
                                       HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
                                       HttpResponseHandler<AmazonServiceException> errorResponseHandler,
                                       ExecutionContext executionContext)
        Executes the request and returns the result.
        Parameters:
        request - The AmazonWebServices request to send to the remote server
        responseHandler - A response handler to accept a successful response from the remote server
        errorResponseHandler - A response handler to accept an unsuccessful response from the remote server
        executionContext - Additional information about the context of this web service call
      • shutdown

        public void shutdown()
        Shuts down this HTTP client object, releasing any resources that might be held open. This is an optional method, and callers are not expected to call it, but can if they want to explicitly release any open resources. Once a client has been shutdown, it cannot be used to make more requests.
      • getRequestMetricCollector

        public RequestMetricCollector getRequestMetricCollector()
        Returns the httpClientSettings client specific request metric collector; or null if there is none.
      • getTimeOffset

        public int getTimeOffset()
        Returns the time difference in seconds between this client and AWS.