Skip to main content
Version: 7.2405.x.x LTS

MySQL session store configuration example

If a session is needed, it is the SessionManagementFilter that creates as well as handles the session and defines the method of session binding (for example with cookies). The session store servlets, such as the MySQLSessionStoreServlet, are responsible for storing and loading the session data.

To set up a cookie-based SessionManagementFilter with a MySQL session store, configure the web.xml file as shown in the sample code below:

<filter>
<filter-name>CookieBasedSessionManagementFilter</filter-name>
<filter-class>ch::nevis::nevisproxy::filter::session::SessionManagementFilter</filter-class>
<init-param>
<param-name>Servlet</param-name>
<param-value>MySQLSessionStoreServlet</param-value>
</init-param>
<init-param>
<param-name>Identification</param-name>
<param-value>Cookie</param-value>
</init-param>
<init-param>
<param-name>Cookie.HttpOnly</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>Cookie.Name</param-name>
<param-value>NPSession</param-value>
</init-param>
</filter>

<!-- add here other filters -->

<filter-mapping>
<filter-name>CookieBasedSessionManagementFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- add here other filter-mappings -->

<servlet>
<servlet-name>MySQLSessionStoreServlet</servlet-name>
<servlet-class>ch::nevis::nevisproxy::servlet::cache::mysql::MySQLSessionStoreServlet</servlet-class>
<servlet-lib>libMySQLSessionStoreServlets.so.1</servlet-lib>
<init-param>
<param-name>SessionsTableName</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AttributesTableName</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>KeyToIdMapTableName</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>ConfigurationsTableName</param-name>
<param-value></param-value>

</init-param>
<init-param>
<param-name>UserName</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>Password</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>ConnectString</param-name>
<param-value></param-value>
</init-param>
</servlet>

<!-- add here other servlets followed by the servlet-mappings -->