• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help in implementing session timeout mechanism  RSS feed

 
Ramna Reddy
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
iam new to HttpSessionAttributeListeners..
How to implement session timeout mechanism in method...
attributeRemoved(HttpSessionBindingEvent se){
//
} ....

Thanks in advance
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pavan kumar:
Hi friends,
iam new to HttpSessionAttributeListeners..
How to implement session timeout mechanism in method...
attributeRemoved(HttpSessionBindingEvent se){
//
} ....

Thanks in advance


To implement sessiontimeout mechanism you do not need HttpSessionAttributeListeners , HTTPSessionlistner is enough.
you can clean the session on call of sessionDestroyed method.
 
Ramna Reddy
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,Thank you.
can you please explain ,when we can use HttpSessionListeners and HttpSessionAttributeListeners?
 
balakrishnan periyaswamy
Greenhorn
Posts: 6
Eclipse IDE Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello pavan,
HttpSessionListener is used when you want to do certain work when a new session is created or deleted(session timeout etc )
HttpSessionAttributeListener is used when you want to do particular work when a object is added/removed/replaced in the session object (i.e HttpSession.setAttribute() or HttpSession.removeAttribute() will cause HttpSessionAttributeListener)
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pavan kumar:

iam new to HttpSessionAttributeListeners..
attributeRemoved(HttpSessionBindingEvent se){
//
} ....


If you dealing with the whole session Object then Rahul reply is fit in your desired operation. or If you want to track any attribute added, removed or replaced in session you need to implement SessionAttributeListener.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!