when a session is invalidated
you cant call get or set attribute anymore on it

also holding on the sessions outside of request is not something you should
do


On Thu, Apr 3, 2008 at 5:51 PM, Warren <[EMAIL PROTECTED]> wrote:

> I am extending HttpSessionStore and keeping track of my sessions there. I
> am
> able to get a hold of members of my Session while it is being invalidated.
> I
> am not quite sure what you mean by " on the unBind() / onDestroy the
> actual
> session object does not exist anymore", the session seems to be available
> and I am able to access members of it as long as I store the Session in
> onBind(...). This is what I am doing:
>
>
> public class ScanManSessionStore extends HttpSessionStore
> {
>        ...
>
>        private Map<String, Session> sessions = new ConcurrentHashMap();
>        private Map<String, Device> devices = new ConcurrentHashMap();
>
>        protected void onBind(Request request, Session newSession)
>        {
>                sessions.put(newSession.getId(), newSession);
>        }
>
>        protected void onUnbind(String sessionId)
>        {
>                if(sessions.containsKey(sessionId))
>                {
>                        Device device =
> ((ScanManSession)sessions.get(sessionId)).getDevice();
>                        if(device != null)
>                        {
>                                devices.remove(device.getDeviceId());
>                        }
>                        sessions.remove(sessionId);
>                }
>        }
>        ...
> }
>
> Please let me know if there is a problem doing it this way.
>
> Warren
>
> > -----Original Message-----
> > From: Robert Novotny [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 03, 2008 3:37 AM
> > To: users@wicket.apache.org
> > Subject: RE: Get informed about invalidation of a session
> >
> >
> >
> > This has been discussed multiple times and the only reasonable
> > solution that
> > I found (and just implemented) is to have a concurrent hashmap of
> session
> > ids into session objects in the custom Application class. The
> > reason is that
> > on the unBind() / onDestroy the actual session object does not
> > exist anymore
> > - the only thing you have is the destroyed session ID.
> >
> > I needed to persist some user info on the logout.
> >
> > My solution goes like  this:
> > public class DavanoApplication extends
> > org.apache.wicket.protocol.http.WebApplication {
> >   private Map<String, User> activeUsersMap = new
> ConcurrentHashMap<String,
> > User>();
> >   ...
> >       @Override
> >       public void sessionDestroyed(String sessionId) {
> >               User user = activeUsersMap.get(sessionId);
> >               if(user != null) {
> >                       userDao.saveOrUpdate(user);
> >                       userDao.updateLastLogin(user);
> >                                   activeUsersMap.remove(sessionId);
> >               }
> >
> >
> >               super.sessionDestroyed(sessionId);
> >       }
> > }
> > I am not sure whether this is correct solution, but it did help me.
> >
> > Robert
> >
> > BatiB80 wrote:
> > >
> > > Hi Warren,
> > >
> > > thanks for your answer. But I'm not sure how I could use this. The
> > > information that I need to access are stored in the session. How can I
> > > access a single instance of this session from the session store?
> > >
> > > Thanks,
> > > Sebastian
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Get-informed-about-invalidation-of-a-session
> > -tp16447452p16467385.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to