Class HttpResponse

java.lang.Object
com.amazonaws.http.HttpResponse

public class HttpResponse extends Object
Represents an HTTP response returned by an AWS service in response to a service request.
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpResponse(Request<?> request, org.apache.http.client.methods.HttpRequestBase httpRequest)
    Constructs a new HttpResponse associated with the specified request.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addHeader(String name, String value)
    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.
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpResponse

      public HttpResponse(Request<?> request, org.apache.http.client.methods.HttpRequestBase httpRequest)
      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

      public Request<?> 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

      public Map<String,String> getHeaders()
      Returns the HTTP headers returned with this response.
      Returns:
      The set of HTTP headers returned with this HTTP response.
    • addHeader

      public void addHeader(String name, String value)
      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

      public void setContent(InputStream content)
      Sets the input stream containing the response content.
      Parameters:
      content - The input stream containing the response content.
    • getContent

      public InputStream getContent()
      Returns the input stream containing the response content.
      Returns:
      The input stream containing the response content.
    • setStatusText

      public void setStatusText(String statusText)
      Sets the HTTP status text returned with this response.
      Parameters:
      statusText - The HTTP status text (ex: "Not found") returned with this response.
    • getStatusText

      public String 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.