mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
微信支付优化部分代码,方便扩展
This commit is contained in:
@@ -53,13 +53,13 @@ public class WxPayServiceApacheHttpImpl extends WxPayServiceAbstractImpl {
|
||||
.setSocketTimeout(this.getConfig().getHttpTimeout())
|
||||
.build());
|
||||
|
||||
if (StringUtils.isNotBlank(this.config.getHttpProxyHost())
|
||||
&& this.config.getHttpProxyPort() > 0) {
|
||||
if (StringUtils.isNotBlank(this.getConfig().getHttpProxyHost())
|
||||
&& this.getConfig().getHttpProxyPort() > 0) {
|
||||
// 使用代理服务器 需要用户认证的代理服务器
|
||||
CredentialsProvider provider = new BasicCredentialsProvider();
|
||||
provider.setCredentials(
|
||||
new AuthScope(this.config.getHttpProxyHost(), this.config.getHttpProxyPort()),
|
||||
new UsernamePasswordCredentials(this.config.getHttpProxyUsername(), this.config.getHttpProxyPassword()));
|
||||
new AuthScope(this.getConfig().getHttpProxyHost(), this.getConfig().getHttpProxyPort()),
|
||||
new UsernamePasswordCredentials(this.getConfig().getHttpProxyUsername(), this.getConfig().getHttpProxyPassword()));
|
||||
httpClientBuilder.setDefaultCredentialsProvider(provider);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ public class WxPayServiceJoddHttpImpl extends WxPayServiceAbstractImpl {
|
||||
try {
|
||||
HttpRequest request = HttpRequest
|
||||
.post(url)
|
||||
.timeout(this.config.getHttpTimeout())
|
||||
.connectionTimeout(this.config.getHttpConnectionTimeout())
|
||||
.timeout(this.getConfig().getHttpTimeout())
|
||||
.connectionTimeout(this.getConfig().getHttpConnectionTimeout())
|
||||
.bodyText(requestStr);
|
||||
|
||||
if (useKey) {
|
||||
@@ -39,9 +39,9 @@ public class WxPayServiceJoddHttpImpl extends WxPayServiceAbstractImpl {
|
||||
request.withConnectionProvider(provider);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(this.config.getHttpProxyHost()) && this.config.getHttpProxyPort() > 0) {
|
||||
ProxyInfo httpProxy = new ProxyInfo(ProxyType.HTTP, this.config.getHttpProxyHost(), this.config.getHttpProxyPort(),
|
||||
this.config.getHttpProxyUsername(), this.config.getHttpProxyPassword());
|
||||
if (StringUtils.isNotBlank(this.getConfig().getHttpProxyHost()) && this.getConfig().getHttpProxyPort() > 0) {
|
||||
ProxyInfo httpProxy = new ProxyInfo(ProxyType.HTTP, this.getConfig().getHttpProxyHost(), this.getConfig().getHttpProxyPort(),
|
||||
this.getConfig().getHttpProxyUsername(), this.getConfig().getHttpProxyPassword());
|
||||
HttpConnectionProvider provider = request.connectionProvider();
|
||||
if (null == provider) {
|
||||
provider = new SocketHttpConnectionProvider();
|
||||
|
||||
Reference in New Issue
Block a user