Java Web in-depth analysis (9) Session and Cookie

Source: Internet
Author: User
Objective:
  • Sessions and cookies are all designed to keep the interaction between the server and the client state. If a day's PV has hundreds of millions of, and a cookie is 200 bytes, but it also consumes a lot of bandwidth? Therefore, the large traffic is referred to the session, but there is no sharing session between the hundreds of server clusters.
Understanding Cookies
  • In short, the user accesses the server via HTTP, and the server returns some Key/value data to the client, with some restrictions on the data, and when the user accesses the server again, it is returned to the server as soon as the condition is met. The design cookie was originally designed to deal with a stateless protocol such as HTTP to distinguish different users, and now cookies can be used as a basis for server data caching.
  • Cookie attribute entries, currently divided into two versions of Version0 and Version1, commonly used are max-age, Domain,expires,path, etc., in the Javaweb servlet specification, We commonly use set-cookie:user-name= ' hakulamatata '; max-age= "1000".

Java Web in-depth analysis (9) Session and Cookie

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.