From 32f72774fed0289a100a4b4cd823be7258d87e92 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Thu, 24 Sep 2020 14:41:24 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96jod?= =?UTF-8?q?d-http=E7=89=88=E6=9C=AC=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B8=8D=E5=85=BC=E5=AE=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../http/jodd/JoddHttpMediaDownloadRequestExecutor.java | 3 ++- .../http/jodd/JoddHttpMediaUploadRequestExecutor.java | 3 ++- .../util/http/jodd/JoddHttpSimpleGetRequestExecutor.java | 3 ++- .../util/http/jodd/JoddHttpSimplePostRequestExecutor.java | 3 ++- .../material/MaterialDeleteJoddHttpRequestExecutor.java | 3 ++- .../material/MaterialNewsInfoJoddHttpRequestExecutor.java | 8 +++++--- .../material/MaterialUploadJoddHttpRequestExecutor.java | 3 ++- .../MaterialVideoInfoJoddHttpRequestExecutor.java | 3 ++- ...erialVoiceAndImageDownloadJoddHttpRequestExecutor.java | 2 +- .../media/MediaImgUploadHttpRequestExecutor.java | 3 ++- .../qrcode/QrCodeJoddHttpRequestExecutor.java | 3 ++- .../open/executor/MaQrCodeJoddHttpRequestExecutor.java | 3 ++- 13 files changed, 27 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 186ac3568..8c115354e 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,7 @@ org.jodd jodd-http - 5.1.6 + 5.2.0 provided diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaDownloadRequestExecutor.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaDownloadRequestExecutor.java index 5c67cbffe..00df2a640 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaDownloadRequestExecutor.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaDownloadRequestExecutor.java @@ -19,6 +19,7 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; /** * . @@ -47,7 +48,7 @@ public class JoddHttpMediaDownloadRequestExecutor extends BaseMediaDownloadReque request.withConnectionProvider(requestHttp.getRequestHttpClient()); HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); String contentType = response.header("Content-Type"); if (contentType != null && contentType.startsWith("application/json")) { diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaUploadRequestExecutor.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaUploadRequestExecutor.java index 93f25fb74..89ea05a02 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaUploadRequestExecutor.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpMediaUploadRequestExecutor.java @@ -14,6 +14,7 @@ import me.chanjar.weixin.common.util.http.RequestHttp; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; /** * . @@ -35,7 +36,7 @@ public class JoddHttpMediaUploadRequestExecutor extends MediaUploadRequestExecut request.withConnectionProvider(requestHttp.getRequestHttpClient()); request.form("media", file); HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); String responseContent = response.bodyText(); WxError error = WxError.fromJson(responseContent, wxType); diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpSimpleGetRequestExecutor.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpSimpleGetRequestExecutor.java index e8adad6b6..5960274eb 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpSimpleGetRequestExecutor.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpSimpleGetRequestExecutor.java @@ -11,6 +11,7 @@ import me.chanjar.weixin.common.util.http.RequestHttp; import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor; import java.io.IOException; +import java.nio.charset.StandardCharsets; /** * . @@ -38,7 +39,7 @@ public class JoddHttpSimpleGetRequestExecutor extends SimpleGetRequestExecutor { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); public MaterialNewsInfoJoddHttpRequestExecutor(RequestHttp requestHttp) { super(requestHttp); } @@ -38,10 +40,10 @@ public class MaterialNewsInfoJoddHttpRequestExecutor extends MaterialNewsInfoReq .withConnectionProvider(requestHttp.getRequestHttpClient()) .body(WxGsonBuilder.create().toJson(ImmutableMap.of("media_id", materialId))); HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); String responseContent = response.bodyText(); - this.logger.debug("响应原始数据:{}", responseContent); + log.debug("响应原始数据:{}", responseContent); WxError error = WxError.fromJson(responseContent, WxType.MP); if (error.getErrorCode() != 0) { throw new WxErrorException(error); diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialUploadJoddHttpRequestExecutor.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialUploadJoddHttpRequestExecutor.java index 7699f2f20..f4caa14b0 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialUploadJoddHttpRequestExecutor.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialUploadJoddHttpRequestExecutor.java @@ -17,6 +17,7 @@ import me.chanjar.weixin.mp.bean.material.WxMpMaterialUploadResult; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -50,7 +51,7 @@ public class MaterialUploadJoddHttpRequestExecutor extends MaterialUploadRequest } HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); String responseContent = response.bodyText(); WxError error = WxError.fromJson(responseContent, WxType.MP); if (error.getErrorCode() != 0) { diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVideoInfoJoddHttpRequestExecutor.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVideoInfoJoddHttpRequestExecutor.java index f142c2178..9149d4679 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVideoInfoJoddHttpRequestExecutor.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVideoInfoJoddHttpRequestExecutor.java @@ -13,6 +13,7 @@ import me.chanjar.weixin.common.util.http.RequestHttp; import me.chanjar.weixin.mp.bean.material.WxMpMaterialVideoInfoResult; import java.io.IOException; +import java.nio.charset.StandardCharsets; /** * Created by ecoolper on 2017/5/5. @@ -32,7 +33,7 @@ public class MaterialVideoInfoJoddHttpRequestExecutor extends MaterialVideoInfoR request.query("media_id", materialId); HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); String responseContent = response.bodyText(); WxError error = WxError.fromJson(responseContent, WxType.MP); if (error.getErrorCode() != 0) { diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVoiceAndImageDownloadJoddHttpRequestExecutor.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVoiceAndImageDownloadJoddHttpRequestExecutor.java index 1a4c25590..e4da2004e 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVoiceAndImageDownloadJoddHttpRequestExecutor.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/material/MaterialVoiceAndImageDownloadJoddHttpRequestExecutor.java @@ -37,7 +37,7 @@ public class MaterialVoiceAndImageDownloadJoddHttpRequestExecutor extends Materi request.query("media_id", materialId); HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); try (InputStream inputStream = new ByteArrayInputStream(response.bodyBytes())) { // 下载媒体文件出错 byte[] responseContent = IOUtils.toByteArray(inputStream); diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/media/MediaImgUploadHttpRequestExecutor.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/media/MediaImgUploadHttpRequestExecutor.java index 76c625141..9da068657 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/media/MediaImgUploadHttpRequestExecutor.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/media/MediaImgUploadHttpRequestExecutor.java @@ -14,6 +14,7 @@ import me.chanjar.weixin.mp.bean.material.WxMediaImgUploadResult; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; /** * Created by ecoolper on 2017/5/5. @@ -39,7 +40,7 @@ public class MediaImgUploadHttpRequestExecutor extends MediaImgUploadRequestExec request.form("media", data); HttpResponse response = request.send(); - response.charset(StringPool.UTF_8); + response.charset(StandardCharsets.UTF_8.name()); String responseContent = response.bodyText(); WxError error = WxError.fromJson(responseContent, WxType.MP); if (error.getErrorCode() != 0) { diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/qrcode/QrCodeJoddHttpRequestExecutor.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/qrcode/QrCodeJoddHttpRequestExecutor.java index 99621843d..32d3d3ca7 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/qrcode/QrCodeJoddHttpRequestExecutor.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/requestexecuter/qrcode/QrCodeJoddHttpRequestExecutor.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.UUID; /** @@ -47,7 +48,7 @@ public class QrCodeJoddHttpRequestExecutor extends QrCodeRequestExecutor