public class HttpUtil extends Object
| 构造器和说明 |
|---|
HttpUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
buildUrl(String url,
Map<String,String> queryParams)
Constructs a complete Url from the query string.
|
static String |
get(String url)
Send a get network request.
|
static <T> T |
get(String url,
Class<T> clazz)
Send a get network request.
|
static String |
get(String url,
Map<String,String> params)
Send a get network request.
|
static <T> T |
get(String url,
Map<String,String> headers,
Map<String,String> params,
long timeout,
Class<T> clazz)
Send a get network request.
|
static <T> T |
post(String url,
Map<String,String> headers,
Map<String,String> params,
long timeout,
Class<T> clazz)
Send a post network request.
|
static <T> T |
post(String url,
Map<String,String> headers,
Object body,
long timeout,
Class<T> clazz)
Send a post network request.
|
static String |
post(String url,
Object body)
Send a post network request.
|
static <T> T |
post(String url,
Object body,
Class<T> clazz)
Send a post network request.
|
static String |
post(String url,
Object body,
long timeout)
Send a post network request.
|
static <T> T |
post(String url,
Object body,
long timeout,
Class<T> clazz)
Send a post network request.
|
static String |
postJson(String url,
String json)
Send a post network request.
|
static String |
put(String url,
Object body)
Send a put network request.
|
static String |
put(String url,
Object body,
Map<String,String> headers)
Send a put network request.
|
public static <T> T get(String url, Map<String,String> headers, Map<String,String> params, long timeout, Class<T> clazz)
T - return the target data typeurl - target urlheaders - headersparams - form datatimeout - request timeoutclazz - return the target data typepublic static String get(String url, Map<String,String> params)
url - target urlparams - form datapublic static <T> T get(String url, Class<T> clazz)
T - return the target data typeurl - target urlclazz - return the target data typepublic static <T> T post(String url, Object body, Class<T> clazz)
T - return the target data typeurl - target urlbody - request bodyclazz - return the target data typepublic static <T> T post(String url, Object body, long timeout, Class<T> clazz)
T - return the target data typeurl - target urlbody - request bodytimeout - request timeoutclazz - return the target data typepublic static <T> T post(String url, Map<String,String> headers, Map<String,String> params, long timeout, Class<T> clazz)
T - return the target data typeurl - target urlheaders - headersparams - form datatimeout - request timeoutclazz - return the target data typepublic static <T> T post(String url, Map<String,String> headers, Object body, long timeout, Class<T> clazz)
T - return the target data typeurl - target urlheaders - headersbody - request bodytimeout - request timeoutclazz - return the target data typepublic static String post(String url, Object body)
url - target urlbody - request bodypublic static String post(String url, Object body, long timeout)
url - target urlbody - request bodytimeout - request timeoutpublic static String postJson(String url, String json)
url - target urljson - json datapublic static String put(String url, Object body)
url - target urlbody - request bodypublic static String put(String url, Object body, Map<String,String> headers)
url - target urlbody - request bodyheaders - headersCopyright © 2022. All rights reserved.