Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.4-RC1
-
None
Description
KittenCaptchaPanel generates the Ajax callback image url in its onclick event handler using:
javascript.append("Wicket.$('" + image.getMarkupId() + "').src = '");
javascript.append(image.urlFor(IResourceListener.INTERFACE));
javascript.append("&rand=" + Math.random());
javascript.append("'");
Appending the rand parameter using "&rand=" assumes the image url already contains (at least) one other parameter.
Within a default (plain website) environment this most likely is true, however in a Portlet this really depends on how the portal encodes the generated image url in the resulting PortletURL.
Jetspeed-2 for instance (can) encode this as path element, in which case appending "&rand=" leads to an incorrect and invalid url.
For further information, please see WICKET-649 in which I described how I fixed similar cases in several other locations within Wicket.
I'll fix this issue likewise in a transparent way replacing the above with the following:
javascript.append("Wicket.$('" + image.getMarkupId() + "').src = '");
CharSequence url = image.urlFor(IResourceListener.INTERFACE);
javascript.append(url);
javascript.append((url.toString().indexOf('?') > -1 ? "&" : "?") + "rand=" + Math.random());
javascript.append("'");