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

IllegalStateException in conjunction with HttpSession

 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

why do most HttpSession methods like setAttribute(), getAttribute(), getAttributeNames(), removeAtrribute(), getCreationTime(), getLastAccessedTime(), invalidate(), isNew() declare an IllegalStateException in their throws clause and methods like getId(), getMaxInactiveInterval(), setMaxInactiveInerval() do not?
I mean if, the session has been invalidated before calling the latter category of methods, shouldn't there be an exception of this type as well?
What happens then, if I call HttpSession.getId() after the current session has been invalidated?

Kind Regards, Andy
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getID() and other methods that don't throw an Exception are sole getter methods which on top are not bound to the session's state.

invalidate(), getLastAccessedTime() and others are all methods that rely on the fact that the Session is still alive.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check the API
it is clearly mentioned over there.......
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic