Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Create a case analysis of Session

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you the example analysis of creating Session, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Q: the browser visits a site, generates a session, and then does the following:

1. Open a new tab card in the same browser and visit the same site. At this time, several session

2. When you drag the newly opened tab card out and become two browsers, create several session

3. Change your browser and visit the same site. At this time, several session

4. Is HttpSession, HttpServletRequest.getSession (), HttpServletRequest.getSession (true) and HttpServletRequest.getSession (false) the same session?

Let's take a look at the first session1 generated.

Visit the local tomcat and store the first sessionId as session, and you can see that the four sessionId are the same.

Newly open tab and compare two sessionId2

It is found that the sessionId of two tab cards is also the same.

After dragging it out,

three

Found that the two sessionId are still the same.

Change the FF and open it again.

It's finally different from what it was before.

1. For the same browser, without clearing the cookie, caching or closing the browser, if the expiration time is not reached, the session is the same.

two。 After being dragged out, the session is still the same

3. Change the browser, change the session

4.HttpSession, HttpServletRequest.getSession (), HttpServletRequest.getSession (true), HttpServletRequest.getSession (false) get the same session

Extraneous remarks

Session exists on the server. Because http is stateless, the server cannot tell which client sends the request, and ultimately relies on cookie. Each request sent carries a JSESSIONID, that is, the sessionId obtained by the server, which uniquely identifies a client request.

The above content is to create the case analysis of Session, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report