views:

58

answers:

1

I am using GWT and PHP and communication is via the RequestBuilder class, but I need to handle internet connection present or not and show some message but RequestBuilder class supports RequestCallback interface which cannot handle internet connection present or not. What is the solution?

+1  A: 

RequestCallback.sendRequest (or just send()) throws RequestException - my guess would be that this is the point of failure in case of no net connection. Additionally, the RequestCallback you pass to the send(Request) method also has an onError method which is:

Called when a Request does not complete normally. A RequestTimeoutException is one example of the type of error that a request may encounter.

You should probably do some testing yourself to see when the RequestException exception is being thrown and when the control gets to onError - although, usually you use the same code/method to handle both cases, so it might not matter which handles what, just that together they handle everything :)

Igor Klimer