HttpServletResponse X IllegalStateException

Rodrigo W Bonatto

Ranch Hand

Posts: 62

posted 11 years ago

Hi,

I�m confused about when the response is commited and when the IllegalStateException is throw. The Spec says: "Calling flush() on the PrintWriter commits the response.", but the container doesn't throw any exception in the following code:

The first isCommited() method returns correct boolean value(false), but if response is in commited state, the container shouldn't have to throw an IllegalStateException when I invoke response.resetBuffer() after flush() method?

Thanks in advanced.

Rodrigo [ February 14, 2005: Message edited by: Rodrigo W Bonatto ]

SCJA, SCJP, SCJD, SCWCD, SCBCD5, SCDJWS, SCEA5

Deb Sadhukhan

Ranch Hand

Posts: 67

posted 11 years ago

Method description says

Clears the content of the underlying buffer in the response without clearing headers or status code. If the response has been committed, this method throws an IllegalStateException.

and that�s it, everything that you try do write o the response object will throw an IllegalStateException. The browser doesn�t show the exception, because the exception occurred after the response was committed.