Interface HTTPResponse

All Known Implementing Classes:
DefaultHttpResponse, DelegateHTTPResponse

public interface HTTPResponse
Interface by which an AbstractOpenWebService retrieves the contents of an HTTP request issued through its HTTPClient.

An HTTPResponse instance shall be disposed as soon as it's response stream has been consumed or is no longer needed. It's up to the implementations to just close the actual InputStream or return the http connection to the connection pool, or any other resource clean up task that needs to be done.

Author:
groldan
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disposes this HTTP response and cleans up any resource being held.
    Short cut for getResponseHeader("Content-Type")
     
    Returns the value of the requested HTTP response header, or null if not set.
    Returns the HTTP response content byte stream, automatically recognizing gzip encoded responses and returning an uncompressing stream if that's the case.
  • Method Details

    • dispose

      void dispose()
      Disposes this HTTP response and cleans up any resource being held.

      Multiple invocations of this method shall not raise an exception but return silently.

    • getContentType

      String getContentType()
      Short cut for getResponseHeader("Content-Type")
    • getResponseHeader

      String getResponseHeader(String headerName)
      Returns the value of the requested HTTP response header, or null if not set.
    • getResponseStream

      InputStream getResponseStream() throws IOException
      Returns the HTTP response content byte stream, automatically recognizing gzip encoded responses and returning an uncompressing stream if that's the case.
      Throws:
      IOException - if such happens when obtaining the response stream.
    • getResponseCharset

      String getResponseCharset()
      Returns:
      the response charset parsed out of the content type response header, if any, or null otherwise.