Thursday, May 27, 2010

Re: Is there a way to wait a RequestBuilder action finished and then do next RequstBuilder action?

When the first request ends, the onSuccess method of the
RequestCallback is called. Send the second request from here. Example:

public void phase1() {
// first request
RequestBuilder b = ...;
...
b.setCallback(new RequestCallback() {
public void onSuccess(...) {
phase2();
}
});
...
}

public void phase2()
{
// second request
...
}

On 27 mai, 09:31, recoco <recoco.zh...@gmail.com> wrote:
> I'm using writing a login process from a remote server with GWT. The
> process is that client get a token first and then use this token and
> username to login in the server. So I wrote two methods. One is
> getToken , another is postLogin. Both use RequestBuider to communate
> to the remote server and should be executed orderly. But I found that
> POST action which is postLogin always execute before getLogin. The
> postLogin method will fail because the token is still not returned
> from the server.
> So, how to wait the first action finished and the perform the second
> one? Thanks in advance.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment