Hi, I'm new to wicket, and I found a bug (I suppose) into MixedParamUrlCodingStrategy. I join the test case (below) I use MixedParamUrlCodingStrategy for BookmarkablePageLink where the first parameter is a String, an human label. And I've got a bug, bad url when I try to link something like "histoire de l'art". During my investigation I found that there is no symmetry between the encoding/decoding of the urlFragment : decodeParameters doesn't decode (urldecode) the fragment of the path.
I use wicket-1.3.0-incubator (from maven rep http://wicketstuff.org/maven/repository/) Regards. ------------------------------------------------------------------- import java.util.HashMap; import java.util.Map; import org.apache.wicket.Page; import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy; import org.apache.wicket.util.string.AppendingStringBuffer; import org.apache.wicket.util.tester.WicketTester; import org.apache.wicket.util.value.ValueMap; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @Test public class MixedParamUrlCodingStrategyTest { private WicketTester wicketTester_; @BeforeClass public void startWicketEnv() throws Exception { wicketTester_ = new WicketTester(); } @AfterClass public void stopWicketEnv() throws Exception { wicketTester_.destroy(); } @DataProvider(name = "params") protected Object[][] paramsProvider() throws Exception { return new Object[][]{ {"value0"}, {"value \u0232\u0224\u0233"}, {"v'alue0"} }; } @SuppressWarnings("unchecked") @Test(dataProvider="params") public void testEncodeDecode(String value) throws Exception { Target target = new Target("/test", Page.class, new String[] { "param0" }); AppendingStringBuffer urlFragment = new AppendingStringBuffer(); Map<String, String> params = new HashMap<String, String>(); urlFragment.setLength(0); params.clear(); params.put("param0", value); target.appendParameters(urlFragment, params); //Assert.assertEquals(urlFragment.toString(), "/value0/value1"); Map urlParams = new HashMap(); ValueMap map = target.decodeParameters(urlFragment.toString(), urlParams); Assert.assertEquals(map.getString("param0"), value); } public static class Target extends MixedParamUrlCodingStrategy { public Target(String mountPath, Class<?> bookmarkablePageClass, String[] parameterNames) { super(mountPath, bookmarkablePageClass, parameterNames); } @SuppressWarnings("unchecked") @Override public void appendParameters(AppendingStringBuffer url, Map parameters) { super.appendParameters(url, parameters); } @SuppressWarnings("unchecked") @Override public ValueMap decodeParameters(String urlFragment, Map urlParameters) { return super.decodeParameters(urlFragment, urlParameters); } } } ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user