Forums Register Login

ServletResponse.isCommitted()

+Pie Number of slices to send: Send
Several methods etc. throw a IllegalStateException if a response is already committed....
What causes the response to be committed? I know it happens once the response header has been sent to the browser but at what point does this occur?
+Pie Number of slices to send: Send
According to Servlet API, method flushBuffer() in class ServletResponse will commit the response and force any content in the buffer to be written to the client..
daniel
+Pie Number of slices to send: Send
 

Originally posted by Tom Adams:
Several methods etc. throw a IllegalStateException if a response is already committed....
What causes the response to be committed? I know it happens once the response header has been sent to the browser but at what point does this occur?


In practice, it might happen any time during the processing of the request. The container regularly flushes the buffer while the servlet is writing to the response. Since the headers are the first part of the response, they are the first ones to be flushed out and the response is committed.
Then, of course, there are methods that force the container to flush the buffer.
Don't play dumb with me! But you can try this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2700 times.
Similar Threads
When is a response committed
IllegalStateException
cannot forward after response has been committed
Please answer these few doubts
IllegalStateException
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:10:22.