Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2050

KittenCaptchaPanel generates a Ajax callback image url which potentially breaks when used in a Portlet

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4-RC1
    • Fix Version/s: 1.4-RC2
    • Component/s: wicket-extensions
    • Labels:
      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("'");

        Attachments

          Activity

            People

            • Assignee:
              ate Ate Douma
              Reporter:
              ate Ate Douma
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: