Provides clustered sessions by backing session data with an
IMap
.
Using this filter requires also registering a
SessionListener
to provide session timeout notifications.
Failure to register the listener when using this filter will result in session state getting out of sync between
the servlet container and Hazelcast.
This filter supports the following
<init-param>
values:
use-client
: When enabled, a HazelcastClient
is
used to connect to the cluster, rather than joining as a full node. (Default: false
)
config-location
: Specifies the location of an XML configuration file that can be used to
initialize the HazelcastInstance
(Default: None; the HazelcastInstance
is initialized
using its own defaults)
client-config-location
: Specifies the location of an XML configuration file that can be
used to initialize the HazelcastInstance
. This setting is only checked when use-client
is set to true
. (Default: Falls back on config-location
)
instance-name
: Names the HazelcastInstance
. This can be used to reference an already-
initialized HazelcastInstance
in the same JVM (Default: The configured instance name, or a
generated name if the configuration does not specify a value)
shutdown-on-destroy
: When enabled, shuts down the HazelcastInstance
when the filter is
destroyed (Default: true
)
map-name
: Names the IMap
the filter should use to persist session details (Default:
"_web_" + ServletContext.getServletContextName()
; e.g. "_web_MyApp")
session-ttl-seconds
: Sets the time-to-live
for
the IMap
used to persist session details (Default: Uses the existing MapConfig
setting
for the IMap
, which defaults to infinite)
sticky-session
: When enabled, optimizes IMap
interactions by assuming individual sessions
are only used from a single node (Default: true
)
deferred-write
: When enabled, optimizes IMap
interactions by only writing session attributes
at the end of a request. This can yield significant performance improvements for session-heavy applications
(Default: false
)
cookie-name
: Sets the name for the Hazelcast session cookie (Default:
"hazelcast.sessionId"
cookie-domain
: Sets the domain for the Hazelcast session cookie (Default: null
)
cookie-secure
: When enabled, indicates the Hazelcast session cookie should only be sent over
secure protocols (Default: false
)
cookie-http-only
: When enabled, marks the Hazelcast session cookie as "HttpOnly", indicating
it should not be available to scripts (Default: false
)
cookie-http-only
requires a Servlet 3.0-compatible container, such as Tomcat 7+ or Jetty 8+