org.restlet.routing
Class Route

java.lang.Object
  extended by org.restlet.Restlet
      extended by org.restlet.routing.Filter
          extended by org.restlet.routing.TemplateRoute
              extended by org.restlet.routing.Route
All Implemented Interfaces:
Uniform

Deprecated. Use TemplateRoute instead.

@Deprecated
public class Route
extends 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. 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.

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.

Author:
Jerome Louvel
See Also:
Template

Field Summary
 
Fields inherited from class org.restlet.routing.Filter
CONTINUE, SKIP, STOP
 
Constructor Summary
Route(Restlet next)
          Deprecated. Constructor behaving as a simple extractor filter.
Route(Router router, String uriTemplate, Restlet next)
          Deprecated. Constructor.
Route(Router router, Template template, Restlet next)
          Deprecated. Constructor.
 
Method Summary
protected  int beforeHandle(Request request, Response response)
          Deprecated. Allows filtering before its handling by the target Restlet.
 Route extractCookie(String attribute, String cookieName, boolean first)
          Deprecated. Extracts an attribute from the request cookies.
 Route extractEntity(String attribute, String parameter, boolean first)
          Deprecated. Extracts an attribute from the request entity form.
 Route extractQuery(String attribute, String parameter, boolean first)
          Deprecated. Extracts an attribute from the query string of the resource reference.
 void validate(String attribute, boolean required, String format)
          Deprecated. Checks the request attributes for presence, format, etc.
 
Methods inherited from class org.restlet.routing.TemplateRoute
getMatchingMode, getMatchQuery, getRouter, getTemplate, isMatchingQuery, score, setMatchingMode, setMatchingQuery, setMatchQuery, setRouter, setTemplate, toString
 
Methods inherited from class org.restlet.routing.Filter
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
 
Methods inherited from class org.restlet.Restlet
finalize, getApplication, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setContext, setDescription, setName, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Route

public Route(Restlet next)
Deprecated. 
Constructor behaving as a simple extractor filter.

Parameters:
next - The next Restlet.

Route

public Route(Router router,
             String uriTemplate,
             Restlet next)
Deprecated. 
Constructor. The URIs will be matched agains the template using the 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.

Parameters:
router - The parent router.
uriTemplate - The URI template.
next - The next Restlet.

Route

public Route(Router router,
             Template template,
             Restlet next)
Deprecated. 
Constructor.

Parameters:
router - The parent router.
template - The URI template.
next - The next Restlet.
Method Detail

beforeHandle

protected int beforeHandle(Request request,
                           Response response)
Deprecated. 
Allows filtering before its handling by the target Restlet. By default it parses the template variable, adjust the base reference, then extracts the attributes from form parameters (query, cookies, entity) and finally tries to validates the variables as indicated by the validate(String, boolean, String) method.

Overrides:
beforeHandle in class TemplateRoute
Parameters:
request - The request to filter.
response - The response to filter.
Returns:
The continuation status.

extractCookie

public Route extractCookie(String attribute,
                           String cookieName,
                           boolean first)
Deprecated. 
Extracts an attribute from the request cookies.

Parameters:
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.
Returns:
The current Filter.

extractEntity

public Route extractEntity(String attribute,
                           String parameter,
                           boolean first)
Deprecated. 
Extracts an attribute from the request entity form.

Parameters:
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.
Returns:
The current Filter.

extractQuery

public Route extractQuery(String attribute,
                          String parameter,
                          boolean first)
Deprecated. 
Extracts an attribute from the query string of the resource reference.

Parameters:
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.
Returns:
The current Filter.

validate

public void validate(String attribute,
                     boolean required,
                     String format)
Deprecated. 
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.
required - Indicates if the attribute presence is required.
format - Format of the attribute value, using Regex pattern syntax.


Copyright © 2005-2011 Noelios Technologies.