Laurie byrum created SLING-3201:
-----------------------------------

             Summary: Redirect after post not possible
                 Key: SLING-3201
                 URL: https://issues.apache.org/jira/browse/SLING-3201
             Project: Sling
          Issue Type: Bug
          Components: General
            Reporter: Laurie byrum


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)

Reply via email to