public class HttpResource extends AbstractFilteredResource
| Modifier and Type | Class and Description |
|---|---|
private static class |
HttpResource.ConnectionClosingInputStream
A wrapper around the
InputStream returned by a HttpMethod that closes the stream and releases the
HTTP connection when HttpResource.ConnectionClosingInputStream.close() is invoked. |
| Modifier and Type | Field and Description |
|---|---|
private static int |
CONNECTION_TIMEOUT
HttpClient connection timeout in milliseconds.
|
private org.apache.commons.httpclient.HttpClient |
httpClient
HTTP client.
|
private String |
resourceUrl
HTTP URL of the resource.
|
private static int |
SOCKET_TIMEOUT
HttpClient socket timeout in milliseconds.
|
| Constructor and Description |
|---|
HttpResource(String resource)
Constructor.
|
HttpResource(String resource,
ResourceFilter resourceFilter)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
boolean |
exists()
Checks whether the resource exists.
|
InputStream |
getInputStream()
Gets the inputstream to the resource's data.
|
org.joda.time.DateTime |
getLastModifiedTime()
Gets the date and time the resource was last modified.
|
String |
getLocation()
Gets resource location information.
|
protected org.apache.commons.httpclient.methods.GetMethod |
getResource()
Gets remote resource.
|
int |
hashCode() |
String |
toString() |
applyFilter, getResourceFilter, setResourceFilterprivate static final int CONNECTION_TIMEOUT
private static final int SOCKET_TIMEOUT
private String resourceUrl
private org.apache.commons.httpclient.HttpClient httpClient
public HttpResource(String resource)
resource - HTTP(S) URL of the resourcepublic HttpResource(String resource, ResourceFilter resourceFilter)
AbstractFilteredResource.setResourceFilter(ResourceFilter) insteadresource - HTTP(S) URL of the resourceresourceFilter - filter to apply to this resourcepublic boolean exists()
throws ResourceException
ResourceException - thrown if there is a problem determining if the resource existspublic InputStream getInputStream() throws ResourceException
ResourceException - thrown if an input stream can not be created for the resourcepublic org.joda.time.DateTime getLastModifiedTime()
throws ResourceException
ResourceException - thrown if the last modified time can not be determinedpublic String getLocation()
protected org.apache.commons.httpclient.methods.GetMethod getResource()
throws ResourceException
ResourceException - thrown if the resource could not be fetchedCopyright © 1999-2015. All Rights Reserved.