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