| java.lang.Object org.restlet.Uniform org.restlet.Restlet org.restlet.Filter org.restlet.Route
All known Subclasses: com.noelios.restlet.component.ClientRoute, com.noelios.restlet.component.HostRoute,
Route | public class Route extends Filter (Code) | | 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.
See Also: org.restlet.util.Template author: Jerome Louvel (contact@noelios.com) |
Method Summary | |
protected void | beforeHandle(Request request, Response response) Allows filtering before its handling by the target Restlet. | public Route | extractCookie(String attribute, String cookieName, boolean first) Extracts an attribute from the request cookies.
Parameters: attribute - The name of the request attribute to set. Parameters: cookieName - The name of the cookies to extract. Parameters: first - Indicates if only the first cookie should be set. | public Route | extractEntity(String attribute, String parameter, boolean first) Extracts an attribute from the request entity form.
Parameters: attribute - The name of the request attribute to set. Parameters: parameter - The name of the entity form parameter to extract. Parameters: first - Indicates if only the first cookie should be set. | public Route | extractQuery(String attribute, String parameter, boolean first) Extracts an attribute from the query string of the resource reference.
Parameters: attribute - The name of the request attribute to set. Parameters: parameter - The name of the query string parameter to extract. Parameters: first - Indicates if only the first cookie should be set. | public Router | getRouter() Returns the parent router. | public Template | getTemplate() Returns the reference template to match. | public float | score(Request request, Response response) Returns the score for a given call (between 0 and 1.0).
Parameters: request - The request to score. Parameters: response - The response to score. | public void | setTemplate(Template template) Sets the reference template to match. | public void | validate(String attribute, boolean required, String format) Checks the request attributes for presence, format, etc. |
Route | public Route(Restlet next)(Code) | | Constructor behaving as a simple extractor filter.
Parameters: next - The next Restlet. |
Route | public Route(Router router, String uriTemplate, Restlet next)(Code) | | Constructor.
Parameters: router - The parent router. Parameters: uriTemplate - The URI template. Parameters: next - The next Restlet. |
Route | public Route(Router router, Template template, Restlet next)(Code) | | Constructor.
Parameters: router - The parent router. Parameters: template - The URI template. Parameters: next - The next Restlet. |
beforeHandle | protected void beforeHandle(Request request, Response response)(Code) | | Allows filtering before its handling by the target Restlet. Does nothing
by default.
Parameters: request - The request to filter. Parameters: response - The response to filter. |
extractCookie | public Route extractCookie(String attribute, String cookieName, boolean first)(Code) | | Extracts an attribute from the request cookies.
Parameters: attribute - The name of the request attribute to set. Parameters: cookieName - The name of the cookies to extract. Parameters: first - Indicates if only the first cookie should be set. Otherwise asa List instance might be set in the attribute value. The current Filter. |
extractEntity | public Route extractEntity(String attribute, String parameter, boolean first)(Code) | | Extracts an attribute from the request entity form.
Parameters: attribute - The name of the request attribute to set. Parameters: parameter - The name of the entity form parameter to extract. Parameters: first - Indicates if only the first cookie should be set. Otherwise asa List instance might be set in the attribute value. The current Filter. |
extractQuery | public Route extractQuery(String attribute, String parameter, boolean first)(Code) | | Extracts an attribute from the query string of the resource reference.
Parameters: attribute - The name of the request attribute to set. Parameters: parameter - The name of the query string parameter to extract. Parameters: first - Indicates if only the first cookie should be set. Otherwise asa List instance might be set in the attribute value. The current Filter. |
getRouter | public Router getRouter()(Code) | | Returns the parent router.
The parent router. |
getTemplate | public Template getTemplate()(Code) | | Returns the reference template to match.
The reference template to match. |
score | public float score(Request request, Response response)(Code) | | Returns the score for a given call (between 0 and 1.0).
Parameters: request - The request to score. Parameters: response - The response to score. The score for a given call (between 0 and 1.0). |
setTemplate | public void setTemplate(Template template)(Code) | | Sets the reference template to match.
Parameters: template - The reference template to match. |
validate | public void validate(String attribute, boolean required, String format)(Code) | | Checks the request attributes for presence, format, etc. If the check
fails, then a response status CLIENT_ERROR_BAD_REQUEST is returned with
the proper status description.
Parameters: attribute - Name of the attribute to look for. Parameters: required - Indicates if the attribute presence is required. Parameters: format - Format of the attribute value, using Regex pattern syntax. |
|
|