Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to get the raw content that is rendered by org.eclipse.swt.browser.Browser
How to get the raw content that is rendered by org.eclipse.swt.browser.Browser [message #454099] Sun, 17 April 2005 10:45 Go to next message
Alessio Pace is currently offline Alessio PaceFriend
Messages: 7
Registered: July 2009
Junior Member
Hi, I am approaching to SWT because I saw there is the package
org.eclipse.swt.browser.Browser which lets me embed a browser (IE or Moz)
in my client side app. That is fine (great job) but I am wondering if and
how I can do these 2 things:

1) assuming the browser component loaded a web page
(browser.setUrl("www.something.somewhere") ), how can I access the raw
content of that loaded page? I tought I could have found a method such
browser.getText(), that is the "dual" method of browser.setText(String
html), but I don't see it (swt 3.1M6)

2) I would like to pre-process the pages before they are rendered by the
browser, modifying the DOM a bit to suit my needs: how can I "hook" myself
between the fetch-the-page step and the render-the-page step of the
browser??

thanks,
Alessio Pace.
Re: How to get the raw content that is rendered by org.eclipse.swt.browser.Browser [message #454165 is a reply to message #454099] Mon, 18 April 2005 17:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doogie03.fastmail.fm

Hi.

I don't think there's a simple way of doing what you want unless you use
a web server. I suggest an embedded web server like Jetty
(http://jetty.mortbay.org/jetty/) - it's easy to setup and use. With an
embedded server (or servlet) you can do all the capturing and
pre-processing of the data you want.

HTH.

~Chris

Alessio Pace wrote:
> Hi, I am approaching to SWT because I saw there is the package
> org.eclipse.swt.browser.Browser which lets me embed a browser (IE or
> Moz) in my client side app. That is fine (great job) but I am wondering
> if and how I can do these 2 things:
>
> 1) assuming the browser component loaded a web page
> (browser.setUrl("www.something.somewhere") ), how can I access the raw
> content of that loaded page? I tought I could have found a method such
> browser.getText(), that is the "dual" method of browser.setText(String
> html), but I don't see it (swt 3.1M6)
>
> 2) I would like to pre-process the pages before they are rendered by the
> browser, modifying the DOM a bit to suit my needs: how can I "hook"
> myself between the fetch-the-page step and the render-the-page step of
> the browser??
>
> thanks,
> Alessio Pace.
>
Re: How to get the raw content that is rendered by org.eclipse.swt.browser.Browser [message #454173 is a reply to message #454099] Mon, 18 April 2005 19:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Paul.Helster.gmail.com

Alessio Pace wrote:
> Hi, I am approaching to SWT because I saw there is the package
> org.eclipse.swt.browser.Browser which lets me embed a browser (IE or
> Moz) in my client side app. That is fine (great job) but I am wondering
> if and how I can do these 2 things:
>
> 1) assuming the browser component loaded a web page
> (browser.setUrl("www.something.somewhere") ), how can I access the raw
> content of that loaded page? I tought I could have found a method such
> browser.getText(), that is the "dual" method of browser.setText(String
> html), but I don't see it (swt 3.1M6)

Why not load it directly from the URL ?

URL url = new URL("www.something.somewhere");
in = url.getInputSrtream();

>
> 2) I would like to pre-process the pages before they are rendered by the
> browser, modifying the DOM a bit to suit my needs: how can I "hook"
> myself between the fetch-the-page step and the render-the-page step of
> the browser??

How about calling browser.setText() with the text that you got from the
URL's input stream?

browser.setText(inAsString);

Paul Helster

>
> thanks,
> Alessio Pace.
>
Re: How to get the raw content that is rendered by org.eclipse.swt.browser.Browser [message #454213 is a reply to message #454173] Tue, 19 April 2005 08:13 Go to previous message
Alessio Pace is currently offline Alessio PaceFriend
Messages: 7
Registered: July 2009
Junior Member
Paul Helster wrote:
> Alessio Pace wrote:
>
>> Hi, I am approaching to SWT because I saw there is the package
>> org.eclipse.swt.browser.Browser which lets me embed a browser (IE or
>> Moz) in my client side app. That is fine (great job) but I am
>> wondering if and how I can do these 2 things:
>>
>> 1) assuming the browser component loaded a web page
>> (browser.setUrl("www.something.somewhere") ), how can I access the raw
>> content of that loaded page? I tought I could have found a method such
>> browser.getText(), that is the "dual" method of browser.setText(String
>> html), but I don't see it (swt 3.1M6)
>
>
> Why not load it directly from the URL ?
>
> URL url = new URL("www.something.somewhere");
> in = url.getInputSrtream();
>
>>
>> 2) I would like to pre-process the pages before they are rendered by
>> the browser, modifying the DOM a bit to suit my needs: how can I
>> "hook" myself between the fetch-the-page step and the render-the-page
>> step of the browser??
>
>
> How about calling browser.setText() with the text that you got from the
> URL's input stream?
>
> browser.setText(inAsString);
>
> Paul Helster
>
>>
>> thanks,
>> Alessio Pace.
>>

You can't do that because there are URLs which are reachable only after
you got cookies, or passing through web forms.. The browser would make
this transparent for me.

Alessio Pace.
Previous Topic:SWT startup problem
Next Topic:Virtual table crash on gtk2
Goto Forum:
  


Current Time: Fri Mar 29 00:03:28 GMT 2024

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

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

Back to the top