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

Wicket fails / does not encode request header values in AjaxCalls

    XMLWordPrintableJSON

    Details

      Description

      Looking at:

      https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js?source

      Wicket just sets the Wicket-FocusedElementId header to the id of the element.
      However according to:

      http://w3c.github.io/html/single-page.html#element-attrdef-global-id

      The id must not contain a space, other UTF-8 characters are allowed.

      When specified on HTML elements, the id attribute value must be unique amongst all the IDs in the element’s tree and must contain at least one character. The value must not contain any space characters.

      We got UTF-8 characters in our ids - now wicket fails to make Ajax calls with e.g. this error:

      ERROR: Wicket.Ajax.Call.failure: Error while parsing response: TypeError: Cannot convert string to ByteString because the character at index 64 has value 328 which is greater than 255.
      

      Because the Header value set in the code:

      if (Wicket.Focus.lastFocusId) {
          headers["Wicket-FocusedElementId"] = Wicket.Focus.lastFocusId;
      }
      

      has to be encoded and decoded on the backend (either base64, url encoding or something else which is allowed to be in a header).

        Attachments

          Activity

            People

            • Assignee:
              svenmeier Sven Meier
              Reporter:
              tkrah Torsten Krah
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: