String id = getRequestedSessionId();
long now = Alarm.getCurrentTime();
SessionImpl session;
if (id != null && id.length() > 6) {
session = manager.getSession(id, now, create,
isRequestedSessionIdFromCookie());
if (session == null) {
}
else if (session.isValid()) {
if (session != null)
setHasCookie();
if (! session.getId().equals(id) && manager.enableSessionCookies()) {
HttpServletResponse response = getResponse();
if (response instanceof CauchoResponse)
((CauchoResponse) getResponse()).setSessionId(session.getId());
}
return session;
}
}
else
id = null;
if (! create)
return null;
// Must accept old ids because different webApps in the same
// server must share the same cookie
//
// But, if the session group doesn't match, then create a new
// session.
session = manager.createSession(id, now, this,
isRequestedSessionIdFromCookie());
if (session != null)
setHasCookie();
if (session.getId().equals(id))
return session;
if (manager.enableSessionCookies()) {
HttpServletResponse response = getResponse();
if (response instanceof CauchoResponse)
((CauchoResponse) getResponse()).setSessionId(session.getId());
}
return session;
}