mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	添加枚举HttpType
This commit is contained in:
		| @ -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.WxAccessToken; | ||||||
| import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||||
| import me.chanjar.weixin.common.exception.WxErrorException; | 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.ApacheHttpClientBuilder; | ||||||
| import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; | import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; | ||||||
| import me.chanjar.weixin.cp.api.WxCpConfigStorage; | import me.chanjar.weixin.cp.api.WxCpConfigStorage; | ||||||
| @ -32,6 +33,11 @@ public class WxCpServiceImpl extends AbstractWxCpService<CloseableHttpClient, Ht | |||||||
|     return httpProxy; |     return httpProxy; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public HttpType getRequestType() { | ||||||
|  |     return HttpType.apacheHttp; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public String getAccessToken(boolean forceRefresh) throws WxErrorException { |   public String getAccessToken(boolean forceRefresh) throws WxErrorException { | ||||||
|     if (forceRefresh) { |     if (forceRefresh) { | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ import jodd.http.*; | |||||||
| import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||||
| import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||||
| import me.chanjar.weixin.common.exception.WxErrorException; | 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.WxCpConfigStorage; | ||||||
| import me.chanjar.weixin.cp.api.impl.AbstractWxCpServiceImpl; | import me.chanjar.weixin.cp.api.impl.AbstractWxCpServiceImpl; | ||||||
|  |  | ||||||
| @ -22,6 +23,11 @@ public class WxCpServiceImpl extends AbstractWxCpServiceImpl<HttpConnectionProvi | |||||||
|     return httpProxy; |     return httpProxy; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public HttpType getRequestType() { | ||||||
|  |     return HttpType.joddHttp; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public String getAccessToken(boolean forceRefresh) throws WxErrorException { |   public String getAccessToken(boolean forceRefresh) throws WxErrorException { | ||||||
|     if (forceRefresh) { |     if (forceRefresh) { | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import java.io.IOException; | |||||||
| import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||||
| import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||||
| import me.chanjar.weixin.common.exception.WxErrorException; | 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.common.util.http.okhttp.OkhttpProxyInfo; | ||||||
| import me.chanjar.weixin.cp.api.WxCpConfigStorage; | import me.chanjar.weixin.cp.api.WxCpConfigStorage; | ||||||
| import me.chanjar.weixin.cp.api.impl.AbstractWxCpServiceImpl; | import me.chanjar.weixin.cp.api.impl.AbstractWxCpServiceImpl; | ||||||
| @ -25,6 +26,11 @@ public class WxCpServiceImpl extends AbstractWxCpServiceImpl<ConnectionPool, Okh | |||||||
|     return httpProxy; |     return httpProxy; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public HttpType getRequestType() { | ||||||
|  |     return HttpType.okHttp; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public String getAccessToken(boolean forceRefresh) throws WxErrorException { |   public String getAccessToken(boolean forceRefresh) throws WxErrorException { | ||||||
|     if (forceRefresh) { |     if (forceRefresh) { | ||||||
|  | |||||||
| @ -46,6 +46,11 @@ public class WxMpServiceImpl extends AbstractWxMpServiceImpl<CloseableHttpClient | |||||||
|     return httpProxy; |     return httpProxy; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public HttpType getRequestType() { | ||||||
|  |     return HttpType.apacheHttp; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public void initHttp() { |   public void initHttp() { | ||||||
|     WxMpConfigStorage configStorage = this.getWxMpConfigStorage(); |     WxMpConfigStorage configStorage = this.getWxMpConfigStorage(); | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import jodd.http.net.SocketHttpConnectionProvider; | |||||||
| import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||||
| import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||||
| import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||||
|  | import me.chanjar.weixin.common.util.http.HttpType; | ||||||
| import me.chanjar.weixin.mp.api.*; | import me.chanjar.weixin.mp.api.*; | ||||||
| import me.chanjar.weixin.mp.api.impl.*; | import me.chanjar.weixin.mp.api.impl.*; | ||||||
|  |  | ||||||
| @ -27,6 +28,11 @@ public class WxMpServiceImpl extends AbstractWxMpServiceImpl<HttpConnectionProvi | |||||||
|     return httpProxy; |     return httpProxy; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public HttpType getRequestType() { | ||||||
|  |     return HttpType.joddHttp; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public void initHttp() { |   public void initHttp() { | ||||||
|  |  | ||||||
|  | |||||||
| @ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl.okhttp; | |||||||
| import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||||
| import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||||
| import me.chanjar.weixin.common.exception.WxErrorException; | 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.common.util.http.okhttp.OkhttpProxyInfo; | ||||||
| import me.chanjar.weixin.mp.api.WxMpConfigStorage; | import me.chanjar.weixin.mp.api.WxMpConfigStorage; | ||||||
| import me.chanjar.weixin.mp.api.WxMpService; | import me.chanjar.weixin.mp.api.WxMpService; | ||||||
| @ -26,6 +27,11 @@ public class WxMpServiceImpl extends AbstractWxMpServiceImpl<ConnectionPool, Okh | |||||||
|     return httpProxy; |     return httpProxy; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public HttpType getRequestType() { | ||||||
|  |     return HttpType.okHttp; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public String getAccessToken(boolean forceRefresh) throws WxErrorException { |   public String getAccessToken(boolean forceRefresh) throws WxErrorException { | ||||||
|     Lock lock = this.getWxMpConfigStorage().getAccessTokenLock(); |     Lock lock = this.getWxMpConfigStorage().getAccessTokenLock(); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 ecoolper
					ecoolper