Package com.amazonaws.http
Class HttpResponse
java.lang.Object
com.amazonaws.http.HttpResponse
Represents an HTTP response returned by an AWS service in response to a
service request.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpResponse
(Request<?> request, org.apache.http.client.methods.HttpRequestBase httpRequest) Constructs a new HttpResponse associated with the specified request. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an HTTP header to the set associated with this response.Returns the input stream containing the response content.Returns the HTTP headers returned with this response.org.apache.http.client.methods.HttpRequestBase
Returns the original http request associated with this response.Request<?>
Returns the original request associated with this response.int
Returns the HTTP status code (ex: 200, 404, etc) associated with this response.Returns the HTTP status text associated with this response.void
setContent
(InputStream content) Sets the input stream containing the response content.void
setStatusCode
(int statusCode) Sets the HTTP status code that was returned with this response.void
setStatusText
(String statusText) Sets the HTTP status text returned with this response.
-
Constructor Details
-
HttpResponse
Constructs a new HttpResponse associated with the specified request.- Parameters:
request
- The associated request that generated this response.httpRequest
- The underlying http request that generated this response.
-
-
Method Details
-
getRequest
Returns the original request associated with this response.- Returns:
- The original request associated with this response.
-
getHttpRequest
public org.apache.http.client.methods.HttpRequestBase getHttpRequest()Returns the original http request associated with this response.- Returns:
- The original http request associated with this response.
-
getHeaders
Returns the HTTP headers returned with this response.- Returns:
- The set of HTTP headers returned with this HTTP response.
-
addHeader
Adds an HTTP header to the set associated with this response.- Parameters:
name
- The name of the HTTP header.value
- The value of the HTTP header.
-
setContent
Sets the input stream containing the response content.- Parameters:
content
- The input stream containing the response content.
-
getContent
Returns the input stream containing the response content.- Returns:
- The input stream containing the response content.
-
setStatusText
Sets the HTTP status text returned with this response.- Parameters:
statusText
- The HTTP status text (ex: "Not found") returned with this response.
-
getStatusText
Returns the HTTP status text associated with this response.- Returns:
- The HTTP status text associated with this response.
-
setStatusCode
public void setStatusCode(int statusCode) Sets the HTTP status code that was returned with this response.- Parameters:
statusCode
- The HTTP status code (ex: 200, 404, etc) associated with this response.
-
getStatusCode
public int getStatusCode()Returns the HTTP status code (ex: 200, 404, etc) associated with this response.- Returns:
- The HTTP status code associated with this response.
-