web服务器通过会话跟踪客户状态(The web server tracks the customer status through sessions).docVIP

  • 3
  • 0
  • 约8.48千字
  • 约 12页
  • 2017-10-05 发布于河南
  • 举报

web服务器通过会话跟踪客户状态(The web server tracks the customer status through sessions).doc

web服务器通过会话跟踪客户状态(The web server tracks the customer status through sessions)

web服务器通过会话跟踪客户状态(The web server tracks the customer status through sessions) 1. add hidden fields to the HTML form, which contains data to track the status of the client; 2. rewrite URL to include data for tracking customer status; 3. use Cookie to transmit data used to track user status; 4. use the session Session mechanism; Conversation: HTTP is a stateless protocol, every time when the client requests access to the Web server, must establish a FTP connection, and then sends a HTTP request, when received from the Web server of the HTTP response, the FTP connection has been closed. The Servlet specification to formulate specific Java operating mechanism based on session, the javax.servlet.http.HttpServlet interface represents a session defined in Servlet API, realize the interface must find a Servlet container, when a session begins, the Servlet container will create a HttpServlet object, the object state information can be stored in the customer (such as shopping cart), the Servlet container is assigned a unique identifier for each HttpSession object, called Session ID. Heres an example of bookstore application that describes the sessions workflow: 1. a browser process first request random access Bookstore application in a Servlet container support session , trying to find the HTTP request Session ID Cookie said, because there is no such Cookie, so that a new session began, and then create a HttpSession object for it distribution of only Session ID, then Session ID as Cookie add HTTP response, when the browser receives the HTTP response results, which will save the Session ID Cookie said to the client. Any 2. of the browser process continue to request access to the bookstore in the application of a support session , in the HTTP request will be included in the Cookie.Servlet container Session ID said trying to find the HTTP request that Session ID Cookie, because it can get such a Cookie, so that the request has been in a session, Servlet the container is no longer

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档