Joerg Heinicke wrote:
On 02.06.2008 05:56, Sylvain Wallez wrote:

Only issue I want to solve before the release is the BufferedOutputStream issue. I planned to do it this weekend.

Done. Please review the file attached. It's still completely untested. At the moment I need some sleep ;) I will write junit tests for it this week and eventually commit it.

Stupid question: why do we need a special BufferedOutputStream?

For being able to reset the response buffer for error handling. This is also possible with java.io.BufferedOutputStream, if the buffer size is big enough (current default value is 1MB), but then the buffer byte[] is always that big rather than increasing. That's what's happening right now, if you don't specify -1 as buffer size. -1 means complete buffering which on the other hand might lead to OutOfMemoryError [1]. In addition our BOS counts the bytes so that we can use the value to set the content length header.

Got it. I'm using a similar technique with a servlet filter providing the response with a ByteArrayOutputStream that gives the size and has the convenient writeTo(OutputStream) method. Now in my case [1] pages are always small and I don't need to put a high limit on the size of the buffer.

Sylvain

[1] http://bluxte.net/blog/2008-04/29-54-29.html

--
Sylvain Wallez - http://bluxte.net

Reply via email to