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 |
cookie(String name,
String value)
小饼配置(替换)
|
HttpUtils |
cookieAdd(String name,
String value)
小饼配置(添加)
|
HttpUtils |
cookies(Iterable<org.noear.solon.core.util.KeyValues<String>> cookies)
小饼配置
|
HttpUtils |
cookies(Map cookies)
小饼配置
|
HttpUtils |
data(Iterable<org.noear.solon.core.util.KeyValues<String>> data)
参数配置
|
HttpUtils |
data(Map data)
参数配置
|
HttpUtils |
data(String name,
String value)
参数配置(替换)
|
HttpUtils |
data(String name,
String filename,
InputStream inputStream,
String contentType)
参数配置
|
String |
delete()
delete 请求并返回 body
|
HttpUtils |
enablePrintln(boolean enable)
启用打印(专为 tester 服务)
|
HttpResponse |
exec(String method)
执行请求并返回响应
|
String |
execAsBody(String mothod)
执行请求并返回响应主体
|
int |
execAsCode(String method)
执行请求并返回代码
|
CompletableFuture<HttpResponse> |
execAsync(String method)
异步执行请求
|
String |
get()
get 请求并返回 body
|
int |
head()
head 请求并返回 code
|
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 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
|
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 |
toQueryString(Map<?,?> map,
String charset)
map 转为 queryString
|
static String |
urlEncode(String s)
url 编码
|
static String |
urlEncode(String s,
String charset)
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 name, 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
IOExceptionString execAsBody(String mothod) throws IOException
IOExceptionint execAsCode(String method) throws IOException
IOExceptionHttpResponse exec(String method) throws IOException
IOExceptionCompletableFuture<HttpResponse> execAsync(String method)
static String urlEncode(String s) throws IOException
IOExceptionstatic String urlEncode(String s, String charset) throws UnsupportedEncodingException
static String toQueryString(Map<?,?> map) throws IOException
IOExceptionstatic String toQueryString(Map<?,?> map, String charset) throws IOException
IOExceptionCopyright © 2024. All rights reserved.