me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor Maven / Gradle / Ivy
package me.chanjar.weixin.common.util.http;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientSimpleGetRequestExecutor;
import me.chanjar.weixin.common.util.http.jodd.JoddHttpSimpleGetRequestExecutor;
import me.chanjar.weixin.common.util.http.okhttp.OkHttpSimpleGetRequestExecutor;
/**
* 简单的GET请求执行器,请求的参数是String, 返回的结果也是String
*
* @author Daniel Qian
*/
public abstract class SimpleGetRequestExecutor implements RequestExecutor {
protected RequestHttp requestHttp;
public SimpleGetRequestExecutor(RequestHttp requestHttp) {
this.requestHttp = requestHttp;
}
public static RequestExecutor create(RequestHttp requestHttp) {
switch (requestHttp.getRequestType()) {
case APACHE_HTTP:
return new ApacheHttpClientSimpleGetRequestExecutor(requestHttp);
case JODD_HTTP:
return new JoddHttpSimpleGetRequestExecutor(requestHttp);
case OK_HTTP:
return new OkHttpSimpleGetRequestExecutor(requestHttp);
default:
throw new IllegalArgumentException("非法请求参数");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy