public static String getUrlPath(String url) throws InvalidUrlException {
    if (StringUtils.isBlank(url)) {
      return null;
    }

    URI urlObj = null;
    try {
      urlObj = new URI(url);
    } catch (URISyntaxException e) {
      throw new InvalidUrlException("Get url path error: " + url, e);
    }

    String path = urlObj.getPath();
    if (path.isEmpty()) {
      return "/";
    }
    return path;
  }
Get url path, remove parameters.

{@literal "http://www.test.com/v1/user" -> "/v1/user" }
{@literal "/v1/user" --> "/v1/user" }
{@literal "/v1/user?lender=true"-->"/v1/user" }

@param url the invalid url
@return the path of the url
@throws InvalidUrlException if the url is invalid
src/main/java/com/eudemon/ratelimiter/utils/UrlUtils.java