Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
The AWS SDK for Java - Core module holds the classes that are used by the individual service clients to interact with Amazon Web Services. Users need to depend on aws-java-sdk artifact for accessing individual client classes.
/*
* Copyright 2011-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.client;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.RequestConfig;
import com.amazonaws.Response;
import com.amazonaws.SdkBaseException;
import com.amazonaws.annotation.Immutable;
import com.amazonaws.annotation.SdkProtectedApi;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.handlers.RequestHandler2;
import com.amazonaws.http.AmazonHttpClient;
import com.amazonaws.http.ExecutionContext;
import com.amazonaws.http.HttpResponseHandler;
import com.amazonaws.internal.auth.SignerProvider;
import com.amazonaws.metrics.AwsSdkMetrics;
import com.amazonaws.metrics.RequestMetricCollector;
import com.amazonaws.util.AWSRequestMetrics;
import com.amazonaws.util.CredentialUtils;
import java.net.URI;
import java.util.List;
/**
* Default implementation of {@link ClientHandler}.
*/
@Immutable
@ThreadSafe
@SdkProtectedApi
public class ClientHandlerImpl extends ClientHandler {
private final AWSCredentialsProvider awsCredentialsProvider;
private final SignerProvider signerProvider;
private final URI endpoint;
private final List requestHandler2s;
private final RequestMetricCollector clientLevelMetricCollector;
private final AmazonHttpClient client;
public ClientHandlerImpl(ClientHandlerParams handlerParams) {
this.signerProvider = handlerParams.getClientParams().getSignerProvider();
this.endpoint = handlerParams.getClientParams().getEndpoint();
this.awsCredentialsProvider = handlerParams.getClientParams().getCredentialsProvider();
this.requestHandler2s = handlerParams.getClientParams().getRequestHandlers();
this.clientLevelMetricCollector = handlerParams.getClientParams().getRequestMetricCollector();
this.client = buildHttpClient(handlerParams);
}
private AmazonHttpClient buildHttpClient(ClientHandlerParams handlerParams) {
final AwsSyncClientParams clientParams = handlerParams.getClientParams();
return AmazonHttpClient.builder()
.clientConfiguration(clientParams.getClientConfiguration())
.retryPolicy(clientParams.getRetryPolicy())
.requestMetricCollector(clientParams.getRequestMetricCollector())
.useBrowserCompatibleHostNameVerifier(handlerParams.isDisableStrictHostnameVerification())
.build();
}
@Override
public Output execute(
ClientExecutionParams executionParams) {
final Input input = executionParams.getInput();
ExecutionContext executionContext = createExecutionContext(
executionParams.getRequestConfig());
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(AWSRequestMetrics.Field.ClientExecuteTime);
Request request = null;
Response