Gwt 会话超时后重定向到索引页在.war中不工作

Gwt 会话超时后重定向到索引页在.war中不工作,gwt,gwt-ext,Gwt,Gwt Ext,我们正在使用Struts2和GWT-EXT 我们已经装箱了一个LoginInterceptor,它将在执行某些受限任务之前被调用 下面是LoginInterceptor的方法 public String intercept(ActionInvocation arg0) throws Exception { try { System.err.println("inside the login interceptor");

我们正在使用Struts2和GWT-EXT

我们已经装箱了一个LoginInterceptor,它将在执行某些受限任务之前被调用

下面是LoginInterceptor的方法

public String intercept(ActionInvocation arg0) throws Exception {

        try
        {
            System.err.println("inside the login interceptor");
            Map session = arg0.getInvocationContext().getSession();
            User loggedInUser = (User)session.get("loggedInUser");

            if(loggedInUser != null)
            {

                return arg0.invoke();
            }else {

                throw new AuthorizationException("unAuthorized");               
            }

        }catch (Exception e) {          
            throw e;
        }       
    }
课后暂停。。如果用户单击任何按钮。在继续登录之前,将调用Receptor并检查用户是否登录

在代码中

我们有一个方法
public void onFailure(Throwable-catch){

我在哪里查到的

if (caught instanceof InvocationException) {
        if (caught instanceof StatusCodeException
                && caught.getMessage().contains(
                    "<title>Error 500 unAuthorized</title>")) {
            MessageBox.alert("Session Expired", "Session has been expired. Press Ok to redirect to Login page.", new AlertCallback(){ 
                    public void execute(){ 
                        History.newItem(HistoryToken.INDEX_PAGE.toString());
                    } 
                }); 

        } else if (caught.getMessage().contains("LoginInterceptor")) {
            History.newItem(HistoryToken.INDEX_PAGE.toString(), true);
        }
if(捕捉到调用异常的实例){
如果(捕获到StatusCodeException的实例)
&&捕获的.getMessage()包含(
“错误500”)){
MessageBox.alert(“会话已过期”,“会话已过期。按“确定”重定向到登录页。”,new AlertCallback(){
public void execute(){
newItem(HistoryToken.INDEX_PAGE.toString());
} 
}); 
}else if(catch.getMessage()包含(“LoginInterceptor”)){
newItem(HistoryToken.INDEX_PAGE.toString(),true);
}
然后,我将其重定向到索引页面

这在Eclipse中可以在托管模式下正常工作,但当我创建.war并在JBoss中运行它时。它不会进入
onFailure
方法,并直接重定向到索引页。

Hiii

在调用异常代码之前尝试此代码。在
if(捕获调用异常的实例){
条件

if(caught.getMessage().contains("unAuthorized") )
    {
        MessageBox.alert("Session Expired", "Session has been expired. Press Ok to redirect to Login page.", new AlertCallback(){ 
            public void execute(){ 
                History.newItem(HistoryToken.INDEX_PAGE.toString());
            } 
        }); 

    }

在调用异常代码之前尝试此代码。在
if(捕获调用异常的实例){
条件

if(caught.getMessage().contains("unAuthorized") )
    {
        MessageBox.alert("Session Expired", "Session has been expired. Press Ok to redirect to Login page.", new AlertCallback(){ 
            public void execute(){ 
                History.newItem(HistoryToken.INDEX_PAGE.toString());
            } 
        }); 

    }

嗨..谢谢你的回复。我会试试看,然后再回来嗨,朋友…谢谢你的建议。我怎么可能没有试过呢?你救了我的命..再次谢谢你的回复。我会试试看,然后再回来嗨,朋友…谢谢你的建议。我怎么可能没有试过呢?你救了我的命..再次谢谢