[
https://issues.apache.org/jira/browse/SLING-10810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17414835#comment-17414835
]
Joerg Hoh commented on SLING-10810:
-----------------------------------
PR at https://github.com/apache/sling-org-apache-sling-engine/pull/20
[~bdelacretaz]: according to the spec the {{setStatus}} method does not throw
any exception, while in case of {{sendError}} the IllegalStateException will be
thrown in case the response is already committed.
So this inconsistent behavior is even part of the Servlet API [1].
[1]
https://javadoc.io/doc/javax.servlet/javax.servlet-api/3.1.0/javax/servlet/http/HttpServletResponse.html
> new status code should not be set if response is already comitted
> -----------------------------------------------------------------
>
> Key: SLING-10810
> URL: https://issues.apache.org/jira/browse/SLING-10810
> Project: Sling
> Issue Type: Improvement
> Components: Engine
> Affects Versions: Engine 2.7.8
> Reporter: Joerg Hoh
> Assignee: Joerg Hoh
> Priority: Major
> Fix For: Engine 2.7.10
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> If the response is already committed, a new response should not be set, but
> it should only be warned.
> Otherwise the status code logged in the Sling instance will taken from the
> ResponseImpl object, which is different from the statuscode which is sent to
> the client.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)