public abstract class AmazonWebServiceRequest extends java.lang.Object implements java.lang.Cloneable, ReadLimitInfo
Modifier and Type | Field and Description |
---|---|
private AmazonWebServiceRequest |
cloneSource
The source object from which the current object was cloned; or null if there isn't one.
|
private AWSCredentialsProvider |
credentialsProvider
The optional credentials to use for this request - overrides the default credentials set at
the client level.
|
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
customQueryParameters
Custom query parameters for the request.
|
private java.util.Map<java.lang.String,java.lang.String> |
customRequestHeaders
A map of custom header names to header values.
|
static AmazonWebServiceRequest |
NOOP |
private ProgressListener |
progressListener
The optional progress listener for receiving updates about the progress of the request.
|
private RequestClientOptions |
requestClientOptions
Arbitrary options storage for individual
AmazonWebServiceRequest s. |
private RequestMetricCollector |
requestMetricCollector
A request metric collector used for this specific service request; or null if there is none.
|
private java.lang.Integer |
sdkClientExecutionTimeout |
private java.lang.Integer |
sdkRequestTimeout |
Constructor and Description |
---|
AmazonWebServiceRequest() |
Modifier and Type | Method and Description |
---|---|
AmazonWebServiceRequest |
clone()
Creates a shallow clone of this request.
|
protected <T extends AmazonWebServiceRequest> |
copyBaseTo(T target)
Copies the internal state of this base class to that of the target request.
|
AmazonWebServiceRequest |
getCloneRoot()
Returns the root object from which the current object was cloned; or null if there isn't one.
|
AmazonWebServiceRequest |
getCloneSource()
Returns the source object from which the current object was cloned; or null if there isn't
one.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getCustomQueryParameters() |
java.util.Map<java.lang.String,java.lang.String> |
getCustomRequestHeaders()
Returns an immutable map of custom header names to header values.
|
ProgressListener |
getGeneralProgressListener()
Returns the optional progress listener for receiving updates about the progress of the
request.
|
int |
getReadLimit()
Returns the read limit for mark-and-reset during retries; or -1 if not
available.
|
RequestClientOptions |
getRequestClientOptions()
Gets the options stored with this request object.
|
AWSCredentials |
getRequestCredentials()
Deprecated.
|
AWSCredentialsProvider |
getRequestCredentialsProvider()
Returns the optional credentials provider to use to sign this request, overriding the default
credentials provider at the client level.
|
RequestMetricCollector |
getRequestMetricCollector()
Returns a request level metric collector; or null if not specified.
|
java.lang.Integer |
getSdkClientExecutionTimeout()
Returns the amount of time (in milliseconds) to allow the client to complete the execution of
an API call.
|
java.lang.Integer |
getSdkRequestTimeout()
Returns the amount of time to wait (in milliseconds) for the request to complete before
giving up and timing out.
|
void |
putCustomQueryParameter(java.lang.String name,
java.lang.String value)
Add a custom query parameter for the request.
|
java.lang.String |
putCustomRequestHeader(java.lang.String name,
java.lang.String value)
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.
|
private void |
setCloneSource(AmazonWebServiceRequest cloneSource) |
void |
setGeneralProgressListener(ProgressListener progressListener)
Sets the optional progress listener for receiving updates about the progress of the request.
|
void |
setRequestCredentials(AWSCredentials credentials)
Deprecated.
|
void |
setRequestCredentialsProvider(AWSCredentialsProvider credentialsProvider)
Sets the optional credentials provider to use for this request, overriding the default credentials
provider at the client level.
|
void |
setRequestMetricCollector(RequestMetricCollector requestMetricCollector)
Sets a request level request metric collector which takes precedence over the ones at the
http client level and AWS SDK level.
|
void |
setSdkClientExecutionTimeout(int sdkClientExecutionTimeout)
Sets the amount of time (in milliseconds) to allow the client to complete the execution of
an API call.
|
void |
setSdkRequestTimeout(int sdkRequestTimeout)
Sets the amount of time to wait (in milliseconds) for the request to complete before giving
up and timing out.
|
<T extends AmazonWebServiceRequest> |
withGeneralProgressListener(ProgressListener progressListener)
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.
|
<T extends AmazonWebServiceRequest> |
withRequestMetricCollector(RequestMetricCollector metricCollector)
Specifies a request level metric collector which takes precedence over the ones at the http
client level and AWS SDK level.
|
<T extends AmazonWebServiceRequest> |
withSdkClientExecutionTimeout(int sdkClientExecutionTimeout)
Sets the amount of time (in milliseconds) to allow the client to complete the execution of
an API call.
|
<T extends AmazonWebServiceRequest> |
withSdkRequestTimeout(int sdkRequestTimeout)
Sets the amount of time to wait (in milliseconds) for the request to complete before giving
up and timing out.
|
public static final AmazonWebServiceRequest NOOP
private ProgressListener progressListener
private final RequestClientOptions requestClientOptions
AmazonWebServiceRequest
s. This field is not
intended to be used by clients.private RequestMetricCollector requestMetricCollector
private AWSCredentialsProvider credentialsProvider
private java.util.Map<java.lang.String,java.lang.String> customRequestHeaders
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> customQueryParameters
private AmazonWebServiceRequest cloneSource
private java.lang.Integer sdkRequestTimeout
private java.lang.Integer sdkClientExecutionTimeout
@Deprecated public void setRequestCredentials(AWSCredentials credentials)
setRequestCredentialsProvider(AWSCredentialsProvider)
credentials
- The optional AWS security credentials to use for this request, overriding the
default credentials set at the client level.@Deprecated public AWSCredentials getRequestCredentials()
getRequestCredentialsProvider()
public void setRequestCredentialsProvider(AWSCredentialsProvider credentialsProvider)
credentialsProvider
- The optional AWS security credentials provider to use for this request, overriding the
default credentials provider at the client level.public AWSCredentialsProvider getRequestCredentialsProvider()
public RequestClientOptions getRequestClientOptions()
public RequestMetricCollector getRequestMetricCollector()
public void setRequestMetricCollector(RequestMetricCollector requestMetricCollector)
public <T extends AmazonWebServiceRequest> T withRequestMetricCollector(RequestMetricCollector metricCollector)
public void setGeneralProgressListener(ProgressListener progressListener)
progressListener
- The new progress listener.public ProgressListener getGeneralProgressListener()
public <T extends AmazonWebServiceRequest> T withGeneralProgressListener(ProgressListener progressListener)
progressListener
- The new progress listener.public java.util.Map<java.lang.String,java.lang.String> getCustomRequestHeaders()
public java.lang.String putCustomRequestHeader(java.lang.String name, java.lang.String value)
NOTE: Custom header values set via this method will overwrite any conflicting values coming from the request parameters.
name
- The name of the header to addvalue
- The value of the header to addpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getCustomQueryParameters()
public void putCustomQueryParameter(java.lang.String name, java.lang.String value)
name
- The name of the query parametervalue
- The value of the query parameter. Only the parameter name will be added in the URI
if the value is set to null. For example, putCustomQueryParameter("param", null)
will be serialized to "?param", while putCustomQueryParameter("param", "") will be
serialized to "?param=".public final int getReadLimit()
ReadLimitInfo
getReadLimit
in interface ReadLimitInfo
protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target)
public AmazonWebServiceRequest getCloneSource()
public AmazonWebServiceRequest getCloneRoot()
private void setCloneSource(AmazonWebServiceRequest cloneSource)
public java.lang.Integer getSdkRequestTimeout()
This feature requires buffering the entire response (for non-streaming APIs) into memory to enforce a hard timeout when reading the response. For APIs that return large responses this could be expensive.
The request timeout feature doesn't have strict guarantees on how quickly a request is aborted when the timeout is breached. The typical case aborts the request within a few milliseconds but there may occasionally be requests that don't get aborted until several seconds after the timer has been breached. Because of this the request timeout feature should not be used when absolute precision is needed.
Note: This feature is not compatible with Java 1.6.
AmazonWebServiceRequest#setSdkClientExecutionTimeout(int)} to enforce a timeout
across all retries
public void setSdkRequestTimeout(int sdkRequestTimeout)
This feature requires buffering the entire response (for non-streaming APIs) into memory to enforce a hard timeout when reading the response. For APIs that return large responses this could be expensive.
The request timeout feature doesn't have strict guarantees on how quickly a request is aborted when the timeout is breached. The typical case aborts the request within a few milliseconds but there may occasionally be requests that don't get aborted until several seconds after the timer has been breached. Because of this the request timeout feature should not be used when absolute precision is needed.
Note: This feature is not compatible with Java 1.6.
sdkRequestTimeout
- The amount of time to wait (in milliseconds) for the request to complete before
giving up and timing out. A non-positive value disables the timeout for this
request.AmazonWebServiceRequest#setSdkClientExecutionTimeout(int)} to enforce a timeout
across all retries
public <T extends AmazonWebServiceRequest> T withSdkRequestTimeout(int sdkRequestTimeout)
This feature requires buffering the entire response (for non-streaming APIs) into memory to enforce a hard timeout when reading the response. For APIs that return large responses this could be expensive.
The request timeout feature doesn't have strict guarantees on how quickly a request is aborted when the timeout is breached. The typical case aborts the request within a few milliseconds but there may occasionally be requests that don't get aborted until several seconds after the timer has been breached. Because of this the request timeout feature should not be used when absolute precision is needed.
Note: This feature is not compatible with Java 1.6.
sdkRequestTimeout
- The amount of time to wait (in milliseconds) for the request to complete before
giving up and timing out. A non-positive value disables the timeout for this
request.AmazonWebServiceRequest
object.AmazonWebServiceRequest#setSdkClientExecutionTimeout(int)} to enforce a timeout
across all retries
public java.lang.Integer getSdkClientExecutionTimeout()
This feature requires buffering the entire response (for non-streaming APIs) into memory to enforce a hard timeout when reading the response. For APIs that return large responses this could be expensive.
The client execution timeout feature doesn't have strict guarantees on how quickly a request is aborted when the timeout is breached. The typical case aborts the request within a few milliseconds but there may occasionally be requests that don't get aborted until several seconds after the timer has been breached. Because of this the client execution timeout feature should not be used when absolute precision is needed.
This may be used together with setSdkRequestTimeout(int)
to
enforce both a timeout on each individual HTTP request (i.e. each retry) and the total time
spent on all requests across retries (i.e. the 'client execution' time). A non-positive value
disables this feature.
Note: This feature is not compatible with Java 1.6.
AmazonWebServiceRequest#setSdkRequestTimeout(int)} to enforce a timeout per HTTP
request
public void setSdkClientExecutionTimeout(int sdkClientExecutionTimeout)
This feature requires buffering the entire response (for non-streaming APIs) into memory to enforce a hard timeout when reading the response. For APIs that return large responses this could be expensive.
The client execution timeout feature doesn't have strict guarantees on how quickly a request is aborted when the timeout is breached. The typical case aborts the request within a few milliseconds but there may occasionally be requests that don't get aborted until several seconds after the timer has been breached. Because of this the client execution timeout feature should not be used when absolute precision is needed.
This may be used together with setSdkRequestTimeout(int)
to
enforce both a timeout on each individual HTTP request (i.e. each retry) and the total time
spent on all requests across retries (i.e. the 'client execution' time). A non-positive value
disables this feature.
Note: This feature is not compatible with Java 1.6.
sdkClientExecutionTimeout
- The amount of time (in milliseconds) to allow the client to complete the execution
of an API call. A non-positive value disables the timeout for this request.AmazonWebServiceRequest#setSdkRequestTimeout(int)} to enforce a timeout per HTTP
request
public <T extends AmazonWebServiceRequest> T withSdkClientExecutionTimeout(int sdkClientExecutionTimeout)
This feature requires buffering the entire response (for non-streaming APIs) into memory to enforce a hard timeout when reading the response. For APIs that return large responses this could be expensive.
The client execution timeout feature doesn't have strict guarantees on how quickly a request is aborted when the timeout is breached. The typical case aborts the request within a few milliseconds but there may occasionally be requests that don't get aborted until several seconds after the timer has been breached. Because of this the client execution timeout feature should not be used when absolute precision is needed.
This may be used together with setSdkRequestTimeout(int)
to
enforce both a timeout on each individual HTTP request (i.e. each retry) and the total time
spent on all requests across retries (i.e. the 'client execution' time). A non-positive value
disables this feature.
Note: This feature is not compatible with Java 1.6.
sdkClientExecutionTimeout
- The amount of time (in milliseconds) to allow the client to complete the execution
of an API call. A non-positive value disables the timeout for this request.AmazonWebServiceRequest#setSdkRequestTimeout(int)} to enforce a timeout per HTTP
request
public AmazonWebServiceRequest clone()
clone
in class java.lang.Object
Object.clone()