Servlet的源代码为:
public class SaveCookie extends HttpServlet { public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

Cookie cookie=new Cookie("username","Tom");
Cookie cookie2=new Cookie("password","test");

response.addCookie(cookie);
response.addCookie(cookie2);

PrintWriter pw=response.getWriter();
pw.println("<h3>add cookie success</h3>");

}}
web.xml中为其映射的url为cookie,IDE为myeclipse6.5.启用其自带的TCP/IP Monitor,
在浏览器里访问以后,看看TCP/IP Monitor,截图如下:

解决方案 »

  1.   

    从你的TCP/IP Monitor中的信息可以组织出来基本的响应头信息了,不是全部的服务器都会返回很规范的响应头信息,没有用过TCP/IP Monitor,如果想知道服务器响应头信息的话,可以自己编写程序从客户端获取。或者可以用其他工具抓包wireshark,比较详细些。
      

  2.   

    抓包必须得是wireshark啊,响应头、体看的是一清二楚!
      

  3.   


    楼主,你点击群殴圈出的蓝色方框里的倒三角形,选择Show Header即可。
      

  4.   

    该用wireshark的英文版还是汉化版呢?如果用英文版,它有没有官网提供下载?
      

  5.   

    试了一下果然行http://www.wireshark.org