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

sendError and sendRedirect

 
James Turner
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have been going through the HFS&J book and the servlet spec and am trying to figure out when the IllegalStateException will be thrown.

So far, I have found that if the response stream is committed any other attempt to write to it will result in an IllegalStateException, except if it is after a sendError or sendRedirect, in which case it will simply be ignored.

Also any attempt to add a header or content type to the response after it is committed will be ignored.

Any other attempt to write to the response stream will result in an IllegalStateException.

Am I write about this? Are there any other exceptions to the rule?

Thank you for your help. Much appreciated.

Regards,
James.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic