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

commiting response

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
should I always call isComitted before using sendError.
am I right in my assumption.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either that, or handle the IllegalStateException.
Which of the two? That depends on how exceptional (rare) the condition would be. If you should not have generated enough content to commit the response, handling the exception is good enough. If on the other hand you might well have generated quite a bit of content, an exception is appropriate and you should check isCommitted() (or, more likely, amend your design so that error conditions are caught before response generation starts; an MVC design usually does the trick).
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic