Efficiently processing data ....
I'm looking for a way to efficiently process data using a Servlet Filter. I have come up with the following solution
class PipedWrapper - ServletResponseWrapper wraps a PipedOutputStream ...
class Consumer - This class connects PipedOutputStream to a PipedInputStream. The PipedInputStream writes out the content to the ServletOutputStream ...
The code runs in a separate thread and awaits for the data that is written via the PipedOutputStream via PipedWrapper
This does seem to work. I do see the data coming via the PipedOutputStream to the PipedInputStream and it is exactly the data that I have written out in the servlet.
But as soon as I try to write out the data to the ServletOutputStream, it fails. Well I don't see an error, but I also don't see any output.
My question to you is: is it possible to write out data via a separate thread or are there known limitations?
I have included an example to give you an idea.