dave wrote :
It appears that the buffer is for the response body, not the header
section, although I'm really not sure. It still wasn't clear to me
from the docs.
Suppose the response body is completely empty and someone starts
adding a large number of headers using "setHeader". Let's assume that
it is flushed, now what happens if "addHeader" is called on something
already committed?
I believe that addHeader simply places the information into a HashMap.
The JavaDoc for setHeader states: "Sets a response header with the
given name and value. If the header had already been set, the new value
overwrites the previous one. The containsHeader method can be used to
test for the presence of a header before setting its value."
When the resonse is ready to be sent back, then the headers are sent,
and marked as committed.
This allows you to set other response values (mime type, cookies, etc)
"out of order", as they will not be sent until the page is ready to be
sent.
Note that this is only speculation...