cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Quenot <...@anyware-tech.com>
Subject Re: How to connect Avalon Component and SessionListener
Date Wed, 14 Dec 2005 11:43:48 GMT
* Stefan Pietschmann:

> I want to notify my Avalon component when a session is created or destroyed.

In your listener, you have access to the servlet context, in which
you can set and get attributes:

        public void sessionCreated(HttpSessionEvent event) {
                ((MyComponent)event.getSession().getServletContext().getAttribute("MyComponent")).someMethod()
        }

And in your component:

        HttpContext context = (HttpContext) ObjectModelHelper.getContext(objectModel);
        context.setAttribute("MyComponent", this);

Best regards,
-- 
Jean-Baptiste Quenot
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/

Mime
View raw message