Example usage for com.liferay.portal.kernel.portlet Route parametersToUrl

List of usage examples for com.liferay.portal.kernel.portlet Route parametersToUrl

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet Route parametersToUrl.

Prototype

public String parametersToUrl(Map<String, String> parameters);

Source Link

Document

Generates a URL from the parameter map if this route is appropriate.

Usage

From source file:com.liferay.portlet.RouteImplTest.java

License:Open Source License

public void testNonMatchingRoute() {
    Map<String, String> parameters = new HashMap<String, String>();

    parameters.put("action", "view");
    parameters.put("id", "bob");

    Map<String, String> originalParameters = new HashMap<String, String>(parameters);

    Route route = new RouteImpl("{action}/{id:\\d+}");

    String url = route.parametersToUrl(parameters);

    assertNull(url);//from   w ww  . jav  a  2  s  .c om
    assertEquals(originalParameters, parameters);
}

From source file:com.liferay.portlet.RouterImpl.java

License:Open Source License

public String parametersToUrl(Map<String, String> parameters) {
    for (Route route : _routes) {
        String url = route.parametersToUrl(parameters);

        if (url != null) {
            return url;
        }/*from  ww w.ja v  a  2s  .co m*/
    }

    return null;
}