Hi Martin,

AjaxSelfUpdatingTimerBehavior has an method called onPostProcessTarget(...); its is called each time the ajax request hits the server side.

You will want to add your timeout detection here.

You don't need to turn off the behavior. You can just invalidate the session directly like:

class ExpiringAjaxTimerBehavior extends AjaxSelfUpdatingTimerBehaviour {
....
protected void onPostProcessTarget(final AjaxRequestTarget target)
    {

        if (userHasntDoneAnyThingLimitReached) {
            this.stop();
            Session.get().invalidate();
        }
    }

}

This way if the timer is active it can leverage application state to determine when to expire and if its not running the standard expiry will take place.

Regards,

Mike



My idea is to disable the ajaxselfupdatingtimerbehavior if the user hasn't do 
anything for 15 mins for instance... and set session timeout to another 15, so 
that the session really lasts 30 mins. But I'm just wondering how to do that 
exactly... Any ideas?

Best,
Martin

-----Original Message-----
From: Ernesto Reinaldo Barreiro [mailto:[email protected]]
Sent: Tuesday, March 16, 2010 4:08 PM
To: [email protected]
Subject: Re: Does AjaxSelfUpdatingBehavior simulate user actions and prevent 
session from expiration?

Maybe you can disable your "clock" if the user haven“t performed any other
activity for a while... That way session will expire...

Ernesto

On Tue, Mar 16, 2010 at 2:46 PM, Martin Asenov<[email protected]>  wrote:

And why is that? Shouldn't Wicket session filter such events and not
consider them user interaction with the system?

Thank you both for the replies, and for the link also! Great help!

Regards,
Martin

-----Original Message-----
From: nino martinez wael [mailto:[email protected]]
Sent: Tuesday, March 16, 2010 3:39 PM
To: [email protected]
Subject: Re: Does AjaxSelfUpdatingBehavior simulate user actions and
prevent session from expiration?

yes. Ajax contacts the server. And on each request the timer are reset.

So your ajax behavior are also functioning as a heartbeat or keepalive
feature.

2010/3/16 Martin Asenov<[email protected]>

Hello, everyone!

In my webapp it looks like the session never expires, although I've set
timeout of 30 seconds. But I have a digital clock in my right lower
corner
of the screen, that has an AjaxSelfUpdatingBehavior activated on it. Does
it
simulate user actions, that may cause session not to expiry?

Thank you,
Martin


---------------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to