会话超时在.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
方法,而是直接重定向到索引页。
没有找到相关结果
已邀请:
1 个回复
际恃啸称桅
之前 条件....