public static ExternalSessionKey fromWebDriverRequest(String path) {
      int sessionIndex = path.indexOf("/session/");
      if (sessionIndex != -1) {
        sessionIndex += "/session/".length();
        int nextSlash = path.indexOf("/", sessionIndex);
        String session;
        if (nextSlash != -1) {
          session = path.substring(sessionIndex, nextSlash);
        } else {
          session = path.substring(sessionIndex, path.length());
        }
        if ("".equals(session)) {
          return null;
        }
        return new ExternalSessionKey(session);
      }
      return null;
  }
public static ExternalSessionKey fromWebDriverRequest ( String path ) { int sessionIndex = path . indexOf ( "/session/" ) ; if ( sessionIndex != - 1 ) { sessionIndex += "/session/" . length ( ) ; int nextSlash = path . indexOf ( "/" , sessionIndex ) ; String session ; if ( nextSlash != - 1 ) { session = path . substring ( sessionIndex , nextSlash ) ; } else { session = path . substring ( sessionIndex , path . length ( ) ) ; } if ( "" . equals ( session ) ) { return null ; } return new ExternalSessionKey ( session ) ; } return null ; }
extract the session xxx from http://host:port/a/b/c/session/xxx/...

@param path The path to the session
@return the ExternalSessionKey provided by the remote., or null if the url didn't contain a session id