java – tomcat中的空会话路径是什么?

我前一天读过apache tomcat文档,我对emptySessionPath感到很困惑.据我所知,如果设置为true,则emptySessionPath将存储在Web应用程序的根文件夹中.请给出术语emptySessionPath的正确定义,如果设置为true和false会发生什么?

请指导我.谢谢.

解决方法

emptySessionPath字段仅指出是否应将所有cookie存储在根URL路径中(如果emptySessionPath = true),否则(否则).

Apache的Connector使用它.查看详细信息here(这适用于AJP Connector,它是Connnector对象的一部分).

这基本上意味着:

If emptySessionPath is enabled in
tomcat,the JSESSIONID cookie is
written to the root “/” path. This
means that whatever webapp you are on
will use the same cookie. Each webapp
will re-write the cookie’s value to
hold that webapp’s session id,and
they are all different.

When this is enabled and servlets in
different webapps are used,requests
from the same user to different
servlets will end up overwriting the
cookie so that when the servlet is
again interacted with it will create
a new session and loose the session it
had already set up.

If emptySessionPath is not set,there
are multiple cookies in the browser,
one for each webapp (none at the
root),so different webapps are not
re-writing each other’s cookie as
above.

JSESSIONID是Webapp的ID会话.查看完整说明here.

更新:有关使用情况的信息有些过时 – 有关如何为最近的tomcat设置会话路径的更新信息,请参阅here.

相关文章

Java中的String是不可变对象 在面向对象及函数编程语言中,不...
String, StringBuffer 和 StringBuilder 可变性 String不可变...
序列化:把对象转换为字节序列的过程称为对象的序列化. 反序...
先说结论,是对象!可以继续往下看 数组是不是对象 什么是对...
为什么浮点数 float 或 double 运算的时候会有精度丢失的风险...
面试题引入 这里引申出一个经典问题,看下面代码 Integer a ...