Package com.hazelcast.web.spring

Provides Spring aware Hazelcast based session replication.

See: Description

Package com.hazelcast.web.spring Description

Provides Spring aware Hazelcast based session replication.

To use Spring aware Hazelcast to provide clustered sessions in a webapp, add the following components to your web.xml:

 <filter>
   <filter-name>springAwareHazelcastWebFilter</filter-name>
   <filter-class>com.hazelcast.web.spring.SpringAwareWebFilter</filter-class>
 </filter>
 <filter-mapping>
   <filter-name>springAwareHazelcastWebFilter</filter-name>
   <url-pattern>/*</url-pattern>
   <dispatcher>FORWARD</dispatcher>
   <dispatcher>INCLUDE</dispatcher>
   <dispatcher>REQUEST</dispatcher>
 </filter-mapping>

 <listener>
   <listener-class>com.hazelcast.web.SessionListener</listener-class>
 </listener>
 

SpringAwareWebFilter should be first in the filter chain to ensure session actions performed in other filters in the chain are replicated. Additionally, note that both the SpringAwareWebFilter and SessionListener must be registered for clustered sessions to work properly. The SessionListener informs the SpringAwareWebFilter of session timeouts so it can update the cluster accordingly and declaring org.springframework.security.web.session.HttpSessionEventPublisher HttpSessionEventPublisher as listener, which is used by Spring to be aware of session events, is not needed anymore since SpringAwareWebFilter already publishes events for Spring.

For more information, see WebFilter.

Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.