Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
indent20px
styledisc

How it was in Wicket 1.4

To mount a page in Wicket 1.4 the developer had to use org.apache.wicket.protocol.http.WebApplication's:

...

This mapper is a combination of all IRequestTargetUrlCodingStrategy implementations from Wicket 1.4. It supports:

Indexed parameters:

mountPage("/page", MyPage.class);
Now a request to "/page/a/b/c" will be handled by MyPage and the parameters can be get with PageParameters.get(int) (e.g. parameters.get(2) will return "c")

Named parameters:

mountPage("/page/${named1}/${named2}", MyPage.class);
Now a request to "/page/a/b" will be handled by MyPage and the parameters can be get with PageParameters.get(String) (e.g. parameters.get("named1") will return "a")

Optional named parameters:

mountPage("/page/${named1}/#{named2}", MyPage.class);
This means the second parameter is optional. Requests to "/page/a/b" , "/page/a/b/" and "/page/a/" will be handled by MyPage and the parameters can be get with PageParameters.get(String) (e.g. parameters.get("named2") will return "b" for the first case and null for the second).
The mapper is smart enough to handle optional named parameters in any segment, not just the last one.

Arbitrary named parameters, e.g. /page/param1Name/param1Value/param2Name/param2Value:

mount(new MountedMapper("/page", MyPage.class, new UrlPathPageParametersEncoder()));
Now a request to "/page/a/1/b/2" will be handled by MyPage and the parameters can be get with PageParameters.get(String) (e.g. parameters.get("a") will return "1")

Query parameters:

mountPage("/page", MyPage.class);
Now a request to "/page?a=a1&b=b1" will be handled by MyPage and the parameters can be get with PageParameters.get(String) (e.g. parameters.get("a") will return "a1")

The mapper can handle a mix of the supported parameters - indexed + named + query.

...