Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2014 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;
 
 import java.util.Map;
 
 
Base class for all user facing web service requests.
 
 public abstract class AmazonWebServiceRequest implements CloneableReadLimitInfo {
 
     public static final AmazonWebServiceRequest NOOP = new AmazonWebServiceRequest() {};

    
The optional progress listener for receiving updates about the progress of the request.
 
     private ProgressListener progressListener = .;

    
Arbitrary options storage for individual AmazonWebServiceRequests. This field is not intended to be used by clients.
 
     private final RequestClientOptions requestClientOptions = new RequestClientOptions();

    
A request metric collector used for this specific service request; or null if there is none. This collector always takes precedence over the ones specified at the http client level and AWS SDK level.
 
The optional credentials to use for this request - overrides the default credentials set at the client level.
 
     private AWSCredentials credentials;

    
A map of custom header names to header values.
 
     private Map<StringStringcustomRequestHeaders;


    
Sets the optional credentials to use for this request, overriding the default credentials set at the client level.

Parameters:
credentials The optional AWS security credentials to use for this request, overriding the default credentials set at the client level.
 
     public void setRequestCredentials(AWSCredentials credentials) {
         this. = credentials;
     }

    
Returns the optional credentials to use to sign this request, overriding the default credentials set at the client level.

Returns:
The optional credentials to use to sign this request, overriding the default credentials set at the client level.
 
     public AWSCredentials getRequestCredentials() {
         return ;
     }

    
Internal only method for accessing private, internal request parameters. Not intended for direct use by callers.

Returns:
private, internal request parameter information.
 
     public Map<StringStringcopyPrivateRequestParameters() {
         return new HashMap<StringString>();
     }

    
Gets the options stored with this request object. Intended for internal use only.
        return ;
    }

    
Returns a request level metric collector; or null if not specified.
        return ;
    }

    
Sets a request level request metric collector which takes precedence over the ones at the http client level and AWS SDK level.
    public void setRequestMetricCollector(RequestMetricCollector requestMetricCollector) {
        this. = requestMetricCollector;
    }

    
Specifies a request level metric collector which takes precedence over the ones at the http client level and AWS SDK level.
    public <T extends AmazonWebServiceRequest> T withRequestMetricCollector(RequestMetricCollector metricCollector) {
        setRequestMetricCollector(metricCollector);
        @SuppressWarnings("unchecked") T t = (T)this;
        return t;
    }

    
Sets the optional progress listener for receiving updates about the progress of the request.

Parameters:
progressListener The new progress listener.
    public void setGeneralProgressListener(ProgressListener progressListener) {
        this. = progressListener == null
                              ? .
                              : progressListener;
    }

    
Returns the optional progress listener for receiving updates about the progress of the request.

Returns:
the optional progress listener for receiving updates about the progress of the request.
        return ;
    }

    
Sets the optional progress listener for receiving updates about the progress of the request, and returns a reference to this object so that method calls can be chained together.

Parameters:
progressListener The new progress listener.
Returns:
A reference to this updated object so that method calls can be chained together.
    public <T extends AmazonWebServiceRequest> T withGeneralProgressListener(ProgressListener progressListener) {
        setGeneralProgressListener(progressListener);
        @SuppressWarnings("unchecked") T t = (T)this;
        return t;
    }

    
Returns an immutable map of custom header names to header values.

Returns:
The immutable map of custom header names to header values.
    public Map<StringStringgetCustomRequestHeaders() {
        if( == null) {
            return null;
        }
        return Collections.unmodifiableMap();
    }

    
Put a new custom header to the map of custom header names to custom header values, and return the previous value if the header has already been set in this map.

NOTE: Custom header values set via this method will overwrite any conflicting values coming from the request parameters.

Parameters:
name The name of the header to add
value The value of the header to add
Returns:
the previous value for the name if it was set, null otherwise
    public String putCustomRequestHeader(String nameString value) {
        if ( == null) {
             = new HashMap<StringString>();
        }
        return .put(namevalue);
    }
    @Override
    public final int getReadLimit() {
        return .getReadLimit();
    }

    
Copies the internal state of this base class to that of the target request.

Returns:
the target request
    protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target) {
        if ( != null) {
            for (Map.Entry<StringStringe.entrySet())
                target.putCustomRequestHeader(e.getKey(), e.getValue());
        }
        target.setRequestCredentials();
        return target;
    }

    
Creates a shallow clone of this request. Explicitly does not clone the deep structure of the request object.

    @Override
    public AmazonWebServiceRequest clone() {
        try {
            return (AmazonWebServiceRequestsuper.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
    }
New to GrepCode? Check out our FAQ X