Interface Response


public interface Response
Represents the response when calling Request.execute(ResponseHandler)
Since:
2.0
  • Method Details

    • getStatusCode

      int getStatusCode()
      Returns:
      status code of the request.
    • getResponseBodyAsString

      String getResponseBodyAsString() throws ResponseException
      Returns:
      the response body of the request.
      Throws:
      ResponseException - If the response cannot be retrieved
    • getResponseBodyAsStream

      InputStream getResponseBodyAsStream() throws ResponseException
      Returns:
      the response body of the request.
      Throws:
      ResponseException - If the response cannot be retrieved
    • getEntity

      <T> T getEntity(Class<T> entityClass) throws ResponseException
      Unmarshall the response body as the specified type
      Parameters:
      entityClass - the type of the response
      Returns:
      the unmarshalled object
      Throws:
      ResponseException - if there was difficulty reading the response or unmarshalling the object
    • getStatusText

      String getStatusText()
      Returns:
      status test of the response
    • isSuccessful

      boolean isSuccessful()
      Returns:
      true if network returned a status code in the 200 range or 300 range
    • getHeader

      String getHeader(String name)
      Get's the header by the given name
      Parameters:
      name - The name of the header
      Returns:
      The value of the header. This will include all values, comma separated, if multiple header fields with the given name were specified, as per RFC2616. When the specified header key is not present, null is returned.
    • getHeaders

      Map<String,String> getHeaders()
      Get a map of all the headers
      Returns:
      A map of header names to header values. The header values will include all values, comma seperated, if multiple header fields with the given name were specified, as per RFC2616.