I am trying to read out the HTTP Cookies from AppEngine Endpoints method:
@ApiMethod(httpMethod = "get")
public void getAll(HttpServletRequest req) {
log.info("req: " + req);
Cookie[] cookies = req.getCookies();
for (Cookie cookie : cookies) {
log.info("cookie: " + cookie.getName() + " " + cookie.getValue());
}
}
But no matter what i try, the cookies are NULL. Any ideas? It should work in this way: http://chirashi.zenconsult.net/2013/07/custom-authentication-with-google-cloud-endpoints-using-app-engine-java
Something like this seems to work for me. I have tested it right on App Engine.
@Api(name = "api_name", version = "v1", description = "An API", auth = @ApiAuth(allowCookieAuth = AnnotationBoolean.TRUE))
It doesn't seem to work with Java. There's a bug filed here: https://code.google.com/p/googleappengine/issues/detail?id=10100
With Python, cookies aren't passed through by default but there is a way to enable them . I think this annotation is meant to do the same in Java but doesn't seem to do anything:
@ApiAuth(allowCookieAuth = AnnotationBoolean.TRUE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.