On Aug 7, 5:04 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> Yes. No.
>
[quoted text clipped - 3 lines]
>
> Arne
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?
Wojtek - 07 Aug 2007 23:30 GMT
dave wrote :
>> Yes. No.
>>
[quoted text clipped - 12 lines]
> 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...

Signature
Wojtek :-)
Arne Vajhøj - 08 Aug 2007 01:18 GMT
>> Yes. No.
>>
[quoted text clipped - 12 lines]
> it is flushed, now what happens if "addHeader" is called on something
> already committed?
flushBuffer docs say:
#A call to this method automatically commits the response, meaning the
#status code and headers will be written.
I would expect a setHeader call to fail after that.
Arne