You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Abhijat Thakur <at...@bdnacorp.com> on 2003/05/08 01:22:17 UTC

HttpSessionBindingListener problem

I want to have handle to all sessions at all times in my application. The code looks something like this.

public class SessionHandler implements HttpSessionBindingListener {
    
    private HttpSession s;
    
    public SessionObject(  ) {
       System.out.println("Called empty constructor of session object");
    }
    public SessionObject( HttpSession s ) {
       System.out.println("Created a new session in sessionObject");
       this.s = s;
    }
    /**
     * implementation of interface method
     */
    public void valueBound( HttpSessionBindingEvent e ) {
        System.out.println("Got Bound");
    }
    /**
     * implementation of interface method
     */
    public void valueUnbound( HttpSessionBindingEvent e ) {
        System.out.println("Got unbound");
    }   
    public HttpSession getSession () {
        return s;
    }
}

There is an entry in web.xml for SessionHandler
<listener>
	<listener-class>SessionHandler</listener-class>
</listener>

On starting up tomcat empty constructor of SessionHandler is called. However on creating a new session the valueBound method is never called. What am i doing wrong ?

thanks 

abhijat

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