code: public static String getSessionId(String url, String sessionIdName) {
          String sessionIdSubstring = getSessionIdSubstring(sessionIdName);
          String sessionId = url.substring(url.indexOf(sessionIdSubstring) + sessionIdSubstring.length());
  
          if (sessionId.endsWith("/")) {
              sessionId = sessionId.substring(0, sessionId.length() - 1);
          }
  
          return sessionId;
      }
docs: Returns the session id from a URL. It is expected that the URL contains a
  session, which can be checked by calling
  {@link Utilities#isSessionEncodedInUrl(String, String)}
  
  @param url
  the url to get the session ID from
  @param sessionIdName
  the name of the session ID, e.g. jsessionid
  @return
  the session ID