You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (Jira)" <ji...@apache.org> on 2021/09/14 07:56:00 UTC
[jira] [Commented] (SLING-10810) new status code should not be set
if response is already comitted
[ https://issues.apache.org/jira/browse/SLING-10810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17414786#comment-17414786 ]
Bertrand Delacretaz commented on SLING-10810:
---------------------------------------------
I'm not sure exactly where this problem happens, but in general shouldn't we throw an exception if code tries to set multiple response status codes?
The [HttpServletResponse.sendError|https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/HttpServletResponse.html#sendError-int-java.lang.String-] method, for example, throws an IllegalStateException if it's called when the response is already committed. We might want do to the same.
> 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
>
>
> 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)