|
||||||||||
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
org.restlet.Route
public class Route
Filter scoring the affinity of calls with the attached Restlet. The score is used by an associated Router in order to determine the most appropriate Restlet for a given call. The routing is based on a reference template. It also supports the extraction of some attributes from a call. Multiple extractions can be defined, based on the query string of the resource reference, on the request form (ex: posted from a browser) or on cookies.
Template
Constructor Summary | |
---|---|
Route(Restlet next)
Constructor behaving as a simple extractor filter. |
|
Route(Router router,
String uriTemplate,
Restlet next)
Constructor. |
|
Route(Router router,
Template template,
Restlet next)
Constructor. |
Method Summary | |
---|---|
protected void |
beforeHandle(Request request,
Response response)
Allows filtering before its handling by the target Restlet. |
Route |
extractCookie(String attribute,
String cookieName,
boolean first)
Extracts an attribute from the request cookies. |
Route |
extractEntity(String attribute,
String parameter,
boolean first)
Extracts an attribute from the request entity form. |
Route |
extractQuery(String attribute,
String parameter,
boolean first)
Extracts an attribute from the query string of the resource reference. |
Router |
getRouter()
Returns the parent router. |
Template |
getTemplate()
Returns the reference template to match. |
float |
score(Request request,
Response response)
Returns the score for a given call (between 0 and 1.0). |
void |
setTemplate(Template template)
Sets the reference template to match. |
void |
validate(String attribute,
boolean required,
String format)
Checks the request attributes for presence, format, etc. |
Methods inherited from class org.restlet.Filter |
---|
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext |
Methods inherited from class org.restlet.Restlet |
---|
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 Route(Restlet next)
next
- The next Restlet.public Route(Router router, String uriTemplate, Restlet next)
router
- The parent router.uriTemplate
- The URI template.next
- The next Restlet.public Route(Router router, Template template, Restlet next)
router
- The parent router.template
- The URI template.next
- The next Restlet.Method Detail |
---|
protected void beforeHandle(Request request, Response response)
beforeHandle
in class Filter
request
- The request to filter.response
- The response to filter.public Route extractCookie(String attribute, String cookieName, boolean first)
attribute
- The name of the request attribute to set.cookieName
- The name of the cookies to extract.first
- Indicates if only the first cookie should be set. Otherwise as
a List instance might be set in the attribute value.
public Route extractEntity(String attribute, String parameter, boolean first)
attribute
- The name of the request attribute to set.parameter
- The name of the entity form parameter to extract.first
- Indicates if only the first cookie should be set. Otherwise as
a List instance might be set in the attribute value.
public Route extractQuery(String attribute, String parameter, boolean first)
attribute
- The name of the request attribute to set.parameter
- The name of the query string parameter to extract.first
- Indicates if only the first cookie should be set. Otherwise as
a List instance might be set in the attribute value.
public Router getRouter()
public Template getTemplate()
public float score(Request request, Response response)
request
- The request to score.response
- The response to score.
public void setTemplate(Template template)
template
- The reference template to match.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |