Question

It is all in the title. Is there a way to do this after the session is created, and potentially multiple times during its lifetime? A fallback approach would be to copy all the data from the current session, terminate it, create a new one, and put the data back, but that is not desirable either for a number of reasons.

Use case is related to security - we just need to be able to occasionally change session ids. We are using an embedded Jetty server and have only one "context".

Does anyone have any ideas? If you do, please help.

Was it helpful?

Solution

You can use HttpServletRequest.changeSessionId(). See also this answer: httpservletrequest - create new session / change session Id

Make sure you use the latest jetty version!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top