|
@@ -7,6 +7,7 @@ import jodd.http.HttpResponse;
|
|
|
import jodd.http.ProxyInfo;
|
|
|
import jodd.util.StringPool;
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import me.chanjar.weixin.common.enums.WxType;
|
|
|
import me.chanjar.weixin.common.error.WxError;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
@@ -18,12 +19,13 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
/**
|
|
|
* Created by ecoolper on 2017/5/5.
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
public class MaterialNewsInfoJoddHttpRequestExecutor extends MaterialNewsInfoRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
|
|
- 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);
|