You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Torsten Krah (JIRA)" <ji...@apache.org> on 2018/07/19 08:47:00 UTC

[jira] [Updated] (WICKET-6568) Wicket fails / does not encode request header values in AjaxCalls

     [ https://issues.apache.org/jira/browse/WICKET-6568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Torsten Krah updated WICKET-6568:
---------------------------------
    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.

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

{code}
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.
{code}

Because the Header value set in the code:

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

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


  was:
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.

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

{code}
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.
{code}

Because the Header set in the code:

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

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



> Wicket fails / does not encode request header values in AjaxCalls
> -----------------------------------------------------------------
>
>                 Key: WICKET-6568
>                 URL: https://issues.apache.org/jira/browse/WICKET-6568
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.7.0
>            Reporter: Torsten Krah
>            Priority: Major
>              Labels: UTF-8, ajax, encode, header
>
> 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.
> We got UTF-8 characters in our ids - now wicket fails to make Ajax calls with e.g. this error:
> {code}
> 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.
> {code}
> Because the Header value set in the code:
> {code}
> if (Wicket.Focus.lastFocusId) {
>     headers["Wicket-FocusedElementId"] = Wicket.Focus.lastFocusId;
> }
> {code}
> has to be encoded and decoded on the backend (either base64, url encoding or something else which is allowed to be in a header.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)