• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher forward()

 
Mathew Sam
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Documentation says
forward method should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.
But in Tomcat server i am not getting any IllegalStateException ,eventhough i called forward() method after out.close()
why it is so ?

regards,
Sam
 
Kyle Tang
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat is lenient in the sense that it ignores the illegal output after flush()(I tried that before), or, you said you tried close() too.
Tomcat is a freeware and it is not 100% following the spec.
Always follow the spec, and if the exam ask this kind of questions, answer what the spec says, not what tomcat does.
 
Mathew Sam
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle.
I just wanted to confirm becuase Tomcat is the reference implementation.In fact i tried both flush() and close().

Sam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic