2
* Copyright 2003-2006 Rick Knowles <winstone-devel at lists sourceforge net>
3
* Distributed under the terms of either:
4
* - the common development and distribution license (CDDL), v1.0; or
5
* - the GNU Lesser General Public License, v2.1 or later
7
package winstone.testApplication.listeners;
9
import javax.servlet.http.HttpSessionActivationListener;
10
import javax.servlet.http.HttpSessionAttributeListener;
11
import javax.servlet.http.HttpSessionBindingEvent;
12
import javax.servlet.http.HttpSessionEvent;
13
import javax.servlet.http.HttpSessionListener;
16
* Logs messages when any session event is received
18
* @author <a href="mailto:rick_knowles@hotmail.com">Rick Knowles</a>
19
* @version $Id: SessionListener.java,v 1.2 2006/02/28 07:32:46 rickknowles Exp $
21
public class SessionListener implements HttpSessionListener,
22
HttpSessionAttributeListener, HttpSessionActivationListener {
23
public void sessionCreated(HttpSessionEvent se) {
24
se.getSession().getServletContext().log(
25
"Session Created - id=" + se.getSession().getId());
28
public void sessionDestroyed(HttpSessionEvent se) {
29
se.getSession().getServletContext().log(
30
"Session Destroyed - id=" + se.getSession().getId());
33
public void attributeAdded(HttpSessionBindingEvent se) {
34
se.getSession().getServletContext().log(
35
"Session Attribute added (session id="
36
+ se.getSession().getId() + ") " + se.getName() + "="
40
public void attributeRemoved(HttpSessionBindingEvent se) {
41
se.getSession().getServletContext().log(
42
"Session Attribute removed (session id="
43
+ se.getSession().getId() + ") " + se.getName() + "="
47
public void attributeReplaced(HttpSessionBindingEvent se) {
48
se.getSession().getServletContext().log(
49
"Session Attribute replaced (session id="
50
+ se.getSession().getId() + ") " + se.getName() + "="
54
public void sessionDidActivate(HttpSessionEvent se) {
55
se.getSession().getServletContext().log(
56
"Session activated - id=" + se.getSession().getId());
59
public void sessionWillPassivate(HttpSessionEvent se) {
60
se.getSession().getServletContext().log(
61
"Session passivating - id=" + se.getSession().getId());