HI All GWT Experts,
Its long time i have been looking for some Synchronous way of making
RPC calls in GWT. Whenever its just one call to server, writing code
is not pain.
But lets say, to initiate one component i need to make following
calls.

1) Check if user is logged in
2) Get Some data List list1  e.g. getUserAddresses
3) Get some data List list2   e.g.  getUserFriends
4) Get Some data List List3  e.g. getUserCommunities
5) now create the UI based on above data retrieved. Now as all GWT RPC
calls are asynchronous, so at the step   5 i am not sure whether all
the calls(1,2,3,4) have completed by the time i reached at step 5, and
there is no Thread object in GWT so i can not wait or join till all
call completes.
And writing such code can be pain.(e.g. writing a Asyncallback for
step 1 then if it success then call step 2 and write asyncallback 2
and in its successs function call step 3 and so on)
Do you guys have any suggestion, how i can achieve this. And on server
side i can not create single API to get all the data in one call, also
sometime i need to call different apis depending on the last call
result
Like if user logged in call above mentioned apis else call some other
apis. And using Asynccallback is really really painful.


I did some R&D and found this calls RequestBuilder which has function
doSend,
      openError = XMLHTTPRequest.open(xmlHttpRequest, httpMethod, url,
true,....)
the above call in this function has one parameter as true, and i guess
if we make it false it can make the call synchronous.

Do you guys see any problem in this,
i am planning to have a global static variable defined which i will be
able to set anytime, and will use in this call
so whenever i want synchronous call i will set it as false and when
want asynchronous set it as true.

Now if its correct then i am wondering why GWT creator didnt gave such
options.

All comments/suggestion are welcome.


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