HttpRequest#get不再尝试File路径

This commit is contained in:
Looly 2024-05-10 17:35:46 +08:00
parent deb2d98a2e
commit dd4390508e
2 changed files with 2 additions and 18 deletions

View File

@ -113,7 +113,7 @@ public final class UrlBuilder implements Builder<String> {
if(false == StrUtil.startWithAnyIgnoreCase(httpUrl, "http://", "https://")){
httpUrl = "http://" + httpUrl;
}
return of(httpUrl, charset);
return of(URLUtil.toUrlForHttp(httpUrl), charset);
}
/**
@ -135,7 +135,7 @@ public final class UrlBuilder implements Builder<String> {
*/
public static UrlBuilder of(String url, Charset charset) {
Assert.notBlank(url, "Url must be not blank!");
return of(URLUtil.urlForNet(StrUtil.trim(url)), charset);
return of(URLUtil.url(StrUtil.trim(url)), charset);
}
/**

View File

@ -164,22 +164,6 @@ public class URLUtil extends URLEncodeUtil {
}
}
/**
* 根据提供的路径创建一个URL对象如果给定路径非网络协议路径直接抛出异常
*
* @param path 表示URL路径的字符串
* @return 返回一个新创建的URL对象
* @throws UtilException 如果给定的路径不能构造一个有效的URL则抛出UtilException
* @since 5.8.28
*/
public static URL urlForNet(String path) throws UtilException{
try {
return new URL(path);
} catch (MalformedURLException e) {
throw new UtilException(e);
}
}
/**
* 获取string协议的URL类似于string:///xxxxx
*