Class LowLevelHttpResponse

  • Direct Known Subclasses:
    MockLowLevelHttpResponse

    public abstract class LowLevelHttpResponse
    extends Object
    Low-level HTTP response.

    This allows providing a different implementation of the HTTP response that is more compatible with the Java environment used.

    Implementation has no fields and therefore thread-safe, but sub-classes are not necessarily thread-safe.

    Since:
    1.0
    Author:
    Yaniv Inbar
    • Constructor Detail

      • LowLevelHttpResponse

        public LowLevelHttpResponse()
    • Method Detail

      • getContent

        public abstract InputStream getContent()
                                        throws IOException
        Returns the HTTP response content input stream or null for none.
        Throws:
        IOException - I/O exception
      • getContentEncoding

        public abstract String getContentEncoding()
                                           throws IOException
        Returns the content encoding (for example "gzip") or null for none.
        Throws:
        IOException
      • getContentLength

        public abstract long getContentLength()
                                       throws IOException
        Returns the content length or 0 for none.
        Throws:
        IOException
      • getContentType

        public abstract String getContentType()
                                       throws IOException
        Returns the content type or null for none.
        Throws:
        IOException
      • getStatusLine

        public abstract String getStatusLine()
                                      throws IOException
        Returns the response status line or null for none.
        Throws:
        IOException
      • getStatusCode

        public abstract int getStatusCode()
                                   throws IOException
        Returns the response status code or <=0 for none.
        Throws:
        IOException
      • getReasonPhrase

        public abstract String getReasonPhrase()
                                        throws IOException
        Returns the HTTP reason phrase or null for none.
        Throws:
        IOException
      • getHeaderCount

        public abstract int getHeaderCount()
                                    throws IOException
        Returns the number of HTTP response headers.

        Note that multiple headers of the same name need to be supported, in which case each header value is treated as a separate header.

        Throws:
        IOException
      • getHeaderName

        public abstract String getHeaderName​(int index)
                                      throws IOException
        Returns the HTTP response header name at the given zero-based index.
        Throws:
        IOException
      • getHeaderValue

        public abstract String getHeaderValue​(int index)
                                       throws IOException
        Returns the HTTP response header value at the given zero-based index.
        Throws:
        IOException
      • disconnect

        public void disconnect()
                        throws IOException
        Default implementation does nothing, but subclasses may override to attempt to abort the connection or release allocated system resources for this connection.
        Throws:
        IOException - I/O exception
        Since:
        1.4