Package com.amazonaws
Class DefaultRequest<T>
java.lang.Object
com.amazonaws.DefaultRequest<T>
- All Implemented Interfaces:
Request<T>
,SignableRequest<T>
Default implementation of the Request interface.
This class is only intended for internal use inside the AWS client libraries. Callers shouldn't ever interact directly with objects of this class.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultRequest
(AmazonWebServiceRequest originalRequest, String serviceName) Constructs a new DefaultRequest with the specified service name and the original, user facing request object.DefaultRequest
(String serviceName) Constructs a new DefaultRequest with the specified service name and no specified original, user facing request object. -
Method Summary
Modifier and TypeMethodDescription<X> void
addHandlerContext
(HandlerContextKey<X> key, X value) Adds a context to the request object that is visible to allRequestHandler2
.void
Sets the specified header for this request.void
addParameter
(String name, String value) Adds the specified request parameter to this request.void
addParameters
(String name, List<String> values) Adds the specified request parameter and list of values to this request.Returns the request metrics.Returns the optional stream containing the payload data to include for this request.Returns the optional raw stream containing the payload data to include for this request, with all progress stream wrappers.Returns the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.<X> X
getHandlerContext
(HandlerContextKey<X> key) Return the context for the given key if present; else return null.Returns a map of all the headers included in this request.Returns the HTTP method (GET, POST, etc) to use when sending this request.Returns the original, user facing request object which this internal request object is representing.Returns the original, user facing request object which this internal request object is representing.Returns a map of all parameters in this request.Returns the read limit info about the original request.Returns the path to the resource being requested.int
Returns the optional value for time offset for this request.void
setAWSRequestMetrics
(AWSRequestMetrics metrics) Bind the request metrics to the request.void
setContent
(InputStream content) Sets the optional stream containing the payload data to include for this request.void
setEndpoint
(URI endpoint) Sets the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.void
setHeaders
(Map<String, String> headers) Sets all headers, clearing any existing ones.void
setHttpMethod
(HttpMethodName httpMethod) Sets the HTTP method (GET, POST, etc) to use when sending this request.void
setParameters
(Map<String, List<String>> parameters) Sets all parameters, clearing any existing values.void
setResourcePath
(String resourcePath) Sets the path to the resource being requested.void
setTimeOffset
(int timeOffset) Sets the optional value for time offset for this request.toString()
withParameter
(String name, String value) Adds the specified request parameter to this request, and returns the updated request object.withTimeOffset
(int timeOffset) Sets the optional value for time offset for this request.
-
Constructor Details
-
DefaultRequest
Constructs a new DefaultRequest with the specified service name and the original, user facing request object.- Parameters:
serviceName
- The name of the service to which this request is being sent.originalRequest
- The original, user facing, AWS request being represented by this internal request object.
-
DefaultRequest
Constructs a new DefaultRequest with the specified service name and no specified original, user facing request object.- Parameters:
serviceName
- The name of the service to which this request is being sent.
-
-
Method Details
-
getOriginalRequest
Returns the original, user facing request object which this internal request object is representing.- Specified by:
getOriginalRequest
in interfaceRequest<T>
- Returns:
- The original, user facing request object which this request object is representing.
-
addHeader
Description copied from interface:SignableRequest
Sets the specified header for this request.- Specified by:
addHeader
in interfaceSignableRequest<T>
- Parameters:
name
- The name of the header to set.value
- The header's value.- See Also:
-
getHeaders
Description copied from interface:SignableRequest
Returns a map of all the headers included in this request.- Specified by:
getHeaders
in interfaceSignableRequest<T>
- Returns:
- A map of all the headers included in this request.
- See Also:
-
setResourcePath
Description copied from interface:Request
Sets the path to the resource being requested.- Specified by:
setResourcePath
in interfaceRequest<T>
- Parameters:
resourcePath
- The path to the resource being requested.- See Also:
-
getResourcePath
Description copied from interface:SignableRequest
Returns the path to the resource being requested.- Specified by:
getResourcePath
in interfaceSignableRequest<T>
- Returns:
- The path to the resource being requested.
- See Also:
-
addParameter
Description copied from interface:SignableRequest
Adds the specified request parameter to this request.- Specified by:
addParameter
in interfaceSignableRequest<T>
- Parameters:
name
- The name of the request parameter.value
- The value of the request parameter.- See Also:
-
addParameters
Description copied from interface:Request
Adds the specified request parameter and list of values to this request.- Specified by:
addParameters
in interfaceRequest<T>
- Parameters:
name
- The name of the request parameter.values
- The value of the request parameter.- See Also:
-
getParameters
Description copied from interface:SignableRequest
Returns a map of all parameters in this request.- Specified by:
getParameters
in interfaceSignableRequest<T>
- Returns:
- A map of all parameters in this request.
- See Also:
-
withParameter
Description copied from interface:Request
Adds the specified request parameter to this request, and returns the updated request object.- Specified by:
withParameter
in interfaceRequest<T>
- Parameters:
name
- The name of the request parameter.value
- The value of the request parameter.- Returns:
- The updated request object.
- See Also:
-
getHttpMethod
Description copied from interface:SignableRequest
Returns the HTTP method (GET, POST, etc) to use when sending this request.- Specified by:
getHttpMethod
in interfaceSignableRequest<T>
- Returns:
- The HTTP method to use when sending this request.
- See Also:
-
setHttpMethod
Description copied from interface:Request
Sets the HTTP method (GET, POST, etc) to use when sending this request.- Specified by:
setHttpMethod
in interfaceRequest<T>
- Parameters:
httpMethod
- The HTTP method to use when sending this request.- See Also:
-
setEndpoint
Description copied from interface:Request
Sets the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.- Specified by:
setEndpoint
in interfaceRequest<T>
- Parameters:
endpoint
- The service endpoint to which this request should be sent.- See Also:
-
getEndpoint
Description copied from interface:SignableRequest
Returns the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.- Specified by:
getEndpoint
in interfaceSignableRequest<T>
- Returns:
- The service endpoint to which this request should be sent.
- See Also:
-
getServiceName
- Specified by:
getServiceName
in interfaceRequest<T>
- Returns:
- The name of the Amazon service this request is for. This is used
as the service name set in request metrics and service
exceptions. This is NOT the same as the service name returned by
AmazonWebServiceClient.getServiceName()
which is used for signing purpose. - See Also:
-
getContent
Description copied from interface:SignableRequest
Returns the optional stream containing the payload data to include for this request. Not all requests will contain payload data.- Specified by:
getContent
in interfaceSignableRequest<T>
- Returns:
- The optional stream containing the payload data to include for this request.
- See Also:
-
setContent
Description copied from interface:SignableRequest
Sets the optional stream containing the payload data to include for this request. This is used, for example, for S3 chunk encoding.- Specified by:
setContent
in interfaceSignableRequest<T>
- Parameters:
content
- The optional stream containing the payload data to include for this request.- See Also:
-
setHeaders
Description copied from interface:Request
Sets all headers, clearing any existing ones.- Specified by:
setHeaders
in interfaceRequest<T>
- See Also:
-
setParameters
Description copied from interface:Request
Sets all parameters, clearing any existing values. Note that List values within the parameters Map must use an implementation that supports null values.- Specified by:
setParameters
in interfaceRequest<T>
- See Also:
-
getTimeOffset
public int getTimeOffset()Description copied from interface:SignableRequest
Returns the optional value for time offset for this request. This will be used by the signer to adjust for potential clock skew. Value is in seconds, positive values imply the current clock is "fast", negative values imply clock is slow.- Specified by:
getTimeOffset
in interfaceSignableRequest<T>
- Returns:
- The optional value for time offset (in seconds) for this request.
- See Also:
-
setTimeOffset
public void setTimeOffset(int timeOffset) Description copied from interface:Request
Sets the optional value for time offset for this request. This will be used by the signer to adjust for potential clock skew. Value is in seconds, positive values imply the current clock is "fast", negative values imply clock is slow.- Specified by:
setTimeOffset
in interfaceRequest<T>
- Parameters:
timeOffset
- The optional value for time offset (in seconds) for this request.- See Also:
-
withTimeOffset
Description copied from interface:Request
Sets the optional value for time offset for this request. This will be used by the signer to adjust for potential clock skew. Value is in seconds, positive values imply the current clock is "fast", negative values imply clock is slow.- Specified by:
withTimeOffset
in interfaceRequest<T>
- Returns:
- The updated request object.
- See Also:
-
toString
-
getAWSRequestMetrics
Description copied from interface:Request
Returns the request metrics.- Specified by:
getAWSRequestMetrics
in interfaceRequest<T>
-
setAWSRequestMetrics
Description copied from interface:Request
Bind the request metrics to the request. Note metrics can be captured before the request is created.- Specified by:
setAWSRequestMetrics
in interfaceRequest<T>
-
addHandlerContext
Description copied from interface:Request
Adds a context to the request object that is visible to allRequestHandler2
. Note that, context added here will available only for the scope of the request execution and will not be marshalled over the wire.- Specified by:
addHandlerContext
in interfaceRequest<T>
- Parameters:
key
- the key for the property being set in the request.value
- the value for the property being set in the request.
-
getHandlerContext
Description copied from interface:Request
Return the context for the given key if present; else return null.- Specified by:
getHandlerContext
in interfaceRequest<T>
- Parameters:
key
- the key for the context- Returns:
- the context if present else null.
-
getContentUnwrapped
Description copied from interface:SignableRequest
Returns the optional raw stream containing the payload data to include for this request, with all progress stream wrappers. Not all requests contain payload data.- Specified by:
getContentUnwrapped
in interfaceSignableRequest<T>
- Returns:
- The optional raw stream containing the payload data to include for this request, with all progress stream wrappers removed.
-
getReadLimitInfo
Description copied from interface:SignableRequest
Returns the read limit info about the original request.- Specified by:
getReadLimitInfo
in interfaceSignableRequest<T>
-
getOriginalRequestObject
Description copied from interface:SignableRequest
Returns the original, user facing request object which this internal request object is representing.- Specified by:
getOriginalRequestObject
in interfaceSignableRequest<T>
- Returns:
- an instance of request as an
Object
.
-