こんにちは@Enrichmanは、次のような実装を行うことができます:
public class HttpSessionRenew implements HttpSessionListener {
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
public HttpSessionRenew() {
super();
}
public void sessionCreated(HttpSessionEvent event) {
HttpSession session = event.getSession();
System.out.println("TIME: " + session.getMaxInactiveInterval());
System.out.println("ID Session "+session.getId()+" create "+session.getCreationTime());
}
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
// print out the session id
if(session != null) {
System.out.println( "Session Id: " + session.getId() );
synchronized(session) {
// invalidating a session destroys it
session.invalidate();
System.out.println("DESTROYD SESSION");
}
}
System.out.println("ID Session "+session.getId()+" destroyd "+ f.format(new Date()));
}
}
web.xml
<listener>
<listener-class>your.fully.qualified.name.HttpSessionRenew</listener-class>
</listener>
<!-- CONFIGURATION TIME -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
お役に立てれば幸いです:)