The FlexSession is invalid问题
package com.cmbj.soa.servicemonitor.view.service.impl; import java.util.Enumeration; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import flex.messaging.HttpFlexSession;
import flex.messaging.MessageBrokerServlet; public class KMessageBrokerServlet extends MessageBrokerServlet {
@Override
public void service(HttpServletRequest req, HttpServletResponse res) {
HttpSession httpSession = req.getSession(true);
HttpFlexSession flexSession = (HttpFlexSession)httpSession.getAttribute("__flexSession");
if( flexSession != null && !flexSession.isValid()){
httpSession.removeAttribute("__flexSession");
}
// HttpSession httpSession = req.getSession(true);
//
// Enumeration<String> names = httpSession.getAttributeNames();
// String name = null;
// for (; names.hasMoreElements();) {
// name = names.nextElement();
// if (httpSession.getAttribute(name) instanceof HttpFlexSession) {
// HttpFlexSession flexSession = (HttpFlexSession) httpSession.getAttribute(name);
// if(null != flexSession && !flexSession.isValid()){
// httpSession.setAttribute(name,null);
// httpSession.removeAttribute(name);
// }
// System.out.println("HttpFlexSession_name is " + name);
// }
// }
super.service(req, res);
}
}
重写MessageBrokerServlet的service方法,因为异常的源头来自该servlet用了一个invalid的HttpFlexSession去获取Principal,所以只要再service方法之前先判断下当前的HttpFlexSession是否已经无效,无效的话我们就从当前的HttpSession中移除这个无效的HttpFlexSession即可。这样,就能保证MessageBrokerServlet中所用的HttpFlexSession一定是有效的
The FlexSession is invalid问题的更多相关文章
- js报错: Uncaught RangeError: Invalid string length
在ajax请求后得到的json数据,遍历的时候chrome控制台报这个错误:Uncaught RangeError: Invalid string length,在stackoverflow查找答案时 ...
- PhpStorm和WAMP配置调试参数,问题描述Error. Interpreter is not specified or invalid. Press “Fix” to edit your project configuration.
PhpStorm和WAMP配置调试参数 问题描述: Error. Interpreter is not specified or invalid. Press “Fix” to edit your p ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): da.huying.usermanag ...
- 【解决方案】cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/javaee":run-as, "http://java.sun.com/xml/ns/javaee":security-role-r
[JAVA错误] cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One o ...
- ABP Zero示例项目登录报错“Empty or invalid anti forgery header token.”问题解决
ABP Zero项目,登录时出现如图"Empty or invalid anti forgery header token."错误提示的解决方法: 在 WebModule.cs的P ...
- Android之RecyclerView的原生Bug-Inconsistency detected. Invalid view holder adapter positionViewHolder{a1bbfa3 position=2 id=-1, oldPos=-1, pLpos:-1 no parent}
今天在运行自己编写的App时,突然发现App在运行时闪退,然后就查看了Android Studio的Log,发现了这个错误,上网查了一下,才知道是RecyclerView的原生Bug,在数据更新时会出 ...
- {"errcode":40097,"errmsg":"invalid args hint: [vjNe7xxxxxx8vr19]"}——记录一次微信错误处理
错误情况概述: 启动应用之后,微信调用 相机拍照 等接口是可以正常使用的, 但是过了一段时间(2个小时左右--token/jsapi_ticket的过期时间),微信调用相机拍照的功能失效,启用debu ...
- [LeetCode] Remove Invalid Parentheses 移除非法括号
Remove the minimum number of invalid parentheses in order to make the input string valid. Return all ...
- Apache报错信息之Invalid command 'Order', perhaps misspelled or defined by a module not included in the server config
今天配置开启Apache虚拟主机时, 然后日志报错提示: Invalid command 'Order', perhaps misspelled or defined by a module not ...
随机推荐
- Bosch 英语面试准备分享
上周从一个朋友那里了解到长沙一家德国外企Bosch在招人,看了下只有MES工程师是对编程经验有要求的,抱着试一试的态度,就投了简历. 没想到对方周一就给我回电话,希望我好好准备一下英语面试,过段时间去 ...
- XMPP--- error : linker command failed with exit code 1
error: linker command failed with exit code 1 (use -v to see invocation) 错误原因:libidn.a文件没添加上去 解决方法:l ...
- [Android] 文件夹下文件的个数限制
Android机子的文件夹下有存放文件的个数限制,做了下测试,如下: 在创建第65534个文件时抛出了异常: java.io.IOException: open failed: ENOSPC (No ...
- 横瓜先生如何用MDB和XLS等低性能数据库来处理千亿级数据量。
横瓜先生如何用MDB和XLS等低性能数据库来处理千亿级数据量. 横瓜先生曾经用ACCESS做数据库,开发出高性能CMS来处理过TB级的文本数据量,任何请求都可以在10MS内完成,基本就是硬盘延迟的时间 ...
- C++拾遗
1三个概念 字符串字面值是一串常量字符(是一个常量),字符串字面值常量用双引号括起来的零个或多个字符表示,为兼容C语言,C++中所有的字符串字面值都由编译器自动在末尾添加一个空字符.字符串字面值的类型 ...
- application(expand)--easyui
一,效果图. 二,源代码. <!DOCTYPE html><html><head> <meta charset="UTF-8"> & ...
- 设置TextView的密码效果以及跑马灯效果
密码效果以及跑马灯效果: xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...
- 【转】CentOS 6 服务器安全配置指南
原文连接: CentOS 6 服务器安全配置指南(通用) Linux 是一个开放式系统,可以在网络上找到许多现成的程序和工具,这既方便了用户,也方便了黑客,因为他们也能很容易地找到程序和工具来潜入 L ...
- Bugzilla使用手册及解决方案
Bugzilla使用手册 Bugzilla 是一个开源的缺陷跟踪系统(Bug-Tracking System),它可以管理软件开发中缺陷的提交(new),修复(resolve),关闭(close)等整 ...
- POJ2485——Highways
Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public h ...