Hi, A colleague mentioned getting "SlingRequestProcessorImpl Writer has already been closed" error messages when using SlingRequestDispatcher.forward(...), and looking at the code [1] I wonder if we should change the request flushing behavior.
Unfortunately, unless I missed something that code is not covered by units tests, but I suppose nested calls to SlingRequestDispatcher.forward(...) would cause the problem: SlingRequestDispatcher blindly calls response.flushBuffer(), which causes logged errors if the response Writer is already closed. So if a Servlet that's been forwarded to calls SlingRequestDispatcher.forward(...) I suppose we get this problem. I could write a test to verify all that of course, but maybe someone already has a clear idea on this. Shall we modify that code to check the request status before calling flushBuffer() ? I don't think there's a direct way to check if the Writer is closed already, but maybe there's another call on the request that would check that? -Bertrand [1] https://github.com/apache/sling-org-apache-sling-engine/blob/631a54f45abf5fd6d7c56dac43fd499db543bcd7/src/main/java/org/apache/sling/engine/impl/request/SlingRequestDispatcher.java#L151