欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

jsessionid 如何删除

最编程 2024-07-11 20:41:33
...
3月16日,北京源创会 —— “数据库,2024 开炫”

1. 如果你是 Tomcat 6的话, 'disableURLRewriting' attribute 设置为 true

找到你tomcat的 context.xml 文件 

1

2

3

<?xml version='1.0' encoding='utf-8'?>

<Context docBase="PATH_TO_WEBAPP" path="/CONTEXT" disableURLRewriting="true">

</Context>

 

 

下面是 Attribute disableURLRewriting 官方说明

Set to true to disable support for using URL rewriting to track session IDs for clients of this Context. URL rewriting is an optional component of the servlet 2.5 specification but disabling URL rewriting will result in non-compliant behaviour since the specification requires that there must be a way to retain sessions if the client doesn't allow session cookies. If not specified, the specification compliant default value of false will be used.

 

2. 如果你是 Tomcat 7+

The Servlet 3.0 standard gives you two ways to disable URL session rewriting. 

 

第一种途径你可以修改 web.xml :

1

2

3

<session-config>

     <tracking-mode>COOKIE</tracking-mode>

</session-config>

或者你在代码里面使用

1

servletContext.setSessionTrackingModes(EnumSet.of(SessionTrackingMode.COOKIE));