public class OkHttpUtil extends Object
| 构造器和说明 |
|---|
OkHttpUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static okhttp3.Response |
call(okhttp3.Request request) |
static String |
post(String urlString,
Map<String,Object> paramMap)
发送post请求
|
static okhttp3.Response |
post(String urlString,
Map<String,Object> paramMap,
Map<String,Object> headerMap)
发送post请求
|
static String |
post(String urlString,
String body)
发送post请求
请求体body参数支持两种类型: 1. |
static okhttp3.Response |
post(String urlString,
String body,
Map<String,Object> headerMap)
发送post请求
请求体body参数支持两种类型: 1. |
public static String post(String urlString, Map<String,Object> paramMap) throws IOException
urlString - 网址paramMap - post表单数据IOExceptionpublic static okhttp3.Response post(String urlString, Map<String,Object> paramMap, Map<String,Object> headerMap) throws IOException
urlString - 网址paramMap - post表单数据headerMap - 消息头IOExceptionpublic static String post(String urlString, String body) throws IOException
1. 标准参数,例如 a=1&b=2 这种格式 2. Rest模式,此时body需要传入一个JSON或者XML字符串,Hutool会自动绑定其对应的Content-Type
urlString - 网址body - post表单数据IOExceptionpublic static okhttp3.Response post(String urlString, String body, Map<String,Object> headerMap) throws IOException
1. 标准参数,例如 a=1&b=2 这种格式 2. Rest模式,此时body需要传入一个JSON或者XML字符串,Hutool会自动绑定其对应的Content-Type
urlString - 网址body - post表单数据headerMap - 消息头IOExceptionpublic static okhttp3.Response call(okhttp3.Request request)
throws IOException
IOExceptionCopyright © 2024. All rights reserved.