This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Qn on Request Dispatcher

 
Chandrakanth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody confirm on this

when we commit the response...and than do

rd.forward(req,res);

do we get the IllegalStateException, displayed to the client(i mean in browser)....
as i did not get it when i tried it on tomcat.....
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat servlet container has default output buffer (about 8 Kb AFAIR).

So when you test your code - no exception may be thrown, because even you send something, this is not actually sent and is stored in output buffer. And exception is not thrown since response is not started yet.

To be safe, it is possible to try flush buffer - make sure response is commited. Or add more output data to force buffer flush.

Note:

The Servlet Spec states that a servlet container is allowed, but not required to buffer the output that's going to the client.
[ March 21, 2006: Message edited by: Vishnu Prakash ]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

do we get the IllegalStateException, displayed to the client(i mean in browser)....
as i did not get it when i tried it on tomcat.....


When the response is already committed, the Exception will not display to client. You can check the tomcat application log. There will be entries for this exception.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic