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

Session attributes

 
Rick Rangers
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm doing a test exam. One question is about the HttpSessionListener. In the explanation of the answer they say that in the sessionDestroyed() method you can still access session attributes.

The book I'm using in prepartion for the exam (deshmukh) says that when a session is invalidated the sessionDestroyed() method is invoked but inside this method you can't access the attributes anymore. Instead you must use a HttpSessionBindingListener.

Which one is true, the test exam or deshmukh?

Regards,
Rick
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the spec:
SRV.1.6.1 HttpSessionListener.sessionDestroyed
In the previous versions of the specification, this method was defined as:
Notification that a session was invalidated.
As of Version 2.4, this method is changed to:
Notification that a session is about to be invalidated
so that it notifies before the session invalidation. If the code assumed the previous behaviour, it must be modified to match the new behaviour.


Which means that you can still access attributes, because the session is not invalidated yet, but about to be.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes...indeed
 
Rick Rangers
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the info!!

Regards,
Rick
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic