KittenCaptchaPanel generates a Ajax callback image url which potentially breaks
when used in a Portlet
---------------------------------------------------------------------------------------------------------
Key: WICKET-2050
URL: https://issues.apache.org/jira/browse/WICKET-2050
Project: Wicket
Issue Type: Bug
Components: wicket-extensions
Affects Versions: 1.4-RC1
Reporter: Ate Douma
Assignee: Ate Douma
Priority: Minor
Fix For: 1.4-RC2
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("'");
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.