~james-page/ubuntu/oneiric/jenkins-winstone/827651

« back to all changes in this revision

Viewing changes to src/test/winstone/testApplication/listeners/SessionListener.java

  • Committer: Bazaar Package Importer
  • Author(s): James Page
  • Date: 2011-06-29 12:16:17 UTC
  • Revision ID: james.westby@ubuntu.com-20110629121617-vd3ha6lp4nqvxkbr
Tags: upstream-0.9.10-jenkins-25+dfsg
ImportĀ upstreamĀ versionĀ 0.9.10-jenkins-25+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
 
6
 */
 
7
package winstone.testApplication.listeners;
 
8
 
 
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;
 
14
 
 
15
/**
 
16
 * Logs messages when any session event is received
 
17
 * 
 
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 $
 
20
 */
 
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());
 
26
    }
 
27
 
 
28
    public void sessionDestroyed(HttpSessionEvent se) {
 
29
        se.getSession().getServletContext().log(
 
30
                "Session Destroyed - id=" + se.getSession().getId());
 
31
    }
 
32
 
 
33
    public void attributeAdded(HttpSessionBindingEvent se) {
 
34
        se.getSession().getServletContext().log(
 
35
                "Session Attribute added (session id="
 
36
                        + se.getSession().getId() + ") " + se.getName() + "="
 
37
                        + se.getValue());
 
38
    }
 
39
 
 
40
    public void attributeRemoved(HttpSessionBindingEvent se) {
 
41
        se.getSession().getServletContext().log(
 
42
                "Session Attribute removed (session id="
 
43
                        + se.getSession().getId() + ") " + se.getName() + "="
 
44
                        + se.getValue());
 
45
    }
 
46
 
 
47
    public void attributeReplaced(HttpSessionBindingEvent se) {
 
48
        se.getSession().getServletContext().log(
 
49
                "Session Attribute replaced (session id="
 
50
                        + se.getSession().getId() + ") " + se.getName() + "="
 
51
                        + se.getValue());
 
52
    }
 
53
 
 
54
    public void sessionDidActivate(HttpSessionEvent se) {
 
55
        se.getSession().getServletContext().log(
 
56
                "Session activated - id=" + se.getSession().getId());
 
57
    }
 
58
 
 
59
    public void sessionWillPassivate(HttpSessionEvent se) {
 
60
        se.getSession().getServletContext().log(
 
61
                "Session passivating - id=" + se.getSession().getId());
 
62
    }
 
63
}