Interface HttpConnection

  • All Superinterfaces:
    AutoCloseable

    public interface HttpConnection
    extends AutoCloseable
    Wrapper for an open HTTP protocol connection.
    Author:
    Stephan Fuhrmann
    • Method Detail

      • getURL

        URL getURL()
            throws IOException
        Get the URL being associated to this connection.
        Returns:
        the URL associated with this connection.
        Throws:
        IOException - if resolving the URL resulted in an error.
      • getHeaderFields

        Map<String,​List<String>> getHeaderFields()
        Get the response header fields from the HTTP server.
        Returns:
        a map with the keys being headers field names and the values being header field values. If a header field is given multiple times the value list will contain all values.
      • getInputStream

        InputStream getInputStream()
                            throws IOException
        Get the input stream reading the HTTP response body.
        Returns:
        the input stream of the connection.
        Throws:
        IOException - if there's a problem getting or opening the input stream.
      • getContentType

        String getContentType()
        Get the content type of the stream.
        Returns:
        the content type, for example "audio/mpeg", or null if not sent by the server.
      • getResponseCode

        int getResponseCode()
                     throws IOException
        Get the HTTP server response code.
        Returns:
        the numerical response code, for example 200 for "OK".
        Throws:
        IOException - if there is a problem getting the response code.
        See Also:
        getResponseMessage()
      • getResponseMessage

        String getResponseMessage()
                           throws IOException
        Get the HTTP server response status message.
        Returns:
        the textual response message, for example "OK".
        Throws:
        IOException - if there is a problem getting the response message.
        See Also:
        getResponseCode()