mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	修改两个文件
This commit is contained in:
		| @ -1,25 +1,33 @@ | ||||
| package me.chanjar.weixin.mp.util.http; | ||||
|  | ||||
| import me.chanjar.weixin.common.util.http.RequestExecutor; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| import me.chanjar.weixin.mp.bean.material.WxMpMaterialVideoInfoResult; | ||||
| import me.chanjar.weixin.mp.util.http.apache.ApacheMaterialVideoInfoRequestExecutor; | ||||
| import me.chanjar.weixin.mp.util.http.jodd.JoddMaterialVideoInfoRequestExecutor; | ||||
| import me.chanjar.weixin.mp.util.http.okhttp.OkhttpMaterialVideoInfoRequestExecutor; | ||||
|  | ||||
|   import me.chanjar.weixin.common.util.http.RequestExecutor; | ||||
|   import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
|  | ||||
|   import me.chanjar.weixin.mp.bean.material.WxMpMaterialVideoInfoResult; | ||||
|   import me.chanjar.weixin.mp.util.http.apache.ApacheMaterialVideoInfoRequestExecutor; | ||||
|   import me.chanjar.weixin.mp.util.http.jodd.JoddMaterialVideoInfoRequestExecutor; | ||||
|   import me.chanjar.weixin.mp.util.http.okhttp.OkhttpMaterialVideoInfoRequestExecutor; | ||||
|  | ||||
|  | ||||
| public abstract class MaterialVideoInfoRequestExecutor<H, P> implements RequestExecutor<WxMpMaterialVideoInfoResult, String> { | ||||
|   protected RequestHttp<H, P> requestHttp; | ||||
|  | ||||
|   public MaterialVideoInfoRequestExecutor(RequestHttp requestHttp) { | ||||
|     this.requestHttp = requestHttp; | ||||
|   } | ||||
|           this.requestHttp = requestHttp; | ||||
|         } | ||||
|  | ||||
|   @Override | ||||
|   public WxMpMaterialVideoInfoResult executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String materialId) throws WxErrorException, IOException { | ||||
|     HttpRequest request = HttpRequest.post(uri); | ||||
|     if (proxyInfo != null) { | ||||
|       provider.useProxy(proxyInfo); | ||||
|     } | ||||
|   } | ||||
|         public static RequestExecutor<WxMpMaterialVideoInfoResult, String> create(RequestHttp requestHttp) { | ||||
|           switch (requestHttp.getRequestType()) { | ||||
|             case apacheHttp: | ||||
|               return new ApacheMaterialVideoInfoRequestExecutor(requestHttp); | ||||
|             case joddHttp: | ||||
|               return new JoddMaterialVideoInfoRequestExecutor(requestHttp); | ||||
|             case okHttp: | ||||
|               return new OkhttpMaterialVideoInfoRequestExecutor(requestHttp); | ||||
|             default: | ||||
|               return null; | ||||
|           } | ||||
|         } | ||||
|  | ||||
| } | ||||
|       } | ||||
|  | ||||
| @ -7,6 +7,7 @@ import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| import me.chanjar.weixin.common.util.http.okhttp.OkhttpProxyInfo; | ||||
| import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; | ||||
| import me.chanjar.weixin.mp.util.http.QrCodeRequestExecutor; | ||||
|  | ||||
| import okhttp3.*; | ||||
|  | ||||
| import java.io.ByteArrayInputStream; | ||||
| @ -46,7 +47,7 @@ public class OkhttpQrCodeRequestExecutor extends QrCodeRequestExecutor<Connectio | ||||
|     Request request = new Request.Builder().url(uri).get().build(); | ||||
|     Response response = client.newCall(request).execute(); | ||||
|     String contentTypeHeader = response.header("Content-Type"); | ||||
|     if (MimeTypes.MIME_TEXT_PLAIN.equals(contentTypeHeader)) { | ||||
|     if ("text/plain".equals(contentTypeHeader)) { | ||||
|       String responseContent = response.body().string(); | ||||
|       throw new WxErrorException(WxError.fromJson(responseContent)); | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 ecoolper
					ecoolper