[
https://issues.apache.org/jira/browse/WICKET-1149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554956
]
Matej Knopp commented on WICKET-1149:
-------------------------------------
Sorry, WebRequestCodingStrategy is definitely not the place to encode the URL.
The encoding is the very last step and makes only sense when the url is used as
a part of generated markup. WebRequestCodingStrategy generates urls that are
not just used in an xml document, it can e.g. be used to generate urls sent in
email.
The encoding is highly dependent on the context in which the url is used.
The LocalizedImageResource.setSrcAttribute(final ComponentTag tag) might not be
the best API decision, but the ComponentTag method attribute makes it clean
that it's used during generation of a markup (xml/xhtml document) and that it
must be escaped. So while I'm not particularly fond of having the
setSrcAttribute method in LocalizedImageResource, i think that the method is
the proper place to do the encoding nevertheless.
> LocalizedImageResource not formatting parameters properly when using
> ResourceReference
> --------------------------------------------------------------------------------------
>
> Key: WICKET-1149
> URL: https://issues.apache.org/jira/browse/WICKET-1149
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-beta4, 1.3.0-rc1
> Reporter: Doug Leeper
> Assignee: Matej Knopp
> Priority: Critical
>
> When using a ResourceReference, the resultant URL generated is not formatted
> properly when using more than one parameter.
> For example:
> Correct URL:
> http://localhost:8081/homeIQ/app/resources/homeiq.wicket.HomeIQApplication/modelPicture?thumbnail=true&maxHeight=100&maxWidth=100&id=1
> Incorrect URL: (generated by LocalizedResourceReference)
> http://localhost:8081/homeIQ/app/resources/homeiq.wicket.HomeIQApplication/modelPicture?thumbnail=true&maxHeight=100&maxWidth=100&id=1
> As can be seen, the & has been replaced with &. This is the result of
> the following code:
> tag.put("src",
> RequestCycle.get().getOriginalResponse().encodeURL(
> Strings.replaceAll(url, "&", "&")));
> It should be:
> tag.put("src",
> RequestCycle.get().getOriginalResponse().encodeURL(url);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.