Detecting Portlet Session Closed
The project I am working on is looking to log when the session is closed (be it via timeout or actively choosing to close it) to try to collect some usage information on the application.
The first question I hav开发者_开发技巧e is there a way to register a listener for session open and closed events within a Java application server? To compound matters more. The application is currently built on portlets, using Spring Portlet MVC. We are using JBoss portal and JBoss Application Server, but I would prefer if the method was tied specifically to one application server if possible.
Create a class that implements javax.servlet.http.HttpSessionListener
and annotate the class with @WebListener, or you can add it to web.xml such as
<listener>
<listener-class>MySessionListener</listener-class>
</listener>
精彩评论