if (dispatch!=REQUEST || requested_session_id!=null)
{
return;
}
SessionManager sessionManager = getSessionManager();
boolean requested_session_id_from_cookie=false;
// Look for session id cookie
if (_sessionManager.isUsingCookies())
{
Cookie[] cookies=request.getCookies();
if (cookies!=null && cookies.length>0)
{
for (int i=0;i<cookies.length;i++)
{
if (sessionManager.getSessionCookie().equalsIgnoreCase(cookies[i].getName()))
{
if (requested_session_id!=null)
{
// Multiple jsessionid cookies. Probably due to
// multiple paths and/or domains. Pick the first
// known session or the last defined cookie.
if (sessionManager.getHttpSession(requested_session_id)!=null)
break;
}
requested_session_id=cookies[i].getValue();
requested_session_id_from_cookie = true;
if(Log.isDebugEnabled())Log.debug("Got Session ID "+requested_session_id+" from cookie");
}
}
}
}
if (requested_session_id==null)
{
String uri = request.getRequestURI();
int semi = uri.lastIndexOf(';');
if (semi>=0)
{
String path_params=uri.substring(semi+1);
// check if there is a url encoded session param.
String param=sessionManager.getSessionURL();
if (param!=null && path_params!=null && path_params.startsWith(param))
{
requested_session_id = path_params.substring(sessionManager.getSessionURL().length()+1);
if(Log.isDebugEnabled())Log.debug("Got Session ID "+requested_session_id+" from URL");
}
}
}