At 07:07 AM 10/11/2010, you wrote:
Are you still using the provided GreetingServiceImpl on server side
that expects a GWT RPC call?

yes. that code is the same except for choosing a response to send to the client.

Because the way you're setting this up is not sending a GWT RPC
request, you're just get/put/post'ing that plaintext
request.  It's perfectly valid to do that, but if your GreetingService
servlet is
still extending RemoteServiceServlet it's going to be expecting a GWT
RPC request..hence the check for 'text/x-gwt-rpc' content-type..and
reject your non-RPC request.

If you want to stick with GWT RPC, you don't use RequestBuilder like
this.

ok.
i am a newbie, so i don't really know. so far all of the stuff that i want to send and receive is just strings.


Based on just your simple use case for timing out an RPC call you can
do something like this with an RpcRequestBuilder implementation that
sets the request timeout to 60000:

ServiceDefTarget async = GWT.create(MyAsync.class);
async.setRpcRequestBuilder(builder);
((MyAsync) async).method(data, callback);

i will try this.

thanks


On Oct 11, 5:29 am, Ray Tayek <[email protected]> wrote:
> 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>htt p://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