play中使用cookie

读取:

if (request.cookies.containsKey("readerPort")) {
    port = Integer.parseInt(request.cookies.get("readerPort").value);
}

var readerPort = Number('${play.mvc.Http.Request.current().cookies.get("readerPort").value}');

写入:

response.setCookie("readerPort", Integer.toString(port));

 

你可能感兴趣的:(cookie,play)