|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.resource.ResourceHandlerChain
public class ResourceHandlerChain
This class implements a chain of responsibility: an instance of this class
holds a list of ResourceHandler instances. The instances are
traversed when client application request a specific handler, given a URI.
| Constructor Summary | |
|---|---|
ResourceHandlerChain()
|
|
| Method Summary | |
|---|---|
void |
append(ResourceHandler handler)
Adds a resource handler to the end of the list that this instance holds. |
protected ResourceHandler |
doSelect(java.lang.String uri)
|
void |
prepend(ResourceHandler handler)
Adds a resource handler to the beginning of the list that this instance holds. |
Resource |
resolveResource(java.lang.String uri)
|
ResourceHandler |
select(java.lang.String uri)
Selects a ResourceHandler from this instance and returns it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceHandlerChain()
| Method Detail |
|---|
public void prepend(ResourceHandler handler)
handler - a ResourceHandler.public void append(ResourceHandler handler)
handler - a ResourceHandler.
public Resource resolveResource(java.lang.String uri)
throws ResourceNotFoundException,
java.io.IOException
resolveResource in interface ResourceCapableResourceNotFoundException
java.io.IOExceptionpublic ResourceHandler select(java.lang.String uri)
ResourceHandler from this instance and returns it.
The handler is chose based on the given URI. This instance traverses
its handlers, calling the accepts() method on them (the
method takes the given URI as a parameter). The first handler that
"accepts" the URI (by returning true) is returned to the
caller. If no handler as accepted the URI, null is returned.
uri - a URI.
null if no handler
could be found for the given URI.protected ResourceHandler doSelect(java.lang.String uri)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||