Class Response


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

      • Response

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

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

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

      • setEncoding

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

        public java.lang.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 java.lang.String getText()
        Gets the text of the response.
        Returns:
        the text
      • getResponseStream

        public java.io.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 java.lang.String getEncoding()
        Gets the encoding.
        Returns:
        the response encoding
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object