You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2012/10/03 13:00:08 UTC

[jira] [Resolved] (WICKET-4777) JavaScriptReference escapes given URL

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

Martin Grigorov resolved WICKET-4777.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.9
         Assignee: Martin Grigorov
    
> JavaScriptReference escapes given URL
> -------------------------------------
>
>                 Key: WICKET-4777
>                 URL: https://issues.apache.org/jira/browse/WICKET-4777
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: Georg Buschbeck
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 6.2.0, 1.5.9
>
>
> while trying to integrate gmaps3 in our webapp i had issues with the wicketstuff-gmap3 stuff ( - we need a client-id for our request) ...
> so i have:
> {noformat}
> public static final String GMAP_API_URL = "%s://maps.google.com/maps/api/js?v=3&sensor=%s&client-id=%s";
> response.render(JavaScriptHeaderItem.forUrl(String.format(GMAP_API_URL, schema, sensor, clientid)));
> {noformat}
> the rendered result of this is:
> {noformat}
> <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false&amp;client-id=...."></script>
> {noformat}
> so the requestparameters are encoded
> which is happening in the JavaScriptUtils Helper:
> {noformat}
> public static void writeJavaScriptUrl(final Response response, final CharSequence url, final String id, boolean defer, String charset)
> {
>         response.write("<script type=\"text/javascript\" ");
>         if (id != null)
>         {
>             response.write("id=\"" + Strings.escapeMarkup(id) + "\" ");
>         }
>         if (defer)
>         {
>             response.write("defer=\"defer\" ");
>         }
>         if (charset != null)
>         {
>             response.write("charset=\"" + Strings.escapeMarkup(charset) + "\" ");
>         }
>         response.write("src=\"");
>         response.write(Strings.escapeMarkup(url));
>         response.write("\"></script>");
>         response.write("\n");
> }
> {noformat}
> but ... is this right to escape the url?
> when i open the above mentioned script, google tells me i have no parameter "sensor" ... which i can understand as ther is only a parameter amp ... 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira