mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 22:11:40 +08:00
提出部分代码为方法,清晰化代码结构
This commit is contained in:
parent
4bd7e613f0
commit
a154e3065a
@ -67,10 +67,6 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
|
|
||||||
private HttpHost httpProxy;
|
private HttpHost httpProxy;
|
||||||
|
|
||||||
public HttpHost getHttpProxy() {
|
|
||||||
return this.httpProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int retrySleepMillis = 1000;
|
private int retrySleepMillis = 1000;
|
||||||
|
|
||||||
private int maxRetryTimes = 5;
|
private int maxRetryTimes = 5;
|
||||||
@ -422,6 +418,10 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HttpHost getHttpProxy() {
|
||||||
|
return this.httpProxy;
|
||||||
|
}
|
||||||
|
|
||||||
public CloseableHttpClient getHttpclient() {
|
public CloseableHttpClient getHttpclient() {
|
||||||
return this.httpClient;
|
return this.httpClient;
|
||||||
}
|
}
|
||||||
@ -429,19 +429,23 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
@Override
|
@Override
|
||||||
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider) {
|
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider) {
|
||||||
this.wxMpConfigStorage = wxConfigProvider;
|
this.wxMpConfigStorage = wxConfigProvider;
|
||||||
|
this.initHttpClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initHttpClient() {
|
||||||
ApacheHttpClientBuilder apacheHttpClientBuilder = this.wxMpConfigStorage.getApacheHttpClientBuilder();
|
ApacheHttpClientBuilder apacheHttpClientBuilder = this.wxMpConfigStorage.getApacheHttpClientBuilder();
|
||||||
if (null == apacheHttpClientBuilder) {
|
if (null == apacheHttpClientBuilder) {
|
||||||
apacheHttpClientBuilder = DefaultApacheHttpHttpClientBuilder.get();
|
apacheHttpClientBuilder = DefaultApacheHttpHttpClientBuilder.get();
|
||||||
}
|
}
|
||||||
apacheHttpClientBuilder.httpProxyHost(this.wxMpConfigStorage.getHttp_proxy_host())
|
|
||||||
.httpProxyPort(this.wxMpConfigStorage.getHttp_proxy_port())
|
|
||||||
.httpProxyUsername(this.wxMpConfigStorage.getHttp_proxy_username())
|
|
||||||
.httpProxyPassword(this.wxMpConfigStorage.getHttp_proxy_password());
|
|
||||||
|
|
||||||
if (wxConfigProvider.getSSLContext() != null){
|
apacheHttpClientBuilder.httpProxyHost(this.wxMpConfigStorage.getHttpProxyHost())
|
||||||
|
.httpProxyPort(this.wxMpConfigStorage.getHttpProxyPort())
|
||||||
|
.httpProxyUsername(this.wxMpConfigStorage.getHttpProxyUsername())
|
||||||
|
.httpProxyPassword(this.wxMpConfigStorage.getHttpProxyPassword());
|
||||||
|
|
||||||
|
if (this.wxMpConfigStorage.getSSLContext() != null){
|
||||||
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
|
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
|
||||||
wxConfigProvider.getSSLContext(),
|
this.wxMpConfigStorage.getSSLContext(),
|
||||||
new String[] { "TLSv1" },
|
new String[] { "TLSv1" },
|
||||||
null,
|
null,
|
||||||
SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
|
SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
|
||||||
|
Loading…
Reference in New Issue
Block a user