jakartaee / jakartaee/rest

Clarification when JAX-RS engine has to close OutputStream provided to WriterInterceptor

Open
#460 3 comments 0 reactions 1 assignee Claimed by @glassfishrobot View on GitHub
Component: filters&handlers
Dominant language
Java
Stars
400
Forks
143
PR merge metrics
No merged PRs in 30d

Description

Please see RI bug [https://java.net/jira/browse/JERSEY-2455](https://java.net/jira/browse/JERSEY-2455) to understand impliciations.

The JavaDocs of WriterInterceptorContext.setOutputStream() says "The JAX-RS runtime is responsible for closing the output stream that is set.", but unfortunately does not mandate _when_ that closing has to be performed. This leads to the problem described in [JERSEY-2455](https://java.net/jira/browse/JERSEY-2455 "Jersey does not close OutputStream provided to interceptor context"). It is essential for programmers to know when this automatic close happens so they know whether they must manually workaround [JERSEY-2455](https://java.net/jira/browse/JERSEY-2455 "Jersey does not close OutputStream provided to interceptor context") by adding an explicit close(), or whether they can rely on the fact that a bug like [JERSEY-2455](https://java.net/jira/browse/JERSEY-2455 "Jersey does not close OutputStream provided to interceptor context") will never happen thanks to the TCK checking it!
#### Affected Versions
[2.0]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.