Interface HTTPClient

  • All Known Implementing Classes:
    DefaultHTTPClient

    public interface HTTPClient
    Abstraction for opening an InputStream on an HTTP IRI.
    Author:
    Richard Cyganiak (richard@cyganiak.de)
    • Method Detail

      • init

        void init​(HTTPClientConfiguration configuration)
        Initializes the HTTP client.
        Parameters:
        configuration - configuration for the HTTP Client.
      • openInputStream

        InputStream openInputStream​(String uri)
                             throws IOException
        Opens the input stream for the given target IRI.
        Parameters:
        uri - target IRI.
        Returns:
        input stream to access IRI content.
        Throws:
        IOException - if any error occurs while reading the IRI content.
      • close

        void close()
        Release all static resources help by the instance. Call this method only if you are sure you will not use it again in your application, like for example when shutting down a servlet context.
      • getContentType

        String getContentType()
        The value of the Content-Type header reported by the server. Can be null.
        Returns:
        the content type as string.
      • getContentLength

        long getContentLength()
        Returns:
        content length in bytes.
      • getActualDocumentIRI

        String getActualDocumentIRI()
        Returns the actual IRI from which the document was fetched. This might differ from the IRI passed to openInputStream() if a redirect was performed. A return value of null means that the IRI is unchanged and the original IRI was used.
        Returns:
        actual document IRI.