/** * Static factory to create an {@link SdkHttpMetadata} from the details in a {@link * HttpResponse}. */ public static SdkHttpMetadata from(HttpResponse httpResponse) { return new SdkHttpMetadata(httpResponse.getHeaders(), httpResponse.getStatusCode()); }
/** * @return HTTP status code of response. */ public int httpStatusCode() { return httpMetadata.getHttpStatusCode(); }
/** * Returns the client specific {@link RequestMetricCollector}; or null if * there is none. */ public RequestMetricCollector getRequestMetricsCollector() { return client.getRequestMetricCollector(); }
@Override public S3ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return (S3ResponseMetadata)client.getResponseMetadataForRequest(request); }
private ExecutionContext createExecutionContext(RequestConfig requestConfig) { boolean isMetricsEnabled = isRequestMetricsEnabled(requestConfig); return ExecutionContext.builder() .withRequestHandler2s(requestHandler2s) .withUseRequestMetrics(isMetricsEnabled) .withSignerProvider(signerProvider) .build(); }
public ErrorUnmarshallingHandler(PutMediaResponseHandler responseHandler, HttpResponseHandler<AmazonServiceException> errorResponseHandler, Request<?> request) { this.responseHandler = responseHandler; this.errorResponseHandler = errorResponseHandler; // Eagerly create the error response to serve as a container for dumping HTTP data into this.errorResponse = new com.amazonaws.http.HttpResponse(request, null); }
@Override public boolean needsConnectionLeftOpen() { return delegate.needsConnectionLeftOpen(); } }
public AmazonHttpClient build() { return new AmazonHttpClient(clientConfig, retryPolicy, requestMetricCollector, useBrowserCompatibleHostNameVerifier, calculateCRC32FromCompressedData); } }
/** * Private constructor - singleton pattern. */ private IdleConnectionReaper() { super("java-sdk-http-connection-reaper"); setDaemon(true); }
@Override public void shutdown() { client.shutdown(); }
/** * Check if the thread has been interrupted. If so throw an {@link InterruptedException}. * Long running tasks should be periodically checked if the current thread has been * interrupted and handle it appropriately * * @throws InterruptedException If thread has been interrupted */ private void checkInterrupted() throws InterruptedException { checkInterrupted(null); }
/** * @return A builder used to configure and execute a HTTP request. */ public RequestExecutionBuilder requestExecutionBuilder() { return new RequestExecutionBuilderImpl(); }
public Builder withUseRequestMetrics(final boolean withUseRequestMetrics) { setUseRequestMetrics(withUseRequestMetrics); return this; }
public Builder withRequestHandler2s(final List<RequestHandler2> requestHandler2s) { setRequestHandler2s(requestHandler2s); return this; }
public Builder withAwsClient(final AmazonWebServiceClient awsClient) { setAwsClient(awsClient); return this; }
public Builder withSignerProvider(final SignerProvider signerProvider) { setSignerProvider(signerProvider); return this; }
@Override public Response<Void> execute() { return execute(null); }
protected ExecutionContext createExecutionContext(AmazonWebServiceRequest req, SignerProvider signerProvider) { boolean isMetricsEnabled = isRequestMetricsEnabled(req) || isProfilingEnabled() || shouldGenerateClientSideMonitoringEvents(); return ExecutionContext.builder() .withRequestHandler2s(requestHandler2s) .withUseRequestMetrics(isMetricsEnabled) .withAwsClient(this) .withSignerProvider(signerProvider).build(); }
/** * @return HTTP status code of response. */ public int httpStatusCode() { return httpMetadata.getHttpStatusCode(); } }
@Override public boolean needsConnectionLeftOpen() { return delegate.needsConnectionLeftOpen(); }