Hi Guys. Below is a general structure of my onModuleLoade()
onModuleLoad{
/*show some loading alert*/
................. (some code)
try {
Request request = builder.sendRequest(null, new
RequestCallback() {
public void onError(Request request, Throwable
exception) {
errorMsg.setVisible(true);
}
public void onResponseReceived(Request request,
Response response)
{
if (200 == response.getStatusCode()) {
try {
// parse the response text into JSON
JSONValue jsonValue =
JSONParser.parse(response.getText());
JSONObject jsonObject =
jsonValue.isObject();
if (jsonObject != null) {
//do initialize the page
...............some code
} else {
throw new JSONException();
}
} catch (JSONException e) {
errorMsg.setVisible(true);
errorMsg.set("Could not parse JSON");
}
} else {
errorMsg.setVisible(true);
errorMsg.set("Couldn't
retrieve JSON (" + response.getStatusText() + ")");
}
}
});
} catch (RequestException e) {
errorMsg.setVisible(true);
errorMsg.set("Couldn't retrieve JSON");
}
}
This is actually working fine in the host mode and IE. But in FF and
safari, it only display the loading message and will never proceed the
onResponseReceived() or onError() methods of the HttpRequest object.
And I also tried to wrap the code that initialize the page in a
deferredCommand. The result is the same, working fine in IE. And in FF
and safari, the deferredCommand part will be processed immediately (I
mean before receiving the http response).
So any one has idea about this?
Cheers.....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---