java - 启用 URL 重写以在 tomcat 7 上使用 jsessionid

标签 java tomcat url-rewriting tomcat7 jsessionid

我在 tomcat 7 上运行 java 应用程序。

在我的特定情况下,我需要在 URL 中发送 jsessionid。 将 ;jsessionid=0123456789ABCDEF0123456789ABCDEF 添加到 URL 不起作用 - jsessionid cookie 值未正确设置。

我查到一个信息,说从tomcat 4开始,url重写默认是关闭的。

如何为 tomcat 7 启用此功能?

是否需要在服务器配置中设置特定的规则?

最佳答案

根据文档,需要在应用程序的 Context 配置中设置属性 cookies="false"

Set to true if you want cookies to be used for session identifier communication if supported by the client (this is the default). Set to false if you want to disable the use of cookies for session identifier communication, and rely only on URL rewriting by the application.

关于java - 启用 URL 重写以在 tomcat 7 上使用 jsessionid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46338165/

相关文章:

java - Eclipse 甚至不会在被告知时尝试编译/运行

javac 声称我没有覆盖抽象类实现中的方法,而我显然是

java - Tomcat8 和 waffle 集成

java - 如何正确转义 JSP 标签中的三重嵌套引号

regex - 从分页 URL 中删除 "page"

java - UrlEncodedFormEntity 替换

java - Android Spinner 更改箭头颜色

java - Spring Boot 嵌入式 tomcat 服务器占用超过 800 MB 内存?

regex - Nginx 将规则路径重写为查询字符串

c# - IIS 反向代理干扰重定向位置 header