Skip to content

HttpServletRequest.getSession() always return a new session #43

@vlcheong

Description

@vlcheong

I'm testing HttpSessionReplacer using a simple webapp. My problem is the HttpSession seems return a new session whenever I post a request to the Servlet, all my previous data was removed. The webapp work as expected without HttpSessionReplacer. Am I missing something in the config ?

Servlet 3.0.1
Tomcat7

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">

<!--distributable/-->

<context-param>
    <param-name>com.amadeus.session.id</param-name>
    <param-value>uuid</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.noHyphensInId</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.namespace</param-name>
    <param-value>test</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.timeout</param-name>
    <param-value>1800</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.sticky</param-name>
    <param-value>false</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.debug</param-name>
    <param-value>false</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.distributable.force</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.distributable</param-name>
    <param-value>true</param-value>
</context-param>

<!-- Redis server -->
<context-param>
    <param-name>com.amadeus.session.repository.factory</param-name>
    <param-value>redis</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.redis.mode</param-name>
    <param-value>SINGLE</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.redis.host</param-name>
    <param-value>localhost</param-value>
</context-param>

<context-param>
    <param-name>com.amadeus.session.redis.port</param-name>
    <param-value>6379</param-value>
</context-param>

<!-- Expiration startegy -->
<context-param>
    <param-name>com.amadeus.session.redis.expiration</param-name>
    <param-value>ZRANGE</param-value>
</context-param>

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <trim-directive-whitespaces>true</trim-directive-whitespaces>
    </jsp-property-group>
</jsp-config>

<session-config>
    <session-timeout>30</session-timeout>
    <cookie-config>
        <!--<secure>true</secure>-->
        <http-only>false</http-only>
    </cookie-config>
    <tracking-mode>COOKIE</tracking-mode>
</session-config>

<!--<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>-->

</web-app>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions