cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: How to connect Avalon Component and SessionListener
Date Sun, 11 Dec 2005 17:48:54 GMT


Stefan Pietschmann wrote:

> It's a new day and a new problem arises for me:
>
>  
>
> I want to notify my Avalon component when a session is created or 
> destroyed. I had previously written a simple HttpSessionListener which 
> I declared in web.xml. sessionCreated() and sessionDestroyed() get 
> invoked just as they should.
>
> Now what's the best practise to notify my component from there? These 
> are the ideas I had:
>
>  
>
> 1)       Make the SessionListener a Serviceable Component itself, so 
> it can use the ServiceManager to lookup my other component and invoke 
> some method there.
>
> 2)       Make my Avalon component a SessionListener itself (I don't 
> think that's possible, is it? I added it to web.xml as listener class 
> and cocoon.xconf as component, but the session methods were not invoked)
>
> 3)       Keep both classes as they are and do it the right way ;) ?
>
>  
>
> How would you go about this?
>
I'd do it the way I have told folks before. Don't use 
HttpSessionListener.  Make your component implement 
HttpSessionBindingListener. Then store your component as a session 
attribute.  When the session is destroyed it will be notified.  This 
doesn't require anything in web.xml.

Ralph


Mime
View raw message