夏日蓝雪 2012-07-04 16:07
浏览 784
已采纳

单点登录session丢失问题

最近在做一个移动的CRM项目,发现从4A系统跳转到CRM系统,2边都是测试环境session不会丢失。但是到了2边都是正式系统时,4A的用户信息已经传到CRM。CRM也保存了用户信息。短信也能正常收到。但是到跳转页面的时候,session丢失,直接到超时界面。代码如下:
//Action代码
ActionContext.getContext().getSession().put(WebConstant.SESSION_ATTRIBUTE_USER, user);
ActionContext.getContext().getSession().put("contactphone", operVO.getContactphone());
LoginMACTable.getInstance().put(user);//更新操作员工号对应的MAC地址
doGetSMSAndSend();//发送短信给操作员
return "index";
//过滤器代码
public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) rsp;
String currentURL = request.getRequestURI();
String requestType = request.getHeader("x-requested-with");
//非ajax访问
if(null==requestType || !requestType.equals("XMLHttpRequest"))
{
if (isProtectedResource(currentURL)) {
User user = (User) request.getSession().getAttribute(WebConstant.SESSION_ATTRIBUTE_USER);
if (user != null) {
} else {request.getSession().invalidate();
String contextPath = request.getContextPath();
String errorStr = "top.location.href='" + contextPath + NO_SIGNON_PAGE + "';";
PrintWriter pw = response.getWriter();
pw.write(errorStr);
return;
}

//struts配置

    <global-results>
        <!-- 当返回login视图名时,转入/login.jsp页面 -->
        <result name="login">/login.jsp</result>
        <result name="login2">/login2.jsp</result>
        <result name="logout">/login.jsp</result>
        <result name="index" type="redirect">/index.jsp</result>
     </global-results>


/index.jsp

  • 写回答

2条回答 默认 最新

  • guazixing 2012-07-04 17:55
    关注

    说的不是很详细,使用的cas做的单点登录吧,你说的跳转页面是指什么?你保存用户信息的时候是否创建了session?你的CRM系统的正式环境是否进行了负载均衡?说一说详细情况吧。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵