org.sapia.resource
Class UrlResourceHandler

java.lang.Object
  extended by org.sapia.resource.UrlResourceHandler
All Implemented Interfaces:
ResourceHandler

public class UrlResourceHandler
extends java.lang.Object
implements ResourceHandler

Implements a ResourceHandler that produces UrlResource instances.

Author:
Yanick Duchesne
See Also:
UrlResource

Constructor Summary
UrlResourceHandler()
           
 
Method Summary
 boolean accepts(java.lang.String uri)
          Returns true if this handler "recognizes" resources with the given URI.
 boolean accepts(java.net.URI uri)
           
 java.io.InputStream getResource(java.lang.String uri)
          Returns the stream corresponding to the given URI.
 Resource getResourceObject(java.lang.String uri)
          Returns the resource object corresponding to the given URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlResourceHandler

public UrlResourceHandler()
Method Detail

getResourceObject

public Resource getResourceObject(java.lang.String uri)
                           throws java.io.IOException
Description copied from interface: ResourceHandler
Returns the resource object corresponding to the given URI.

Specified by:
getResourceObject in interface ResourceHandler
Parameters:
uri - a URI.
Returns:
a Resource.
Throws:
java.io.IOException - if a problem occurs.

getResource

public java.io.InputStream getResource(java.lang.String uri)
                                throws java.io.IOException
Description copied from interface: ResourceHandler
Returns the stream corresponding to the given URI.

Specified by:
getResource in interface ResourceHandler
Parameters:
uri - a URI.
Returns:
an InputStream.
Throws:
ResourceNotFoundException - if a resource corresponding to the URI could does not exist.
java.io.IOException - if a problem occurs.

accepts

public boolean accepts(java.lang.String uri)
Description copied from interface: ResourceHandler
Returns true if this handler "recognizes" resources with the given URI. This methods is used to hold resource handlers in a chain of responsability.

Specified by:
accepts in interface ResourceHandler
Parameters:
uri - a URI.
Returns:
true if this handler can handle resources with the given URI.

accepts

public boolean accepts(java.net.URI uri)
Specified by:
accepts in interface ResourceHandler
Parameters:
uri - a URI.
Returns:
true if this handler can handle resources with the given URI.
See Also:
ResourceHandler.accepts(String)


Copyright © 2011 Sapia OSS. All Rights Reserved.