org.apache.wicket.request.mapper.parameter
Class UrlPathPageParametersEncoder

java.lang.Object
  extended by org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder
All Implemented Interfaces:
IPageParametersEncoder

public class UrlPathPageParametersEncoder
extends Object
implements IPageParametersEncoder

Encodes page parameters into Url path fragments instead of the query string like the default PageParametersEncoder. The parameters are encoded in the following format: /param1Name/param1Value/param2Name/param2Value.

Note: Because of the nature of the encoder it doesn't support POST request parameters.

This used to be the default way of encoding page parameters in 1.4.x applications. Newer 1.5.x+ applications use the query string, by default. This class facilitates backwards compatibility and migrations of 1.4.x application to 1.5.x+ codebase.

Example usage: mount(new MountedMapper("/myPage", MyPage.class, new UrlPathPageParametersEncoder());

Author:
Chris Colman, Luniv (on Stack Overflow), ivaynberg

Constructor Summary
UrlPathPageParametersEncoder()
           
 
Method Summary
 PageParameters decodePageParameters(Request request)
          Decodes the given URL to PageParameters.
 Url encodePageParameters(PageParameters params)
          Encode the given PageParameters instance into URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlPathPageParametersEncoder

public UrlPathPageParametersEncoder()
Method Detail

encodePageParameters

public Url encodePageParameters(PageParameters params)
Description copied from interface: IPageParametersEncoder
Encode the given PageParameters instance into URL. The URL will be then merged with the URL generated for IRequestHandler.

Specified by:
encodePageParameters in interface IPageParametersEncoder
Returns:
Url generated from the page parameters

decodePageParameters

public PageParameters decodePageParameters(Request request)
Description copied from interface: IPageParametersEncoder
Decodes the given URL to PageParameters. The URL will have all IRequestHandler specified segments/parameters stripped.

Specified by:
decodePageParameters in interface IPageParametersEncoder
Returns:
PageParameters instance or null if empty


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.