Package org.apache.any23.http
Interface HTTPClient
-
- All Known Implementing Classes:
DefaultHTTPClient
public interface HTTPClient
Abstraction for opening anInputStream
on an HTTP IRI.- Author:
- Richard Cyganiak (richard@cyganiak.de)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Release all static resources help by the instance.String
getActualDocumentIRI()
Returns the actual IRI 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 IRI.
-
-
-
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 benull
.- 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 ofnull
means that the IRI is unchanged and the original IRI was used.- Returns:
- actual document IRI.
-
-