Class HttpResponse


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

      • 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 Detail

      • 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.