HttpOnly cookie在谷歌app引擎java [英] HttpOnly cookies on google app engine java
问题描述
任何人都知道我如何在应用程序引擎上使用httponly cookie进行会话和cookie。
Anyone know how I can use httponly cookies for sessions and cookies on the app engine?
在Cookie类的javadoc中, http://java.sun.com/javaee/ 6 / docs / api / javax / servlet / http / Cookie.html#setHttpOnly(boolean),
有一个setHttpOnly方法。
In the javadoc for the Cookie class, http://java.sun.com/javaee/6/docs/api/javax/servlet/http/Cookie.html#setHttpOnly(boolean) , there is a setHttpOnly method.
我得到一个编译器错误,当尝试使用它时开发的应用程序引擎虽然。
I get a compiler error when trying to use it when developing for app engine though.
该方法在Servlet 3.0规范中引入,因此它非常新。
The method was introduced in the Servlet 3.0 spec, so its pretty new.
推荐答案
App Engine支持版本2.5的Servlet API,因此您不能使用setHttpOnly方法。
App Engine supports the Servlet API at version 2.5, so you cannot use the setHttpOnly method.
您可以尝试自己输出Cookie标头。 p>
You could try to output the cookie header yourself.
resp.setHeader("Set-Cookie", "A=7; expires=Fri, 31-Dec-2010 23:59:59 GMT; path=/; domain=.example.net; HttpOnly");
这篇关于HttpOnly cookie在谷歌app引擎java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!