a . Cookie in the Web application, the cookie class corresponding to the Servlet API is saved on the client.
Purpose: Protects the information that is allowed to be saved by the user when accessing the Web application through a browser.
Implementation: Each Web application has a corresponding cookie file (TXT format) for each browser of the client and is not shared with each other. Where, under the Win7 system, the Internet Explorer cookie file
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Cookies path, (Cookies folder may be hidden, set to show). is saved as a key-value pair.
Application: Login website, there is a check to save the password ,
two Session in the Web application , originally intended to be a conversation , corresponding to the Servlet API HttpSession class, saved on the server .
function: In order to make the service side and the client contact , in the server side of the memory specifically for the session to generate an ID for the specific representation of the client's identity.
Implementation: each time the client accesses the server, it will be accessed with the ID assigned to it, otherwise it will be re-generated a new ID. The implementation of the ID from the client to the service side of the process of delivery, there are 2 ways, one is to save the cookie, the ID is placed in the browser's cookie , the other is to rewrite the URL, the path of access to encode, Response.encodeurl (" Access path ")//completed with the ID placed after the URL, and the Chinese characters such as encoding function
Specific to the client, is the usual browser.
Rule: 1. Except for special browser settings, usually a new session ID will be generated for each new browser opened.
2. If you close this window (Not the tab window, the entire browser window, the taskbar window, that is, to stop the browser process), and then reopen the browser, it will also regenerate a Sessioin ID, and will not continue to use the browser just the session Id!
Application: The user name of the login website will be treated as a session by the server.
Three application in a Web application , the ServletContext class corresponding to the Servlet API
Role: Can let all clients share some information, is the service side of their own information.
Cookie,session and browser relationship, application