[AppleScript] 纯文本查看 复制代码
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if ("name".equals(cookie.getName())) {
//%E4%B8%AD%E6%96%87
String value = cookie.getValue();
System.out.println("已经存在的cookie的value值:" + value);
System.out.println("解码后的字符串:" + URLDecoder.decode(value, "UTF-8"));
}
}
}
String value = "中文";
//Cookie cookie = new Cookie("name", value);
String encode = URLEncoder.encode(value, "UTF-8");
System.out.println("编码后的字符串:" + encode);
Cookie cookie = new Cookie("name", encode);
response.addCookie(cookie);