Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] How to write a stream-oriented servlet response filter?

Apologies in advance: this is not a Jetty-specific question, but I thought someone here might be able to help me anyway...

I have an XSLT filter which transforms XML output from a servlet to HTML. The filter uses a CharResponseWrapper to extract the response output as a string and then run it through the transformer. This works fine unless the output is larger than a certain size, at which point I get an OutOfMemoryError.

The sensible way to deal with this would presumably be to connect up the response's output stream to the transformer's input source, so that I don't have to materialise all the output as a string before I start transforming it. I can't find any examples which show how I can do this; all the examples I've seen also work by materialising the output as a string before processing it.

Please can anyone point me at a sensible example which filters the output in a stream-oriented way?

TIA,
--
John English


Back to the top