Giriş
Tomcat Session Manager sanırım hem server.xml hem de context.xml içinde tanımlanabilir
HazelcastSessionManager
Örnek
Şöyle yaparız
<Context>
...
<Manager className="com.hazelcast.session.HazelcastSessionManager"/>
...
</Context>
Tomcat İle Gelen Session Manager Sınıfları
Açıklaması şöyle
A session manager is a component that creates and maintains HTTP sessions for a web application. Tomcat provides two standard implementations of session manager: StandardManager and PersistentManager
StandardManager
Açıklaması şöyle
The StandardManager is the default session manager for Tomcat. It stores active sessions in memory and optionally persists them to a file across application restarts1. You can configure the StandardManager by using the <Manager> element inside the <Context> element of your web application2
Örnek
Şöyle yaparız
<Manager>
<SessionManager>
<className>org.apache.catalina.session.StandardSessionManager</className>
<maxActive>100</maxActive>
<maxIdle>30</maxIdle>
<sessionTimeout>30</sessionTimeout>
</SessionManager>
</Manager>
Örnek
Şöyle yaparız
<Context>
<Manager className="org.apache.catalina.session.StandardManager"
maxActiveSessions="100"
pathname="myapp_sessions.ser"
persistAuthentication="true"/>
</Context>
PersistentManager
Açıklaması şöyle
The PersistentManager is an optional session manager that stores active sessions that have been swapped out to a storage location, such as a file or a database. You can configure the PersistentManager by using the <Manager> element with a nested <Store> element inside the <Context> element of your web application
Örnek - FileStore
Hem PersistentManager hem de StandardManager session bilgisini diske yazabiliyor. Aradaki fark şöyle
StandardManager ... it stores all sessions in a single file of an applications temporary directory.With PersistentManager using FileStore the situation is different: every session is saved in a separate file, according to its JSESSIONID.
Şöyle yaparız
<Context>
<Manager className="org.apache.catalina.session.PersistentManager"
maxActiveSessions="100"
maxIdleSwap="10">
<Store className="org.apache.catalina.session.FileStore"
directory="/tmp/sessions"/>
</Manager>
</Context>
Örnek - JDBCStore
Session bilgisini saklamak için JDBC kullanır. Açıklaması şöyle
It will then use the store to maintain the session on each http request. Note that the documentation assumes that only one http request will be made by the same client at a time.This will allow you to use non sticky session load balancer in front of your java ee servers.
Şöyle yaparız
<Valve className="org.apache.catalina.valves.PersistentValve" />
<Manager className="org.apache.catalina.session.PersistentManager"
distributable="true" processExpiresFrequency="1" maxIdleBackup="1" maxIdleSwap="0"
minIdleSwap="0" >
<Store className="org.apache.catalina.session.JDBCStore"
driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://localhost:5432/develop_4_5_0?currentSchema=datasuite"
connectionName="*" connectionPassword="*"
sessionAppCol="app_name" sessionDataCol="session_data" sessionIdCol="jsession_id"
sessionLastAccessedCol="last_access" sessionMaxInactiveCol="max_inactive"
sessionTable="tomcat_session" sessionValidCol="valid_session" />
</Manager>
Hiç yorum yok:
Yorum Gönder