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