The principle of Web application--session

Source: Internet
Author: User
Tags session id

Conversation is a common technique for developing Java EE Web applications, so what is the session, what is the purpose of the session, and what is the working principle, the following is simply said.

What is a session, in a Web application, as the client's browser, accesses various web pages of the same Web site through the request/Response mode, from the beginning of accessing the server until the end of the entire process is called a session. Then there is a problem, there are many clients accessing this server, how can you ensure that the server to each client to return the corresponding response? The simplest way is to guarantee one by one of the service through the continuous link service, but the Web server to improve the performance of many users at the same time, In the client and server side of the request response to use the stateless protocol HTTP, causing it to not even the memory of fish, one but the completion of a response will be and which client communication, and the contents of the communication forgotten, so that the client again sent to the request when the server is completely not impressed with it as a new client to deal with, This is obviously not appropriate. It's like you and a person have just introduced each other and talk very happy, turn face goodbye he said to you in a blank face, "first meet please more care."

To solve the above problem, the Web server generates an ID called the "session identifier" when the client first requests the Web server, and then the response is sent to the client, and then the client sends a request with that particular ID in the communication, and the server can know which client it is. This is like you save a person, he in order to repay you for the future you left a pledge, later you come to him with a token he will know who you are, this "token" is the session ID.

In the HTTP response header, where Jsessionid is the session ID generated by the server and is typically sent as a cookie. The session ID is sent to the server as a cookie in every request initiated by the subsequent client, so that the session state can be maintained.

The principle of Web application--session

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.