Google Web Toolkit News - onGWT.com

To content | To menu | To search

Tag - asynchronous

Entries feed - Comments feed

Thursday 15 March 2007

GWT : from asynchronous to synchronous

rapsli :

How can I assure, that the RPC method is called and answer is waited for?

dgirard :

I have just done it with a transparent image, it works perfectly.

Problem with RPC



Tuesday 23 January 2007

Making asynchronous cross-domain requests using GWT

GWT includes in it’s own classes the HTTPRequest class. This class is used to make asynchronous HTTP requests to the originating server. HTTPRequest class has 4 static methods that deal both with GET and POST requests and all of the 4 methods return false if the request fails.
The typical scenario of HTTPRequest usage is to communicate with a remote API (say, Google Maps or Yahoo! Search API) or with your own server-side scripts (php, asp, jsp, etc). In either case using GWT’s hosted mode to make asynchronous calls is NOT going to be straightforward unless your request is targeted to the same domain (different port counts as a different domain so localhost and localhost:8888 are on different domains). To blacken the horizon even more, GWT’s hosted mode runs an embedded tomcat server so if you have hosted locally some php scripts and want to call them using HTTPRequest it is going to fail, since the originating server (the server that has the script making the call) is tomcat running on a different port of your php server (typically apache on port 80). I believe the solution presented here is the best choice among other alternatives, given that it only modifies the tomcat server installation used internally by GWT and not the server holding the scripts or the deployment server. Besides, it’s also possible to do it without the need of any modification whatsoever to the requested URL. But enough theory, let’s jump to the code.

Making asynchronous cross-domain requests using GWT