This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
After the response is committed by out.flush(), why does response.sendError() not throw an IllegalStateException? Or is the exception thrown but not visible? [ March 13, 2007: Message edited by: Aniket Patil ]
SCJP 5.0 | SCWCD 1.4 <br /> <br />If you don't know where you are going, any road will take you there!
one can use the response.isCommited( ) as a precaution !
SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ] Performance is a compulsion, not a option, if my existence is to be justified.
Joined: May 02, 2006
That's useful Niranjan. Mark, i looked at the Tomcat console window to se if i could get an exception, but wasn't able to find any.
I'm facing a similar problem with the following code too:
I remember i had an IllegalStateException for the above, since i'm trying to forward after committing the response. This is also mentioned on Pg. 205 of K&b. But since today, i have stopped getiing the exception and "Got beer color" gets printed in the browser.
Why does Tomcat exhibit such variable behavior? [ March 13, 2007: Message edited by: Aniket Patil ]
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joined: May 02, 2006
I've read topics around here that mention that Tomcat isn't fully J2EE-compliant. I've switched to Resin now and i'm getting the expected results.
I'm able to get an IllegalStateException if i try to forward()/sendRedirect() after a flush(). The curious thing is, the text i am sending through flush() is getting printed to browser and THEN an exception is raised. With Tomcat (when i got the exception once), no text was printed. [ March 14, 2007: Message edited by: Aniket Patil ]
I tried the code snippet that you gave on tomcat ver 5.0 and it did give me IllegalStateException. What I wanted to know from you is that, did you check your log files i.e the text file for the day you ran this code under logs folder? It should reflect IllegalStateException there.