code: public String getRequestedSessionIdFromURL(ServletRequest request, boolean force) {
          if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
              LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[GET_REQUESTED_SESSION_ID_FROM_URL],"force="+force);
          }
          String sessionID = null;
          if (_smc.getEnableUrlRewriting() || force) {
              String requestURI = ((IExtendedRequest) request).getEncodedRequestURI();
              if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
                  LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID_FROM_URL], "request uri:" + requestURI);
              }
              int prefix = requestURI.indexOf(_smc.getSessUrlRewritePrefix());
              if (prefix != -1) {
                  int sessionIDstart = requestURI.indexOf("=", prefix + 1);
                  int i = requestURI.indexOf(";", prefix + 1);
                  int j = requestURI.indexOf("?", prefix + 1);
                  int postfix = -1;
                  if (i == -1) {
                      postfix = j;
                  } else if (j == -1) {
                      postfix = i;
                  } else
                      postfix = (i > j) ? j : i;
  
                  if (postfix != -1) {
                      sessionID = requestURI.substring(sessionIDstart + 1, postfix);
                  } else {
                      sessionID = requestURI.substring(sessionIDstart + 1);
                  }
              }
          }
          if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
              LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[GET_REQUESTED_SESSION_ID_FROM_URL], sessionID);
          }
          return sessionID;
      }
docs: Requested session id from URL