I believe that I see a but in Wicket 1.3.5. Perhaps it has been fixed in a subsequent version. Under certain circumstances an http parameter that contains a slash "/" ascii 47 results in the following exception:
*** URL fragment has unmatched key/value pairs, responding with 404. *** The circumstances under which we've encountered this error are as follows. We have a page that is both the home page: @Override public Class<? extends Page> getHomePage() { return VcomCartDetailPage.class; } and is also mounted as a bookmarkable page in Application.init() mountBookmarkablePage("/Cart", VcomCartDetailPage.class); Then when an http get is made to the app root this is received by the home page, which works correctly. However, if you then redirect to a new instance of the same page: CartDetailPage redirectTo = new VcomCartDetailPage(); redirectTo.modelChanging(); // put stuff in the Cart -- i.e. in the Session redirectTo.modelChanged(); // This is to guard against resubmitting legacy page cart additions. We // redirect to a "page mapped" version of the base CartDetailPage so that // the legacy submitted URL is cleared from the browser history, allowing // back/forward button support. setRedirect(true); setResponsePage(redirectTo); Then BookmarkablePageRequestTargetUrlCodingStrategy.encode() is invoked (comes from mountBookmarkablePage in App.init()), and ultimately the parameters are written in a REST-style in AbstractRequestTargetUrlCodingStrategy.appendValue(). private void appendValue(AppendingStringBuffer url, String key, String value) { String escapedValue = urlEncodePathComponent(value); if(!Strings.isEmpty(escapedValue)) { if(!url.endsWith("/")) url.append("/"); url.append(key).append("/").append(escapedValue).append("/"); } } However, because the path component encoder in WicketURLEncoder public static final WicketURLEncoder PATH_INSTANCE = new WicketURLEncoder(2); Does not encode a slash (ascii 47) // from WicketURLEncoder's constructor switch(type) { case 1: // '\001' dontNeedEncoding.set(32); dontNeedEncoding.set(47); dontNeedEncoding.set(63); break; case 2: // '\002' dontNeedEncoding.set(38); dontNeedEncoding.set(61); dontNeedEncoding.set(43); break; } if one of the parameter values contains a slash we end up with a bad path. E.g. for the following parameters: key1 :: value1 key2 :: value2with/slashembedded key3 :: value3 org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy URL fragment has unmatched key/value pairs, responding with 404. Fragment: key1/value1/key2/value2with/slashembedded/key3/value3 Can anyone suggest a work-around? Has this been fixed in any version past 1.3.5? Thank you, Scott --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org