Liferay 6.1.2-ce-ga3

com.liferay.portal.kernel.portlet
Interface Router


public interface Router

Contains a list of the available routes and handles conversion of URLs to parameter maps and vice versa.

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.

See Also:
Route, DefaultFriendlyURLMapper

Method Summary
 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.
 

Method Detail

addRoute

Route addRoute(String pattern)
Generates a new route from its pattern string.

Parameters:
pattern - the route pattern string
Returns:
the generated route

parametersToUrl

String parametersToUrl(Map<String,String> parameters)
Generates a URL from the parameter map using the available routes.

Parameters:
parameters - the parameter map
Returns:
the URL path, or null if an applicable route was not found

urlToParameters

boolean urlToParameters(String url,
                        Map<String,String> parameters)
Parses a URL into a parameter map using the available routes.

Parameters:
url - the URL to be parsed
parameters - the parameter map to be populated
Returns:
true if a match was found and parameters was populated; false otherwise

Liferay 6.1.2-ce-ga3