1
0
mirror of synced 2025-12-23 18:48:00 +08:00

添加枚举HttpType

This commit is contained in:
ecoolper
2017-05-03 21:11:56 +08:00
parent 2384b4b863
commit 6b7c86da95
6 changed files with 35 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ package me.chanjar.weixin.cp.api.impl.apache;
import me.chanjar.weixin.common.bean.WxAccessToken;
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.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import me.chanjar.weixin.cp.api.WxCpConfigStorage;
@@ -32,6 +33,11 @@ public class WxCpServiceImpl extends AbstractWxCpService<CloseableHttpClient, Ht
return httpProxy;
}
@Override
public HttpType getRequestType() {
return HttpType.apacheHttp;
}
@Override
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {

View File

@@ -4,6 +4,7 @@ import jodd.http.*;
import me.chanjar.weixin.common.bean.WxAccessToken;
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.cp.api.WxCpConfigStorage;
import me.chanjar.weixin.cp.api.impl.AbstractWxCpServiceImpl;
@@ -22,6 +23,11 @@ public class WxCpServiceImpl extends AbstractWxCpServiceImpl<HttpConnectionProvi
return httpProxy;
}
@Override
public HttpType getRequestType() {
return HttpType.joddHttp;
}
@Override
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {

View File

@@ -5,6 +5,7 @@ import java.io.IOException;
import me.chanjar.weixin.common.bean.WxAccessToken;
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.cp.api.WxCpConfigStorage;
import me.chanjar.weixin.cp.api.impl.AbstractWxCpServiceImpl;
@@ -25,6 +26,11 @@ public class WxCpServiceImpl extends AbstractWxCpServiceImpl<ConnectionPool, Okh
return httpProxy;
}
@Override
public HttpType getRequestType() {
return HttpType.okHttp;
}
@Override
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {