com.amazonaws
Class DefaultRequest<T>

java.lang.Object
  extended by com.amazonaws.DefaultRequest<T>
All Implemented Interfaces:
Request<T>

public class DefaultRequest<T>
extends Object
implements Request<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
DefaultRequest(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
 void addHeader(String name, String value)
          Adds the specified header to this request.
 void addParameter(String name, String value)
          Adds the specified request parameter to this request.
 InputStream getContent()
          Returns the optional stream containing the payload data to include for this request.
 URI getEndpoint()
          Returns the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.
 Map<String,String> getHeaders()
          Returns a map of all the headers included in this request.
 com.amazonaws.http.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.
 Map<String,String> getParameters()
          Returns a map of all parameters in this request.
 String getResourcePath()
          Returns the path to the resource being requested.
 String getServiceName()
          Returns the name of the Amazon service this request is for.
 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(com.amazonaws.http.HttpMethodName httpMethod)
          Sets the HTTP method (GET, POST, etc) to use when sending this request.
 void setParameters(Map<String,String> parameters)
          Sets all parameters, clearing any existing values.
 void setResourcePath(String resourcePath)
          Sets the path to the resource being requested.
 String toString()
           
 Request<T> withParameter(String name, String value)
          Adds the specified request parameter to this request, and returns the updated request object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultRequest

public DefaultRequest(AmazonWebServiceRequest originalRequest,
                      String serviceName)
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

public DefaultRequest(String serviceName)
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 Detail

getOriginalRequest

public AmazonWebServiceRequest getOriginalRequest()
Returns the original, user facing request object which this internal request object is representing.

Specified by:
getOriginalRequest in interface Request<T>
Returns:
The original, user facing request object which this request object is representing.

addHeader

public void addHeader(String name,
                      String value)
Description copied from interface: Request
Adds the specified header to this request.

Specified by:
addHeader in interface Request<T>
Parameters:
name - The name of the header to add.
value - The header's value.
See Also:
Request.addHeader(java.lang.String, java.lang.String)

getHeaders

public Map<String,String> getHeaders()
Description copied from interface: Request
Returns a map of all the headers included in this request.

Specified by:
getHeaders in interface Request<T>
Returns:
A map of all the headers included in this request.
See Also:
Request.getHeaders()

setResourcePath

public void setResourcePath(String resourcePath)
Description copied from interface: Request
Sets the path to the resource being requested.

Specified by:
setResourcePath in interface Request<T>
Parameters:
resourcePath - The path to the resource being requested.
See Also:
Request.setResourcePath(java.lang.String)

getResourcePath

public String getResourcePath()
Description copied from interface: Request
Returns the path to the resource being requested.

Specified by:
getResourcePath in interface Request<T>
Returns:
The path to the resource being requested.
See Also:
Request.getResourcePath()

addParameter

public void addParameter(String name,
                         String value)
Description copied from interface: Request
Adds the specified request parameter to this request.

Specified by:
addParameter in interface Request<T>
Parameters:
name - The name of the request parameter.
value - The value of the request parameter.
See Also:
Request.addParameter(java.lang.String, java.lang.String)

getParameters

public Map<String,String> getParameters()
Description copied from interface: Request
Returns a map of all parameters in this request.

Specified by:
getParameters in interface Request<T>
Returns:
A map of all parameters in this request.
See Also:
Request.getParameters()

withParameter

public Request<T> withParameter(String name,
                                String value)
Description copied from interface: Request
Adds the specified request parameter to this request, and returns the updated request object.

Specified by:
withParameter in interface Request<T>
Parameters:
name - The name of the request parameter.
value - The value of the request parameter.
Returns:
The updated request object.
See Also:
Request.withParameter(java.lang.String, java.lang.String)

getHttpMethod

public com.amazonaws.http.HttpMethodName getHttpMethod()
Description copied from interface: Request
Returns the HTTP method (GET, POST, etc) to use when sending this request.

Specified by:
getHttpMethod in interface Request<T>
Returns:
The HTTP method to use when sending this request.
See Also:
Request.getHttpMethod()

setHttpMethod

public void setHttpMethod(com.amazonaws.http.HttpMethodName httpMethod)
Description copied from interface: Request
Sets the HTTP method (GET, POST, etc) to use when sending this request.

Specified by:
setHttpMethod in interface Request<T>
Parameters:
httpMethod - The HTTP method to use when sending this request.
See Also:
Request.setHttpMethod(com.amazonaws.http.HttpMethodName)

setEndpoint

public void setEndpoint(URI endpoint)
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 interface Request<T>
Parameters:
endpoint - The service endpoint to which this request should be sent.
See Also:
Request.setEndpoint(java.net.URI)

getEndpoint

public URI getEndpoint()
Description copied from interface: Request
Returns the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.

Specified by:
getEndpoint in interface Request<T>
Returns:
The service endpoint to which this request should be sent.
See Also:
Request.getEndpoint()

getServiceName

public String getServiceName()
Description copied from interface: Request
Returns the name of the Amazon service this request is for.

Specified by:
getServiceName in interface Request<T>
Returns:
The name of the Amazon service this request is for.
See Also:
Request.getServiceName()

getContent

public InputStream getContent()
Description copied from interface: Request
Returns the optional stream containing the payload data to include for this request. Not all requests will contain payload data.

Specified by:
getContent in interface Request<T>
Returns:
The optional stream containing the payload data to include for this request.
See Also:
Request.getContent()

setContent

public void setContent(InputStream content)
Description copied from interface: Request
Sets the optional stream containing the payload data to include for this request. Not all requests will contain payload data.

Specified by:
setContent in interface Request<T>
Parameters:
content - The optional stream containing the payload data to include for this request.
See Also:
Request.setContent(java.io.InputStream)

setHeaders

public void setHeaders(Map<String,String> headers)
Description copied from interface: Request
Sets all headers, clearing any existing ones.

Specified by:
setHeaders in interface Request<T>
See Also:
Request.setHeaders(java.util.Map)

setParameters

public void setParameters(Map<String,String> parameters)
Description copied from interface: Request
Sets all parameters, clearing any existing values.

Specified by:
setParameters in interface Request<T>
See Also:
Request.setParameters(java.util.Map)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.