code: protected static String cleanupUrl(final String url) {
          if (url == null) {
              return null;
          }
          val jsessionPosition = url.indexOf(";jsession");
          if (jsessionPosition == -1) {
              return url;
          }
          val questionMarkPosition = url.indexOf('?');
          if (questionMarkPosition < jsessionPosition) {
              return url.substring(0, url.indexOf(";jsession"));
          }
          return url.substring(0, jsessionPosition) + url.substring(questionMarkPosition);
      }
docs: Cleanup the url. Removes jsession ids and query strings.
  
  @param url the url
  @return sanitized url.