Changing the session cookie name

Viewed 690

I am using Spark Java with the embedded Jetty to run the application. The application is a small web app with multiple integrations with certain external services depending upon a certain configuration.

The requirement is that the customer should be able to run multiple integrations in the same server in different ports i.e. for eg: application runs on different ports 8080 and 8084 with different integration enabled. The issue is that the session cookie clashes when the user tries to access both applications in the same browser and it creates issues. Is there a way I can change the session variable from JSESSIONID to something else? Or is there a way I can inform Spark to include port too in the cookie domain?

I tried setting the cookie domain using getServletContext().getSessionCookieConfig().setDomain() but getServletContext() is always returning NULL.

Any help is much appreciated. Thanks,

1 Answers
Related