You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (Jira)" <ji...@apache.org> on 2023/08/15 13:18:00 UTC
[jira] [Resolved] (SLING-12003) The RequestDispatcher should flush the buffer on forward only if the buffer hasn't already been closed
[ https://issues.apache.org/jira/browse/SLING-12003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radu Cotescu resolved SLING-12003.
----------------------------------
Resolution: Fixed
> The RequestDispatcher should flush the buffer on forward only if the buffer hasn't already been closed
> ------------------------------------------------------------------------------------------------------
>
> Key: SLING-12003
> URL: https://issues.apache.org/jira/browse/SLING-12003
> Project: Sling
> Issue Type: Improvement
> Components: Engine
> Affects Versions: Engine 2.2.10
> Reporter: Radu Cotescu
> Assignee: Radu Cotescu
> Priority: Major
> Fix For: Engine 2.15.6
>
>
> The {{SlingRequestDispatcher#forward}} call [0] attempts to close the response buffer even if this has already been closed by the servlet to which the request was originally forwarded. The Servlet Specification [1] mentions the following in section 9.4:
> {quote}Before the forward method of the RequestDispatcher interface returns without exception, the response content must be sent and committed, and closed by the servlet container, unless the request was put into the asynchronous mode.
> {quote}
> As such, the {{RequestDispatcher#forward}} implementation should indeed make sure the response is committed, but it's not necessarily the only one that must commit the response. Jetty seems to have the same understanding [2], where the close is performed only if the response hasn't already been committed and the request is not async.
> [0] - [https://github.com/apache/sling-org-apache-sling-engine/blob/368690a2a81fd8a121e62767fcd32b63936a65b8/src/main/java/org/apache/sling/engine/impl/request/SlingRequestDispatcher.java#L125-L128]
> [1] - [https://download.oracle.com/otn-pub/jcp/servlet-3_1-fr-spec/servlet-3_1-final.pdf]
> [2] - [https://github.com/eclipse/jetty.project/blob/jetty-11.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java#L218]
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)