会话超时在.war中不起作用后重定向到索引页面

| 我们正在使用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;
        }       
    }
会话超时后。如果用户单击任何按钮。在继续之前,LoginInterceptor会被调用并检查用户是否已登录。 在代码中 我们有一种方法
public void onFailure(Throwable caught) {
我在哪里检查
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);
        }
然后,我将其重定向到索引页。 这在托管模式下的Eclipse中正常运行,但是当我创建.war并在JBoss中运行它时。它不属于
onFailure
方法,而是直接重定向到索引页。     
已邀请:
嗨... 在调用异常代码之前尝试此代码。
if (caught instanceof InvocationException) {
之前  条件....
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());
            } 
        }); 

    }
    

要回复问题请先登录注册