code: void setRequestedSessionId(String pathParams)
      {
          _requestedSessionId=null;
          
          // try cookies first
          if (_servletHandler.isUsingCookies())
          {
              Cookie[] cookies=_httpRequest.getCookies();
              if (cookies!=null && cookies.length>0)
              {
                  for (int i=0;i<cookies.length;i++)
                  {
                      if (SessionManager.__SessionCookie.equalsIgnoreCase(cookies[i].getName()))
                      {
                          if (_requestedSessionId!=null)
                          {
                              // Multiple jsessionid cookies. Probably due to
                              // multiple paths and/or domains. Pick the first
                              // known session or the last defined cookie.
                              SessionManager manager = _servletHandler.getSessionManager();
                              if (manager!=null && manager.getHttpSession(_requestedSessionId)!=null)
                                  break;
                              log.debug("multiple session cookies");
                          }
                          
                          _requestedSessionId=cookies[i].getValue();
                          _sessionIdState = __SESSIONID_COOKIE;
                          if(log.isDebugEnabled())log.debug("Got Session "+_requestedSessionId+" from cookie");
                      }
                  }
              }
          }
              
          // check if there is a url encoded session param.
          if (pathParams!=null && pathParams.startsWith(SessionManager.__SessionURL))
          {
              String id =
                  pathParams.substring(SessionManager.__SessionURL.length()+1);
              if(log.isDebugEnabled())log.debug("Got Session "+id+" from URL");
              
              if (_requestedSessionId==null)
              {
                  _requestedSessionId=id;
                  _sessionIdState = __SESSIONID_URL;
              }
              else if (!id.equals(_requestedSessionId))
                  log.debug("Mismatched session IDs");
          }
          
          if (_requestedSessionId == null)
              _sessionIdState = __SESSIONID_NONE;        
      }
docs: /* ------------------------------------------------------------