-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
6.2.12.Final
-
None
The issue is similar to RESTEASY-3040 but for ClientRequestContext with OutputStream.
The method ClientRequestContext#setEntityStream is documented with,
Set a new entity output stream. The JAX-RS runtime is responsible for closing the output stream.
However when overriding this, the replaced stream is never explicitly closed. The following example never prints Was closed when the request completes. If this is not the responsibility of the framework, then the documentation should be clarified as it is unclear when and where the stream should be closed otherwise.
import org.apache.commons.io.output.ProxyOutputStream; @jakarta.ws.rs.ext.Provider public final class TestInterceptor implements ClientRequestFilter { @Override public void filter(ClientRequestContext requestContext) { requestContext.setEntityStream(new ProxyInputStream(requestContext.getEntityStream()) { @Override public void close() throws IOException { System.err.println("Was closed"); super.close(); } }); } }