Are Google Apps Sessions now supported?
I thought the google engine doesn't support sessions (I last checked a few months ago). Now I searched for it again and saw this:
http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling_Sessions
says it supports:
javax.servlet.http.HttpSession
does that mean we have servlet session support? If so, does anyone have an example of using this? I wanted to create my own user class and support user login and session management (I know the app engine already supports this for google users, but wanted my own users to fulfill various requirements).
Thanks!
------------ Update ---------------------------------- --- ------
I put this in my GreetingServiceImpl, just to take a picture:
public void login(String username, String password) {
HttpSession session = getThreadLocalRequest().getSession(false);
session.setAttribute("username", username);
}
then I am trying to check if a session can be opened on my jsp page on load, after the page is refreshed in the browser:
<body>
<%
String username = null;
HttpSession mysession = request.getSession(false);
if (mysession.getAttribute("username") != null) {
username = (String)mysession.getAttribute("username");
}
%>
but it looks like the jsp page cannot decide that the user is logged in. I would like to know that the user has visited the landing page when the user refreshes, if possible.
thanks
------------ Update 2 --------------------------------- --- -------
He works,
thanks
a source to share
Session support is a feature out of the GAEJ box.
You can code a login servlet that stores a user in a session:
HttpSession session = request.getSession();
if(ProvidedUserParametersAreOK){
session.setAttribute("user", "name");
and then program a control like this in the dispatcher servlet:
HttpSession session = request.getSession(false);
if (session.getAttribute("user") != null){
User user=(User)session.getAttribute("user");
//user logged in
a source to share