mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 16:18:51 +08:00
Merge commit 'bb22974d6553dc85202bee5b027ccddde3a2e7b2' into develop
* commit 'bb22974d6553dc85202bee5b027ccddde3a2e7b2': 统一使用getHttpClient,使得可以复用httpClient
This commit is contained in:
commit
60731d229c
@ -108,8 +108,7 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();
|
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();
|
||||||
httpGet.setConfig(config);
|
httpGet.setConfig(config);
|
||||||
}
|
}
|
||||||
CloseableHttpClient httpclient = getHttpclient();
|
CloseableHttpResponse response = getHttpclient().execute(httpGet);
|
||||||
CloseableHttpResponse response = httpclient.execute(httpGet);
|
|
||||||
String resultContent = new BasicResponseHandler().handleResponse(response);
|
String resultContent = new BasicResponseHandler().handleResponse(response);
|
||||||
WxError error = WxError.fromJson(resultContent);
|
WxError error = WxError.fromJson(resultContent);
|
||||||
if (error.getErrorCode() != 0) {
|
if (error.getErrorCode() != 0) {
|
||||||
@ -673,7 +672,7 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
StringEntity entity = new StringEntity(xml, Consts.UTF_8);
|
StringEntity entity = new StringEntity(xml, Consts.UTF_8);
|
||||||
httpPost.setEntity(entity);
|
httpPost.setEntity(entity);
|
||||||
try {
|
try {
|
||||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
CloseableHttpResponse response = getHttpclient().execute(httpPost);
|
||||||
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
||||||
XStream xstream = XStreamInitializer.getInstance();
|
XStream xstream = XStreamInitializer.getInstance();
|
||||||
xstream.alias("xml", WxMpPrepayIdResult.class);
|
xstream.alias("xml", WxMpPrepayIdResult.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user