httpmime-session session persistence

Reprinted from this article

The session is directly passed between the browser and the web server through a cookie named sessionid, so as long as the sessionid is kept the same for each data request, the web session can be used. This is the first time. When the data is requested, the value of the sessionid is obtained and stored in a static variable. Then, when the data is requested for the second time, the sessionid should be placed in a cookie and sent to the server. The server uses this sessionid to identify which one is. The client is requesting data,

The name of this sessionid in php is PHPSESSID 

The name of this sessionid in Java is JSESSIONID

In fact, the principle of web is the same. It is based on the http protocol. If the website is not made by java or php, the cookie called sessionid may be called something else, but it is called another name. This may need to be checked in detail. .

In fact, it is not just an Android program. When any other program needs to use it in this way, it only needs to send the corresponding SessionId in the HTTP protocol request header. This method just now can help understand sessionid. In fact, if there is a more general method, you can send all the cookies back to the server every time, which can solve the problem of session retention, but this is possible There will be slightly more network traffic overhead.

From: http://l62s.iteye.com/blog/1663113


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325551402&siteId=291194637