Rustam Issabekov
Rustam Issabekov

Reputation: 3517

Is spring-session compatible with hazelcast-wm?

I am using hazelcast 3.8.4 in my web application to store some custom data in the hazelcast cluster.

On top of that, I use @EnableHazelcastHttpSession annotation from spring-session version 1.3.1 that makes hazelcast a default httpsession storage (and allows for the http session replication in the cluster).

I noticed that the whole shebang works by passing "SESSION" cookie. By default that cookie has "path" attribute which is equal to the context path of the application.

So I tried to find a way to modify that "path" attribute. All of the hazelcast resources sent me to hazelcast-wm project which allows for that path attribute customization. But the more I look at hazelcast-wm the more I start to think that it's doing the same job as spring-session, am I right? Will I need to drop spring-session and replace it with hazelcast-wm? Is there a way to modify "path" attribute in the spring-session?

Thanks in advance.

Upvotes: 0

Views: 138

Answers (1)

Rustam Issabekov
Rustam Issabekov

Reputation: 3517

I think I found the answer, I can change the path attribute by manually creating an instance of DefaultCookieSerializer, which later will be autowired into spring-session pipeline:

@Bean
public CookieSerializer cookieSerializer() {
    DefaultCookieSerializer serializer = new DefaultCookieSerializer();
    serializer.setCookiePath("/");
    return serializer;
}

Upvotes: 0

Related Questions