Under what conditions is a JSESSIONID created?

后端 未结 5 878
灰色年华
灰色年华 2020-11-22 09:34

When / what are the conditions when a JSESSIONID is created?

Is it per a domain? For instance, if I have a Tomcat app server, and I deploy multiple web

5条回答
  •  花落未央
    2020-11-22 10:03

    CORRECTION: Please vote for Peter Štibraný's answer - it is more correct and complete!

    A "JSESSIONID" is the unique id of the http session - see the javadoc here. There, you'll find the following sentence

    Session information is scoped only to the current web application (ServletContext), so information stored in one context will not be directly visible in another.

    So when you first hit a site, a new session is created and bound to the SevletContext. If you deploy multiple applications, the session is not shared.

    You can also invalidate the current session and therefore create a new one. e.g. when switching from http to https (after login), it is a very good idea, to create a new session.

    Hope, this answers your question.

提交回复
热议问题