Nicolas Richeton's blog

Java Stateless Session Filter released on sourceforge

☕️ 1 min read
logo

I just finished publishing on sourceforge a simple filter named Java Stateless Session Filter which let you change the way your application use HTTP session without refactoring the code, or share user session between webapps while using the standard session API.

Several session stores are available out of the box :

  • Cookie, with variants : plain (development only), Encrypted, JSON based
  • Memcache
  • Native session (when some attributes doesn’t need sharing)

The inital code is released under the Apache License v2.0 by Capgemini.

Status:

This code was written in a few days as a Proof Of Concept and was tested with Struts2, Wicket and JSF.

Feel free to test this filter and report success or issues. See the support page for project forums and trackers.

How it works:

How it works

Usage:

The project exposes a maven2 repository. To add this filter on your application, just add repository and dependencies to your project pom :

<repository
<id>statelessfilter-repository</id>
<name>Stateless Filter repository</name>
<url>http://statelessfilter.sourceforge.net/maven2/repository</url>
</repository>


<dependency>
<groupId>net.sourceforge.statelessfilter</groupId>
<artifactId>stateless-core</artifactId>
<version>0.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>net.sourceforge.statelessfilter</groupId>
<artifactId>stateless-cookie-plain</artifactId>
<version>0.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

Then add the filter in WEB-INF/web.xml :

<filter>
<filter-name>session</filter-name>
<filter-class>net.sourceforge.statelessfilter.filter.StatelessFilter</filter-class>
</filter>

(...)

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

For additional details, see the complete documentation on sourceforge.