-1

I am running apache-tomcat-6.0.53 on my web application server, i deploy application using spring and struts. when i access my webpage it creates JSESSIONID=xxxxxxxx automatically. i want to add another JSESSIONID but with different name, i want to check this another cookies in my app to detect state of user when access my app.

is it possible to create another JSESSIONID with another name such as LSESSIONID=xxxxxxx from tomcat settings?

Thanks

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
  • ...in order to do what? You can create as many cookies as you like, but it sounds that you're having something particular in mind with it – Olaf Kock Jul 18 '17 at 07:38
  • @OlafKock how to create it? from my application or in tomcat?. i want to check cookies which exist to detect activity of user. if exist this user enable do something, if not exist he/she not. – Bagas Widodo Jul 18 '17 at 07:54
  • I'm clueless. Please edit the question to give us *the full story* not just what you came up with in order to implement whatever you want to implement. You don't "detect activity" by "checking cookies", especially not when mentioning JSESSIONID or the option to change this name. These things are completely unrelated. – Olaf Kock Jul 18 '17 at 08:00
  • No @OlafKock , i want to add another JSESSIONID but with another name. not change name of JSESSIONID for example LSESSIONID. why i rename it, because in my application server running more than one application and it creates JSESSIONID. is it possible to create another one not from my application? – Bagas Widodo Jul 18 '17 at 08:20

1 Answers1

0

I think you have a naming issue, which led to the long comment stream. If you want to add another Cookie, this can easily be done by calling response.addCookie()

Of course, this cookie can have an arbitrary name. And you're not limited to those sounding similar to JSESSIONID.

Replying to your comment, you're still confusing me: Why would tomcat want to have multiple session cookies when one is fully sufficient. Tomcat cares for one session and one only. If you prefer to handle additional cookies and associate them with more behaviour, the rest is up to you.

If you don't like the name JSESSIONID and want to change it: This is what you do.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90