Let your own wicket session object implement session bind listener
(dont know the excact name) then you have those lifecycle events on
your wicket session object itself.
By the way only in newer servlet specs that you can call getID() on
the httpsession that was also not allowed for quite a while, thats why
we keep the session id in wicket session itself
On 4/16/08, sander v F <[EMAIL PROTECTED]> wrote:
> Example:
>
>
> public class PojoUpdater implements HttpSessionListener
> {
> private static Map<String, Object> pojos = new HashMap<String,
> Object>();
>
> public void sessionCreated(HttpSessionEvent se)
> {
> //do nothing
> }
>
> public void sessionDestroyed(HttpSessionEvent se)
> {
> Object object=pojos.get(se.getSession().getId());
> if(object != null)
> {
> // Do what you want here with the object
> }
> }
>
> public static void registerPojo(String sessionId,Object object)
> {
> pojos.put(sessionId,object);
> }
> }
>
> 2008/4/16, sander v F <[EMAIL PROTECTED]>:
> >
> > You could also use a HttpSessionListener for knowing when a session is
> > destroyed. The problem is indeed that you can't get the attributes when
> the
> > session is invalidated, but you can get the sessionId. So you could use a
> > Map to register the session id with the Pojo you would like to update. So
> > when the session get's destroyed you can update the Pojo.
> >
> > See
> >
> http://www.stardeveloper.com/articles/display.html?article=2001112001&page=1for
> an example with the HttpSessionListener.
> >
> >
> >
> >
> > 2008/4/16, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]>:
> > >
> > > So what do you think?
> > >
> > > Im not sure how common a case this is ?
> > >
> > >
> > > regards Nino
> > >
> > > Nino Saturnino Martinez Vazquez Wael wrote:
> > >
> > > > Hmm, that feels a bit hacky.. Then I'll need to implement a way of
> > > > tracking sessions, and I saw something about keeping references to
> destroyed
> > > > sessions arent that great.
> > > >
> > > > It might be me that's just way of context(not knowing all of the
> > > > internals), but should something like this be easy todo in wicket?
> > > >
> > > > Like maybe have a onDestroy or onExpire(or both?) in session class?
> > > > However I have no idea on how much overhead this would bring to
> applications
> > > > that does not use the feature.
> > > >
> > > >
> > > > regards Nino
> > > >
> > > > Johan Compagner wrote:
> > > >
> > > > > attached to a session of the session that is just invalided/expired?
> > > > > That wont work. You cant get to a http sessions attributes when it
> > > > > is
> > > > > invalidated.
> > > > >
> > > > > To know which session id's are destroyed:
> > > > >
> > > > > public void sessionDestroyed(String sessionId) of WebApplication
> > > > >
> > > > > johan
> > > > >
> > > > >
> > > > > On Tue, Apr 15, 2008 at 9:07 AM, Nino Saturnino Martinez Vazquez
> > > > > Wael <
> > > > > [EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > I've checked a little around, but could not find anything
> > > > > > directly. This
> > > > > > is what I want todo:
> > > > > >
> > > > > > When a user either logs out or expire I want to update a pojo
> > > > > > attached to
> > > > > > session.
> > > > > >
> > > > > > So does anyone have an example on how todo this(if possible)?
> > > > > >
> > > > > > --
> > > > > > -Wicket for love
> > > > > >
> > > > > > Nino Martinez Wael
> > > > > > Java Specialist @ Jayway DK
> > > > > > http://www.jayway.dk
> > > > > > +45 2936 7684
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > --
> > > -Wicket for love
> > >
> > > Nino Martinez Wael
> > > Java Specialist @ Jayway DK
> > > http://www.jayway.dk
> > > +45 2936 7684
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]