@ProviderType
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(java.lang.String pattern)
Generates a new route from its pattern string.
|
java.util.List<Route> |
getRoutes() |
java.lang.String |
parametersToUrl(java.util.Map<java.lang.String,java.lang.String> parameters)
Generates a URL from the parameter map using the available routes.
|
boolean |
urlToParameters(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> parameters)
Parses a URL into a parameter map using the available routes.
|
Route addRoute(java.lang.String pattern)
pattern
- the route pattern stringjava.util.List<Route> getRoutes()
java.lang.String parametersToUrl(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters
- the parameter mapnull
if an applicable route was not
foundboolean urlToParameters(java.lang.String url, java.util.Map<java.lang.String,java.lang.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