This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • URL Coding Strategies
Skip to end of metadata
Go to start of metadata

Obsolete since Wicket 1.5

Check Request mapping for the new way in 1.5

Wicket 1.4/1.3/1.2


Encodes and decodes mounts for a single bookmarkable page class

Example (in your initialization for WebApplication class)

mountBookmarkablePage("/path/to/bookmarkable/page", MyWebPage.class);


Url coding strategy for bookmarkable pages that encodes index based parameters. Strategy looks for parameters whose name is an integer in an incremented order starting with zero. Found parameters will be appended to the url in the form /mount-path/paramvalue0/paramvalue1/paramvalue2 When decoded these parameters will once again be available under their index (PageParameters.getString("0")(wink).

Example (in your initialization for WebApplication class)

mount(new IndexedParamUrlCodingStrategy("/path/to/bookmarkable/page", MyWebPage.class));


A URL coding strategy that encodes the mount point, page parameters and page instance information into the URL. The benefits compared to mounting page with BookmarkablePageRequestTargetUrlCodingStrategy are that the mount point is preserved even after invoking listener interfaces (thus you don't lose bookmarkability after clicking links) and that for ajax only pages the state is preserved on refresh.

The url with HybridUrlCodingStrategy looks like /mount/path/param1/value1.3. or /mount/path/param1/value1.3.2 where 3 is page Id and 2 is version number.

Also to preserve state on refresh with ajax-only pages the HybridUrlCodingStrategy does an immediate redirect after hitting bookmarkable URL, e.g. it immediately redirects from /mount/path to /mount/path.3 where 3 is the next page id. This preserves the page instance on subsequent page refresh.

Other strategies always create new page instance. The difference with HybridUrlCodingStrategy is that it attempts to reuse existing page instance (when pageid in session matches the class specified by mount point).

Example (in your initialization for WebApplication class)

mount(new HybridUrlCodingStrategy("/path/to/bookmarkable/page", MyWebPage.class));


This is a request coding strategy which encrypts the URL and hence makes it impossible for users to guess what is in the url and rebuild it manually. It uses the CryptFactory registered with the application to encode and decode the URL. Hence, the coding algorithm must be a two-way one (reversible). Because the algorithm is reversible, URLs which were bookmarkable before will remain bookmarkable.

To register the request coding strategy to need to do the following:

Example (in your WebApplication class)

protected IRequestCycleProcessor newRequestCycleProcessor() {
  	return new WebRequestCycleProcessor()
  		protected IRequestCodingStrategy newRequestCodingStrategy()
  			return new CryptedUrlWebRequestCodingStrategy(new WebRequestCodingStrategy());

Note: When trying to hack urls in the browser an exception might be caught while decoding the URL. By default, for safety reasons a very simple WicketRuntimeException is thrown. The original stack trace is only logged.

See also


Encodes and decodes mounts for a whole package, see example below:

mount(new PackageRequestTargetUrlCodingStrategy("/bookmarkable/prefix", PackageName.forClass(MyWebPage.class)));

or shorter:

mount("/bookmarkable/prefix", PackageName.forClass(MyWebPage.class));
  • No labels