Session analysis,

Source: Internet
Author: User
Tags key string

Session analysis,
Session Analysis 1. Understanding of session Technology

The web Session technology includes Session and Cookie. The Session technology is the interaction technology between the browser and the server. In the cookie technology, if the client has business needs when requesting the server, the server will set the key value and value of the response header, and bring it to the browser in response. Then, the browser will send each request to the server in compliance with the path condition, and the client will close, the session ends. A server corresponds to multiple clients. When there are multiple client requests, the server will send a response to each client. When a client is closed, a session between the client and the server ends;

2. Session Technology

1. seesion Creation

Call the getSession () method of the request object

If a session object exists, but the JSESSIONID does not match the session object, the system will recreate the session for you.

2. seesion destruction

Obsolete destruction: the client will destroy the session 30 minutes after the session action is not performed. For example, if you do not perform the session Action for 29 minutes, the session will be re-calculated after the session action is performed.

Manual destruction: Call invalidate (); the session is destroyed when the method is called.

Abnormal server shutdown: when the server is normally shut down, the session will be deactivated. When the server is restarted, the session object will be re-activated.

3. Common session APIs

Set property setAttribute (key, value) -------> any type of key string type value

GetAttribute (key) ---------> no null is returned based on the key value

Remove attributes removeAttribute (key) ------> Delete attributes by key

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.