0

I am trying to use GWT to download the source code of web pages, but i do not know where to start, can anyone gives me some key word that i can search on google, or gives me some links from tutorials.

Thanks!!

user200340
  • 3,301
  • 13
  • 52
  • 74

2 Answers2

1

In JavaScript, this is typically done with an XMLHttpRequest. GWT's analog to XMLHttpRequest is RequestBuilder, which can be used like so:

new RequestBuilder("GET", "http://example.com/page.html").sendRequest("", new RequestCallback() {
  @Override
  public void onResponseReceived(Request request, Response response) {
    String src = response.getText();
    // do things with the source
  }
  @Override
  public void onError(Request request, Throwable throwable) {
    // handle the error
  }
});
Jason Hall
  • 20,632
  • 4
  • 50
  • 57
-1

Some GWT manual about cross-site scripting https://developers.google.com/web-toolkit/doc/latest/tutorial/Xsite

And here some discussion about using RequestBuilder and JSNI GWT RequestBuilder - Cross Site Requests

As alternative you can do a page download on the server-side...

Community
  • 1
  • 1
Bitman
  • 1,996
  • 1
  • 15
  • 18