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 ...
随机推荐
- python yaml使用
YAML Ain't Markup Language 和GNU一样,YAML是一个递归着说“不”的名字.不同的是,GNU对UNIX说不,YAML说不的对象是XML. YAML不是XML. 为什么不是X ...
- IT第七天 - 类及其属性、方法的理解,断点调试初识,代码优化总结,编程逻辑培养
IT第七天 上午 类 1.对象:是多个实体抽象出来的共同点集合,对象包括:属性(即实体的特征).方法(即尸体的功能作用) 2.程序中,用类来模拟对象 3.类是抽象的,是对象的类型,是将多个拥有相同属性 ...
- Save Princess(丑数)
Save Princess 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Yesterday, the princess was kidnapped by a de ...
- POJ输出状态的逻辑。
实測POJ应该是採取一个一个点測.哪个点fail了就输出哪个点的状态,但接下来的点貌似还是要測. 測试方法,1000先測出有6个測点1,2,3,4,6.15,然后交了下面代码. #include &l ...
- IOS中使用像素位图(CGImageRef)对图片进行处理
IOS中对图片进行重绘处理的方法总结 一.CGImageRef是什么 CGImageRef是定义在QuartzCore框架中的一个结构体指针,用C语言编写.在CGImage.h文件中,我们可以看到下面 ...
- 如何安装系统认证签名过的APK
如果你的App因为权限原因需要设置 android:sharedUserId="android.uid.system" 那么IDE编译出的包通常是无法直接安装的,查看控制台会发现报 ...
- Shell脚本运行hive语句 | hive以日期建立分区表 | linux schedule程序 | sed替换文件字符串 | shell推断hdfs文件文件夹是否存在
#!/bin/bash source /etc/profile; ################################################## # Author: ouyang ...
- UVA 531 - Compromise(dp + LCS打印路径)
Compromise In a few months the European Currency Union will become a reality. However, to join th ...
- DSP连接不上CCS3.3的问题讨论
环境 操作系统:Win7, 64bit IDE:CCS V3.3 仿真器:SEED XDS510PLUS DSP型号:TMS320C6713GDP(DSP6713) 检查步骤 试着按下复位按键后再点击 ...
- sql2008r2局域网复制订阅实操
10.129.186.37 本机 10.129.186.95 服务器 局域网环境 复制类型:事务复制 注意点:要复制的表,必须有主键,否则不可选复制表. 要点1,局域网尝试用共享的方式保存快照文件夹, ...