mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -14,7 +14,7 @@ package org.dromara.hutool.http.client.cookie;
|
||||
|
||||
import org.dromara.hutool.core.io.IORuntimeException;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.net.url.URLUtil;
|
||||
import org.dromara.hutool.core.net.url.UrlUtil;
|
||||
import org.dromara.hutool.http.client.engine.jdk.JdkHttpConnection;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -137,6 +137,6 @@ public class GlobalCookieManager {
|
||||
* @return URI
|
||||
*/
|
||||
private static URI getURI(final JdkHttpConnection conn){
|
||||
return URLUtil.toURI(conn.getUrl());
|
||||
return UrlUtil.toURI(conn.getUrl());
|
||||
}
|
||||
}
|
||||
|
@@ -148,7 +148,7 @@ public class JdkClientEngine implements ClientEngine {
|
||||
* @param isAsync 最终请求是否异步
|
||||
* @return {@link JdkHttpResponse},无转发返回 {@code null}
|
||||
*/
|
||||
private JdkHttpResponse sendRedirectIfPossible(JdkHttpConnection conn, final Request message, final boolean isAsync) {
|
||||
private JdkHttpResponse sendRedirectIfPossible(final JdkHttpConnection conn, final Request message, final boolean isAsync) {
|
||||
// 手动实现重定向
|
||||
if (message.maxRedirectCount() > 0) {
|
||||
final int code;
|
||||
|
@@ -13,7 +13,7 @@
|
||||
package org.dromara.hutool.http.client.engine.jdk;
|
||||
|
||||
import org.dromara.hutool.core.lang.Opt;
|
||||
import org.dromara.hutool.core.net.url.URLUtil;
|
||||
import org.dromara.hutool.core.net.url.UrlUtil;
|
||||
import org.dromara.hutool.core.reflect.FieldUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.http.HttpException;
|
||||
@@ -52,7 +52,7 @@ public class JdkHttpConnection implements HeaderOperation<JdkHttpConnection>, Cl
|
||||
* @return HttpConnection
|
||||
*/
|
||||
public static JdkHttpConnection of(final String urlStr, final Proxy proxy) {
|
||||
return of(URLUtil.toUrlForHttp(urlStr), proxy);
|
||||
return of(UrlUtil.toUrlForHttp(urlStr), proxy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@ package org.dromara.hutool.http.server;
|
||||
import org.dromara.hutool.core.io.IORuntimeException;
|
||||
import org.dromara.hutool.core.io.IoUtil;
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
import org.dromara.hutool.core.net.url.URLEncoder;
|
||||
import org.dromara.hutool.core.net.url.UrlEncoder;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.util.ByteUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
@@ -435,7 +435,7 @@ public class HttpServerResponse extends HttpServerBase {
|
||||
|
||||
if (!contentType.startsWith("text/")) {
|
||||
// 非文本类型数据直接走下载
|
||||
setHeader(HeaderName.CONTENT_DISPOSITION, StrUtil.format("attachment;filename={}", URLEncoder.encodeAll(fileName, charset)));
|
||||
setHeader(HeaderName.CONTENT_DISPOSITION, StrUtil.format("attachment;filename={}", UrlEncoder.encodeAll(fileName, charset)));
|
||||
}
|
||||
return write(in, length, contentType);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ import org.dromara.hutool.core.io.IoUtil;
|
||||
import org.dromara.hutool.core.map.CaseInsensitiveMap;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.net.NetUtil;
|
||||
import org.dromara.hutool.core.net.url.URLEncoder;
|
||||
import org.dromara.hutool.core.net.url.UrlEncoder;
|
||||
import org.dromara.hutool.core.net.multipart.MultipartFormData;
|
||||
import org.dromara.hutool.core.net.multipart.UploadSetting;
|
||||
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||
@@ -607,7 +607,7 @@ public class JakartaServletUtil {
|
||||
*/
|
||||
public static void write(final HttpServletResponse response, final InputStream in, final String contentType, final String fileName) {
|
||||
final String charset = ObjUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.NAME_UTF_8);
|
||||
final String encodeText = URLEncoder.encodeAll(fileName, CharsetUtil.charset(charset));
|
||||
final String encodeText = UrlEncoder.encodeAll(fileName, CharsetUtil.charset(charset));
|
||||
response.setHeader("Content-Disposition",
|
||||
StrUtil.format("attachment;filename=\"{}\";filename*={}''{}", encodeText, charset, encodeText));
|
||||
response.setContentType(contentType);
|
||||
|
@@ -26,7 +26,7 @@ import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.net.NetUtil;
|
||||
import org.dromara.hutool.core.net.multipart.MultipartFormData;
|
||||
import org.dromara.hutool.core.net.multipart.UploadSetting;
|
||||
import org.dromara.hutool.core.net.url.URLEncoder;
|
||||
import org.dromara.hutool.core.net.url.UrlEncoder;
|
||||
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
@@ -618,7 +618,7 @@ public class ServletUtil {
|
||||
*/
|
||||
public static void write(final HttpServletResponse response, final InputStream in, final String contentType, final String fileName) {
|
||||
final String charset = ObjUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.NAME_UTF_8);
|
||||
final String encodeText = URLEncoder.encodeAll(fileName, CharsetUtil.charset(charset));
|
||||
final String encodeText = UrlEncoder.encodeAll(fileName, CharsetUtil.charset(charset));
|
||||
response.setHeader("Content-Disposition",
|
||||
StrUtil.format("attachment;filename=\"{}\";filename*={}''{}", encodeText, charset, encodeText));
|
||||
response.setContentType(contentType);
|
||||
|
Reference in New Issue
Block a user