|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cafesip.gwtcomp.client.utils.AsyncCallback<T>
public abstract class AsyncCallback<T>
This abstract class can be used in place of GWT AsyncCallback to automatically handle server communication failure including authentication request from the server. An authentication request is sent by the servlet container to the browser in response to a HTTP request when the HTTP session has timed out because of inactivity and the URL being accessed has an authentication constraint. An RPC call is a HTTP request and therefore, is given the same treatment. GWT does not handle this very well. The RPC call fails with an exception and the application has to handle this. This class takes care of the problem by handling the exception transparently. When an RPC invocation fails, GWT throws an InvocationException. This class assumes that there is a either a session timeout or the server is down. This class displays an alert message and redirects to the login page.
For this to work, the static setLoginURL() method must be called prior to using this class to set the login page.
The abstract methods are invoked when the RPC response is received from the server.
| Constructor Summary | |
|---|---|
AsyncCallback()
|
|
| Method Summary | |
|---|---|
static String |
getLoginURL()
|
abstract void |
onException(Throwable caught)
This method is invoked when the GWTServlet throws an exception. |
void |
onFailure(Throwable caught)
|
abstract void |
onSuccess(T result)
|
static void |
setLoginURL(String loginURL)
Set the login URL. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AsyncCallback()
| Method Detail |
|---|
public final void onFailure(Throwable caught)
onFailure in interface AsyncCallback<T>public abstract void onSuccess(T result)
onSuccess in interface AsyncCallback<T>public abstract void onException(Throwable caught)
caught - public static String getLoginURL()
public static void setLoginURL(String loginURL)
loginURL - The loginURL to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||