cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Pietschmann" <dev.sen...@gmail.com>
Subject AW: AW: How to connect Avalon Component and SessionListener
Date Fri, 16 Dec 2005 09:17:03 GMT
I'm sorry, I still don't completely get it. I assume that SessionData is the
class that implements HTTPSessionBindingListener?

So you call getInstance() during login, which adds the component
(SessionData) to the Session. It will then be notified, when it is unbound
from the session, which allows me to do my stuff.

But how (and where) do you call getInstance()? Do you do it via an Action?
Or is there an easier way? And can you be a bit more specific as where to
put it? I guess in the auth-login matcher?

Thanx,
Stefan
| 
| Ralph Goers wrote:
| 
| >
| >
| > Stefan Pietschmann wrote:
| >
| >> Yes, I read about that and tried to find out a bit more about
| >> HTTPSessionBindingListener. However I don't quite get the "store your
| >> component as a session attribute"-part.
| >> 1. I'm using my component in the pipline implementation. I assume
| >> you'd do
| >> it some way like this (made it short):
| >>
| >>
| ObjectModelHelper.getRequest(environment.getObjectModel()).getSession().se
| tA
| >>
| >> ttribute("mycomponent",component);
| >>
| >>
| >
| > I call this method during login - it is in the SessionData class
| 
| I should be clearer. This code assumes that login is single threaded so
| synchronization is not necessary.
| 
| >
| >    public static SessionData getInstance(Session session)
| >    {
| >        SessionData sessionData = (SessionData)
| > session.getAttribute(SESSION_DATA);
| >
| >        if (sessionData == null)
| >        {
| >            sessionData = new SessionData();
| >            session.setAttribute(SESSION_DATA, sessionData);
| >        }
| >        return sessionData;
| >    }
| >
| >


Mime
View raw message