大家好,又见面了,我是你们的朋友全栈君。
public class AuthorizationInterceptor extends AbstractInterceptor {
@Override
public String intercept(ActionInvocation ai) throws Exception {
Map<?, ?> session = ai.getInvocationContext().getSession();
UsrinfVO actor = (UsrinfVO) session.get(Constants.LGNUSR);
if (actor == null) {
actor = SpringUtil.getLgnUsr();
}
Action action = (Action) ai.getAction();
if (action instanceof UsrAction) {
return ai.invoke();
}
HttpServletRequest request = ServletActionContext.getRequest();
// AJAX request session time out handle
String type = request.getHeader(“X-Requested-With”);
if ( type != null && type.equalsIgnoreCase(“XMLHttpRequest”)) {
if(!validateLoginStatus(actor)){
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType(“text/html;charset=utf-8”);
PrintWriter pw = response.getWriter();
//request.setAttribute(“message”, “timeout”);
Log.info(“Ajax 超时”);
pw.write(“timeout”);
return null;
}
}
if (!validateLoginStatus(actor)) {
Log.info(“超时退出”);
return “goLoginAppPage”;
}
return ai.invoke();
}
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/146374.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...