mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 21:56:06 +08:00
#370 WxMpServiceOkHttpImpl改用httpProxy
This commit is contained in:
parent
a2cf1f66e5
commit
802f9e8a28
@ -67,8 +67,15 @@ public class WxCpServiceOkHttpImpl extends WxCpServiceAbstractImpl<OkHttpClient,
|
||||
@Override
|
||||
public void initHttp() {
|
||||
this.log.debug("WxCpServiceOkHttpImpl initHttp");
|
||||
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
||||
//设置代理
|
||||
if (configStorage.getHttpProxyHost() != null && configStorage.getHttpProxyPort() > 0) {
|
||||
httpProxy = OkHttpProxyInfo.httpProxy(configStorage.getHttpProxyHost(),
|
||||
configStorage.getHttpProxyPort(),
|
||||
configStorage.getHttpProxyUsername(),
|
||||
configStorage.getHttpProxyPassword());
|
||||
}
|
||||
|
||||
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
||||
if (httpProxy != null) {
|
||||
clientBuilder.proxy(getRequestHttpProxy().getProxy());
|
||||
|
||||
|
@ -28,7 +28,7 @@ public abstract class WxMpServiceAbstractImpl<H, P> implements WxMpService, Requ
|
||||
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
protected WxSessionManager sessionManager = new StandardSessionManager();
|
||||
private WxMpConfigStorage wxMpConfigStorage;
|
||||
protected WxMpConfigStorage wxMpConfigStorage;
|
||||
private WxMpKefuService kefuService = new WxMpKefuServiceImpl(this);
|
||||
private WxMpMaterialService materialService = new WxMpMaterialServiceImpl(this);
|
||||
private WxMpMenuService menuService = new WxMpMenuServiceImpl(this);
|
||||
|
@ -5,7 +5,6 @@ import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.HttpType;
|
||||
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import okhttp3.*;
|
||||
|
||||
@ -64,13 +63,16 @@ public class WxMpServiceOkHttpImpl extends WxMpServiceAbstractImpl<OkHttpClient,
|
||||
@Override
|
||||
public void initHttp() {
|
||||
this.log.debug("WxMpServiceOkHttpImpl initHttp");
|
||||
WxMpConfigStorage configStorage = this.getWxMpConfigStorage();
|
||||
|
||||
if (configStorage.getHttpProxyHost() != null && configStorage.getHttpProxyPort() > 0) {
|
||||
httpProxy = OkHttpProxyInfo.httpProxy(configStorage.getHttpProxyHost(), configStorage.getHttpProxyPort(), configStorage.getHttpProxyUsername(), configStorage.getHttpProxyPassword());
|
||||
}
|
||||
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
||||
//设置代理
|
||||
if (wxMpConfigStorage.getHttpProxyHost() != null && wxMpConfigStorage.getHttpProxyPort() > 0) {
|
||||
httpProxy = OkHttpProxyInfo.httpProxy(wxMpConfigStorage.getHttpProxyHost(),
|
||||
wxMpConfigStorage.getHttpProxyPort(),
|
||||
wxMpConfigStorage.getHttpProxyUsername(),
|
||||
wxMpConfigStorage.getHttpProxyPassword());
|
||||
}
|
||||
|
||||
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
|
||||
if (httpProxy != null) {
|
||||
clientBuilder.proxy(getRequestHttpProxy().getProxy());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user