GXT: How to bring up the login page when the session expires

I am developing a web application using GXT, Hibernate, mysql, etc. There is a login page for the application. Actually, I am having a problem setting the login page when the session expires. We can set the timeout in the web.xml file, but in this case we cannot redirect to the login page. Can you tell me how to achieve this.

+5
source share
4 answers

I used the concept of throwing exceptions on the server side when the session expired, and then tried to catch the exception on the client side. I do not know if there is a better way to do this.

+2
source

, , , . , . AsyncCallback, GWT RPC:

public abstract class SessionExpiredAwareAsyncCallback<T> implements AsyncCallback<T> {

    @Override
    public void onSuccess(T returnObject) {
        doOnSuccess(returnObject);
    }

    @Override
    public void onFailure(Throwable exception) {
        if (exception instanceof SessionExpiredException) {
            goToLoginPage();
        } else {
            doOnFailure(exception);
        }
    }

    public abstract doOnSuccess(T returnObject);

    public abstract doOnFailure(Throwable exception);
}
+2

gwteventservice .

+1
source

All Articles