• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

sendError and sendRedirect

Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic