abort asynccallback

7 views
Skip to first unread message

Bela

unread,
May 21, 2008, 10:51:11 AM5/21/08
to Google Web Toolkit

How to I abort a asynccallback call in GWT? There is an abort method
for XMLHttpRequst. What is the equivalent command in GWT.

Ian Petersen

unread,
May 21, 2008, 11:21:02 AM5/21/08
to Google-We...@googlegroups.com
On Wed, May 21, 2008 at 10:51 AM, Bela <feket...@yahoo.com> wrote:
> How to I abort a asynccallback call in GWT? There is an abort method
> for XMLHttpRequst. What is the equivalent command in GWT.

I don't know if it's supported in GWT 1.4, but it will be in GWT 1.5.
Instead of making your async methods return void, you can declare that
they return RequestBuilder, or something like that, and use the
returned object to control the request, including aborting it. If you
search the contributors' forum, I think you should be able to find
something. You might have to upgrade to one of the 1.5 Milestone
builds, though.

Ian

--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com

Jason Essington

unread,
May 21, 2008, 12:03:01 PM5/21/08
to Google-We...@googlegroups.com
Actually, it appears that your Async interface can return either:
void, Request, or RequestBuilder

returning void and Request appear to behave the same behind the
scenes, so you could simply define your async interface like:

Request myServiceMethod(String param, AsyncCallback cb);

then

Request request = service.myServiceMethod(param, cb);

and if you decide you want to cancel the RPC, just do

request.cancel()


If you define your Async interface with a RequestBuilder return type,
I believe you would have to invoke the requestBuilder.send() method
yourself to fire the RPC ... but you would have access to more
internals if you needed them.

-jason

Reply all
Reply to author
Forward
0 new messages