The internet is full of discussions whether a servlet should or must not call close() and there are more opinions than options ...

I think, a servlet should not close as this can cause upstream problems, for example in a filter. And as mentioned I ran into issues with using johnzon in a servlet and closing the stream (my app was not a sling app though), so I needed to add a wrapper with a nop close method. But on the other hand I don't want to get into a big debate about this either.

Let's just add that sanity check and then everyone is happy :)

Regards
Carsten

Am 15.06.2022 um 11:01 schrieb Radu Cotescu:
This behaviour has been added via https://issues.apache.org/jira/browse/SLING-2724 
<https://issues.apache.org/jira/browse/SLING-2724>, but I think that what 
happens with flush* is too drastic.

On 15 Jun 2022, at 10:53, Radu Cotescu <[email protected]> wrote:

Sure there is. However, in our case the dispatcher’s [1] and writer’s flush [3] 
methods are the ones that fail, since they throw an exception if the stream was 
closed. I don’t think this is correct. Flush should send the content to the 
client and commit the response, but IMO should not throw if the response has 
already been committed.



--
Carsten Ziegeler
Adobe
[email protected]

Reply via email to