1. tomcat5 modification method
Add the org. Apache. Catalina. session_cookie_name parameter to the startup Item.
Linux
Java_opts = '-dorg. Apache. Catalina. session_cookie_name = yousessionname'
Win
Set java_opts = "-dorg. Apache. Catalina. session_cookie_name = yousessionname"
2. Tomcat 6 and tomcat 7 are modified in the same way.
Add the sessioncookiename parameter to the context container label.
<Context Path = "/" docbase = "webapp" reloadable = "false" sessioncookiename = "yoursessionname"> </context>
3. Why is it so easy to use?
Added parameters for tomcat5 to take effect for all the context, which has a great impact. Therefore, it will only be set for context in later versions.
Tomcat5 source code is as follows:
Public final class globals
/**
* The Name Of The cookie used to pass the session identifier back
* And forth with the client.
*/
Public static final string session_cookie_name =
System. getproperty ("org. Apache. Catalina. session_cookie_name ",
"JSESSIONID ");
The source code of tomcat6 and tomcat7 is similar, as shown below:
Public class standardcontext
.... Omitted
/**
* The name to use for session cookies. <code> null </code> indicates that
* The name is controlled by the application.
*/
Private string sessioncookiename;
/**
* Gets the name to use for session cookies.
*
* @ Return the value of the default session cookie name or null if not
* Specified
*/
Public String getsessioncookiename (){
Return sessioncookiename;
}
/**
* Sets the name to use for session cookies. overrides any setting that
* May be specified by the application.
*
* @ Param sessioncookiename the name to use
*/
Public void setsessioncookiename (string sessioncookiename ){
String oldsessioncookiename = This. sessioncookiename;
This. sessioncookiename = sessioncookiename;
Support. firepropertychange ("sessioncookiename ",
Oldsessioncookiename, sessioncookiename );
}