tags:

views:

42

answers:

1

Hi all,

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!!

+1  A: 

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