I've enabled sessions in App Engine which works perfectly well when the app is deployed. My problem is that this does not appear to work in development mode. I need something to persist sessions somewhere (disk, datastore, memory) in development mode so that I don't have to log into my app every time I restart the local server (which is every time I make changes to server or shared code).
I ordinarily do this by defining a HashSessionManager in jetty-web.xml, but apparently (and understandably) App Engine explicitly disables that config file for security reasons.
Does anyone know the standard way of achieving local session persistence in App Engine, assuming one exists?
I have the following related lines in appengine-web.xml:
<sessions-enabled>true</sessions-enabled>
<async-session-persistence enabled="true" />
I'm using version 1.6.5 (latest) of the App Engine SDK.
Here are some steps I've taken:
In my server-side class extending RemoteServiceServlet, I added the following line:
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
// Added this line
System.out.println(request.getSession().getCreationTime());
...
}
I restarted the dev mode server, loaded my app and got "1337796704817" for every request my app made, indicating the same session is in use between requests. Then, I restarted the dev mode server, and the next request produced "1337796798184", indicating a new session had been created.
As noted below, I am using Google Cloud SQL, and I've disabled the datastore options in app engine settings, though this doesn't seem to cause any problems when deployed. Also, I tried the same steps above with those options checked, and got the same results.