Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

flush() in rd.include vs rd.forward()  RSS feed

 
luke brown
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have the following code snippet in my web app:




When i am using flush before Forward(), its throwing illegalstateexception (since the response is sent the moment we call flush and later we are trying to resend the response using forward) but the code works fine even after i provided flush before the rd.include(). Why doesnt it throw the exception here?

Regards
Luke
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2919
205
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The include method of the RequestDispatcher interface does not throw an IllegalStateException.

Just check the Servlet 3.0 specs chapter 9.3 (The Include Method) and 9.4 (The Forward Method)
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!