You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Carlo M. Camerino" <cm...@gmail.com> on 2009/05/18 05:32:59 UTC

How To Call A Method When Browser Is Closed

Hi,

I was just wondering if any of you have implemented this in your wicket applications already.
Have you tried calling a logout method when the user closed the browser?
One of the things that I could do is to provide a timeout listener but it would have to wait for the expiration time to happen.

What I would like to happen is this:

User A logins to the application
User A has a session already and accesses some parts of the application.
User A closes the firefox browser.

Upon closing browser, the application automatically logouts User A and destroys server side session.


Thanks

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


Re: How To Call A Method When Browser Is Closed

Posted by Igor Vaynberg <ig...@gmail.com>.
Typing on a phone sucks :)

S/pinh/ping

You can register a map of (sessionid) to (ping timestamp, userid)

-igor

On Sunday, May 17, 2009, Igor Vaynberg <ig...@gmail.com> wrote:
> You can have each page register pinh into an application scoped map.
> Then have a thread checking for timeouts.
>
> -Igor
>
> On Sunday, May 17, 2009, Carlo M. Camerino <cm...@gmail.com> wrote:
>> ya we've done something sort of similar to this one before but
>> it kinda behaves differently on different browsers. Plus issues when the user presses refresh also arises.
>>
>> I was wondering if there was anything server side that can do this ?
>> Can comet implement this?
>>
>> ----- Original Message -----
>> From: "Jeremy Thomerson" <je...@wickettraining.com>
>> To: users@wicket.apache.org
>> Sent: Monday, May 18, 2009 11:35:28 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
>> Subject: Re: How To Call A Method When Browser Is Closed
>>
>> You could try binding to window onUnload event but I think there are
>> limitations as to what you can do within that and it may not always be
>> called.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Sun, May 17, 2009 at 10:32 PM, Carlo M. Camerino
>> <cm...@gmail.com> wrote:
>>> Hi,
>>>
>>> I was just wondering if any of you have implemented this in your wicket applications already.
>>> Have you tried calling a logout method when the user closed the browser?
>>> One of the things that I could do is to provide a timeout listener but it would have to wait for the expiration time to happen.
>>>
>>> What I would like to happen is this:
>>>
>>> User A logins to the application
>>> User A has a session already and accesses some parts of the application.
>>> User A closes the firefox browser.
>>>
>>> Upon closing browser, the application automatically logouts User A and destroys server side session.
>>>
>>>
>>> Thanks
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

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


Re: How To Call A Method When Browser Is Closed

Posted by Carlo Camerino <cm...@gmail.com>.
um,
sory i didn't get it,
what do i have to register, the page itself? what's pinh (sorry)
So i create a map and then i create a scheduled thread?

So that thread has to constantly poll the map?
is there a method in the page that I can use for this?

On Mon, May 18, 2009 at 2:30 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> You can have each page register pinh into an application scoped map.
> Then have a thread checking for timeouts.
>
> -Igor
>
> On Sunday, May 17, 2009, Carlo M. Camerino <cm...@gmail.com> wrote:
>> ya we've done something sort of similar to this one before but
>> it kinda behaves differently on different browsers. Plus issues when the user presses refresh also arises.
>>
>> I was wondering if there was anything server side that can do this ?
>> Can comet implement this?
>>
>> ----- Original Message -----
>> From: "Jeremy Thomerson" <je...@wickettraining.com>
>> To: users@wicket.apache.org
>> Sent: Monday, May 18, 2009 11:35:28 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
>> Subject: Re: How To Call A Method When Browser Is Closed
>>
>> You could try binding to window onUnload event but I think there are
>> limitations as to what you can do within that and it may not always be
>> called.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Sun, May 17, 2009 at 10:32 PM, Carlo M. Camerino
>> <cm...@gmail.com> wrote:
>>> Hi,
>>>
>>> I was just wondering if any of you have implemented this in your wicket applications already.
>>> Have you tried calling a logout method when the user closed the browser?
>>> One of the things that I could do is to provide a timeout listener but it would have to wait for the expiration time to happen.
>>>
>>> What I would like to happen is this:
>>>
>>> User A logins to the application
>>> User A has a session already and accesses some parts of the application.
>>> User A closes the firefox browser.
>>>
>>> Upon closing browser, the application automatically logouts User A and destroys server side session.
>>>
>>>
>>> Thanks
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How To Call A Method When Browser Is Closed

Posted by Igor Vaynberg <ig...@gmail.com>.
You can have each page register pinh into an application scoped map.
Then have a thread checking for timeouts.

-Igor

On Sunday, May 17, 2009, Carlo M. Camerino <cm...@gmail.com> wrote:
> ya we've done something sort of similar to this one before but
> it kinda behaves differently on different browsers. Plus issues when the user presses refresh also arises.
>
> I was wondering if there was anything server side that can do this ?
> Can comet implement this?
>
> ----- Original Message -----
> From: "Jeremy Thomerson" <je...@wickettraining.com>
> To: users@wicket.apache.org
> Sent: Monday, May 18, 2009 11:35:28 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
> Subject: Re: How To Call A Method When Browser Is Closed
>
> You could try binding to window onUnload event but I think there are
> limitations as to what you can do within that and it may not always be
> called.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Sun, May 17, 2009 at 10:32 PM, Carlo M. Camerino
> <cm...@gmail.com> wrote:
>> Hi,
>>
>> I was just wondering if any of you have implemented this in your wicket applications already.
>> Have you tried calling a logout method when the user closed the browser?
>> One of the things that I could do is to provide a timeout listener but it would have to wait for the expiration time to happen.
>>
>> What I would like to happen is this:
>>
>> User A logins to the application
>> User A has a session already and accesses some parts of the application.
>> User A closes the firefox browser.
>>
>> Upon closing browser, the application automatically logouts User A and destroys server side session.
>>
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How To Call A Method When Browser Is Closed

Posted by "Carlo M. Camerino" <cm...@gmail.com>.
ya we've done something sort of similar to this one before but
it kinda behaves differently on different browsers. Plus issues when the user presses refresh also arises.

I was wondering if there was anything server side that can do this ?
Can comet implement this?

----- Original Message -----
From: "Jeremy Thomerson" <je...@wickettraining.com>
To: users@wicket.apache.org
Sent: Monday, May 18, 2009 11:35:28 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
Subject: Re: How To Call A Method When Browser Is Closed

You could try binding to window onUnload event but I think there are
limitations as to what you can do within that and it may not always be
called.

--
Jeremy Thomerson
http://www.wickettraining.com




On Sun, May 17, 2009 at 10:32 PM, Carlo M. Camerino
<cm...@gmail.com> wrote:
> Hi,
>
> I was just wondering if any of you have implemented this in your wicket applications already.
> Have you tried calling a logout method when the user closed the browser?
> One of the things that I could do is to provide a timeout listener but it would have to wait for the expiration time to happen.
>
> What I would like to happen is this:
>
> User A logins to the application
> User A has a session already and accesses some parts of the application.
> User A closes the firefox browser.
>
> Upon closing browser, the application automatically logouts User A and destroys server side session.
>
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


Re: How To Call A Method When Browser Is Closed

Posted by Jeremy Thomerson <je...@wickettraining.com>.
You could try binding to window onUnload event but I think there are
limitations as to what you can do within that and it may not always be
called.

--
Jeremy Thomerson
http://www.wickettraining.com




On Sun, May 17, 2009 at 10:32 PM, Carlo M. Camerino
<cm...@gmail.com> wrote:
> Hi,
>
> I was just wondering if any of you have implemented this in your wicket applications already.
> Have you tried calling a logout method when the user closed the browser?
> One of the things that I could do is to provide a timeout listener but it would have to wait for the expiration time to happen.
>
> What I would like to happen is this:
>
> User A logins to the application
> User A has a session already and accesses some parts of the application.
> User A closes the firefox browser.
>
> Upon closing browser, the application automatically logouts User A and destroys server side session.
>
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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