Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » observe when user hit the browser refresh button
observe when user hit the browser refresh button [message #117627] Tue, 06 January 2009 14:15 Go to next message
rollo is currently offline rolloFriend
Messages: 117
Registered: July 2009
Senior Member
Hi,

I have a little problem.
I'm using a background thread to update some data from a server every 20
seconds.

The user can start and stop the update manually.
But when this update is running and the user is pressing the refresh
button of the browser, I get an SWTException: Invalid thread access.

Is there any possibility to observe when user hit the browser refresh
button, so that I can first stop this update???

Roland
Re: observe when user hit the browser refresh button [message #117640 is a reply to message #117627] Tue, 06 January 2009 14:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

Hi Roland,

the problem is that there doesn't seem to be a reliable way to notice when the user leaves the page or closes the browser.
the method postWindowClose() is not called in this case. this is a problem for me, because i have to rely on the tomcat
session timeout to close the ressources (database etc.). the postWindowClose() is only called when the User uses a logout or
exit action. it is possible to specify a exitconfirmation when the user leaves the page or closes the browser, but this is realised
with a simple javascript function that pops up a dialog with a string. if there is, or will be, any way to bind a method call, upon leaving the
browser, via javascript i'd really love to hear it :).

if the session is destroyed upon refreshing the page you could hook an listener on the session and use the method beforeDestroy() to cancel running
jobs...

greetings,
ben


Roland Siebert schrieb:
> Hi,
>
> I have a little problem.
> I'm using a background thread to update some data from a server every 20
> seconds.
>
> The user can start and stop the update manually.
> But when this update is running and the user is pressing the refresh
> button of the browser, I get an SWTException: Invalid thread access.
>
> Is there any possibility to observe when user hit the browser refresh
> button, so that I can first stop this update???
>
> Roland
Re: observe when user hit the browser refresh button [message #117650 is a reply to message #117640] Tue, 06 January 2009 16:08 Go to previous messageGo to next message
rollo is currently offline rolloFriend
Messages: 117
Registered: July 2009
Senior Member
Hmm,

I tried out the method postWindowClose() and it will be called when I
hit the refresh button.

Roland

Ben W. schrieb:
> Hi Roland,
>
> the problem is that there doesn't seem to be a reliable way to notice
> when the user leaves the page or closes the browser.
> the method postWindowClose() is not called in this case. this is a
> problem for me, because i have to rely on the tomcat
> session timeout to close the ressources (database etc.). the
> postWindowClose() is only called when the User uses a logout or
> exit action. it is possible to specify a exitconfirmation when the user
> leaves the page or closes the browser, but this is realised
> with a simple javascript function that pops up a dialog with a string.
> if there is, or will be, any way to bind a method call, upon leaving the
> browser, via javascript i'd really love to hear it :).
>
> if the session is destroyed upon refreshing the page you could hook an
> listener on the session and use the method beforeDestroy() to cancel
> running
> jobs...
>
> greetings,
> ben
Re: observe when user hit the browser refresh button [message #117661 is a reply to message #117650] Tue, 06 January 2009 16:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hi,

could you please check if the method is also called when closing the browser (X) or leaving the url?

greetings,
ben


Roland Siebert schrieb:
> Hmm,
>
> I tried out the method postWindowClose() and it will be called when I
> hit the refresh button.
>
> Roland
>
> Ben W. schrieb:
>> Hi Roland,
>>
>> the problem is that there doesn't seem to be a reliable way to notice
>> when the user leaves the page or closes the browser.
>> the method postWindowClose() is not called in this case. this is a
>> problem for me, because i have to rely on the tomcat
>> session timeout to close the ressources (database etc.). the
>> postWindowClose() is only called when the User uses a logout or
>> exit action. it is possible to specify a exitconfirmation when the
>> user leaves the page or closes the browser, but this is realised
>> with a simple javascript function that pops up a dialog with a string.
>> if there is, or will be, any way to bind a method call, upon leaving the
>> browser, via javascript i'd really love to hear it :).
>>
>> if the session is destroyed upon refreshing the page you could hook an
>> listener on the session and use the method beforeDestroy() to cancel
>> running
>> jobs...
>>
>> greetings,
>> ben
Re: observe when user hit the browser refresh button [message #117777 is a reply to message #117661] Wed, 07 January 2009 10:44 Go to previous messageGo to next message
rollo is currently offline rolloFriend
Messages: 117
Registered: July 2009
Senior Member
Hi,

yes, it will be called when you reload the page, close the browser,
close the tab and also when you type another url.

Roland


Ben W. schrieb:
> hi,
>
> could you please check if the method is also called when closing the
> browser (X) or leaving the url?
>
> greetings,
> ben
>
>
> Roland Siebert schrieb:
>> Hmm,
>>
>> I tried out the method postWindowClose() and it will be called when I
>> hit the refresh button.
>>
>> Roland
>>
>> Ben W. schrieb:
>>> Hi Roland,
>>>
>>> the problem is that there doesn't seem to be a reliable way to notice
>>> when the user leaves the page or closes the browser.
>>> the method postWindowClose() is not called in this case. this is a
>>> problem for me, because i have to rely on the tomcat
>>> session timeout to close the ressources (database etc.). the
>>> postWindowClose() is only called when the User uses a logout or
>>> exit action. it is possible to specify a exitconfirmation when the
>>> user leaves the page or closes the browser, but this is realised
>>> with a simple javascript function that pops up a dialog with a
>>> string. if there is, or will be, any way to bind a method call, upon
>>> leaving the
>>> browser, via javascript i'd really love to hear it :).
>>>
>>> if the session is destroyed upon refreshing the page you could hook
>>> an listener on the session and use the method beforeDestroy() to
>>> cancel running
>>> jobs...
>>>
>>> greetings,
>>> ben
Re: observe when user hit the browser refresh button [message #117788 is a reply to message #117777] Wed, 07 January 2009 11:31 Go to previous messageGo to next message
Stefan Hansel is currently offline Stefan HanselFriend
Messages: 103
Registered: July 2009
Senior Member
>> yes, it will be called when you reload the page, close the browser,
>> close the tab and also when you type another url.

Is this a new feature ? Some time ago exactly that didn't work (at least
not when closing the browser) and I can't remember having read something
about this in the release notes ?
That would be really great indeed, if that worked now !
Re: observe when user hit the browser refresh button [message #117800 is a reply to message #117788] Wed, 07 January 2009 12:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

Hi,


i've tested this by launching the app from eclipse and launching deployed on a tomcat.
using firefox, it seems that the mechanism works fine now, the method is called when leaving
the url or closing the browser, almost always. With Internet Explorer it doesn't seem to work
very reliable but the method is also called many times.

this is a very pleasant change because this didn't work so reliably in the past which gave
me some problems.

very nice!!!


greetings
ben



stefan.hansel@tolina.de schrieb:
>>> yes, it will be called when you reload the page, close the browser,
>>> close the tab and also when you type another url.
>
> Is this a new feature ? Some time ago exactly that didn't work (at least
> not when closing the browser) and I can't remember having read something
> about this in the release notes ?
> That would be really great indeed, if that worked now !
Re: observe when user hit the browser refresh button [message #117811 is a reply to message #117800] Wed, 07 January 2009 12:41 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Just a note of clarification, there are reliable mechanisms to
observe *whenever* a session terminates (e.g. ISessionStoreListener,
postWindowClose). However, closing the browser window or tab does
*not* terminate the session. The session is terminated after the
session-timeout has elapsed without any request being sent to the
session.
In RAP, this behavior hasn't changed since ever.

HTH
Rüdiger


Ben W. wrote:
> Hi,
>
>
> i've tested this by launching the app from eclipse and launching
> deployed on a tomcat.
> using firefox, it seems that the mechanism works fine now, the method is
> called when leaving
> the url or closing the browser, almost always. With Internet Explorer it
> doesn't seem to work
> very reliable but the method is also called many times.
>
> this is a very pleasant change because this didn't work so reliably in
> the past which gave
> me some problems.
>
> very nice!!!
>
>
> greetings
> ben
>
>
>
> stefan.hansel@tolina.de schrieb:
>>>> yes, it will be called when you reload the page, close the browser,
>>>> close the tab and also when you type another url.
>>
>> Is this a new feature ? Some time ago exactly that didn't work (at
>> least not when closing the browser) and I can't remember having read
>> something about this in the release notes ?
>> That would be really great indeed, if that worked now !
Re: observe when user hit the browser refresh button [message #117822 is a reply to message #117811] Wed, 07 January 2009 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

Hi Rüdiger,


i use the postWindowClose() method to close the session immediately (set the timeout on 1 second programmatically), the
ISessionStoreListener always worked fine, that's right.


Greetings,
ben



Rüdiger Herrmann schrieb:
> Just a note of clarification, there are reliable mechanisms to observe
> *whenever* a session terminates (e.g. ISessionStoreListener,
> postWindowClose). However, closing the browser window or tab does *not*
> terminate the session. The session is terminated after the
> session-timeout has elapsed without any request being sent to the session.
> In RAP, this behavior hasn't changed since ever.
>
> HTH
> Rüdiger
>
>
> Ben W. wrote:
>> Hi,
>>
>>
>> i've tested this by launching the app from eclipse and launching
>> deployed on a tomcat.
>> using firefox, it seems that the mechanism works fine now, the method
>> is called when leaving
>> the url or closing the browser, almost always. With Internet Explorer
>> it doesn't seem to work
>> very reliable but the method is also called many times.
>>
>> this is a very pleasant change because this didn't work so reliably in
>> the past which gave
>> me some problems.
>>
>> very nice!!!
>>
>>
>> greetings
>> ben
>>
>>
>>
>> stefan.hansel@tolina.de schrieb:
>>>>> yes, it will be called when you reload the page, close the browser,
>>>>> close the tab and also when you type another url.
>>>
>>> Is this a new feature ? Some time ago exactly that didn't work (at
>>> least not when closing the browser) and I can't remember having read
>>> something about this in the release notes ?
>>> That would be really great indeed, if that worked now !
Re: observe when user hit the browser refresh button [message #117846 is a reply to message #117822] Wed, 07 January 2009 14:11 Go to previous message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Ben,

sorry, my previous post was misleading. Of course the
SessionStoreListener is the only way to stay informed about the end
of a session.

Cheers,
Rüdiger


Ben W. wrote:
> Hi Rüdiger,
>
>
> i use the postWindowClose() method to close the session immediately (set
> the timeout on 1 second programmatically), the
> ISessionStoreListener always worked fine, that's right.
>
>
> Greetings,
> ben
>
>
>
> Rüdiger Herrmann schrieb:
>> Just a note of clarification, there are reliable mechanisms to observe
>> *whenever* a session terminates (e.g. ISessionStoreListener,
>> postWindowClose). However, closing the browser window or tab does
>> *not* terminate the session. The session is terminated after the
>> session-timeout has elapsed without any request being sent to the
>> session.
>> In RAP, this behavior hasn't changed since ever.
>>
>> HTH
>> Rüdiger
>>
>>
>> Ben W. wrote:
>>> Hi,
>>>
>>>
>>> i've tested this by launching the app from eclipse and launching
>>> deployed on a tomcat.
>>> using firefox, it seems that the mechanism works fine now, the method
>>> is called when leaving
>>> the url or closing the browser, almost always. With Internet Explorer
>>> it doesn't seem to work
>>> very reliable but the method is also called many times.
>>>
>>> this is a very pleasant change because this didn't work so reliably
>>> in the past which gave
>>> me some problems.
>>>
>>> very nice!!!
>>>
>>>
>>> greetings
>>> ben
>>>
>>>
>>>
>>> stefan.hansel@tolina.de schrieb:
>>>>>> yes, it will be called when you reload the page, close the
>>>>>> browser, close the tab and also when you type another url.
>>>>
>>>> Is this a new feature ? Some time ago exactly that didn't work (at
>>>> least not when closing the browser) and I can't remember having read
>>>> something about this in the release notes ?
>>>> That would be really great indeed, if that worked now !
Previous Topic:Equinox - Jetty - Rap - Default Page - Index.html
Next Topic:Problem with popup menu of table
Goto Forum:
  


Current Time: Thu Dec 05 23:16:56 GMT 2024

Powered by FUDForum. Page generated in 0.04562 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top