mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-20 02:29:44 +08:00
#855 http请求执行器类RequestExecutor接口增加异步执行方法
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package me.chanjar.weixin.open.api.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
@@ -7,17 +12,13 @@ import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.open.api.WxOpenComponentService;
|
||||
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
|
||||
import me.chanjar.weixin.open.api.WxOpenService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
public abstract class WxOpenServiceAbstractImpl<H, P> implements WxOpenService, RequestHttp<H, P> {
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
protected WxOpenComponentService wxOpenComponentService = new WxOpenComponentServiceImpl(this);
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
private WxOpenComponentService wxOpenComponentService = new WxOpenComponentServiceImpl(this);
|
||||
private WxOpenConfigStorage wxOpenConfigStorage;
|
||||
|
||||
@Override
|
||||
@@ -37,7 +38,7 @@ public abstract class WxOpenServiceAbstractImpl<H, P> implements WxOpenService,
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 RequestHttp
|
||||
* 初始化 RequestHttp.
|
||||
*/
|
||||
public abstract void initHttp();
|
||||
|
||||
|
@@ -1,15 +1,17 @@
|
||||
package me.chanjar.weixin.open.util.requestexecuter.ma;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.ResponseHandler;
|
||||
import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 获得小程序体验QrCode图片 请求执行器
|
||||
* 获得小程序体验QrCode图片 请求执行器.
|
||||
*
|
||||
* @author yqx
|
||||
* @date 2018-09-13
|
||||
@@ -21,6 +23,11 @@ public abstract class MaQrCodeRequestExecutor<H, P> implements RequestExecutor<F
|
||||
this.requestHttp = requestHttp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String uri, WxMaQrcodeParam data, ResponseHandler<File> handler) throws WxErrorException, IOException {
|
||||
handler.handle(this.execute(uri, data));
|
||||
}
|
||||
|
||||
public static RequestExecutor<File, WxMaQrcodeParam> create(RequestHttp requestHttp) throws WxErrorException {
|
||||
switch (requestHttp.getRequestType()) {
|
||||
case APACHE_HTTP:
|
||||
|
Reference in New Issue
Block a user