cookie实现自动登陆(2)
????????????????????????????+ ":" + validTime + ":" + webKey);
?????????????
??????????????//将要被保存的完整的Cookie值
??????????????String cookieValue = user.getUserName() + ":" + validTime + ":" + cookieValueWithMd5;
?????????????
??????????????//再一次对Cookie的值进行BASE64编码
??????????????String cookieValueBase64 = new String(Base64.encode(cookieValue.getBytes()));
?????????????
??????????????//开始保存Cookie
??????????????Cookie cookie = new Cookie(cookieDomainName, cookieValueBase64);
???????????
cookie.setMaxAge(60 * 60 * 24 * 365 * 2);
//cookie有效路径是网站根目录
??????????????cookie.setPath("/");
??????????????//向客户端写入
??????????????response.addCookie(cookie);
???????}