WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

examples.servlets.lifecycle
Class SessionListener

java.lang.Object
  |
  +--examples.servlets.lifecycle.SessionListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionListener

public class SessionListener
extends java.lang.Object
implements javax.servlet.http.HttpSessionListener

SessionListener is a servlet listener class that implements the javax.Servlet.http.HttpSessionListener interface. This class simply implements the sessionDestroyed and sessionCreated methods to log the calls of them to standard out. These methods are called when a client initializes an Http Session, and when that session is destroyed.

Author:
Copyright (c) 2002 by BEA Systems, Inc. All Rights Reserved.

Field Summary
static java.util.Hashtable h
           
(package private)  java.io.ObjectInputStream in
           
(package private)  java.io.ObjectOutputStream out
           
(package private)  javax.servlet.http.HttpSession sess
           
 
Constructor Summary
SessionListener()
           
 
Method Summary
 void log(java.lang.String s)
          log method to prepend all messages from this class with [SessionListener]
 void sessionCreated(javax.servlet.http.HttpSessionEvent evt)
          log the call of sessionCreated.
 void sessionDestroyed(javax.servlet.http.HttpSessionEvent evt)
          log the call of sessionDestroyed.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

h

public static java.util.Hashtable h

in

java.io.ObjectInputStream in

out

java.io.ObjectOutputStream out

sess

javax.servlet.http.HttpSession sess
Constructor Detail

SessionListener

public SessionListener()
Method Detail

log

public void log(java.lang.String s)
log method to prepend all messages from this class with [SessionListener]

sessionCreated

public void sessionCreated(javax.servlet.http.HttpSessionEvent evt)
log the call of sessionCreated. Also add the session to a hashTable so List.jsp has access to the session info.
Specified by:
sessionCreated in interface javax.servlet.http.HttpSessionListener

sessionDestroyed

public void sessionDestroyed(javax.servlet.http.HttpSessionEvent evt)
log the call of sessionDestroyed. Also remove the session from the hashTable of sessions.
Specified by:
sessionDestroyed in interface javax.servlet.http.HttpSessionListener

Documentation is available at
http://e-docs.bea.com/wls/docs70

Copyright © 2002 BEA Systems, Inc. All Rights Reserved.