You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2013/10/23 00:27:43 UTC

[jira] [Commented] (SLING-3201) Redirect after post not possible

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

Felix Meschberger commented on SLING-3201:
------------------------------------------

Committed proposed fix in Rev. 1534825 along with a simple unit test making sure the Location header is appropriately set for the 201 and 3xx responses.

> Redirect after post not possible
> --------------------------------
>
>                 Key: SLING-3201
>                 URL: https://issues.apache.org/jira/browse/SLING-3201
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Post 2.3.2
>            Reporter: Laurie byrum
>            Assignee: Felix Meschberger
>             Fix For: Servlets Post 2.3.4
>
>
> We are using the default post servlet and have PostOperation implementations that run some of our code and set up the response. In certain cases, we'd like to redirect (via a 302 response + Location header). When we do this, the 302 is returned, but the Location isn't set because of code here: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.sling/org.apache.sling.servlets.post/2.3.0/org/apache/sling/servlets/post/AbstractPostResponse.java#320
> I talked to Felix Meschberger about this. His response was:
> Looking at the code and the HTTP spec, I would think that the iff statement is incomplete and should not only encompass the 201/CREATED code but also the 3xx redirect codes, something like:
> if (statusCode == HttpServletResponse.SC_CREATED || statusCode / 100 == 3) {
>     response.setHeader("Location", getLocation());
> }
> So, I would think this is a bug (or oversight) in the AbstractPostResponse.
> Do you mind reporting a Sling issue ?



--
This message was sent by Atlassian JIRA
(v6.1#6144)