0

How can I destroy the current session and get a new session in coding at the same time?

asked 2024-03-11 11:46:01 +0800

ZkDsedtMo2021 gravatar image ZkDsedtMo2021
1 1

updated 2024-03-11 12:07:58 +0800



Session session = Sessions.getCurrent();


System.out.println("currentSessionId :" + ((HttpSession)session.getNativeSession()).getId());
session.invalidate();
session = Sessions.getCurrent(true);
System.out.println("currentSessionId :" + ((HttpSession)session.getNativeSession()).getId());

result :
currentSessionId :9E8BB14CAA574CD6F0C4734759FD735B
currentSessionId :9E8BB14CAA574CD6F0C4734759FD735B

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2024-03-11 11:46:01 +0800

Seen: 4 times

Last updated: Mar 11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More