I looked at doing this with a dynamic host page, and still might re-consider it should I get some spare time (unlikely). But we ended up just using a custom servlet to get our data. In our case, we need the server to initialize the data and constants before sending them to the client. We fire this off in the constructor of our primary Presenter, when it comes back it fires an event, the presenter listens for that event before loading up the page since it depends on those constants.
If you just need static data loaded from the server and it doesn't need to be initialized or include anything dynamically generated on the server, then there may be a better way like the DataResource you mentioned or Jens' idea of integrating the resource file copying in your build. On Tuesday, November 12, 2013 5:08:50 PM UTC-5, Geoffrey Arnold wrote: > > Thanks Thomas. `Dictionary` is almost exactly what we need, however our > GWT JavaScript is being loaded in an anonymous function so the variables > aren't being set at `Window` scope. And unfortunately we don't have the > ability to change this because a customer is loading our script. Other > thoughts? > > > On Tue, Nov 12, 2013 at 3:45 AM, Thomas Broyer <[email protected]<javascript:> > > wrote: > >> Use a "dynamic host page": >> http://www.gwtproject.org/articles/dynamic_host_page.html >> >> On Monday, November 11, 2013 7:47:22 PM UTC+1, [email protected]: >>> >>> Hello, >>> >>> What is the best practice for injecting/configuring environment-specific >>> settings inside GWT-generated JavaScript? For example, we have a series of >>> JSONP services hosted across a series of servers, and the hostnames/ports >>> of those servers are different across our development/test/production >>> environments. My guess is `DataResource` is the preferred method, however >>> adding another round-trip to the server seems like a bit of overkill. Is >>> there another way? >>> >>> Thanks in advance, >>> Geoff. >>> >> -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
