public interface Router
The priority of a route is based on when it was added to the router. The first route has the highest priority and a URL path will always be matched against it first. If the first route does not match, the second will be tried, continuing until either a match is found or all the routes have been tested.
When choosing the order in which to place a list of routes, the general rule is to sort the routes from least general to most general. The simplest way of determining the generality of a route is by counting the number of capturing fragments in it.
Route,
DefaultFriendlyURLMapper| Modifier and Type | Method and Description |
|---|---|
Route |
addRoute(String pattern)
Generates a new route from its pattern string.
|
String |
parametersToUrl(Map<String,String> parameters)
Generates a URL from the parameter map using the available routes.
|
boolean |
urlToParameters(String url,
Map<String,String> parameters)
Parses a URL into a parameter map using the available routes.
|
Route addRoute(String pattern)
pattern - the route pattern stringString parametersToUrl(Map<String,String> parameters)
parameters - the parameter mapnull if an applicable route was not
foundboolean urlToParameters(String url, Map<String,String> parameters)
url - the URL to be parsedparameters - the parameter map to be populatedtrue if a match was found and
parameters was populated; false
otherwise