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:
- During the lookup, so that they have a chance to check any access
rights,
- Before the request is actually processed by its target resource,
- And optionally, after the request has been processed (depending on
the return value of the second stage.).
- See Also:
- ResourceFilter
-
filters
- Our list of filters.
-
FilteredResource()
-
-
applyIngoing(Request)
- Apply filters on the way in.
-
applyOutgoing(Request, Reply, boolean)
- Apply filters on the way back.
-
checkAccess(LookupState)
- Check the access to this filtered resource.
-
definesAttribute(int)
- Does this resource or one of its filters define the given attribute.
-
getFilters()
- Get our whole list of filters.
-
getValue(int, Object)
- Filters can supply part of the attributes value for a resource.
-
initialize(Object[])
- Initialize a filtered resource.
-
perform(Request)
- Perform the request for this filtered target resource.
-
pickle(DataOutputStream)
- Pickle a filtered resource.
-
registerFilter(ResourceFilter, Hashtable)
- Register a new filter to this resource.
-
unpickleInstance(DataInputStream, Hashtable)
- Unpickle a filtered resource.
-
unregisterFilter(ResourceFilter)
- Unregister a filter to this target.
filters
protected ResourceFilter filters[]
- Our list of filters.
FilteredResource
public FilteredResource()
getFilters
public synchronized ResourceFilter[] getFilters()
- Get our whole list of filters.
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.
unregisterFilter
public synchronized void unregisterFilter(ResourceFilter filter)
- Unregister a filter to this target.
- Parameters:
- filter - The filter to unregister.
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
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
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.
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.
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
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
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
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
initialize
public void initialize(Object values[])
- Initialize a filtered resource.
- Overrides:
- initialize in class AttributeHolder
All Packages Class Hierarchy This Package Previous Next Index