*********Http Post登陆后如何保持会话?*********
关于Http请求有问题请教一下,我想实现Post登陆(用自己的站做的测试).但不会处理Cookie来达到会话持久的目的
Web服务器端:
网站登陆成功后,设置session代码如下:session.setAttribute("uid",uid);然后重定向到登陆成功的页面:response.sendRedirect(....);POST /_login.jsp HTTP/1.1Host: 192.168.1.2Accept-Language: zh-cnConnection: keep-aliveusername=admin&userpwd=admin
HTTP/1.1 302 Moved TemporarilyServer: Apache-Coyote/1.1Set-Cookie: JSESSIONID=129FDBC989E0942F3EB64C818554AB94; Path=/glxtLocation: http://192.168.1.2/glxt/index.jsp?fid=40&tid=3Content-Type: text/html;charset=UTF-8Content-Length: 0Date: Sat, 18 Feb 2012 05:55:49 GMT
GET /glxt/index.jsp?fid=40&tid=4 HTTP/1.1Host: 192.168.1.2:8080Cookie: JSESSIONID=129FDBC989E0942F3EB64C818554AB94
HTTP/1.1 302 Moved TemporarilyServer: Apache-Coyote/1.1Location: http://192.168.1.2:8080/glxt/index.jsp?fid=1&tid=3Content-Type: text/html;charset=UTF-8Content-Length: 0Date: Sat, 18 Feb 2012 05:55:49 GMT