Thanks, Michael!

But how could I know if the user hasn't done anything? Does it have something 
to do with the RequestCycle? 

Regards,
Martin

-----Original Message-----
From: Michael O'Cleirigh [mailto:michael.ocleir...@rivulet.ca] 
Sent: Tuesday, March 16, 2010 5:45 PM
To: users@wicket.apache.org
Subject: Re: Does AjaxSelfUpdatingBehavior simulate user actions and prevent 
session from expiration?

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:reier...@gmail.com]
> Sent: Tuesday, March 16, 2010 4:08 PM
> To: users@wicket.apache.org
> 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<mase...@velti.com>  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:nino.martinez.w...@gmail.com]
>> Sent: Tuesday, March 16, 2010 3:39 PM
>> To: users@wicket.apache.org
>> 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<mase...@velti.com>
>>
>>      
>>> 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: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to