You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/09/14 09:51:16 UTC

[GitHub] [sling-org-apache-sling-engine] joerghoh commented on a change in pull request #20: SLING-10810 do not set the statuscode if the response is already committed

joerghoh commented on a change in pull request #20:
URL: https://github.com/apache/sling-org-apache-sling-engine/pull/20#discussion_r708105777



##########
File path: src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
##########
@@ -150,11 +150,12 @@ public void setStatus(final int sc, final String msg) {
                 LOG.warn("Response already committed. Failed to set status code from {} to {}. {}",
                         getStatus(), sc, explanation);
             }
-        }
-        if (msg == null) {
-            super.setStatus(sc);
-        } else {
-            super.setStatus(sc, msg);
+        } else { // response is not yet committed, so the statuscode can be changed

Review comment:
       The [Servlet API](https://javadoc.io/doc/javax.servlet/javax.servlet-api/3.1.0/javax/servlet/http/HttpServletResponse.html#setStatus(int)) does not mention any exception in the signature of ```setStatus```, so my understanding is that this behavior is fully compliant to the standard.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org