开发者

Detecting Portlet Session Closed

开发者 https://www.devze.com 2023-03-02 17:25 出处:网络
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 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消