Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to detect refresh event in Browser
How to detect refresh event in Browser [message #466555] Wed, 11 January 2006 10:21 Go to next message
Yetkin Oezkucur is currently offline Yetkin Oezkucur
Messages: 15
Registered: July 2009
Junior Member
Hi,

We are using the Browser widget to present some information which is
actually stoed in our database. The documents are prepared at runtime and
stored into some temporary files in the temp folder. The browser widget
shows these temporary files.

We've also implemented a locationListener which detects hyperlink clicks to
prepare the next document.

As the user clicks refresh (or F5), he expects to see the actual values from
the database. But our problem is that, we can not detect the refresh event
in the browser. Do you have any idea how to do it?

BTW, we have also regsitered a URLStreamHandlerService in the BundleContext
(OSGI URL_HANDLER_PROTOCOL). This protocol is used to address items in our
database. We are currently using our database as our update site. But the
browser seems to ignore this protocol. Is there way to render documents in
browser using this protocol (e.g: mtb://files/item55.html) ?

Thanks in advance,

Yetkin
Re: How to detect refresh event in Browser [message #466601 is a reply to message #466555] Wed, 11 January 2006 16:02 Go to previous messageGo to next message
Eclipse User
Originally posted by: sunil_kamath.nohotspammail.com

Yetkin Oezkucur <yetkin.oezkucur@asg.com> wrote:
> Hi,
>
> We are using the Browser widget to present some information which is
> actually stoed in our database. The documents are prepared at runtime
> and stored into some temporary files in the temp folder. The browser
> widget shows these temporary files.
>
> We've also implemented a locationListener which detects hyperlink
> clicks to prepare the next document.
>
> As the user clicks refresh (or F5), he expects to see the actual
> values from the database. But our problem is that, we can not detect
> the refresh event in the browser. Do you have any idea how to do it?
>
Why not add meta-tags to prevent caching of your page?
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

--
Sunil
Re: How to detect refresh event in Browser [message #466657 is a reply to message #466601] Thu, 12 January 2006 07:09 Go to previous messageGo to next message
Yetkin Oezkucur is currently offline Yetkin Oezkucur
Messages: 15
Registered: July 2009
Junior Member
This won't work, becuase I am not using a web server here (no server side
page). I am only using the file protocol
My code is something like that:

String path = prepareFile(item1); //path is something like
file://C:/temp/file1.html
browser.setURL(path);
browser.addLocationListener(new LocationListener(){
public void changed(LocationEvent event) {}
public void changing(LocationEvent event) {
item2 = extractItemInfoFromLocation(event.location);
prepareFile(item2); //prepare the next file
file://C:/temp/file2.html
}
}

So, as long as the file1.html exists in the file system, it doesn't matter
whether the browser caches it or not.

Maybe I should use a small web server and implement servlets. But we thought
that using web server etc. woould increse the footprint of our RCP
application.

Yetkin

"Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
news:dq3rpu$t6l$1@utils.eclipse.org...
> Yetkin Oezkucur <yetkin.oezkucur@asg.com> wrote:
>> Hi,
>>
>> We are using the Browser widget to present some information which is
>> actually stoed in our database. The documents are prepared at runtime
>> and stored into some temporary files in the temp folder. The browser
>> widget shows these temporary files.
>>
>> We've also implemented a locationListener which detects hyperlink
>> clicks to prepare the next document.
>>
>> As the user clicks refresh (or F5), he expects to see the actual
>> values from the database. But our problem is that, we can not detect
>> the refresh event in the browser. Do you have any idea how to do it?
>>
> Why not add meta-tags to prevent caching of your page?
> <META HTTP-EQUIV="Expires" CONTENT="0">
> <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
>
> --
> Sunil
>
Re: How to detect refresh event in Browser [message #466666 is a reply to message #466657] Thu, 12 January 2006 13:46 Go to previous messageGo to next message
Eclipse User
Originally posted by: sunil_kamath.nohotspammail.com

Yetkin Ozkucur <yetkin.oezkucur@asg.com> wrote:
> This won't work, becuase I am not using a web server here (no server
> side page). I am only using the file protocol
> My code is something like that:
>
I thought that meta-tags would be used by the browser to control caching.
Not by the server.

--
Sunil
Re: How to detect refresh event in Browser [message #466678 is a reply to message #466657] Fri, 13 January 2006 03:13 Go to previous messageGo to next message
Toshihiro Izumi is currently offline Toshihiro Izumi
Messages: 338
Registered: July 2009
Location: Japan
Senior Member
`Refresh' doesn't change Location.
You may use ProgressListener but be careful about trigger(when you should
call prepareFile()).
changed() will be fired several times, not once.
completed() will not be fired when refresh.
See Bug 107337 - SWT Browser.refresh() does not fire ProgressEvent
https://bugs.eclipse.org/bugs/show_bug.cgi?id=107337
(In case of IE6, event.current=event.total=0 in chaned() means completed.)

(Sorry, I don't know preparing/modifying file in changed() is OK or
not(too late))
Re: How to detect refresh event in Browser [message #466679 is a reply to message #466666] Fri, 13 January 2006 03:22 Go to previous message
Yetkin Oezkucur is currently offline Yetkin Oezkucur
Messages: 15
Registered: July 2009
Junior Member
Hi Sunil,

You are right. The meta tags are for the browser, not server. But it still
doesn't help for my case:
I create the file c:\temp\file1.html and set it as url to the browser. If
you refresh the browser (no matter what meta tags), it will grab and render
the file C:\temp\file.html again. My question was, if I can get an event
from browser during (before or after) this refresh event occurs. What I need
is quiet similar to the LocationListener interface.

Y.
"Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
news:dq686q$rmj$1@utils.eclipse.org...
> Yetkin Ozkucur <yetkin.oezkucur@asg.com> wrote:
>> This won't work, becuase I am not using a web server here (no server
>> side page). I am only using the file protocol
>> My code is something like that:
>>
> I thought that meta-tags would be used by the browser to control caching.
> Not by the server.
>
> --
> Sunil
>
Previous Topic:Excluding custom Composite from tab order
Next Topic:Threading and displaying exceptions in dialog confusion
Goto Forum:
  


Current Time: Wed Apr 16 18:47:52 EDT 2014

Powered by FUDForum. Page generated in 0.09257 seconds