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