top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can my application get to know when a HttpSession is removed (when it time-outs)?

+1 vote
361 views
How can my application get to know when a HttpSession is removed (when it time-outs)?
posted Oct 5, 2015 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Define a class, say SessionTimeoutNotifier, that implements javax.servlet.http.HttpSessionBindingListener. Create a SessionTimeoutNotifier object and add it to the user session. When the session is removed, SessionTimeoutNotifier.valueUnbound() will be called by the servlet engine. You can implement valueUnbound() to do whatever you want.

answer Oct 6, 2015 by Karthick.c
...