Dear gwt group,
I'd like to fetch the contents of a url located in another domain and
print it on the screen. I've pasted code that tries to achieve this
using RequestBuilder. The code throws a security exception since you
can't grab urls from other domains using RequestBuilder. How do I go
about doing what I want to do?
cheers
--Jacques


class LabelInclude extends Label {
  public LabelInclude(final String url) {
    super();
    final LabelInclude widget = this;
    try {
      new RequestBuilder(RequestBuilder.GET, url).sendRequest("",
          new RequestCallback() {
            public void onError(Request request, Throwable exception)
{
                widget.setText("failed");
            }
            public void onResponseReceived(Request request, Response
response) {
              if (response.getStatusCode() == 200) {
                widget.setText(response.getText());
              } else {
                  widget.setText("failed");
              }
            }
          });
    } catch (RequestException e) {
        widget.setText("failed because of:" + e.toString());

    }
  }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to