public class OkHttpHttpClient extends AbstractHttpClient
限定符和类型 | 类和说明 |
---|---|
protected static interface |
AbstractBaseHttpClient.AsyncExecute |
protected static interface |
AbstractBaseHttpClient.Execute<T> |
构造器和说明 |
---|
OkHttpHttpClient()
构造函数
|
OkHttpHttpClient(okhttp3.OkHttpClient httpClient)
构造函数
|
OkHttpHttpClient(OkHttpClientConnectionManager connectionManager)
构造函数
|
限定符和类型 | 方法和说明 |
---|---|
protected static void |
asyncExecute(AbstractBaseHttpClient.AsyncExecute execute) |
Response |
connect(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
CONNECT 请求
|
Response |
connect(URI uri,
Map<String,Object> parameters,
List<Header> headers)
CONNECT 请求
|
Response |
copy(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
COPY 请求
|
Response |
copy(URI uri,
Map<String,Object> parameters,
List<Header> headers)
COPY 请求
|
Response |
delete(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
DELETE 请求
|
Response |
delete(URI uri,
Map<String,Object> parameters,
List<Header> headers)
DELETE 请求
|
protected Response |
doRequest(OkHttpRequest request) |
protected Response |
doRequest(OkHttpRequestBuilder builder) |
protected Response |
doRequest(OkHttpRequestBuilder builder,
int readTimeout) |
protected static <T> T |
execute(AbstractBaseHttpClient.Execute<T> execute) |
Response |
get(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
GET 请求
|
Response |
get(URI uri,
Map<String,Object> parameters,
List<Header> headers)
GET 请求
|
ConnectionManager |
getConnectionManager()
获取连接管理器
|
okhttp3.OkHttpClient |
getHttpClient() |
ProtocolVersion |
getHttpVersion()
获取 HTTP 协议版本
|
Response |
head(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
HEAD 请求
|
Response |
head(URI uri,
Map<String,Object> parameters,
List<Header> headers)
HEAD 请求
|
Response |
link(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
LINK 请求
|
Response |
link(URI uri,
Map<String,Object> parameters,
List<Header> headers)
LINK 请求
|
Response |
lock(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
LOCK 请求
|
Response |
lock(URI uri,
Map<String,Object> parameters,
List<Header> headers)
LOCK 请求
|
Response |
move(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
MOVE 请求
|
Response |
move(URI uri,
Map<String,Object> parameters,
List<Header> headers)
MOVE 请求
|
Response |
options(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
OPTIONS 请求
|
Response |
options(URI uri,
Map<String,Object> parameters,
List<Header> headers)
OPTIONS 请求
|
Response |
patch(URI uri,
int readTimeout,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
PATCH 请求
|
Response |
patch(URI uri,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
PATCH 请求
|
Response |
post(URI uri,
int readTimeout,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
POST 请求
|
Response |
post(URI uri,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
POST 请求
|
Response |
propfind(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
PROPFIND 请求
|
Response |
propfind(URI uri,
Map<String,Object> parameters,
List<Header> headers)
PROPFIND 请求
|
Response |
proppatch(URI uri,
int readTimeout,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
PROPPATCH 请求
|
Response |
proppatch(URI uri,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
PROPPATCH 请求
|
Response |
purge(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
PURGE 请求
|
Response |
purge(URI uri,
Map<String,Object> parameters,
List<Header> headers)
PURGE 请求
|
Response |
put(URI uri,
int readTimeout,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
PUT 请求
|
Response |
put(URI uri,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
PUT 请求
|
Response |
report(URI uri,
int readTimeout,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
REPORT 请求
|
Response |
report(URI uri,
RequestBody<?> data,
Map<String,Object> parameters,
List<Header> headers)
REPORT 请求
|
void |
setConnectionManager(ConnectionManager connectionManager)
设置连接管理器
|
void |
setHttpClient(okhttp3.OkHttpClient httpClient) |
void |
setHttpVersion(ProtocolVersion httpVersion)
设置 HTTP 协议版本
|
Response |
trace(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
TRACE 请求
|
Response |
trace(URI uri,
Map<String,Object> parameters,
List<Header> headers)
TRACE 请求
|
Response |
unlink(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
UNLINK 请求
|
Response |
unlink(URI uri,
Map<String,Object> parameters,
List<Header> headers)
UNLINK 请求
|
Response |
unlock(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
UNLOCK 请求
|
Response |
unlock(URI uri,
Map<String,Object> parameters,
List<Header> headers)
UNLOCK 请求
|
protected static URI |
URL2URI(URL url) |
Response |
view(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
VIEW 请求
|
Response |
view(URI uri,
Map<String,Object> parameters,
List<Header> headers)
VIEW 请求
|
Response |
wrapped(URI uri,
int readTimeout,
Map<String,Object> parameters,
List<Header> headers)
WRAPPED 请求
|
Response |
wrapped(URI uri,
Map<String,Object> parameters,
List<Header> headers)
WRAPPED 请求
|
connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, delete, delete, delete, delete, delete, delete, delete, delete, delete, delete, delete, delete, delete, delete, get, get, get, get, get, get, get, get, get, get, get, get, get, get, head, head, head, head, head, head, head, head, head, head, head, head, head, head, link, link, link, link, link, link, link, link, link, link, link, link, link, link, lock, lock, lock, lock, lock, lock, lock, lock, lock, lock, lock, lock, lock, lock, move, move, move, move, move, move, move, move, move, move, move, move, move, move, options, options, options, options, options, options, options, options, options, options, options, options, options, options, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, purge, purge, purge, purge, purge, purge, purge, purge, purge, purge, purge, purge, purge, purge, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, view, view, view, view, view, view, view, view, view, view, view, view, view, view, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, connect, connect, connect, connect, connect, connect, connect, copy, copy, copy, copy, copy, copy, copy, copy, delete, delete, delete, delete, delete, delete, delete, delete, get, get, get, get, get, get, get, get, head, head, head, head, head, head, head, head, link, link, link, link, link, link, link, link, lock, lock, lock, lock, lock, lock, lock, lock, move, move, move, move, move, move, move, move, options, options, options, options, options, options, options, options, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, patch, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, propfind, propfind, propfind, propfind, propfind, propfind, propfind, propfind, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, proppatch, purge, purge, purge, purge, purge, purge, purge, purge, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, report, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, request, trace, trace, trace, trace, trace, trace, trace, trace, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlink, unlock, unlock, unlock, unlock, unlock, unlock, unlock, unlock, view, view, view, view, view, view, view, view, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped, wrapped
getConnectionManager, getHttpVersion, setConnectionManager, setHttpVersion
public OkHttpHttpClient()
public OkHttpHttpClient(OkHttpClientConnectionManager connectionManager)
connectionManager
- 连接管理器public OkHttpHttpClient(okhttp3.OkHttpClient httpClient)
httpClient
- OkHttp Clientpublic okhttp3.OkHttpClient getHttpClient()
public void setHttpClient(okhttp3.OkHttpClient httpClient)
public Response get(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response get(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response post(URI uri, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLdata
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response post(URI uri, int readTimeout, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间data
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response put(URI uri, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLdata
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response put(URI uri, int readTimeout, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间data
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response patch(URI uri, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLdata
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response patch(URI uri, int readTimeout, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间data
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response delete(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response delete(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response connect(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response connect(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response trace(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response trace(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response copy(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response copy(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response move(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response move(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response head(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response head(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response options(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response options(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response link(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response link(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response unlink(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response unlink(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response purge(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response purge(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response lock(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response lock(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response unlock(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response unlock(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response propfind(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response propfind(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response proppatch(URI uri, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLdata
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response proppatch(URI uri, int readTimeout, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间data
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response report(URI uri, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLdata
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response report(URI uri, int readTimeout, RequestBody<?> data, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间data
- 请求数据parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response view(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response view(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response wrapped(URI uri, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLparameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常public Response wrapped(URI uri, int readTimeout, Map<String,Object> parameters, List<Header> headers) throws IOException, RequestException
HttpClient
uri
- 请求 URLreadTimeout
- 读取超时时间parameters
- 请求参数headers
- 请求头Response
IOException
- IO 异常RequestException
- 请求异常protected Response doRequest(OkHttpRequestBuilder builder) throws IOException, RequestException
protected Response doRequest(OkHttpRequestBuilder builder, int readTimeout) throws IOException, RequestException
protected Response doRequest(OkHttpRequest request) throws IOException, RequestException
public ConnectionManager getConnectionManager()
IBaseHttpClient
getConnectionManager
在接口中 IBaseHttpClient
public void setConnectionManager(ConnectionManager connectionManager)
IBaseHttpClient
setConnectionManager
在接口中 IBaseHttpClient
connectionManager
- 连接管理器public ProtocolVersion getHttpVersion()
IBaseHttpClient
getHttpVersion
在接口中 IBaseHttpClient
public void setHttpVersion(ProtocolVersion httpVersion)
IBaseHttpClient
setHttpVersion
在接口中 IBaseHttpClient
httpVersion
- HTTP 协议版本protected static URI URL2URI(URL url) throws URISyntaxException
protected static <T> T execute(AbstractBaseHttpClient.Execute<T> execute) throws IOException, RequestException
protected static void asyncExecute(AbstractBaseHttpClient.AsyncExecute execute) throws IOException, RequestException
Copyright © 2023 buession.com Inc.. All rights reserved.