public class HttpUtils extends Object
| 构造器和说明 |
|---|
HttpUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
download(String url,
String path)
http 下载请求
|
static String |
execute(org.apache.http.impl.client.CloseableHttpClient httpClient,
org.apache.http.client.methods.HttpRequestBase request)
执行http请求方法
|
static String |
get(String url)
http get请求
|
static String |
post(String url)
http post请求
|
static String |
post(String url,
List<PostParam> params) |
static String |
post(String url,
PostParam... params)
http post请求
|
static String |
post(String url,
String postParams)
http post 请求
|
static String |
postFile(String url,
PostFileParam... fileParams)
http 提交文件
|
static String |
postJson(String url,
String json)
http post json请求
|
static String |
postString(String url,
String str)
提交字符串数据
|
static String |
postString(String url,
String data,
String type)
http post string请求
|
static String |
postXml(String url,
String xml)
http post xml请求
|
public static String execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase request)
httpClient - request - public static String post(String url, PostParam... params)
url - 请求地址params - 请求参数public static String post(String url, String postParams)
url - 请求地址postParams - 字符串型地址public static String postString(String url, String str) throws com.lorne.core.framework.exception.HttpException
url - 请求地址str - 请求数据com.lorne.core.framework.exception.HttpException - StringEntity(str)转码异常public static boolean download(String url, String path)
url - 请求地址path - 保存路径public static String postFile(String url, PostFileParam... fileParams)
url - 请求地址fileParams - 文件参数public static String postJson(String url, String json)
url - 请求地址json - 请求参数public static String postString(String url, String data, String type)
url - 请求地址data - 请求数据type - 请求数据格式Copyright © 2017. All rights reserved.