public class EmptyHttpRequest extends Object implements Request<Object>
Constructor and Description |
---|
EmptyHttpRequest(String endpoint,
HttpMethodName httpMethod) |
EmptyHttpRequest(String endpoint,
HttpMethodName httpMethod,
InputStream payload) |
Modifier and Type | Method and Description |
---|---|
<X> void |
addHandlerContext(HandlerContextKey<X> key,
X value)
Adds a context to that is visible to all
RequestHandler2 s. |
void |
addHeader(String name,
String value)
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.
|
AWSRequestMetrics |
getAWSRequestMetrics()
Returns the request metrics.
|
InputStream |
getContent()
Returns the optional stream containing the payload data to include for
this request.
|
InputStream |
getContentUnwrapped()
Returns the optional raw stream containing the payload data to include
for this request, with all progress stream wrappers.
|
URI |
getEndpoint()
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.
|
Map<String,String> |
getHeaders()
Returns a map of all the headers included in this request.
|
HttpMethodName |
getHttpMethod()
Returns the HTTP method (GET, POST, etc) to use when sending this
request.
|
AmazonWebServiceRequest |
getOriginalRequest()
Returns the original, user facing request object which this internal
request object is representing.
|
Object |
getOriginalRequestObject()
Returns the original, user facing request object which this internal
request object is representing.
|
Map<String,List<String>> |
getParameters()
Returns a map of all parameters in this request.
|
ReadLimitInfo |
getReadLimitInfo()
Returns the read limit info about the original request.
|
String |
getResourcePath()
Returns the path to the resource being requested.
|
String |
getServiceName() |
int |
getTimeOffset()
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 |
setOriginalRequest(AmazonWebServiceRequest originalRequest) |
void |
setParameters(Map<String,List<String>> parameters)
Sets all parameters, clearing any existing values.
|
void |
setResourcePath(String path)
Sets the path to the resource being requested.
|
void |
setTimeOffset(int timeOffset)
Sets the optional value for time offset for this request.
|
Request<Object> |
withParameter(String name,
String value)
Adds the specified request parameter to this request, and returns the
updated request object.
|
Request<Object> |
withTimeOffset(int timeOffset)
Sets the optional value for time offset for this request.
|
public EmptyHttpRequest(String endpoint, HttpMethodName httpMethod)
public EmptyHttpRequest(String endpoint, HttpMethodName httpMethod, InputStream payload)
public void addHeader(String name, String value)
SignableRequest
addHeader
in interface SignableRequest<Object>
name
- The name of the header to set.value
- The header's value.public Map<String,String> getHeaders()
ImmutableRequest
getHeaders
in interface ImmutableRequest<Object>
public void setHeaders(Map<String,String> headers)
Request
setHeaders
in interface Request<Object>
public void setResourcePath(String path)
Request
setResourcePath
in interface Request<Object>
path
- The path to the resource being requested.public String getResourcePath()
ImmutableRequest
getResourcePath
in interface ImmutableRequest<Object>
public void addParameter(String name, String value)
SignableRequest
addParameter
in interface SignableRequest<Object>
name
- The name of the request parameter.value
- The value of the request parameter.public Request<Object> withParameter(String name, String value)
Request
withParameter
in interface Request<Object>
name
- The name of the request parameter.value
- The value of the request parameter.public void addParameters(String name, List<String> values)
Request
addParameters
in interface Request<Object>
name
- The name of the request parameter.values
- The value of the request parameter.public Map<String,List<String>> getParameters()
ImmutableRequest
getParameters
in interface ImmutableRequest<Object>
public void setParameters(Map<String,List<String>> parameters)
Request
setParameters
in interface Request<Object>
public URI getEndpoint()
ImmutableRequest
getEndpoint
in interface ImmutableRequest<Object>
public void setEndpoint(URI endpoint)
Request
setEndpoint
in interface Request<Object>
endpoint
- The service endpoint to which this request should be sent.public HttpMethodName getHttpMethod()
ImmutableRequest
getHttpMethod
in interface ImmutableRequest<Object>
public void setHttpMethod(HttpMethodName httpMethod)
Request
setHttpMethod
in interface Request<Object>
httpMethod
- The HTTP method to use when sending this request.public InputStream getContent()
ImmutableRequest
getContent
in interface ImmutableRequest<Object>
public void setContent(InputStream content)
SignableRequest
setContent
in interface SignableRequest<Object>
content
- The optional stream containing the payload data to include for
this request.public String getServiceName()
getServiceName
in interface Request<Object>
AmazonWebServiceClient.getServiceName()
which is used for
signing purpose.AmazonServiceException#getServiceName()}
,
AWSRequestMetrics.Field#ServiceName}
public AmazonWebServiceRequest getOriginalRequest()
Request
getOriginalRequest
in interface Request<Object>
public void setOriginalRequest(AmazonWebServiceRequest originalRequest)
public int getTimeOffset()
ImmutableRequest
getTimeOffset
in interface ImmutableRequest<Object>
public void setTimeOffset(int timeOffset)
Request
setTimeOffset
in interface Request<Object>
timeOffset
- The optional value for time offset (in seconds) for this request.public Request<Object> withTimeOffset(int timeOffset)
Request
withTimeOffset
in interface Request<Object>
public AWSRequestMetrics getAWSRequestMetrics()
Request
getAWSRequestMetrics
in interface Request<Object>
public void setAWSRequestMetrics(AWSRequestMetrics metrics)
Request
setAWSRequestMetrics
in interface Request<Object>
public ReadLimitInfo getReadLimitInfo()
ImmutableRequest
getReadLimitInfo
in interface ImmutableRequest<Object>
public InputStream getContentUnwrapped()
ImmutableRequest
getContentUnwrapped
in interface ImmutableRequest<Object>
public Object getOriginalRequestObject()
ImmutableRequest
getOriginalRequestObject
in interface ImmutableRequest<Object>
Object
.public <X> void addHandlerContext(HandlerContextKey<X> key, X value)
HandlerContextAware
RequestHandler2
s.
Note that, context added here will available only for the scope of
the request execution and will not be marshalled over the wire.addHandlerContext
in interface HandlerContextAware
key
- the key for the property being set in the request.value
- the value for the property being set in the request.public <X> X getHandlerContext(HandlerContextKey<X> key)
HandlerContextAware
getHandlerContext
in interface HandlerContextAware
key
- the key for the contextCopyright © 2018. All rights reserved.