|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Restlet
org.restlet.routing.Filter
org.restlet.routing.Validator
public class Validator
Filter validating attributes from a call. Validation is verified based on
regex pattern matching.
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.
Pattern
Field Summary |
---|
Fields inherited from class org.restlet.routing.Filter |
---|
CONTINUE, SKIP, STOP |
Constructor Summary | |
---|---|
Validator()
Constructor. |
|
Validator(Context context)
Constructor. |
|
Validator(Context context,
Restlet next)
Constructor. |
Method Summary | |
---|---|
protected int |
beforeHandle(Request request,
Response response)
Allows filtering before its handling by the target Restlet. |
void |
validate(String attribute,
boolean required,
String format)
Checks the request attributes for presence or format. |
void |
validateFormat(String attribute,
String format)
Checks the request attributes for format only. |
void |
validatePresence(String attribute)
Checks the request attributes for presence only. |
Methods inherited from class org.restlet.routing.Filter |
---|
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop |
Methods inherited from class org.restlet.Restlet |
---|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Validator()
public Validator(Context context)
context
- The context.public Validator(Context context, Restlet next)
context
- The context.next
- The next Restlet.Method Detail |
---|
protected int beforeHandle(Request request, Response response)
validate(String, boolean, String)
method.
beforeHandle
in class Filter
request
- The request to filter.response
- The response to filter.
Filter.CONTINUE
status.public void validate(String attribute, boolean required, String format)
attribute
- Name of the attribute to look for.required
- Indicates if the attribute presence is required.format
- Format of the attribute value, using Regex pattern syntax.public void validateFormat(String attribute, String format)
attribute
- Name of the attribute to look for.format
- Format of the attribute value, using Regex pattern syntax.public void validatePresence(String attribute)
attribute
- Name of the attribute to look for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |