public interface HttpUtils
限定符和类型 | 方法和说明 |
---|---|
HttpUtils |
bodyJson(java.lang.String txt)
主体配置
|
HttpUtils |
bodyRaw(byte[] bytes)
主体配置
|
HttpUtils |
bodyRaw(byte[] bytes,
java.lang.String contentType)
主体配置
|
HttpUtils |
bodyRaw(java.io.InputStream raw)
主体配置
|
HttpUtils |
bodyRaw(java.io.InputStream raw,
java.lang.String contentType)
主体配置
|
HttpUtils |
bodyTxt(java.lang.String txt)
主体配置
|
HttpUtils |
bodyTxt(java.lang.String txt,
java.lang.String contentType)
主体配置
|
HttpUtils |
charset(java.lang.String charset)
编码配置
|
HttpUtils |
cookies(java.util.Map<java.lang.String,java.lang.String> cookies)
主体配置
|
HttpUtils |
data(java.lang.Iterable<KeyValues<java.lang.String>> data)
参数配置
|
HttpUtils |
data(java.util.Map data)
参数配置
|
HttpUtils |
data(java.lang.String key,
java.lang.String value)
参数配置
|
HttpUtils |
data(java.lang.String key,
java.lang.String filename,
java.io.InputStream inputStream,
java.lang.String contentType)
参数配置
|
java.lang.String |
delete()
delete 请求并返回 body
|
HttpUtils |
enablePrintln(boolean enable)
启用打印(专为 tester 服务)
|
HttpResponse |
exec(java.lang.String mothod)
执行请求并返回响应
|
java.lang.String |
execAsBody(java.lang.String mothod)
执行请求并返回响应主体
|
int |
execAsCode(java.lang.String mothod)
执行请求并返回代码
|
void |
execAsync(java.lang.String method,
HttpCallback callback)
异步执行请求
|
java.lang.String |
get()
get 请求并返回 body
|
void |
getAsync(HttpCallback callback)
get 异步执行请求
|
int |
head()
head 请求并返回 code
|
void |
headAsync(HttpCallback callback)
head 异步执行请求
|
HttpUtils |
header(java.lang.String name,
java.lang.String value)
头配置(替换)
|
HttpUtils |
headerAdd(java.lang.String name,
java.lang.String value)
头配置(添加)
|
HttpUtils |
headers(java.lang.Iterable<KeyValues<java.lang.String>> headers)
头配置
|
HttpUtils |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
头配置
|
static HttpUtils |
http(java.lang.String url) |
static HttpUtils |
http(java.lang.String service,
java.lang.String path) |
static HttpUtils |
http(java.lang.String group,
java.lang.String service,
java.lang.String path) |
HttpUtils |
multipart(boolean multipart)
是否多部分配置
|
java.lang.String |
options()
options 请求并返回 body
|
java.lang.String |
patch()
patch 请求并返回 body
|
java.lang.String |
post()
post 请求并返回 body
|
void |
postAsync(HttpCallback callback)
post 异步执行请求
|
java.lang.String |
put()
put 请求并返回 body
|
HttpUtils |
timeout(int timeoutSeconds)
超时配置
|
HttpUtils |
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 编码
|
HttpUtils |
userAgent(java.lang.String ua)
用户代理配置
|
static HttpUtils http(java.lang.String service, java.lang.String path)
static HttpUtils http(java.lang.String group, java.lang.String service, java.lang.String path)
static HttpUtils http(java.lang.String url)
HttpUtils enablePrintln(boolean enable)
HttpUtils timeout(int timeoutSeconds)
HttpUtils timeout(int connectTimeoutSeconds, int writeTimeoutSeconds, int readTimeoutSeconds)
HttpUtils multipart(boolean multipart)
HttpUtils userAgent(java.lang.String ua)
HttpUtils charset(java.lang.String charset)
HttpUtils headers(java.util.Map<java.lang.String,java.lang.String> headers)
HttpUtils header(java.lang.String name, java.lang.String value)
HttpUtils headerAdd(java.lang.String name, java.lang.String value)
HttpUtils data(java.util.Map data)
HttpUtils data(java.lang.String key, java.lang.String value)
HttpUtils data(java.lang.String key, java.lang.String filename, java.io.InputStream inputStream, java.lang.String contentType)
HttpUtils bodyTxt(java.lang.String txt)
HttpUtils bodyTxt(java.lang.String txt, java.lang.String contentType)
HttpUtils bodyJson(java.lang.String txt)
HttpUtils bodyRaw(byte[] bytes)
HttpUtils bodyRaw(byte[] bytes, java.lang.String contentType)
HttpUtils bodyRaw(java.io.InputStream raw)
HttpUtils bodyRaw(java.io.InputStream raw, java.lang.String contentType)
HttpUtils cookies(java.util.Map<java.lang.String,java.lang.String> cookies)
java.lang.String get() throws java.io.IOException
java.io.IOException
java.lang.String post() throws java.io.IOException
java.io.IOException
java.lang.String put() throws java.io.IOException
java.io.IOException
java.lang.String patch() throws java.io.IOException
java.io.IOException
java.lang.String delete() throws java.io.IOException
java.io.IOException
java.lang.String options() throws java.io.IOException
java.io.IOException
int head() throws java.io.IOException
java.io.IOException
HttpResponse exec(java.lang.String mothod) throws java.io.IOException
java.io.IOException
java.lang.String execAsBody(java.lang.String mothod) throws java.io.IOException
java.io.IOException
int execAsCode(java.lang.String mothod) throws java.io.IOException
java.io.IOException
void postAsync(HttpCallback callback) throws java.io.IOException
java.io.IOException
void getAsync(HttpCallback callback) throws java.io.IOException
java.io.IOException
void headAsync(HttpCallback callback) throws java.io.IOException
java.io.IOException
void execAsync(java.lang.String method, HttpCallback callback)
static java.lang.String urlEncode(java.lang.String s)
static java.lang.String toQueryString(java.util.Map<?,?> map)