You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Matej Knopp (JIRA)" <ji...@apache.org> on 2007/12/20 17:36:50 UTC

[jira] Resolved: (WICKET-1149) LocalizedImageResource not formatting parameters properly when using ResourceReference

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

Matej Knopp resolved WICKET-1149.
---------------------------------

    Resolution: Invalid

I believe that this issue is not valid and that we are doing the right thing.

RequestCycle.urlFor(ResourceReference) returns the url without & being escaped which is fine. 

However,

LocalizedImageResource.setSrcAttribute(final ComponentTag tag) replaces the & with &amp; because it's setting an xml tag attribute. In xml tag attribute & must be escaped, because otherwise it would mean a start of some entity (which it obviously isn't in this case). However, keep in mind that during the xml/xhtml parsing the &amp; entity is converted back to & giving the original URL. 

So you can't just copy the url from page source code and past it to browser location field and expect it to work. You have to remove the entity first.

If we didn't do that we would create invalid / not well formed documents.

> 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
>             Fix For: 1.3.0-rc3
>
>
> 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&amp;maxHeight=100&amp;maxWidth=100&amp;id=1
> As can be seen, the & has been replaced with &amp;.  This is the result of the following code:
> 		tag.put("src", RequestCycle.get().getOriginalResponse().encodeURL(
> 			Strings.replaceAll(url, "&", "&amp;")));
> 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.