01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tctest.webapp.listeners;
06:
07: import com.tctest.webapp.servlets.ListenerReportingServlet;
08:
09: import javax.servlet.http.HttpSessionBindingEvent;
10: import javax.servlet.http.HttpSessionBindingListener;
11:
12: public class BindingListener implements HttpSessionBindingListener {
13:
14: private final String key;
15:
16: // this default constructor is needed for deployment
17: public BindingListener() {
18: key = null;
19: }
20:
21: public BindingListener(String key) {
22: System.err.println("### BindingListener is here!!! key = "
23: + key);
24: this .key = key;
25: }
26:
27: public void valueBound(HttpSessionBindingEvent e) {
28: System.err.println("### BindingListener.valueBound");
29: // the value being bound must not be in session yet...
30: ListenerReportingServlet
31: .incrementCallCount("BindingListener.valueBound");
32: }
33:
34: public void valueUnbound(HttpSessionBindingEvent e) {
35: System.err.println("### BindingListener.valueUnbound");
36: // the value being unbound must not be in session already...
37: ListenerReportingServlet
38: .incrementCallCount("BindingListener.valueUnbound");
39: }
40:
41: public String toString() {
42: return key;
43: }
44: }
|