Is it possible to set response headers after a response has been committed as I am under the impression that ALL response headers must be sent before the response body is sent?
e.g. response.setHeader("headername", "headervalue"); response.flushBuffer(); response.setHeader("headername", "headervalue"); response.flushBuffer();
once the response is committed we can't set the header. you have used flushBuffer() which commits the response which forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written.
Do all headers have to be sent before the response body is sent?
Of course - at the TCP/IP level, the response is just a single stream of characters sent to the browser. The servlet API keeps the headers separate from the output buffer until the first buffer flush, but after that the headers have been written. Bill
Post by:autobot
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking