Package com.amazonaws

Examples of com.amazonaws.AmazonWebServiceRequest


            }
        }
        if (requestLog.isDebugEnabled())
            requestLog.debug("Sending Request: " + request);
        final AWSCredentials credentials = execContext.getCredentials();
        final AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        // Sign the request if a signer was provided
        p.newSigner(request, execContext);
        if (p.signer != null && credentials != null) {
            awsRequestMetrics.startEvent(RequestSigningTime);
            try {
                if (timeOffset != 0)
                    request.setTimeOffset(timeOffset);
                p.signer.sign(request, credentials);
            } finally {
                awsRequestMetrics.endEvent(RequestSigningTime);
            }
        }
        p.newApacheRequest(httpRequestFactory, request, config, execContext);
        final ProgressListener listener = awsreq.getGeneralProgressListener();

        if (p.requestCount > 1) {   // retry
            publishProgress(listener, ProgressEventType.CLIENT_REQUEST_RETRY_EVENT);
            // Notify the progress listener of the retry
            awsRequestMetrics.startEvent(RetryPauseTime);
View Full Code Here


            userAgent += ", " + ClientConfiguration.DEFAULT_USER_AGENT;
        }
        if ( userAgent != null ) {
            request.addHeader(HEADER_USER_AGENT, userAgent);
        }
        AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        RequestClientOptions opts = awsreq.getRequestClientOptions();
        if (opts != null) {
            String userAgentMarker = opts.getClientMarker(Marker.USER_AGENT);
            if (userAgentMarker != null) {
                request.addHeader(HEADER_USER_AGENT,
                    createUserAgentString(userAgent, userAgentMarker));
View Full Code Here

            HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
            HttpRequestBase method, HttpResponse httpResponse,
            org.apache.http.HttpResponse apacheHttpResponse,
            ExecutionContext executionContext) throws IOException
    {
        AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        ProgressListener listener = awsreq.getGeneralProgressListener();
        try {
            /*
             * Apply the byte counting stream wrapper if the legacy runtime profiling is enabled.
             */
            CountingInputStream countingInputStream = null;
View Full Code Here

            HttpResponseHandler<AmazonServiceException> errorResponseHandler,
            ExecutionContext executionContext) {
        if (executionContext == null)
            throw new AmazonClientException("Internal SDK Error: No execution context parameter specified.");
        final List<RequestHandler2> requestHandler2s = requestHandler2s(request, executionContext);
        AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        ProgressListener listener = awsreq.getGeneralProgressListener();
        Map<String, String> customHeaders = awsreq.getCustomRequestHeaders();
        if (customHeaders != null) {
            request.getHeaders().putAll(customHeaders);
        }
        final AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        Response<T> response = null;
View Full Code Here

     * @return an input stream, which will be made mark-and-resettable if
     *         possible, for progress tracking purposes; or null if the request
     *         doesn't have an input stream
     */
    private InputStream beforeRequest(Request<?> request) {
        final AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        ProgressListener listener = awsreq.getGeneralProgressListener();
        Map<String,String> headers = request.getHeaders();
        String s = headers.get("Content-Length");
        if (s != null) {
            try {
                long contentLength = Long.parseLong(s);
View Full Code Here

        final Map<String, String> originalHeaders =
            new HashMap<String, String>(request.getHeaders());
        // Always mark the input stream before execution.
        final InputStream originalContent = request.getContent();
        if (originalContent != null && originalContent.markSupported()) {
            AmazonWebServiceRequest awsreq = request.getOriginalRequest();
            final int readLimit = awsreq.getRequestClientOptions().getReadLimit();
            originalContent.mark(readLimit);
        }
        final ExecOneRequestParams p = new ExecOneRequestParams();
        while (true) {
            p.initPerRetry();
View Full Code Here

            }
        }
        if (requestLog.isDebugEnabled())
            requestLog.debug("Sending Request: " + request);
        final AWSCredentials credentials = execContext.getCredentials();
        final AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        // Sign the request if a signer was provided
        p.newSigner(request, execContext);
        if (p.signer != null && credentials != null) {
            awsRequestMetrics.startEvent(RequestSigningTime);
            try {
                if (timeOffset != 0)
                    request.setTimeOffset(timeOffset);
                p.signer.sign(request, credentials);
            } finally {
                awsRequestMetrics.endEvent(RequestSigningTime);
            }
        }
        p.newApacheRequest(httpRequestFactory, request, config, execContext);
        final ProgressListener listener = awsreq.getGeneralProgressListener();

        if (p.isRetry()) {
            publishProgress(listener, ProgressEventType.CLIENT_REQUEST_RETRY_EVENT);
            // Notify the progress listener of the retry
            awsRequestMetrics.startEvent(RetryPauseTime);
View Full Code Here

            userAgent += ", " + ClientConfiguration.DEFAULT_USER_AGENT;
        }
        if ( userAgent != null ) {
            request.addHeader(HEADER_USER_AGENT, userAgent);
        }
        AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        RequestClientOptions opts = awsreq.getRequestClientOptions();
        if (opts != null) {
            String userAgentMarker = opts.getClientMarker(Marker.USER_AGENT);
            if (userAgentMarker != null) {
                request.addHeader(HEADER_USER_AGENT,
                    createUserAgentString(userAgent, userAgentMarker));
View Full Code Here

            HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
            HttpRequestBase method, HttpResponse httpResponse,
            org.apache.http.HttpResponse apacheHttpResponse,
            ExecutionContext executionContext) throws IOException
    {
        AmazonWebServiceRequest awsreq = request.getOriginalRequest();
        ProgressListener listener = awsreq.getGeneralProgressListener();
        try {
            /*
             * Apply the byte counting stream wrapper if the legacy runtime profiling is enabled.
             */
            CountingInputStream countingInputStream = null;
View Full Code Here

import com.amazonaws.util.TimingInfo;

public class EC2RequestHandler extends AbstractRequestHandler {
    @Override
    public void beforeRequest(Request<?> request) {
        AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
        if (originalRequest instanceof ImportKeyPairRequest) {
            ImportKeyPairRequest importKeyPairRequest = (ImportKeyPairRequest)originalRequest;
            String publicKeyMaterial = importKeyPairRequest.getPublicKeyMaterial();
            String encodedKeyMaterial = Base64.encodeAsString(publicKeyMaterial.getBytes());
            request.addParameter("PublicKeyMaterial", encodedKeyMaterial);
View Full Code Here

TOP

Related Classes of com.amazonaws.AmazonWebServiceRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.