Hi, thanks for the tip, it works like a charm! Here is some more detailed info for GWT beginners (like me). Like Thomas wrote, in order to set timeout for RPC request, you need to change your functions in xxxAsync interface. For instance instead of:
void getServerInfo(String input, AsyncCallback<String> callback); you should have: RequestBuilder getServerInfo(String input, AsyncCallback<String> callback); And when you call the service, you must explicitly run send() function. Example below: RequestBuilder rb = serviceAsync.getServerInfo(input, new AsyncCallback<String>() { @Override public void onSuccess(String result) { } @Override public void onFailure(Throwable caught) { } }); rb.setTimeoutMillis(6000); try { rb.send(); } catch (RequestException e) { } Many thanks for both answers. Cheers, Andrzej On Sep 11, 10:34 am, Thomas Broyer <t.bro...@gmail.com> wrote: > On 10 sep, 17:00, And <and.bed.w...@gmail.com> wrote: > > > > > Hi, > > I couldn't find a way to set a timeout in GWT RPC call. Am I missing > > something or this is done deliberately? > > > This feature is essential if your client use the system in low quality > > network. Responses from the server might be lost sometimes and we > > don't want obviously to loose one of two active connections to the > > server. > > > I see there is nice implementation of timeout (with abort on > > XmlHttpRequest) in RequestBuilder class, so any http request in GWT > > supports timeout. Why I cannot use timeout with RPC? It should be easy > > to implement because RPC uses RequestBuilder anyway (if I understand > > GWT code correctly). > > > Did anybody cope with this issue? > > Because RpcRequestBuilder (suggested by Sri) is a GWT 2.0 thing; if > you're using a GWT "official release" (hoping it is the latest, 1.7), > you can just declare your method in your xxxAsync to return a > RequestBuilder instead of void; then you can set the RequestBuilder's > timeout before calling send() to actually make the call. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---