mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	统一使用getHttpClient,使得可以复用httpClient
This commit is contained in:
		| @ -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) { | ||||||
| @ -672,7 +671,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); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 darknesstm
					darknesstm