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

James Phillpotts edited comment on SLING-2543 at 9/27/12 10:33 PM:
-------------------------------------------------------------------

The fix was a little more complicated than expected - basically Sling's 
redirection was assuming that given a post path of "/abc/def/", a new node 
called "xyz" and a redirect of "*", then the returned path should be 
"/abc/def/xyz". However, the HttpServletResponse URL encoding sets it to 
/abc/xyz in this case.

As this is almost certainly a rule people will be expecting to be honoured (not 
least by the integration tests), I've made sure this rule is honoured when 
generating the redirection url.

The attached patch contains the necessary changes to SlingPostServlet and its 
test.
                
      was (Author: mrpotes):
    The fix was a little more complicated than expected - basically Sling's 
redirection was assuming that given a post path of "/abc/def/", a new node 
called "xyz" and a redirect of "*", then the returned path should be 
"/abc/def/xyz". However, the HttpServletResponse URL encoding sets it to 
/abc/xyz in this case.

As this is almost certainly a rule people will be expecting to be honoured (not 
least by the integration tests), I've made sure this rule is honoured when 
generating the redirection rule.

The attached patch contains the necessary changes to SlingPostServlet and its 
test.
                  
> SlingPostServlet is not encoding redirect URLs
> ----------------------------------------------
>
>                 Key: SLING-2543
>                 URL: https://issues.apache.org/jira/browse/SLING-2543
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Post 2.1.2
>            Reporter: James Phillpotts
>            Assignee: Bertrand Delacretaz
>             Fix For: Servlets Post 2.1.4
>
>         Attachments: SLING-2543-integration-tests-fix.patch, SLING-2543.patch
>
>
> According to the JavaEE documentation for 
> HttpServletResponse.encodeRedirectURL, "All URLs sent to the 
> HttpServletResponse.sendRedirect method should be run through this method."
> The SlingPostServlet isn't doing this, and so if you try and redirect to a 
> node that contains special characters in the name, the redirect URL is 
> incorrect.
> e.g. A post request containing :name of Друга and :redirect of *.html gets a 
> redirect URL of ?????.html rather than %D0%94%D1%80%D1%83%D0%B3%D0%B0.html as 
> would be expected.

--
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

Reply via email to