cookie

MD5 md = new MD5();

String inbuf="key=CA8768191C13390AC8CA476A87D97A6Eunitid=309userid=1usertype=1";

 

String name = "msign";

String patch = "/";

String value = md.getMD5ofStr(inbuf);

 

 

Cookie cookie = new Cookie(name ,value);

cookie.setPath(patch);

resp.addCookie(cookie);

Cookie[] cookies = req.getCookies();

 Object object = null;

 for(int i=0;i<cookies.length;i++)

 {

  if(cookies[i].getName().equals(name)==true)

  {

   object = cookies[i].getValue();

   System.out.println(object);

   break;

  }

 }

}

你可能感兴趣的:(cookie)