At 11:22 PM 10/10/2010, you wrote:
Hello Ray,

if you are wondering what url the gwt async uses, you can see this in firebug (network tab).

cool

I think you are missing your module in the url.
Dont use GWT.getHostPageBaseURL() use GWT.getModuleBaseURL() and you should be fine.

that and changing greetingService to greet gets me: http://127.0.0.1:8888/rtecg2/greet?input=Command2, and a 405 HTTP method GET is not supported by this URL .

changing get to put does not help
trying a post , gets a 505: javax.servlet.ServletException: Content-Type was 'text/plain; charset=utf-8'. Expected 'text/x-gwt-rpc'.

i am sending just a string. my code (please see below) tries to build a request with a timeout. the normal code that works uses:

greetingService.greetServer(id, new AsyncCallback<String>() { ... }

thanks


private void sendStringToServer(final String string, final Label label) {
Log.info("sending: " + string + ", label=" + label);
final String request = GWT.getModuleBaseURL() + "greet?input=" + string;
Log.info(request);
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, request);
requestBuilder.setTimeoutMillis(60000);
RequestCallback requestCallback = new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
Log.error("fail! " + exception);
label.setText("fail! " + exception);
}

@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);
if (label != null)
label.setText(answer);
}
};

try {
requestBuilder.sendRequest(null, requestCallback);
} catch (RequestException e) {
requestCallback.onError(null, e);
}
}




-Daniel Kurka

2010/10/11 Ray Tayek <<mailto:[email protected]>[email protected]>
At 03:47 PM 10/10/2010, you wrote:
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>() { ... }

...

using the second (please see code below), the code: GWT.getHostPageBaseURL() + "greetingService?input=" + string);

returns: <http://127.0.0.1:8888/greetingService?input=Command1>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>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?


i'm geting a 404, the console says: [WARN] 404 - GET /greetingService?input=command0id (127.0.0.1) 1401 bytes ...

---
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.

Reply via email to