struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Nenning (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4628) Space character and includeParams
Date Tue, 02 Aug 2016 14:53:20 GMT

    [ https://issues.apache.org/jira/browse/WW-4628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15404125#comment-15404125
] 

Christoph Nenning commented on WW-4628:
---------------------------------------

This approach brought me much enlightenment ;)

When {{<s:url includeParams=""/>}} is used, it takes existing params from {{HttpServletRequest}}.
That class provides methods like {{getParameterMap()}} or {{getParameterValues()}} (among
others). Those return parameters decoded. So no issue with them.

But as struts wants to explicitly handle GET parameters only it uses a different approach
(in some cases): {{HttpServletRequest().getQueryString()}} (or: {{HttpServletRequest().getAttribute("javax.servlet.forward.query_string")}}).
When paraters are accessed in this way they are not decoded.

Existing struts code is already prepared for that and does decoding for exactly these parameters.
So it does already what I was about to add.

But here comes the other issue mentioned: {{URLDecoderUtil.decode()}} does not handle the
{{+}} character for spaces.

So finally the decoding issue is the only issue.


> Space character and includeParams
> ---------------------------------
>
>                 Key: WW-4628
>                 URL: https://issues.apache.org/jira/browse/WW-4628
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.3.28
>            Reporter: Pierre-Yves Soblet
>            Assignee: Christoph Nenning
>             Fix For: 2.3.31, 2.5.3
>
>         Attachments: Struts2UrlTest.zip
>
>
> With this JSP snippet using Struts 2 taglib:
> {code}
> myParameter=[<s:property value="%{#parameters['myParameter']}"/>]
> <br/>
> <s:url action="url" includeParams="get"/>
> <br/>
> <s:url action="url">
>     <s:param name="myParameter" value="%{#parameters['myParameter']}"/>
> </s:url>
> {code}
> When the action is called with a parameter containing a space (which is escaped in the
URL) :
> {code}
> localhost:8080/url?myParameter=with+space
> {code}
> The output is as follows :
> {code}
> myParameter=[with space]
> /url.action?myParameter=with%2Bspace
> /url.action?myParameter=with+space    
> {code}
> The *includeParams* attribute of the “url” tag seems to transform the "space" character
into the "plus" character (both in their url-encoded forms).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message