|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
net.shibboleth.utilities.java.support.resource.AbstractResource
net.shibboleth.utilities.java.support.httpclient.HttpResource
@NotThreadSafe public class HttpResource
A resource that fetches data from a remote source via HTTP.
| Nested Class Summary | |
|---|---|
static interface |
HttpResource.HttpGetCustomizationStrategy
Strategy that can be used to customize an HttpGet object before it is used. |
static interface |
HttpResource.HttpResponseCustomizationStrategy
Strategy used to perform any HttpResponse processing prior to returning the InputStream for its
content. |
| Field Summary | |
|---|---|
static String |
ETAG_PROP
Property name under which the ETag data is stored. |
private HttpClient |
httpClient
Client used to make HTTP requests. |
private HttpResource.HttpGetCustomizationStrategy |
httpGetCustomizationStrategy
Strategy used to customize an HttpGet before using it. |
private HttpResource.HttpResponseCustomizationStrategy |
httpResponseCustomizationStrategy
Strategy used to customize an HttpResponse before get its content. |
static String |
LAST_MODIFIED_PROP
Property name under which the Last-Modified data is stored. |
private Logger |
log
Class logger. |
| Constructor Summary | |
|---|---|
HttpResource(HttpClient client,
String url)
Constructor. |
|
| Method Summary | |
|---|---|
private HttpGet |
buildGetMethod()
Gets the, potentially customized, HttpGet method. |
protected void |
doDestroy()
Performs component specific destruction logic. |
protected boolean |
doExists()
Checks whether the resource exists. |
protected InputStream |
doGetInputStream()
Gets the input stream to the resource's data. |
protected long |
doGetLastModifiedTime()
Gets the time, in milliseconds since the epoch, when the resource was last modified. |
HttpResource.HttpGetCustomizationStrategy |
getHttpGetCustomizationStrategy()
Gets the strategy used customize the HttpGet used to fetch the resource. |
HttpResource.HttpResponseCustomizationStrategy |
getHttpResponseCustomizationStrategy()
Gets the strategy used to customize the HttpResponse before its content is returned. |
private org.apache.http.HttpResponse |
getResourceHeaders()
Attempts to fetch only the headers for a given resource. |
void |
setHttpGetCustomizationStrategy(HttpResource.HttpGetCustomizationStrategy strategy)
Sets the strategy used customize the HttpGet used to fetch the resource. |
void |
setHttpResponseCustomizationStrategy(HttpResource.HttpResponseCustomizationStrategy strategy)
Sets the strategy used to customize the HttpResponse before its content is returned. |
| Methods inherited from class net.shibboleth.utilities.java.support.resource.AbstractResource |
|---|
doValidate, equals, exists, getInputStream, getLastModifiedTime, getLocation, hashCode, setLocation, toString, validate |
| Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent |
|---|
destroy, doInitialize, initialize, isDestroyed, isInitialized |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent |
|---|
destroy, isDestroyed |
| Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent |
|---|
initialize, isInitialized |
| Field Detail |
|---|
public static final String ETAG_PROP
public static final String LAST_MODIFIED_PROP
private final Logger log
private HttpClient httpClient
private HttpResource.HttpGetCustomizationStrategy httpGetCustomizationStrategy
HttpGet before using it.
private HttpResource.HttpResponseCustomizationStrategy httpResponseCustomizationStrategy
HttpResponse before get its content.
| Constructor Detail |
|---|
public HttpResource(@Nonnull
HttpClient client,
@Nonnull@NotEmpty
String url)
client - client used to fetch the remote resource dataurl - URL of the remote resource data| Method Detail |
|---|
@Nullable public HttpResource.HttpGetCustomizationStrategy getHttpGetCustomizationStrategy()
HttpGet used to fetch the resource.
HttpGet used to fetch the resource
public void setHttpGetCustomizationStrategy(@Nullable
HttpResource.HttpGetCustomizationStrategy strategy)
HttpGet used to fetch the resource.
strategy - strategy used customize the HttpGet used to fetch the resource@Nullable public HttpResource.HttpResponseCustomizationStrategy getHttpResponseCustomizationStrategy()
HttpResponse before its content is returned.
HttpResponse before its content is returned
public void setHttpResponseCustomizationStrategy(@Nullable
HttpResource.HttpResponseCustomizationStrategy strategy)
HttpResponse before its content is returned.
strategy - strategy used to customize the HttpResponse before its content is returned
protected long doGetLastModifiedTime()
throws ResourceException
doGetLastModifiedTime in class AbstractResourceResourceException - thrown if the last modified time can not be determined
protected boolean doExists()
throws ResourceException
doExists in class AbstractResourceResourceException - thrown if there is a problem determining if the resource exists
@Nonnull
protected InputStream doGetInputStream()
throws ResourceException
doGetInputStream in class AbstractResourceResourceException - thrown if an input stream can not be created for the resourceprotected void doDestroy()
doDestroy in class AbstractDestructableInitializableComponent
private org.apache.http.HttpResponse getResourceHeaders()
throws ResourceException
ResourceException - thrown if there is a problem contacting the resourceprivate HttpGet buildGetMethod()
HttpGet method.
HttpGet method
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||