public abstract class Filter extends Restlet
Modifier and Type | Field and Description |
---|---|
static int |
CONTINUE
Indicates that the request processing should continue normally.
|
static int |
SKIP
Indicates that after the
beforeHandle(Request, Response) method,
the request processing should skip the
doHandle(Request, Response) method to continue with the
afterHandle(Request, Response) method. |
static int |
STOP
Indicates that the request processing should stop and return the current
response from the filter.
|
Constructor and Description |
---|
Filter()
Constructor.
|
Filter(Context context)
Constructor.
|
Filter(Context context,
Restlet next)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterHandle(Request request,
Response response)
Allows filtering after processing by the next Restlet.
|
protected int |
beforeHandle(Request request,
Response response)
Allows filtering before processing by the next Restlet.
|
protected int |
doHandle(Request request,
Response response)
Handles the call by distributing it to the next Restlet.
|
Restlet |
getNext()
Returns the next Restlet.
|
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.
|
boolean |
hasNext()
Indicates if there is a next Restlet.
|
void |
setNext(java.lang.Class<? extends ServerResource> targetClass)
|
void |
setNext(Restlet next)
Sets the next Restlet.
|
void |
start()
Starts the filter and the next Restlet if attached.
|
void |
stop()
Stops the filter and the next Restlet if attached.
|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
public static final int CONTINUE
beforeHandle(Request, Response)
method, the
filter then invokes the doHandle(Request, Response)
method. If
returned from the doHandle(Request, Response)
method, the filter
then invokes the afterHandle(Request, Response)
method.public static final int SKIP
beforeHandle(Request, Response)
method,
the request processing should skip the
doHandle(Request, Response)
method to continue with the
afterHandle(Request, Response)
method.public static final int STOP
public Filter()
public Filter(Context context)
context
- The context.protected void afterHandle(Request request, Response response)
request
- The request to handle.response
- The response to update.protected int beforeHandle(Request request, Response response)
CONTINUE
by default.protected int doHandle(Request request, Response response)
Status.SERVER_ERROR_INTERNAL
status is returned.
Returns CONTINUE
by default.public Restlet getNext()
public final void handle(Request request, Response response)
public boolean hasNext()
public void setNext(java.lang.Class<? extends ServerResource> targetClass)
Restlet
as a Finder
for a given
ServerResource
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.targetClass
- The target resource class to attach.public void setNext(Restlet next)
next
- The next Restlet.public void start() throws java.lang.Exception
Copyright © 2005-2024 Restlet.