Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom session manager in tomcat

Tags:

tomcat

tomcat7

Where can I find documentation on creating a custom session manager for Tomcat?

For example:

How do I configure my session manager in tomcats server.xml?
What interface must be implemented to use my session manager?

like image 237
Chris Johnson Avatar asked Dec 30 '11 19:12

Chris Johnson


People also ask

How does Tomcat session management work?

In session management, Tomcat creates a session id whenever client's first request gets to the server (However, other servlet containers may behave differently). Then it inserts this session id into a cookie with a name JSESSIONID and sends along with the response.

Which Tomcat configuration file is used to manage Tomcat session?

The server. xml file is Tomcat's main configuration file, and is responsible for specifying Tomcat's initial configuration on startup as well as defining the way and order in which Tomcat boots and builds.

What is jvmRoute in Tomcat?

jvmRoute. A routing identifier for this Tomcat instance. It will be added to the session id to allow for stateless stickyness routing by load balancers. The details on how the jvmRoute will be included in the id are implementation dependent.

How does Tomcat store session data?

Tomcat's sessions are stored according to chosen session manager. If we pick the standard manager (StandardManager class saw previously), all session data will be saved into Java heap. The storing of session data in JVM memory is a dangerous idea.


1 Answers

Q: How do I configure my session manager in tomcats server.xml ?
A: <Manager... goes inside <Context.... From Tomcat docs:

A Manager element MAY be nested inside a Context component. If it is not included, a default Manager configuration will be created automatically, which is sufficient for most requirements, — see Standard Manager Implementation below for the details of this configuration.

Q: What interface must be implemented to use my session manager ?
A: org.apache.catalina.Manager

like image 96
mindas Avatar answered Oct 07 '22 14:10

mindas