org.apache.any23.http
Interface HTTPClient

All Known Implementing Classes:
DefaultHTTPClient

public interface HTTPClient

Abstraction for opening an InputStream on an HTTP URI.

Author:
Richard Cyganiak (richard@cyganiak.de)

Method Summary
 void close()
          Release all static resources help by the instance.
 String getActualDocumentURI()
          Returns the actual URI from which the document was fetched.
 long getContentLength()
           
 String getContentType()
          The value of the Content-Type header reported by the server.
 void init(HTTPClientConfiguration configuration)
          Initializes the HTTP client.
 InputStream openInputStream(String uri)
          Opens the input stream for the given target URI.
 

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 URI.

Parameters:
uri - target URI.
Returns:
input stream to access URI content.
Throws:
IOException - if any error occurs while reading the URI 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.

getActualDocumentURI

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

Returns:
actual document URI.


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.