|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Uniform
org.restlet.Restlet
org.restlet.Filter
com.noelios.restlet.StatusFilter
public class StatusFilter
Filter associating a response entity based on the status. In order to
customize the default representation, just subclass this class and override
the "getRepresentation" method.
If any exception occurs during the call handling, a "server internal error"
status is automatically associated to the call. Of course, you can
personalize the representation of this error. Also, if no status is set
(null), then the "success ok" status is assumed.
Concurrency note: instances of this class or its subclasses can be invoked by
several threads at the same time and therefore must be thread-safe. You
should be especially careful when storing state in member variables.
Field Summary |
---|
Fields inherited from class org.restlet.Filter |
---|
CONTINUE, SKIP, STOP |
Constructor Summary | |
---|---|
StatusFilter(Context context,
boolean overwrite,
java.lang.String email,
java.lang.String homeUri)
Constructor. |
Method Summary | |
---|---|
void |
afterHandle(Request request,
Response response)
Allows filtering after its handling by the target Restlet. |
int |
doHandle(Request request,
Response response)
Handles the call by distributing it to the next Restlet. |
Representation |
getRepresentation(Status status,
Request request,
Response response)
Returns a representation for the given status. In order to customize the default representation, this method can be overriden. |
Status |
getStatus(java.lang.Throwable throwable,
Request request,
Response response)
Returns a status for a given exception or error. |
Methods inherited from class org.restlet.Filter |
---|
beforeHandle, getNext, handle, hasNext, setNext, setNext |
Methods inherited from class org.restlet.Restlet |
---|
getApplication, getContext, getLogger, init, isStarted, isStopped, setContext, start, stop |
Methods inherited from class org.restlet.Uniform |
---|
delete, delete, get, get, handle, head, head, options, options, post, post, put, put |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StatusFilter(Context context, boolean overwrite, java.lang.String email, java.lang.String homeUri)
context
- The context.overwrite
- Indicates whether an existing representation should be
overwritten.email
- Email address of the administrator to contact in case of
error.homeUri
- The home URI to propose in case of error.Method Detail |
---|
public void afterHandle(Request request, Response response)
afterHandle
in class Filter
request
- The request to handle.response
- The response to update.public int doHandle(Request request, Response response)
getStatus(Throwable, Request, Response)
method is
invoked.
doHandle
in class Filter
request
- The request to handle.response
- The response to update.
public Representation getRepresentation(Status status, Request request, Response response)
status
- The status to represent.request
- The request handled.response
- The response updated.
public Status getStatus(java.lang.Throwable throwable, Request request, Response response)
Status.SERVER_ERROR_INTERNAL
status including the related error
or exception and logs a severe message.
throwable
- The exception or error caught.request
- The request handled.response
- The response updated.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |