Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Styled parameter encoding examples

...

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

Indexed parameters

...

- /page/idx1/idx2

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

...

- /page/${named1}/${named2}

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

...

- /page/${named1}/#{named2\

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

...

- /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

...

- /page?param1Name=param1Value&param2Name=param2Value

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")

...