Any way to anticipate session timeout?
问题 Is there a way to "catch" the session timeout event, so as to retrieve data from HttpSession before its invalidated ? We're implementing the Filter Interface, and in the doFilter method, the user we stored in the session object at login is null when session times out. Thanks in advance. 回答1: You should be able to register an HttpSessionListener for your webapp that will allow you to get notified when a Session is destroyed. It has two callback methods: public void sessionCreated