|
||||||||||
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.Route
org.restlet.routing.TemplateRoute
public class TemplateRoute
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.
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.
Template
Field Summary |
---|
Fields inherited from class org.restlet.routing.Filter |
---|
CONTINUE, SKIP, STOP |
Constructor Summary | |
---|---|
TemplateRoute(Restlet next)
Constructor behaving as a simple extractor filter. |
|
TemplateRoute(Router router,
String uriTemplate,
Restlet next)
Constructor. |
|
TemplateRoute(Router router,
Template template,
Restlet next)
Constructor. |
Method Summary | |
---|---|
protected int |
beforeHandle(Request request,
Response response)
Allows filtering before its handling by the target Restlet. |
int |
getMatchingMode()
Returns the matching mode to use on the template when parsing a formatted reference. |
Template |
getTemplate()
Returns the reference template to match. |
boolean |
isMatchingQuery()
Indicates whether the query part should be taken into account when matching a reference with the template. |
float |
score(Request request,
Response response)
Returns the score for a given call (between 0 and 1.0). |
void |
setMatchingMode(int matchingMode)
Sets the matching mode to use on the template when parsing a formatted reference. |
void |
setMatchingQuery(boolean matchingQuery)
Sets whether the matching should be done on the URI with or without query string. |
void |
setTemplate(Template template)
Sets the reference template to match. |
String |
toString()
|
Methods inherited from class org.restlet.routing.Route |
---|
getRouter, setRouter |
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, wait, wait, wait |
Constructor Detail |
---|
public TemplateRoute(Restlet next)
next
- The next Restlet.public TemplateRoute(Router router, String uriTemplate, Restlet next)
Template.MODE_STARTS_WITH
matching mode. This can be changed by
getting the template and calling Template.setMatchingMode(int)
with Template.MODE_EQUALS
for exact matching.
router
- The parent router.uriTemplate
- The URI template.next
- The next Restlet.public TemplateRoute(Router router, Template template, Restlet next)
router
- The parent router.template
- The URI template.next
- The next Restlet.Method Detail |
---|
protected int beforeHandle(Request request, Response response)
beforeHandle
in class Filter
request
- The request to filter.response
- The response to filter.
public int getMatchingMode()
public Template getTemplate()
public boolean isMatchingQuery()
public float score(Request request, Response response)
score
in class Route
request
- The request to score.response
- The response to score.
public void setMatchingMode(int matchingMode)
matchingMode
- The matching mode to use.public void setMatchingQuery(boolean matchingQuery)
matchingQuery
- True if the matching should be done with the query string,
false otherwise.public void setTemplate(Template template)
template
- The reference template to match.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |