我的会话如何随机为空? [英] How could randomly my session is null?

查看:77
本文介绍了我的会话如何随机为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Tomcat 6.0,JSF2.0.2

I am using Tomcat 6.0, JSF2.0.2

我意识到随机地HttpServletRequest getSession方法会返回null.

I realized that randomly HttpServletRequest getSession method, returns null.

我可以将会话随机设置为null吗?

I could the session randomly be null?

如何调试将会话设置为null的人?

How can I debug who sets the session to null?

我用request.getSession(true)检查了它,并返回null.无法创建会话怎么可能?

I checked it with request.getSession(true) and it returns null. How could it be that it cannot create a session?

推荐答案

首先,此问题与JSF无关,因为它只是"一个基于组件的MVC框架.这个问题与所讨论的servlet容器更为相关,在本例中就是Tomcat.

First, this problem is not related to JSF since it's "just" a component based MVC framework. This problem is more related to the servletcontainer in question, which is in this case thus Tomcat.

关于这个问题:我之前在特定的门户(如门户)应用程序中已经看到过这一点. Tomcat具有一些内置的网络钓鱼防护功能,当给定的cookie ID和路径与Tomcat的会话管理器中的任何cookie不匹配时,它将阻止返回null会话.通过设置 conf/server.xmltrue中的HTTP连接器 <Connector>.

As to the problem: I've seen this before in specific portal(-like) applications. Tomcat has some builtin phishing prevention which would return a null session when the given cookie ID and path doesn't match with any cookie in Tomcat's session manager. More than often this problem can be solved by setting emptySessionPath attribute of the HTTP Connector <Connector> in conf/server.xml to true.

这篇关于我的会话如何随机为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆