org.opensaml.util.resource
Class HttpResource

java.lang.Object
  extended by org.opensaml.util.resource.AbstractFilteredResource
      extended by org.opensaml.util.resource.HttpResource
All Implemented Interfaces:
Resource
Direct Known Subclasses:
FileBackedHttpResource

public class HttpResource
extends AbstractFilteredResource

A resource representing a file retrieved from a URL using Apache Commons HTTPClient.


Constructor Summary
HttpResource(java.lang.String resource)
          Constructor.
HttpResource(java.lang.String resource, ResourceFilter resourceFilter)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 boolean exists()
          Checks whether the resource exists.
 java.io.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.
 java.lang.String getLocation()
          Gets resource location information.
protected  org.apache.commons.httpclient.methods.GetMethod getResource()
          Gets remote resource.
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class org.opensaml.util.resource.AbstractFilteredResource
getResourceFilter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpResource

public HttpResource(java.lang.String resource)
Constructor.

Parameters:
resource - HTTP(S) URL of the resource

HttpResource

public HttpResource(java.lang.String resource,
                    ResourceFilter resourceFilter)
Constructor.

Parameters:
resource - HTTP(S) URL of the resource
resourceFilter - filter to apply to this resource
Method Detail

exists

public boolean exists()
               throws ResourceException
Checks whether the resource exists.

Returns:
true if the resource exists, false if not
Throws:
ResourceException - thrown if there is a problem determining if the resource exists

getInputStream

public java.io.InputStream getInputStream()
                                   throws ResourceException
Gets the inputstream to the resource's data.

Returns:
inputstream to the resource's data
Throws:
ResourceException - thrown if an input stream can not be created for the resource

getLastModifiedTime

public org.joda.time.DateTime getLastModifiedTime()
                                           throws ResourceException
Gets the date and time the resource was last modified.

Returns:
date and time the resource was last modified
Throws:
ResourceException - thrown if the last modified time can not be determined

getLocation

public java.lang.String getLocation()
Gets resource location information. Examples might be filesystem path, URL, etc.

Returns:
resource location information

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

getResource

protected org.apache.commons.httpclient.methods.GetMethod getResource()
                                                               throws ResourceException
Gets remote resource.

Returns:
the remove resource
Throws:
ResourceException - thrown if the resource could not be fetched


Copyright © 2006-2009 Internet2. All Rights Reserved.