You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stephen Charles Huey <st...@fastmail.fm> on 2004/07/16 01:06:29 UTC

session listener not listening

My session listener doesn't seem to be listening.  At the top of my
web.xml (before any servlet elements, and I have nothing like a filter
or anything else before it), I have this:

<listener>    
	<listener-class>central.OurSessionListener</listener-class>  
</listener>





Here is my listener class:


package central;

import java.util.HashMap;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import wwxchange.utility.*;
import wwxchange.beans.*;

public class OurSessionListener implements HttpSessionListener {

  public void sessionCreated(HttpSessionEvent se) {
    HttpSession session = se.getSession();
    UserAcctBean user = (UserAcctBean)
    session.getAttribute("currentuser");
    String loginID = user.getLoginID();
    System.out.println("Added session: " + session.getId() + " for user
    " + user.getLoginID());
    SystemControl.addActiveUser(session.getId(), user.getLoginID() );
  }

  public void sessionDestroyed(HttpSessionEvent se) {
    HttpSession session = se.getSession();
    SystemControl.removeActiveUser(session.getId());
    System.out.println("Removed session: " + session.getId());
  }
}


My SystemControl's static HashMap doesn't seem to be getting updated,
and the above methods aren't even getting called because nothing is
going to stdout when I log in as different users.  

What am I doing wrong?  Is my listener not registered to listen?  

Thanks,
Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org