I am trying out GWT in this 'configuration':
1) I have written a server backend in python which will produce json output (running at localhot:8094)
2) I have written a very simple GWT app that will use RequestBuilder to set GET to the python server (in development mode of the GWT eclipse plugin, it is accessible via http://127.0.0.1:8888/test.html)
The code is simply
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Test implements EntryPoint {
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
*/
private static final String SERVER_URL = "http://localhost:8094";
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network "
+ "connection and try again.";
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, SERVER_URL);
try {
requestBuilder.sendRequest(null, new Jazz10RequestCallback());
} catch (RequestException e) {
Window.alert("Failed to send the message: "
+ e.getMessage());
}
}
class Jazz10RequestCallback implements RequestCallback{
public void onError(Request request, Throwable exception) {
// never reach here
Window.alert("Failed to send the message: "
+ exception.getMessage());
}
public void onResponseReceived(Request request, Response response) {
// render output
Window.alert(response.getText());
}
}
}
However the alert always comes from onResponseReceived and display nothing (empty string I suppose)
I can reach my python server alright and download the json via the browser. But I cannot see any request hitting the server from GWT.
I have ensured that "inherits name='com.google.gwt.http.HTTP" is in the gwt.xml file
Questions are:
1) Is it same site policy restriction at work here? I would expect Exception (and hence the fail message), but it did not happen
2) If it is indeed the same site policy issue, what is the easiest way to deploy the GWT scripts from the python backend? The eclipse gwt plugin produces some artifact in the war subdirectory. Is it sufficient to copy these files to some static directory of my python backend?