Friday, October 29, 2010

Re: About async calls...

Waiting for the role to return and creating the app in onSuccess() is a perfectly valid solution.  To do so, you would just move your Widget initialization code into onSuccess().

Alternatively, you can load the app first, then populate it when the RPC request returns.  It would be a little more complicated, but the app would appear more responsive to the user because it loads immediately.
1. Send RPC request
2. Synchronously create the app
3. When RPC request returns, populate the state of the app.  If RPC request returns before the app it initialized, hold it until after the app is initialized.

Thanks,
John LaBanca
jlabanca@google.com


On Fri, Oct 29, 2010 at 5:03 AM, Pablo G.F <blayhck@gmail.com> wrote:
Hello:

I´m building a webapp which, depending on the user, will show some
options on the menu or other ones. For doing this, I invoke a Single
Singed On method passing as arguments, the user and the application
and getting as return value a string identifying the "role" of the
user. As I´m using GWT, I can´t invoke the SSO method from the client
side, so I have to make a RPC to the server, which will invoke the
method and return the "role" to the client.
I do all of this before "start creating the widgets that will be
showed", but I face the problem of asyncronous calls.
I invoke the RPC, but the return value may come late (by late I mean
when it has already started "building the widgets and appearance of
the web application".
The only solution I see (and I don´t know if it´s correct or even
possible) is start the building part  in the body of "onSuccess(String
result)" method, of the callback method associated to the RPC call.

I don´t know if I explanied it right...but I hope so.

Any other idea?

Thanks

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


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