I use StreamingOutput Jersey, which worked very well until we got to Jersey 2.16. That's what. My StreamingOuput produces products very slowly in some cases. I write data regularly, but I write it rather slowly and a little out of it at a time. I call flush() on an OutputStream passed to StreamingOutput.write() every time I write any bytes, but flush () has no effect. Nothing is sent over the cable until 8K is written to the OutputStream . Unfortunately, in some cases, at the time of writing 8K, the client has expired.
I downloaded some source of jersey and after some debugging, I see that the OutputStream passed to write() is an UnCloseableOutputStream that wraps a CommittingOutputStream .
CommittingOutputStream enabled in CommittingOutputStream mode, and so flush () is essentially no-op until the response is complete (completed).
So I'm in the brine. How can I use StreamingOutput (or else write directly to the output stream) and make it send bytes over the wire until the whole response is complete? Is there any other way to do this with jersey? I cannot find any methods in ResponseBuilder for this. I can not find a way to disable buffering.
source share