简体   繁体   中英

Works on development server but it doesn't on Google App Engine (Sessions)

I have this code that works just fine on the development server but when I deploy the application, the session isn't created. What am I doing wrong?

HttpSession session = req.getSession(true); session.setAttribute("loggedIn", new String("true"));

Edit:

The sessions are enabled. What I realized now is that the _ah_SESSION variable is not being created, not even on the development server (although it works).

您可以通过以下方法在GAE中获取会话:

this.getThreadLocalRequest().getSession();

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM