mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 10:15:08 +08:00
fix some code
This commit is contained in:
@@ -8,20 +8,15 @@ public interface RequestHttp<H, P> {
|
||||
/**
|
||||
* 返回httpClient
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
H getRequestHttpClient();
|
||||
|
||||
/**
|
||||
* 返回httpProxy
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
P getRequestHttpProxy();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
HttpType getRequestType();
|
||||
|
||||
}
|
||||
|
@@ -12,11 +12,10 @@ import me.chanjar.weixin.common.util.http.okhttp.OkHttpSimpleGetRequestExecutor;
|
||||
public abstract class SimpleGetRequestExecutor<H, P> implements RequestExecutor<String, String> {
|
||||
protected RequestHttp<H, P> requestHttp;
|
||||
|
||||
public SimpleGetRequestExecutor(RequestHttp requestHttp) {
|
||||
public SimpleGetRequestExecutor(RequestHttp<H, P> requestHttp) {
|
||||
this.requestHttp = requestHttp;
|
||||
}
|
||||
|
||||
|
||||
public static RequestExecutor<String, String> create(RequestHttp requestHttp) {
|
||||
switch (requestHttp.getRequestType()) {
|
||||
case APACHE_HTTP:
|
||||
@@ -26,7 +25,7 @@ public abstract class SimpleGetRequestExecutor<H, P> implements RequestExecutor<
|
||||
case OK_HTTP:
|
||||
return new OkHttpSimpleGetRequestExecutor(requestHttp);
|
||||
default:
|
||||
return null;
|
||||
throw new IllegalArgumentException("非法请求参数");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -210,8 +210,7 @@ public abstract class AbstractWxMpServiceImpl<H, P> implements WxMpService, Requ
|
||||
String url = String.format(WxMpService.OAUTH2_VALIDATE_TOKEN_URL, oAuth2AccessToken.getAccessToken(), oAuth2AccessToken.getOpenId());
|
||||
|
||||
try {
|
||||
RequestExecutor<String, String> executor = SimpleGetRequestExecutor.create(this);
|
||||
executor.execute(url, null);
|
||||
SimpleGetRequestExecutor.create(this).execute(url, null);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (WxErrorException e) {
|
||||
|
Reference in New Issue
Block a user