Class w3c.jigsaw.resources.FilteredResource
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.resources.FilteredResource

java.lang.Object
   |
   +----w3c.jigsaw.resources.AttributeHolder
           |
           +----w3c.jigsaw.resources.Resource
                   |
                   +----w3c.jigsaw.resources.HTTPResource
                           |
                           +----w3c.jigsaw.resources.ContainerResource
                                   |
                                   +----w3c.jigsaw.resources.FilteredResource

public class FilteredResource
extends ContainerResource
Filtered resources. A filtered resource is a resource that can be filtered through any filters. Filters are trigered at three points during request processing:
See Also:
ResourceFilter

Variable Index

 o filters
Our list of filters.

Constructor Index

 o FilteredResource()

Method Index

 o applyIngoing(Request)
Apply filters on the way in.
 o applyOutgoing(Request, Reply, boolean)
Apply filters on the way back.
 o checkAccess(LookupState)
Check the access to this filtered resource.
 o definesAttribute(int)
Does this resource or one of its filters define the given attribute.
 o getFilters()
Get our whole list of filters.
 o getValue(int, Object)
Filters can supply part of the attributes value for a resource.
 o initialize(Object[])
Initialize a filtered resource.
 o perform(Request)
Perform the request for this filtered target resource.
 o pickle(DataOutputStream)
Pickle a filtered resource.
 o registerFilter(ResourceFilter, Hashtable)
Register a new filter to this resource.
 o unpickleInstance(DataInputStream, Hashtable)
Unpickle a filtered resource.
 o unregisterFilter(ResourceFilter)
Unregister a filter to this target.

Variables

 o filters
  protected ResourceFilter filters[]
Our list of filters.

Constructors

 o FilteredResource
  public FilteredResource()

Methods

 o getFilters
  public synchronized ResourceFilter[] getFilters()
Get our whole list of filters.
 o registerFilter
  public synchronized void registerFilter(ResourceFilter filter,
                                          Hashtable defs)
Register a new filter to this resource. This method register a new filter to the this filtered resource. The provided filter should be an uninitialized ResourceFilter instance.
Parameters:
The - uninitialized filter.
 o unregisterFilter
  public synchronized void unregisterFilter(ResourceFilter filter)
Unregister a filter to this target.
Parameters:
filter - The filter to unregister.
 o definesAttribute
  public synchronized boolean definesAttribute(int idx) throws IllegalAttributeAccess
Does this resource or one of its filters define the given attribute.
Parameters:
idx - The attribute index.
Returns:
A boolean true if attribute is defined.
Overrides:
definesAttribute in class AttributeHolder
 o getValue
  public synchronized Object getValue(int idx,
                                      Object def) throws IllegalAttributeAccess
Filters can supply part of the attributes value for a resource. This method lookup the current resource for an attribute value, and than examine all its filters, to look for a filter-supplied value.
Parameters:
idx - The index of the queried attribute.
def - The default return value.
Returns:
The attribute value, or the provided default value if undef.
Overrides:
getValue in class AttributeHolder
 o applyIngoing
  protected synchronized void applyIngoing(Request request) throws HTTPException
Apply filters on the way in. Any filters that want to be invoked on the way back has to return the appropriate code. These filters are saved into the request, so that on the way back, we know wich of them we should trigger.
Parameters:
request - The request being handled.
Throws: HTTPException
If some error is encoutered during the filtering process.
 o applyOutgoing
  protected synchronized Reply applyOutgoing(Request request,
                                             Reply reply,
                                             boolean erred) throws HTTPException
Apply filters on the way back. Get the list of filters to be applied from the pseudo field of the request, and apply the one that needs to be applied (ie the one that return an appropriate code).
Parameters:
request - The request being processed.
reply - The target's resource original reply.
erred - Wether the original reply was an error or not.
Throws: HTTPException
If the original reply was an error, or if the outgoing filter failed.
 o checkAccess
  public synchronized void checkAccess(LookupState state) throws HTTPException
Check the access to this filtered resource. Apply each ingoing filters, so that they can check for authorization access. If the provided state doesn't come with a request, than the filters don't get applied.
Parameters:
state - The current lookup state.
Throws: HTTPException
If access is denied.
Overrides:
checkAccess in class ContainerResource
 o perform
  public Reply perform(Request request) throws HTTPException
Perform the request for this filtered target resource. This method applies any found filters on the way in, perform the request and than, applies any filters on the way back. It finally returns the appropriate reply.
Overrides:
perform in class HTTPResource
 o pickle
  public synchronized void pickle(DataOutputStream out) throws IOException
Pickle a filtered resource. Pickle the resource itself, along with its associated filters.
Parameters:
out - The data output stream to pickle to.
Overrides:
pickle in class AttributeHolder
 o unpickleInstance
  public AttributeHolder unpickleInstance(DataInputStream in,
                                          Hashtable defs) throws IOException
Unpickle a filtered resource.
Parameters:
in - The input stream to unpickle from.
defs - The default attributes for the unpickled resource.
Overrides:
unpickleInstance in class AttributeHolder
 o initialize
  public void initialize(Object values[])
Initialize a filtered resource.
Overrides:
initialize in class AttributeHolder

All Packages  Class Hierarchy  This Package  Previous  Next  Index