public class HttpClientUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected static org.apache.http.client.HttpClient |
httpClient |
| 构造器和说明 |
|---|
HttpClientUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
downloadData(String url)
Download Data
|
static org.apache.http.HttpResponse |
execute(org.apache.http.client.methods.HttpUriRequest request) |
static <T> T |
execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.client.ResponseHandler<T> responseHandler) |
static <T> T |
executeJsonResult(org.apache.http.client.methods.HttpUriRequest request,
Class<T> clazz)
数据返回自动JSON对象解析
|
static void |
init(int maxTotal,
int maxPerRoute) |
static void |
initMchKeyStore(String keyStoreName,
String keyStoreFilePath,
String mch_id,
int maxTotal,
int maxPerRoute)
初始化 MCH HttpClient KeyStore
|
public static void init(int maxTotal,
int maxPerRoute)
public static void initMchKeyStore(String keyStoreName, String keyStoreFilePath, String mch_id, int maxTotal, int maxPerRoute)
keyStoreName - keyStore 名称keyStoreFilePath - 私钥文件路径mch_id - mch_idmaxTotal - maxTotalmaxPerRoute - maxPerRoutepublic static org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest request)
public static <T> T execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.client.ResponseHandler<T> responseHandler)
throws Exception
Exceptionpublic static <T> T executeJsonResult(org.apache.http.client.methods.HttpUriRequest request,
Class<T> clazz)
throws Exception
T - The class name of clazzrequest - The URI requestclazz - The result classException - Exceptionpublic static byte[] downloadData(String url)
url - TargetCopyright © 2021. All rights reserved.