public class OkHttpUtils extends AbstractHttpUtils implements HttpUtils
| Modifier and Type | Class and Description |
|---|---|
static class |
OkHttpUtils.StreamBody |
| Modifier and Type | Field and Description |
|---|---|
protected static OkHttpDispatcherLoader |
dispatcherLoader |
protected static org.slf4j.Logger |
log |
_charset, _cookies, _enablePrintln, _files, _headers, _multipart, _params, _proxy, _serializer, _sslSupplier, _timeout, _url| Constructor and Description |
|---|
OkHttpUtils(String url) |
| Modifier and Type | Method and Description |
|---|---|
HttpUtils |
body(byte[] bytes,
String contentType)
主体配置
|
HttpUtils |
body(InputStream raw,
String contentType)
主体配置
|
HttpUtils |
body(String txt,
String contentType)
设置 BODY txt 及内容类型
|
HttpUtils |
bodyOfBean(Object obj)
主体配置(由序列化器决定内容类型)
|
protected HttpResponse |
execDo(String _method,
CompletableFuture<HttpResponse> future) |
protected okhttp3.OkHttpClient |
getClient() |
protected List<okhttp3.ConnectionSpec> |
getConnectionSpecs() |
protected HttpResponse |
getResponse(okhttp3.Response response,
String method) |
protected String |
urlRebuild(String method,
String url,
Charset charset) |
charset, charset, cookie, cookieAdd, cookies, cookies, data, data, data, data, data, delete, deleteAs, enablePrintln, exec, execAsBody, execAsBody, execAsCode, execAsLineStream, execAsSseStream, execAsync, get, getAs, getLocationUrl, getRequestCookieString, head, header, headerAdd, headers, headers, isRedirected, multipart, options, patch, patchAs, post, postAs, proxy, put, putAs, serializer, serializer, ssl, timeout, tryInitCookies, tryInitFiles, tryInitHeaders, tryInitParams, userAgentclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, body, body, bodyJson, bodyOfJson, bodyOfTxt, bodyRaw, bodyRaw, bodyRaw, bodyRaw, bodyTxt, bodyTxt, charset, contentType, cookie, cookieAdd, cookies, cookies, data, data, data, data, data, data, delete, deleteAs, enablePrintln, exec, execAsBody, execAsBody, execAsCode, execAsEventStream, execAsLineStream, execAsSseStream, execAsTextStream, execAsync, fill, get, getAs, head, header, headerAdd, headers, headers, http, http, http, multipart, options, patch, patchAs, post, post, postAs, postAs, proxy, proxy, put, putAs, serializer, serializer, ssl, timeout, timeout, timeout, toQueryString, toQueryString, urlEncode, urlEncode, userAgentprotected static final org.slf4j.Logger log
protected static final OkHttpDispatcherLoader dispatcherLoader
public OkHttpUtils(String url)
public HttpUtils bodyOfBean(Object obj) throws HttpException
HttpUtilsbodyOfBean in interface HttpUtilsHttpExceptionpublic HttpUtils body(byte[] bytes, String contentType)
HttpUtilspublic HttpUtils body(InputStream raw, String contentType)
HttpUtilsprotected HttpResponse execDo(String _method, CompletableFuture<HttpResponse> future) throws IOException
execDo in class AbstractHttpUtilsIOExceptionprotected okhttp3.OkHttpClient getClient()
protected List<okhttp3.ConnectionSpec> getConnectionSpecs()
protected HttpResponse getResponse(okhttp3.Response response, String method) throws IOException
IOExceptionprotected String urlRebuild(String method, String url, Charset charset) throws UnsupportedEncodingException
UnsupportedEncodingExceptionCopyright © 2025. All rights reserved.