更新时间:2023-02-09 14:07:04
可能不是最有效的方式,但更安全类型:
Probably not the most efficient way, but more type safe :
private String getUrlWithoutParameters(String url) throws URISyntaxException {
URI uri = new URI(url);
return new URI(uri.getScheme(),
uri.getAuthority(),
uri.getPath(),
null, // Ignore the query part of the input url
uri.getFragment()).toString();
}