mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-01-10 02:14:52 +08:00
🎨 #3830 【公共问题】修复使用HttpComponents时不配置proxy password启动报错问题
This commit is contained in:
@@ -5,7 +5,6 @@ import me.chanjar.weixin.channel.bean.token.StableTokenParam;
|
||||
import me.chanjar.weixin.channel.config.WxChannelConfig;
|
||||
import me.chanjar.weixin.channel.util.JsonUtils;
|
||||
import me.chanjar.weixin.common.util.http.HttpClientType;
|
||||
import me.chanjar.weixin.common.util.http.apache.ApacheBasicResponseHandler;
|
||||
import me.chanjar.weixin.common.util.http.hc.BasicResponseHandler;
|
||||
import me.chanjar.weixin.common.util.http.hc.DefaultHttpComponentsClientBuilder;
|
||||
import me.chanjar.weixin.common.util.http.hc.HttpComponentsClientBuilder;
|
||||
@@ -41,7 +40,7 @@ public class WxChannelServiceHttpComponentsImpl extends BaseWxChannelServiceImpl
|
||||
apacheHttpClientBuilder.httpProxyHost(config.getHttpProxyHost())
|
||||
.httpProxyPort(config.getHttpProxyPort())
|
||||
.httpProxyUsername(config.getHttpProxyUsername())
|
||||
.httpProxyPassword(config.getHttpProxyPassword().toCharArray());
|
||||
.httpProxyPassword(config.getHttpProxyPassword() == null ? null : config.getHttpProxyPassword().toCharArray());
|
||||
|
||||
if (config.getHttpProxyHost() != null && config.getHttpProxyPort() > 0) {
|
||||
this.httpProxy = new HttpHost(config.getHttpProxyHost(), config.getHttpProxyPort());
|
||||
|
||||
@@ -82,7 +82,8 @@ public class WxCpServiceHttpComponentsImpl extends BaseWxCpServiceImpl<Closeable
|
||||
apacheHttpClientBuilder.httpProxyHost(this.configStorage.getHttpProxyHost())
|
||||
.httpProxyPort(this.configStorage.getHttpProxyPort())
|
||||
.httpProxyUsername(this.configStorage.getHttpProxyUsername())
|
||||
.httpProxyPassword(this.configStorage.getHttpProxyPassword().toCharArray());
|
||||
.httpProxyPassword(this.configStorage.getHttpProxyPassword() == null ? null :
|
||||
this.configStorage.getHttpProxyPassword().toCharArray());
|
||||
|
||||
if (this.configStorage.getHttpProxyHost() != null && this.configStorage.getHttpProxyPort() > 0) {
|
||||
this.httpProxy = new HttpHost(this.configStorage.getHttpProxyHost(), this.configStorage.getHttpProxyPort());
|
||||
|
||||
@@ -35,7 +35,8 @@ public class WxCpCgServiceHttpComponentsImpl extends BaseWxCpCgServiceImpl<Close
|
||||
apacheHttpClientBuilder.httpProxyHost(this.configStorage.getHttpProxyHost())
|
||||
.httpProxyPort(this.configStorage.getHttpProxyPort())
|
||||
.httpProxyUsername(this.configStorage.getHttpProxyUsername())
|
||||
.httpProxyPassword(this.configStorage.getHttpProxyPassword().toCharArray());
|
||||
.httpProxyPassword(this.configStorage.getHttpProxyPassword() == null ? null :
|
||||
this.configStorage.getHttpProxyPassword().toCharArray());
|
||||
|
||||
if (this.configStorage.getHttpProxyHost() != null && this.configStorage.getHttpProxyPort() > 0) {
|
||||
this.httpProxy = new HttpHost(this.configStorage.getHttpProxyHost(), this.configStorage.getHttpProxyPort());
|
||||
|
||||
@@ -10,7 +10,6 @@ import me.chanjar.weixin.common.util.http.hc.BasicResponseHandler;
|
||||
import me.chanjar.weixin.common.util.http.hc.DefaultHttpComponentsClientBuilder;
|
||||
import me.chanjar.weixin.common.util.http.hc.HttpComponentsClientBuilder;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
|
||||
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
||||
import org.apache.hc.client5.http.config.RequestConfig;
|
||||
@@ -89,7 +88,8 @@ public class WxCpTpServiceHttpComponentsImpl extends BaseWxCpTpServiceImpl<Close
|
||||
apacheHttpClientBuilder.httpProxyHost(this.configStorage.getHttpProxyHost())
|
||||
.httpProxyPort(this.configStorage.getHttpProxyPort())
|
||||
.httpProxyUsername(this.configStorage.getHttpProxyUsername())
|
||||
.httpProxyPassword(this.configStorage.getHttpProxyPassword().toCharArray());
|
||||
.httpProxyPassword(this.configStorage.getHttpProxyPassword() == null ? null :
|
||||
this.configStorage.getHttpProxyPassword().toCharArray());
|
||||
|
||||
if (this.configStorage.getHttpProxyHost() != null && this.configStorage.getHttpProxyPort() > 0) {
|
||||
this.httpProxy = new HttpHost(this.configStorage.getHttpProxyHost(), this.configStorage.getHttpProxyPort());
|
||||
|
||||
@@ -51,7 +51,8 @@ public class WxMpServiceHttpComponentsImpl extends BaseWxMpServiceImpl<Closeable
|
||||
apacheHttpClientBuilder.httpProxyHost(configStorage.getHttpProxyHost())
|
||||
.httpProxyPort(configStorage.getHttpProxyPort())
|
||||
.httpProxyUsername(configStorage.getHttpProxyUsername())
|
||||
.httpProxyPassword(configStorage.getHttpProxyPassword().toCharArray());
|
||||
.httpProxyPassword(configStorage.getHttpProxyPassword() == null ? null :
|
||||
configStorage.getHttpProxyPassword().toCharArray());
|
||||
|
||||
if (configStorage.getHttpProxyHost() != null && configStorage.getHttpProxyPort() > 0) {
|
||||
this.httpProxy = new HttpHost(configStorage.getHttpProxyHost(), configStorage.getHttpProxyPort());
|
||||
|
||||
@@ -48,8 +48,10 @@ public class WxQidianServiceHttpComponentsImpl extends BaseWxQidianServiceImpl<C
|
||||
HttpComponentsClientBuilder apacheHttpClientBuilder = DefaultHttpComponentsClientBuilder.get();
|
||||
|
||||
apacheHttpClientBuilder.httpProxyHost(configStorage.getHttpProxyHost())
|
||||
.httpProxyPort(configStorage.getHttpProxyPort()).httpProxyUsername(configStorage.getHttpProxyUsername())
|
||||
.httpProxyPassword(configStorage.getHttpProxyPassword().toCharArray());
|
||||
.httpProxyPort(configStorage.getHttpProxyPort())
|
||||
.httpProxyUsername(configStorage.getHttpProxyUsername())
|
||||
.httpProxyPassword(configStorage.getHttpProxyPassword() == null ? null :
|
||||
configStorage.getHttpProxyPassword().toCharArray());
|
||||
|
||||
if (configStorage.getHttpProxyHost() != null && configStorage.getHttpProxyPort() > 0) {
|
||||
this.httpProxy = new HttpHost(configStorage.getHttpProxyHost(), configStorage.getHttpProxyPort());
|
||||
|
||||
Reference in New Issue
Block a user