限定符和类型 | 类和说明 |
---|---|
static class |
HttpUtilsImpl.StreamBody |
构造器和说明 |
---|
HttpUtilsImpl(java.lang.String url) |
HttpUtilsImpl(java.lang.String url,
okhttp3.OkHttpClient client) |
限定符和类型 | 方法和说明 |
---|---|
HttpUtilsImpl |
bodyJson(java.lang.String txt)
设置 BODY josn
|
HttpUtilsImpl |
bodyRaw(byte[] bytes)
设置 BODY raw
|
HttpUtilsImpl |
bodyRaw(byte[] bytes,
java.lang.String contentType)
"设置 BODY raw 及内容类型
|
HttpUtilsImpl |
bodyRaw(java.io.InputStream raw)
设置 BODY raw stream
|
HttpUtilsImpl |
bodyRaw(java.io.InputStream raw,
java.lang.String contentType)
设置 BODY raw stream 及内容类型
|
HttpUtilsImpl |
bodyTxt(java.lang.String txt)
设置 BODY txt
|
HttpUtilsImpl |
bodyTxt(java.lang.String txt,
java.lang.String contentType)
设置 BODY txt 及内容类型
|
HttpUtilsImpl |
charset(java.lang.String charset)
设置 charset
|
HttpUtilsImpl |
cookies(java.util.Map<java.lang.String,java.lang.String> cookies)
设置请求 cookies
|
HttpUtils |
data(java.lang.Iterable<KeyValues<java.lang.String>> data)
参数配置
|
HttpUtilsImpl |
data(java.util.Map data)
设置表单数据
|
HttpUtilsImpl |
data(java.lang.String key,
java.lang.String value)
设置表单数据
|
HttpUtilsImpl |
data(java.lang.String key,
java.lang.String filename,
java.io.InputStream inputStream,
java.lang.String contentType)
设置表单文件
|
java.lang.String |
delete()
发起DELETE请求,返回字符串(RESTAPI.delete 从服务端删除资源)
|
HttpUtils |
enablePrintln(boolean enable)
启用打印(专为 tester 服务)
|
HttpResponse |
exec(java.lang.String method)
执行请求,返回响应对象
|
java.lang.String |
execAsBody(java.lang.String method)
执行请求,返回Body字符串
|
int |
execAsCode(java.lang.String method)
执行请求,返回状态码
|
void |
execAsync(java.lang.String method,
HttpCallback callback)
异步执行请求
|
java.lang.String |
get()
发起GET请求,返回字符串(RESTAPI.select 从服务端获取一或多项资源)
|
void |
getAsync(HttpCallback callback)
get 异步执行请求
|
int |
head()
head 请求并返回 code
|
void |
headAsync(HttpCallback callback)
head 异步执行请求
|
HttpUtilsImpl |
header(java.lang.String name,
java.lang.String value)
设置请求头
|
HttpUtilsImpl |
headerAdd(java.lang.String name,
java.lang.String value)
添加请求头
|
HttpUtils |
headers(java.lang.Iterable<KeyValues<java.lang.String>> headers)
头配置
|
HttpUtilsImpl |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
设置请求头
|
HttpUtilsImpl |
multipart(boolean multipart)
设置 multipart 标识
|
java.lang.String |
options()
options 请求并返回 body
|
java.lang.String |
patch()
发起PATCH请求,返回字符串(RESTAPI.update 客户端提供改变的属性)
|
java.lang.String |
post()
发起POST请求,返回字符串(RESTAPI.create 在服务端新建一项资源)
|
void |
postAsync(HttpCallback callback)
post 异步执行请求
|
java.lang.String |
put()
发起PUT请求,返回字符串(RESTAPI.update 客户端提供改变后的完整资源)
|
HttpUtilsImpl |
timeout(int timeoutSeconds)
超时设置
|
HttpUtilsImpl |
timeout(int connectTimeoutSeconds,
int writeTimeoutSeconds,
int readTimeoutSeconds)
超时设置
|
static java.lang.String |
toQueryString(java.util.Map<?,?> map)
map 转为 queryString
|
static java.lang.String |
urlEncode(java.lang.String s)
url 编码
|
HttpUtilsImpl |
userAgent(java.lang.String ua)
设置 UA
|
public HttpUtilsImpl(java.lang.String url)
public HttpUtilsImpl(java.lang.String url, okhttp3.OkHttpClient client)
public HttpUtils enablePrintln(boolean enable)
HttpUtils
enablePrintln
在接口中 HttpUtils
public HttpUtilsImpl timeout(int timeoutSeconds)
public HttpUtilsImpl timeout(int connectTimeoutSeconds, int writeTimeoutSeconds, int readTimeoutSeconds)
public HttpUtilsImpl multipart(boolean multipart)
public HttpUtilsImpl userAgent(java.lang.String ua)
public HttpUtilsImpl charset(java.lang.String charset)
public HttpUtilsImpl headers(java.util.Map<java.lang.String,java.lang.String> headers)
public HttpUtils headers(java.lang.Iterable<KeyValues<java.lang.String>> headers)
HttpUtils
public HttpUtilsImpl header(java.lang.String name, java.lang.String value)
public HttpUtilsImpl headerAdd(java.lang.String name, java.lang.String value)
public HttpUtilsImpl data(java.util.Map data)
public HttpUtils data(java.lang.Iterable<KeyValues<java.lang.String>> data)
HttpUtils
public HttpUtilsImpl data(java.lang.String key, java.lang.String value)
public HttpUtilsImpl data(java.lang.String key, java.lang.String filename, java.io.InputStream inputStream, java.lang.String contentType)
public HttpUtilsImpl bodyTxt(java.lang.String txt)
public HttpUtilsImpl bodyTxt(java.lang.String txt, java.lang.String contentType)
public HttpUtilsImpl bodyJson(java.lang.String txt)
public HttpUtilsImpl bodyRaw(byte[] bytes)
public HttpUtilsImpl bodyRaw(byte[] bytes, java.lang.String contentType)
public HttpUtilsImpl bodyRaw(java.io.InputStream raw)
public HttpUtilsImpl bodyRaw(java.io.InputStream raw, java.lang.String contentType)
public HttpUtilsImpl cookies(java.util.Map<java.lang.String,java.lang.String> cookies)
public HttpResponse exec(java.lang.String method) throws java.io.IOException
public java.lang.String execAsBody(java.lang.String method) throws java.io.IOException
execAsBody
在接口中 HttpUtils
java.io.IOException
public int execAsCode(java.lang.String method) throws java.io.IOException
execAsCode
在接口中 HttpUtils
java.io.IOException
public java.lang.String get() throws java.io.IOException
public java.lang.String post() throws java.io.IOException
public void postAsync(HttpCallback callback)
HttpUtils
public void getAsync(HttpCallback callback)
HttpUtils
public void headAsync(HttpCallback callback)
HttpUtils
public void execAsync(java.lang.String method, HttpCallback callback)
HttpUtils
public java.lang.String put() throws java.io.IOException
public java.lang.String patch() throws java.io.IOException
public java.lang.String delete() throws java.io.IOException
public java.lang.String options() throws java.io.IOException
HttpUtils
public int head() throws java.io.IOException
HttpUtils
public static java.lang.String urlEncode(java.lang.String s)
HttpUtils
public static java.lang.String toQueryString(java.util.Map<?,?> map) throws java.io.UnsupportedEncodingException
HttpUtils
toQueryString
在接口中 HttpUtils
java.io.UnsupportedEncodingException