I have worked with GWT quite a bit, including rpc, however I have been
unable to get a simple com.google.gwt.http.client.Request working. I
have included the module into mine and am using the example code. The
callback onResponseReceived() always receives a response object with
the status code == 0. response.getHeadersAsString() gives a null
exception. I have played with different WOKRING urls and I always get
the same results. I have the same results with gwt 2.0.3 and 2.1.1
thanks, Chet
String url = "
http://localhost/index.html";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
URL.encode(url));
try {
Request request = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
displaySearchResults( "ERROR" );
}
public void onResponseReceived(Request request,
com.google.gwt.http.client.Response response) {
if (200 == response.getStatusCode()) {
displaySearchResults( response.getText() );
} else {
displaySearchResults( "WRONG STATUS CODE" );
}
}
});
} catch (RequestException e) {
displaySearchResults( "CONNECT ERROR" );
}
}