hi, i would like to add a timeout to some of my async callbacks. i am
using a hacked up version of greet server. the normal code:
greetingService.greetServer(id, new AsyncCallback<String>() { ... }
works fine.
i found this:
http://www.mail-archive.com/[email protected]/msg25955.html,
and this: http://code.google.com/p/json-object/wiki/ExampleApplicationit.
using the second (please see code below), the
code: GWT.getHostPageBaseURL() + "greetingService?input=" + string);
returns: http://127.0.0.1:8888/greetingService?input=Command1
the url that the browser uses is:
http://127.0.0.1:8888/Rtecg2.html?gwt.codesvr=127.0.0.1:9997
can someone tell me the correct url to use or how to fix the code to
get it programatically?
thanks
private void sendStringToServer(final String string,final Label label) {
final String request= GWT.getHostPageBaseURL() +
"greetingService?input=" + string;
Log.info(request);
RequestBuilder requestBuilder = new
RequestBuilder(RequestBuilder.GET, GWT.getHostPageBaseURL() +
"greetingService?input=" + string);
requestBuilder.setTimeoutMillis(60000);
RequestCallback requestCallback = new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
Log.error("fail!");
label.setText("fail!");
}
@Override
public void onResponseReceived(Request request, Response response) {
int statusCode = response.getStatusCode();
if (statusCode != Response.SC_OK) {
this.onError(request, null);
return;
}
final String answer = response.getText();
Log.info("answer=" + answer);
label.setText(answer);
}
};
try {
requestBuilder.sendRequest(null, requestCallback);
} catch (RequestException e) {
requestCallback.onError(null, e);
}
}
---
co-chair http://ocjug.org/
--
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.