| java.lang.Object org.restlet.Uniform org.restlet.Restlet org.restlet.Filter
All known Subclasses: org.restlet.Route, com.noelios.restlet.LogFilter, com.noelios.restlet.application.Decoder, org.restlet.Transformer, com.noelios.restlet.application.Encoder, com.noelios.restlet.StatusFilter, org.restlet.Guard, com.noelios.restlet.application.TunnelFilter,
Filter | abstract public class Filter extends Restlet (Code) | | Restlet filtering calls before passing them to an attached Restlet. The
purpose is to do some pre-processing or post-processing on the calls going
through it before or after they are actually handled by an attached Restlet.
Also note that you can attach and detach targets while handling incoming
calls as the filter is ensured to be thread-safe.
author: Jerome Louvel (contact@noelios.com) |
Method Summary | |
protected void | afterHandle(Request request, Response response) Allows filtering after processing by the next Restlet. | protected void | beforeHandle(Request request, Response response) Allows filtering before processing by the next Restlet. | protected void | doHandle(Request request, Response response) Handles the call by distributing it to the next Restlet. | public Restlet | getNext() Returns the next Restlet. | final public void | handle(Request request, Response response) Handles a call by first invoking the beforeHandle() method for
pre-filtering, then distributing the call to the next Restlet via the
doHandle() method. | public boolean | hasNext() Indicates if there is a next Restlet. | public void | setNext(Restlet next) Sets the next Restlet. | public void | setNext(Class<? extends Resource> targetClass) Sets the next Restlet as a Finder for a given Resource class. |
Filter | public Filter()(Code) | | Constructor.
|
Filter | public Filter(Context context)(Code) | | Constructor.
Parameters: context - The context. |
Filter | public Filter(Context context, Restlet next)(Code) | | Constructor.
Parameters: context - The context. Parameters: next - The next Restlet. |
afterHandle | protected void afterHandle(Request request, Response response)(Code) | | Allows filtering after processing by the next Restlet. Does nothing by
default.
Parameters: request - The request to handle. Parameters: response - The response to update. |
beforeHandle | protected void beforeHandle(Request request, Response response)(Code) | | Allows filtering before processing by the next Restlet. Does nothing by
default.
Parameters: request - The request to handle. Parameters: response - The response to update. |
doHandle | protected void doHandle(Request request, Response response)(Code) | | Handles the call by distributing it to the next Restlet.
Parameters: request - The request to handle. Parameters: response - The response to update. |
getNext | public Restlet getNext()(Code) | | Returns the next Restlet.
The next Restlet or null. |
handle | final public void handle(Request request, Response response)(Code) | | Handles a call by first invoking the beforeHandle() method for
pre-filtering, then distributing the call to the next Restlet via the
doHandle() method. When the handling is completed, it finally invokes the
afterHandle() method for post-filtering.
Parameters: request - The request to handle. Parameters: response - The response to update. |
hasNext | public boolean hasNext()(Code) | | Indicates if there is a next Restlet.
True if there is a next Restlet. |
setNext | public void setNext(Restlet next)(Code) | | Sets the next Restlet.
Parameters: next - The next Restlet. |
setNext | public void setNext(Class<? extends Resource> targetClass)(Code) | | Sets the next Restlet as a Finder for a given Resource class. When the
call is delegated to the Finder instance, a new instance of the Resource
class will be created and will actually handle the request.
Parameters: targetClass - The target Resource class to attach. |
|
|