tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Souther <>
Subject Session Listeners in separate context?
Date Fri, 02 Apr 2004 20:03:50 GMT
Do sessionListeners reside in a different context from other servlets?
I'm trying to create a session listener that stores the sessions in a context scoped Object.
For some reason, other servlets can't seem to access the the object.

     * Adds a reference to the new session to the activeUsersList
    public void sessionCreated(HttpSessionEvent event){
        HttpSession session      = event.getSession();       
        ServletContext context   = session.getServletContext();
        Hashtable activeUserList = (Hashtable)context.getAttribute("activeUserList");
        if(activeUserList == null){           
            activeUserList = new Hashtable();
        activeUserList.put(session.getId(), session);
        context.setAttribute("activeUserList", activeUserList);

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message