David Leangen schreef:
I looked into this a bit, and this is due to some confusion about whether the RequestParameters parameters should be a Map<String, String> or a Map<String, String[]>.http://localhost:8080/app//page?wicket:pageMapName=wicket-0&ct=% 5BLjava.lang.String%3B%401e26e52
Not sure how to properly fix this, but but the attached workaround seems to do fine in my case.
Arnout
package nl.topicuszorg.util.wicket; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import wicket.request.target.coding.QueryStringUrlCodingStrategy; import wicket.util.value.ValueMap; /** * Workaround: sometimes the Strategy gets passed a Map<String, String[]> instead of a Map<String, String>. * * * @author engelen */ public class WorkaroundQueryStringUrlCodingStrategy extends QueryStringUrlCodingStrategy { /** ctor */ public WorkaroundQueryStringUrlCodingStrategy(String mountPath, Class bookmarkablePageClass) { super(mountPath, bookmarkablePageClass); } /** * * @see wicket.request.target.coding.QueryStringUrlCodingStrategy#decodeParameters(java.lang.String, java.util.Map) */ @Override protected ValueMap decodeParameters(String arg0, Map passedParameters) { ValueMap parameters = new ValueMap(); if (passedParameters != null && !passedParameters.isEmpty()) { Object firstValue = passedParameters.values().iterator().next(); if (firstValue instanceof String) { parameters.putAll(passedParameters); } else if (firstValue instanceof String[]) { for (Entry<String, String[]> entry : (Set<Entry<String, String[]>>) passedParameters.entrySet()) { if (entry.getValue().length != 1) { throw new IllegalArgumentException("Invalid number of parameter values: " + entry.getValue().length); } parameters.put(entry.getKey(), entry.getValue()[0]); } } else { throw new IllegalArgumentException("Invalid type of parameter value: " + firstValue.getClass()); } } return parameters; } }
------------------------------------------------------------------------- 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