我试图在web.xml中按以下方式重命名JSESSIONID,但似乎有时确实在日志中看到了默认名称(我正在登录过滤器,以防提供默认名称),知道吗? 我正在使用Spring 3.2.18和servlet-api-3.1
<session-config>
<session-timeout>45</session-timeout>
<cookie-config>
<path>/</path>
<domain>.example.com</domain>
<name>XXX_JSESSIONID</name>
</cookie-config>
</session-config>
答案 0 :(得分:1)
As you are using spring-3.2.18
you should try the following code to override DefaultCookieSerializer
. You can find detail information in Spring Docs
@Bean
public DefaultCookieSerializer defaultCookieSerializer(){
DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer();
defaultCookieSerializer.setCookieName("mySessionId");
return defaultCookieSerializer;
}