jdevelop
jdevelop

Reputation: 12296

Initialize static collection with service call in GWT

The problem is that I need to get static data from server prior the client application will become "operable".

So I created helper class with static variable of type List and tried to do service call within static block to server (handling onSuccess method to set the static property).

The problem with this approach is that GWT is loading everything at once (it seems), so I may get page rendered while static data is not set yet.

What is the right approach? I know that there is no synchronous calls to remote services, but I really don't want to make async calls to the service all the time when need static data. Perhaps I could implement some proxy, which will do real call to service when the data is needed, and then cache result - but have no idea ow to implement this.

Upvotes: 0

Views: 643

Answers (1)

jusio
jusio

Reputation: 9920

If you want to have some data an app BEFORE app is even loaded you'll have to use the trick called dynamic host page: http://code.google.com/webtoolkit/articles/dynamic_host_page.html

Upvotes: 1

Related Questions