public class HttpUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
PROTOCOL_TLSV1 |
| 构造器和说明 |
|---|
HttpUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.apache.http.impl.client.CloseableHttpClient |
client(String url) |
static org.apache.http.impl.client.CloseableHttpClient |
client(String url,
String userAgent) |
static org.apache.http.impl.client.CloseableHttpClient |
createClient(String userAgent) |
static String |
createFullPath(String host,
String url)
创建完整HTTP路径
|
static org.apache.http.impl.client.CloseableHttpClient |
createSSLClient(File keyFile,
String protocol,
String password) |
static org.apache.http.impl.client.CloseableHttpClient |
defaultClient() |
static org.apache.http.impl.client.CloseableHttpClient |
defaultClient(String userAgent) |
static org.apache.http.impl.client.CloseableHttpClient |
defaultSSLClient() |
static org.apache.http.impl.client.CloseableHttpClient |
defaultSSLClient(String userAgent) |
static HttpResponse |
delete(Map<String,String> headers,
String url,
String charset,
List<org.apache.http.NameValuePair> pairs) |
static HttpResponse |
delete(Map<String,String> headers,
String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
delete(Map<String,String> headers,
String url,
String charset,
org.apache.http.NameValuePair... pairs) |
static HttpResponse |
delete(String url,
String charset,
List<org.apache.http.NameValuePair> pairs) |
static HttpResponse |
delete(String url,
String charset,
Map<String,Object> params) |
static String |
domain(String url) |
static DownloadTask |
download(DownloadProgress progress,
String url,
File dst,
boolean override) |
static DownloadTask |
download(DownloadProgress progress,
String url,
File dst,
Map<String,String> headers,
Map<String,Object> params,
boolean override) |
static DownloadTask |
download(DownloadProgress progress,
String url,
String dest,
boolean override) |
static DownloadTask |
download(DownloadProgress progress,
String url,
String dest,
Map<String,String> headers,
Map<String,Object> params,
boolean override) |
static DownloadTask |
download(Map<String,String> headers,
String url,
File dst) |
static DownloadTask |
download(Map<String,String> headers,
String url,
File dst,
Map<String,Object> params) |
static DownloadTask |
download(Map<String,String> headers,
String url,
File dst,
Map<String,Object> params,
boolean override) |
static DownloadTask |
download(Map<String,String> headers,
String url,
String dst) |
static DownloadTask |
download(Map<String,String> headers,
String url,
String dest,
Map<String,Object> params) |
static DownloadTask |
download(Map<String,String> headers,
String url,
String dest,
Map<String,Object> params,
boolean override) |
static DownloadTask |
download(String url,
File dst) |
static DownloadTask |
download(String url,
String dst) |
static String |
encode(String origin,
boolean enable,
boolean cn)
url参数编码
|
static HttpResponse |
get(Map<String,String> headers,
String url) |
static HttpResponse |
get(Map<String,String> headers,
String url,
String charset) |
static HttpResponse |
get(Map<String,String> headers,
String url,
String charset,
List<org.apache.http.NameValuePair> pairs) |
static HttpResponse |
get(Map<String,String> headers,
String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
get(String url) |
static HttpResponse |
get(String url,
String charset) |
static HttpResponse |
get(String url,
String charset,
List<org.apache.http.NameValuePair> pairs) |
static HttpResponse |
get(String url,
String charset,
Map<String,Object> params) |
static String |
host(String url)
提取url根目录
|
static org.apache.http.entity.mime.MultipartEntityBuilder |
mergeParam(org.apache.http.entity.mime.MultipartEntityBuilder builder,
Map<String,Object> params,
org.apache.http.entity.ContentType contetType) |
static String |
mergeParam(String url,
Map<String,Object> params)
合并参数
|
static String |
mergeParam(String url,
String... params)
合并参数
|
static String |
mergePath(String... paths) |
static List<org.apache.http.NameValuePair> |
packNameValuePair(Map<String,Object> params) |
static String |
parseDir(String url)
提取一个URL所在的目录
|
static String |
parseFileName(String url)
提取一个URL指向的文件名
|
static String |
parsePath(String url)
从URL中提取文件目录(删除查询参数)
|
static HttpResponse |
post(Map<String,String> headers,
String url) |
static HttpResponse |
post(Map<String,String> headers,
String url,
org.apache.http.HttpEntity entity) |
static HttpResponse |
post(Map<String,String> headers,
String url,
String charset,
org.apache.http.HttpEntity entity) |
static HttpResponse |
post(Map<String,String> headers,
String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
post(String url) |
static HttpResponse |
post(String url,
org.apache.http.HttpEntity entity) |
static HttpResponse |
post(String url,
Map<String,Object> params) |
static HttpResponse |
post(String url,
String charset,
org.apache.http.HttpEntity entity) |
static HttpResponse |
post(String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
put(Map<String,String> headers,
String url,
String charset,
org.apache.http.HttpEntity entity) |
static HttpResponse |
put(Map<String,String> headers,
String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
put(String url,
String charset,
Map<String,Object> params) |
static String |
read(InputStream is,
String charset) |
static int |
status(String url) |
static HttpResponse |
stream(Map<String,String> headers,
String url,
String charset,
org.apache.http.HttpEntity entity) |
static HttpResponse |
stream(Map<String,String> headers,
String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
stream(String url) |
static HttpResponse |
stream(String url,
String charset,
org.apache.http.HttpEntity entity) |
static HttpResponse |
stream(String url,
String charset,
Map<String,Object> params) |
static HttpResponse |
upload(String url,
Map<String,Object> files) |
static HttpResponse |
upload(String url,
Map<String,Object> files,
Map<String,Object> params) |
static HttpResponse |
upload(String url,
Map<String,Object> files,
Map<String,String> headers,
Map<String,Object> params) |
static HttpResponse |
upload(String url,
Map<String,Object> files,
String charset,
Map<String,String> headers,
Map<String,Object> params)
文件上传
|
public static String PROTOCOL_TLSV1
public static HttpResponse post(String url, Map<String,Object> params)
public static HttpResponse post(String url)
public static HttpResponse post(Map<String,String> headers, String url)
public static HttpResponse post(String url, String charset, org.apache.http.HttpEntity entity)
public static HttpResponse post(String url, org.apache.http.HttpEntity entity)
public static HttpResponse post(Map<String,String> headers, String url, org.apache.http.HttpEntity entity)
public static HttpResponse post(Map<String,String> headers, String url, String charset, Map<String,Object> params)
public static HttpResponse post(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)
public static HttpResponse put(Map<String,String> headers, String url, String charset, Map<String,Object> params)
public static HttpResponse put(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)
public static HttpResponse stream(String url)
public static HttpResponse stream(String url, String charset, org.apache.http.HttpEntity entity)
public static HttpResponse stream(Map<String,String> headers, String url, String charset, Map<String,Object> params)
public static HttpResponse stream(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)
public static HttpResponse get(String url)
public static HttpResponse get(String url, String charset)
public static HttpResponse get(Map<String,String> headers, String url, String charset, Map<String,Object> params)
public static HttpResponse get(String url, String charset, List<org.apache.http.NameValuePair> pairs)
public static HttpResponse get(Map<String,String> headers, String url, String charset, List<org.apache.http.NameValuePair> pairs)
public static HttpResponse get(Map<String,String> headers, String url)
public static HttpResponse delete(Map<String,String> headers, String url, String charset, Map<String,Object> params)
public static HttpResponse delete(String url, String charset, List<org.apache.http.NameValuePair> pairs)
public static HttpResponse delete(Map<String,String> headers, String url, String charset, org.apache.http.NameValuePair... pairs)
public static HttpResponse delete(Map<String,String> headers, String url, String charset, List<org.apache.http.NameValuePair> pairs)
public static int status(String url)
public static DownloadTask download(String url, String dst)
public static DownloadTask download(String url, File dst)
public static DownloadTask download(Map<String,String> headers, String url, String dest, Map<String,Object> params)
public static DownloadTask download(Map<String,String> headers, String url, File dst, Map<String,Object> params)
public static DownloadTask download(Map<String,String> headers, String url, String dest, Map<String,Object> params, boolean override)
public static DownloadTask download(Map<String,String> headers, String url, File dst, Map<String,Object> params, boolean override)
public static DownloadTask download(DownloadProgress progress, String url, String dest, boolean override)
public static DownloadTask download(DownloadProgress progress, String url, File dst, boolean override)
public static DownloadTask download(DownloadProgress progress, String url, String dest, Map<String,String> headers, Map<String,Object> params, boolean override)
public static DownloadTask download(DownloadProgress progress, String url, File dst, Map<String,String> headers, Map<String,Object> params, boolean override)
public static HttpResponse upload(String url, Map<String,Object> files, Map<String,String> headers, Map<String,Object> params)
public static HttpResponse upload(String url, Map<String,Object> files, Map<String,Object> params)
public static HttpResponse upload(String url, Map<String,Object> files)
public static HttpResponse upload(String url, Map<String,Object> files, String charset, Map<String,String> headers, Map<String,Object> params)
url - urlfiles - File或byte[]或InputStream如果是url可以调用URL.openStream()获取输入流charset - 编码headers - headerparams - 参数public static String createFullPath(String host, String url)
host - hosturl - urlpublic static String read(InputStream is, String charset)
public static String mergeParam(String url, Map<String,Object> params)
url - urlparams - paramspublic static org.apache.http.entity.mime.MultipartEntityBuilder mergeParam(org.apache.http.entity.mime.MultipartEntityBuilder builder,
Map<String,Object> params,
org.apache.http.entity.ContentType contetType)
public static String mergeParam(String url, String... params)
url - urlparams - paramspublic static List<org.apache.http.NameValuePair> packNameValuePair(Map<String,Object> params)
public static org.apache.http.impl.client.CloseableHttpClient client(String url)
public static org.apache.http.impl.client.CloseableHttpClient client(String url, String userAgent)
public static org.apache.http.impl.client.CloseableHttpClient defaultClient()
public static org.apache.http.impl.client.CloseableHttpClient defaultClient(String userAgent)
public static org.apache.http.impl.client.CloseableHttpClient createClient(String userAgent)
public static org.apache.http.impl.client.CloseableHttpClient createSSLClient(File keyFile, String protocol, String password)
public static org.apache.http.impl.client.CloseableHttpClient defaultSSLClient()
public static org.apache.http.impl.client.CloseableHttpClient defaultSSLClient(String userAgent)
Copyright © 2024. All rights reserved.