public class AsyncHttpClient extends Object
限定符和类型 | 方法和说明 |
---|---|
static AsyncHttpClient |
build(String group)
构造一个实例
|
static AsyncHttpClient |
build(String group,
OkHttpClient client)
构造一个实例
|
void |
cancelAll()
取消所有
|
void |
cancelRequests(Object context,
boolean mayInterruptIfRunning)
取消请求
|
void |
close() |
void |
delete(Object context,
String url,
AsyncHttpResponseHandler responseHandler)
执行delete方法
|
void |
delete(Object context,
String url,
Map<String,String> headers,
Map<String,String> params,
AsyncHttpResponseHandler responseHandler)
执行delete方法
|
void |
execMethod(String method,
Object context,
String url,
Map<String,String> headers,
Map<String,String> params,
AsyncHttpResponseHandler responseHandler)
执行方法
|
void |
execMethod(String method,
Object context,
String url,
Map<String,String> headers,
RequestBody requestBody,
AsyncHttpResponseHandler responseHandler) |
void |
execMethod(String method,
Object context,
String url,
Map<String,String> headers,
RequestParams params,
AsyncHttpResponseHandler responseHandler)
执行方法
|
void |
get(Object context,
String url,
AsyncHttpResponseHandler responseHandler)
执行get方法
|
void |
get(Object context,
String url,
Map<String,String> headers,
Map<String,String> params,
AsyncHttpResponseHandler responseHandler)
执行get方法
|
void |
get(Object context,
String url,
RequestParams requestParams,
AsyncHttpResponseHandler responseHandler)
执行get方法
|
protected RetryHandler |
getRetryHandler()
获取RetryHandler
|
void |
patch(Object context,
String url,
AsyncHttpResponseHandler responseHandler)
执行patch方法
|
void |
patch(Object context,
String url,
Map<String,String> headers,
Map<String,String> params,
AsyncHttpResponseHandler responseHandler)
执行patch方法
|
void |
post(Object context,
String url,
AsyncHttpResponseHandler responseHandler)
执行post方法
|
void |
post(Object context,
String url,
JSONObject json,
AsyncHttpResponseHandler responseHandler)
执行post方法
|
void |
post(Object context,
String url,
Map<String,String> headers,
Map<String,String> params,
AsyncHttpResponseHandler responseHandler)
执行post方法
|
void |
put(Object context,
String url,
AsyncHttpResponseHandler responseHandler)
执行put方法
|
void |
put(Object context,
String url,
Map<String,String> headers,
Map<String,String> params,
AsyncHttpResponseHandler responseHandler)
执行put方法
|
protected void |
sendRequest(OkHttpClient client,
Request uriRequest,
AsyncHttpResponseHandler responseHandler,
Object context) |
void |
setThreadPool(PoolManager.Pool pool)
设置线程池
|
public static AsyncHttpClient build(String group)
group
- public static AsyncHttpClient build(String group, OkHttpClient client)
group
- client
- public void setThreadPool(PoolManager.Pool pool)
pool
- protected RetryHandler getRetryHandler()
public void get(Object context, String url, AsyncHttpResponseHandler responseHandler)
context
- url
- responseHandler
- public void get(Object context, String url, Map<String,String> headers, Map<String,String> params, AsyncHttpResponseHandler responseHandler)
context
- url
- headers
- params
- responseHandler
- public void get(Object context, String url, RequestParams requestParams, AsyncHttpResponseHandler responseHandler)
context
- url
- requestParams
- responseHandler
- public void patch(Object context, String url, AsyncHttpResponseHandler responseHandler)
context
- url
- responseHandler
- public void patch(Object context, String url, Map<String,String> headers, Map<String,String> params, AsyncHttpResponseHandler responseHandler)
context
- url
- headers
- params
- responseHandler
- public void post(Object context, String url, AsyncHttpResponseHandler responseHandler)
context
- url
- responseHandler
- public void post(Object context, String url, JSONObject json, AsyncHttpResponseHandler responseHandler)
context
- url
- json
- responseHandler
- public void post(Object context, String url, Map<String,String> headers, Map<String,String> params, AsyncHttpResponseHandler responseHandler)
context
- url
- headers
- params
- responseHandler
- public void put(Object context, String url, AsyncHttpResponseHandler responseHandler)
context
- url
- responseHandler
- public void put(Object context, String url, Map<String,String> headers, Map<String,String> params, AsyncHttpResponseHandler responseHandler)
context
- url
- headers
- params
- responseHandler
- public void delete(Object context, String url, AsyncHttpResponseHandler responseHandler)
context
- url
- responseHandler
- public void delete(Object context, String url, Map<String,String> headers, Map<String,String> params, AsyncHttpResponseHandler responseHandler)
context
- url
- headers
- params
- responseHandler
- public void execMethod(String method, Object context, String url, Map<String,String> headers, Map<String,String> params, AsyncHttpResponseHandler responseHandler)
method
- context
- url
- headers
- params
- responseHandler
- public void execMethod(String method, Object context, String url, Map<String,String> headers, RequestParams params, AsyncHttpResponseHandler responseHandler)
method
- context
- url
- headers
- params
- responseHandler
- public void execMethod(String method, Object context, String url, Map<String,String> headers, RequestBody requestBody, AsyncHttpResponseHandler responseHandler)
method
- context
- url
- headers
- requestBody
- responseHandler
- protected void sendRequest(OkHttpClient client, Request uriRequest, AsyncHttpResponseHandler responseHandler, Object context)
public void cancelRequests(Object context, boolean mayInterruptIfRunning)
context
- mayInterruptIfRunning
- public void cancelAll()
public void close()