java.lang.Object
org.springframework.extensions.webscripts.connector.Response

public class Response extends Object
Representation of the response from a remote HTTP API call.
Author:
Kevin Roast
  • Constructor Details

    • Response

      public Response(ResponseStatus status)
      Instantiates a new response.
      Parameters:
      status - the status
    • Response

      public Response(String data, ResponseStatus status)
      Instantiates a new response.
      Parameters:
      data - the data
      status - the status
    • Response

      public Response(InputStream is, ResponseStatus status)
      Instantiates a new response.
      Parameters:
      is - the is
      status - the status
  • Method Details

    • setEncoding

      public void setEncoding(String encoding)
      Sets the encoding.
      Parameters:
      encoding - the new encoding
    • getResponse

      public String getResponse()
      Gets the response.
      Returns:
      the data stream from the response object - will be null on error or if the response has already been streamed to an OutputStream.
    • getText

      public String getText()
      Gets the text of the response.
      Returns:
      the text
    • getResponseStream

      public InputStream getResponseStream()
      Gets the response stream.
      Returns:
      the response InputStream if set during construction, else will be null.
    • getStatus

      public ResponseStatus getStatus()
      Gets the status.
      Returns:
      Status object representing the response status and any error information
    • getEncoding

      public String getEncoding()
      Gets the encoding.
      Returns:
      the response encoding
    • toString

      public String toString()
      Overrides:
      toString in class Object