Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Tomcat maintain session integrity?

HttpServletRequest's getSession(boolean) method mentions session integrity. How does Tomcat maintains session integrity? What rules does it use? What method? What is happening under the hood precisely?

EDIT

How and when is a specific session ID is created? Does Tomcat rely on IP address and port for example?

like image 696
Jérôme Verstrynge Avatar asked Nov 05 '22 13:11

Jérôme Verstrynge


1 Answers

In Tomcat the ManagerBase.generateSessionId() method is responsible for session id generation. It looks for me that session ids are generated based on random numbers. You can store the client's IP address in the session and check it in your webapp but as far as I know Tomcat does not do that.

About session integrity: could you define it, please? There is a paragraph about it in the Java Servlet Specification, Version 3.0 but it isn't too much:

7.1.4 Session Integrity

Web containers must be able to support the HTTP session while servicing HTTP requests from clients that do not support the use of cookies. To fulfill this requirement, Web containers commonly support the URL rewriting mechanism.

like image 68
palacsint Avatar answered Nov 09 '22 09:11

palacsint