• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

sendError and sendRedirect

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.

    Bookmark Topic Watch Topic
  • New Topic