public class BaseHttpExecutor extends Object
| 构造器和说明 |
|---|
BaseHttpExecutor() |
| 限定符和类型 | 方法和说明 |
|---|---|
static okhttp3.Request.Builder |
buildBaseReq()
构建builder
|
static void |
executeAsync(@NotNull okhttp3.Callback callback,
@NotNull okhttp3.OkHttpClient client,
@NotNull okhttp3.Request req)
执行异步请求(okhttp3原生callback)
|
static void |
executeAsync(@NotNull HttpCallback httpCallback,
@NotNull okhttp3.OkHttpClient client,
@NotNull okhttp3.Request req,
boolean logFlag,
@Nullable String reqId)
执行异步请求
|
static HttpResponse |
executeGet(@NotNull String url,
@Nullable okhttp3.Headers headers,
@Nullable ClientConfig clientConfig)
执行同步get请求
|
static void |
executeGetAsync(@NotNull String url,
@Nullable okhttp3.Headers headers,
@Nullable ClientConfig clientConfig,
@NotNull okhttp3.Callback callback)
执行异步Get请求
|
static void |
executeGetAsync(@NotNull String url,
@Nullable okhttp3.Headers headers,
@Nullable ClientConfig clientConfig,
@NotNull HttpCallback httpCallback)
执行异步Get请求
|
static HttpResponse |
executeWithBody(@NotNull String method,
@NotNull String url,
@Nullable okhttp3.Headers headers,
@Nullable byte[] body,
@Nullable okhttp3.MediaType contentType,
@Nullable ClientConfig clientConfig)
执行同步请求
|
static void |
executeWithBodyAsync(@NotNull String method,
@NotNull String url,
@Nullable okhttp3.Headers headers,
@Nullable byte[] body,
@Nullable okhttp3.MediaType contentType,
@Nullable ClientConfig clientConfig,
@NotNull okhttp3.Callback callback)
执行异步请求
|
static void |
executeWithBodyAsync(@NotNull String method,
@NotNull String url,
@Nullable okhttp3.Headers headers,
@Nullable byte[] body,
@Nullable okhttp3.MediaType contentType,
@Nullable ClientConfig clientConfig,
@NotNull HttpCallback httpCallback)
执行异步请求
|
static boolean |
getLogFlag() |
static LogLevelEnum |
getLogLevel() |
static void |
setLogFlag(boolean logFlag) |
static void |
setLogLevel(LogLevelEnum logLevel) |
public static LogLevelEnum getLogLevel()
public static void setLogLevel(LogLevelEnum logLevel)
public static boolean getLogFlag()
public static void setLogFlag(boolean logFlag)
public static okhttp3.Request.Builder buildBaseReq()
public static HttpResponse executeGet(@NotNull @NotNull String url, @Nullable @Nullable okhttp3.Headers headers, @Nullable @Nullable ClientConfig clientConfig) throws IOException
url - url地址headers - 请求头clientConfig - client配置IOExceptionpublic static HttpResponse executeWithBody(@NotNull @NotNull String method, @NotNull @NotNull String url, @Nullable @Nullable okhttp3.Headers headers, @Nullable @Nullable byte[] body, @Nullable @Nullable okhttp3.MediaType contentType, @Nullable @Nullable ClientConfig clientConfig) throws IOException
method - http methodurl - url地址headers - 请求头body - 请求体contentType - 请求体的消息类型clientConfig - client配置IOExceptionpublic static void executeGetAsync(@NotNull
@NotNull String url,
@Nullable
@Nullable okhttp3.Headers headers,
@Nullable
@Nullable ClientConfig clientConfig,
@NotNull
@NotNull HttpCallback httpCallback)
url - url地址headers - 请求头clientConfig - client配置httpCallback - 异步callbackpublic static void executeWithBodyAsync(@NotNull
@NotNull String method,
@NotNull
@NotNull String url,
@Nullable
@Nullable okhttp3.Headers headers,
@Nullable
@Nullable byte[] body,
@Nullable
@Nullable okhttp3.MediaType contentType,
@Nullable
@Nullable ClientConfig clientConfig,
@NotNull
@NotNull HttpCallback httpCallback)
method - http methodurl - url地址headers - 请求头body - 请求体contentType - 请求体的消息类型clientConfig - client配置httpCallback - 异步callbackpublic static void executeGetAsync(@NotNull
@NotNull String url,
@Nullable
@Nullable okhttp3.Headers headers,
@Nullable
@Nullable ClientConfig clientConfig,
@NotNull
@NotNull okhttp3.Callback callback)
url - url地址headers - 请求头clientConfig - client配置callback - 异步callbackpublic static void executeWithBodyAsync(@NotNull
@NotNull String method,
@NotNull
@NotNull String url,
@Nullable
@Nullable okhttp3.Headers headers,
@Nullable
@Nullable byte[] body,
@Nullable
@Nullable okhttp3.MediaType contentType,
@Nullable
@Nullable ClientConfig clientConfig,
@NotNull
@NotNull okhttp3.Callback callback)
method - http methodurl - url地址headers - 请求头body - 请求体contentType - 请求体的消息类型clientConfig - client配置callback - 异步callbackpublic static void executeAsync(@NotNull
@NotNull HttpCallback httpCallback,
@NotNull
@NotNull okhttp3.OkHttpClient client,
@NotNull
@NotNull okhttp3.Request req,
boolean logFlag,
@Nullable
@Nullable String reqId)
httpCallback - 异步callbackclient - http clientreq - http requestpublic static void executeAsync(@NotNull
@NotNull okhttp3.Callback callback,
@NotNull
@NotNull okhttp3.OkHttpClient client,
@NotNull
@NotNull okhttp3.Request req)
callback - 异步callbackclient - http clientreq - http requestCopyright © 2020. All rights reserved.