public class HttpClientUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
CONNECTIONREQUESTTIMEOUT |
static String |
CONNECTTIMEOUT |
static String |
LOCAL_HOST |
static String |
SOCKETTIMEOUT |
| 构造器和说明 |
|---|
HttpClientUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
convertStringParamter(Map parameterMap)
将map集合的键值对转化成:key1=value1&key2=value2 的形式
|
static String |
sendHttpDelete(String httpUrl)
发送 Delete请求
|
static String |
sendHttpGet(String httpUrl)
发送 get请求
|
static String |
sendHttpHead(String httpUrl)
发送 Head请求
|
static String |
sendHttpOptions(String httpUrl)
发送 Options请求
|
static String |
sendHttpPost(String httpUrl,
String paramsJson,
String contentType)
发送 post请求 发送json数据
|
static List<String> |
sendHttpPostList(String httpUrl,
List<String> requestJsonStr,
String contentType)
批量发送post请求
|
static String |
sendHttpPutJson(String httpUrl,
String paramsJson,
String contentType)
发送 put请求 发送json数据
|
static List<String> |
sendHttpPutJsonList(String httpUrl,
List<String> requestJsonStr,
String contentType)
批量发送post请求
|
static String |
sendHttpTrace(String httpUrl)
发送 Trace请求
|
static void |
setProxy(String ipAddress,
int port,
String scheme)
设置代理
|
public static String sendHttpPutJson(String httpUrl, String paramsJson, String contentType)
httpUrl - 地址paramsJson - 参数(格式 json)public static List<String> sendHttpPutJsonList(String httpUrl, List<String> requestJsonStr, String contentType)
httpUrl - requestJsonStr - public static String sendHttpPost(String httpUrl, String paramsJson, String contentType)
httpUrl - 地址paramsJson - 参数(格式 json)public static List<String> sendHttpPostList(String httpUrl, List<String> requestJsonStr, String contentType)
httpUrl - requestJsonStr - public static void setProxy(String ipAddress, int port, String scheme) throws Exception
ipAddress - port - scheme - ExceptionCopyright © 2019. All rights reserved.