程序包 org.anyline.net
类 HttpUtil
- java.lang.Object
-
- org.anyline.net.HttpUtil
-
public class HttpUtil extends Object
-
-
字段概要
字段 修饰符和类型 字段 说明 static StringPROTOCOL_TLSV1
-
构造器概要
构造器 构造器 说明 HttpUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static org.apache.http.impl.client.CloseableHttpClientclient(String url)static org.apache.http.impl.client.CloseableHttpClientclient(String url, String userAgent)static org.apache.http.impl.client.CloseableHttpClientcreateClient(String userAgent)static StringcreateFullPath(String host, String url)创建完整HTTP路径static org.apache.http.impl.client.CloseableHttpClientcreateSSLClient(File keyFile, String protocol, String password)static org.apache.http.impl.client.CloseableHttpClientdefaultClient()static org.apache.http.impl.client.CloseableHttpClientdefaultClient(String userAgent)static org.apache.http.impl.client.CloseableHttpClientdefaultSSLClient()static org.apache.http.impl.client.CloseableHttpClientdefaultSSLClient(String userAgent)static HttpResponsedelete(String url, String charset, List<org.apache.http.NameValuePair> pairs)static HttpResponsedelete(String url, String charset, Map<String,Object> params)static HttpResponsedelete(Map<String,String> headers, String url, String charset, List<org.apache.http.NameValuePair> pairs)static HttpResponsedelete(Map<String,String> headers, String url, String charset, Map<String,Object> params)static HttpResponsedelete(Map<String,String> headers, String url, String charset, org.apache.http.NameValuePair... pairs)static Stringdomain(String url)static DownloadTaskdownload(String url, File dst)static DownloadTaskdownload(String url, File dst, Map<String,String> headers, Map<String,Object> params)static DownloadTaskdownload(String url, File dst, Map<String,String> headers, Map<String,Object> params, boolean override)static DownloadTaskdownload(String url, String dst)static DownloadTaskdownload(String url, String dest, Map<String,String> headers, Map<String,Object> params)static DownloadTaskdownload(String url, String dest, Map<String,String> headers, Map<String,Object> params, boolean override)static DownloadTaskdownload(DownloadProgress progress, String url, File dst, boolean override)static DownloadTaskdownload(DownloadProgress progress, String url, File dst, Map<String,String> headers, Map<String,Object> params, boolean override)static DownloadTaskdownload(DownloadProgress progress, String url, String dest, boolean override)static DownloadTaskdownload(DownloadProgress progress, String url, String dest, Map<String,String> headers, Map<String,Object> params, boolean override)static Stringencode(String origin, boolean enable, boolean cn)url参数编码static HttpResponseget(String url)static HttpResponseget(String url, String charset)static HttpResponseget(String url, String charset, List<org.apache.http.NameValuePair> pairs)static HttpResponseget(String url, String charset, Map<String,Object> params)static HttpResponseget(Map<String,String> headers, String url)static HttpResponseget(Map<String,String> headers, String url, String charset)static HttpResponseget(Map<String,String> headers, String url, String charset, List<org.apache.http.NameValuePair> pairs)static HttpResponseget(Map<String,String> headers, String url, String charset, Map<String,Object> params)static Stringhost(String url)提取url根目录static StringmergeParam(String url, String... params)合并参数static StringmergeParam(String url, Map<String,Object> params)合并参数static org.apache.http.entity.mime.MultipartEntityBuildermergeParam(org.apache.http.entity.mime.MultipartEntityBuilder builder, Map<String,Object> params, org.apache.http.entity.ContentType contetType)static StringmergePath(String... paths)static List<org.apache.http.NameValuePair>packNameValuePair(Map<String,Object> params)static StringparseDir(String url)提取一个URL所在的目录static StringparseFileName(String url)提取一个URL指向的文件名static StringparsePath(String url)从URL中提取文件目录(删除查询参数)static HttpResponsepost(String url)static HttpResponsepost(String url, String charset, Map<String,Object> params)static HttpResponsepost(String url, String charset, org.apache.http.HttpEntity entity)static HttpResponsepost(String url, Map<String,Object> params)static HttpResponsepost(String url, org.apache.http.HttpEntity entity)static HttpResponsepost(Map<String,String> headers, String url)static HttpResponsepost(Map<String,String> headers, String url, String charset, Map<String,Object> params)static HttpResponsepost(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)static HttpResponsepost(Map<String,String> headers, String url, org.apache.http.HttpEntity entity)static HttpResponseput(String url, String charset, Map<String,Object> params)static HttpResponseput(Map<String,String> headers, String url, String charset, Map<String,Object> params)static HttpResponseput(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)static Stringread(InputStream is, String charset)static intstatus(String url)static HttpResponsestream(String url)static HttpResponsestream(String url, String charset, Map<String,Object> params)static HttpResponsestream(String url, String charset, org.apache.http.HttpEntity entity)static HttpResponsestream(Map<String,String> headers, String url, String charset, Map<String,Object> params)static HttpResponsestream(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)static HttpResponseupload(String url, Map<String,Object> files)static HttpResponseupload(String url, Map<String,Object> files, String charset, Map<String,String> headers, Map<String,Object> params)文件上传static HttpResponseupload(String url, Map<String,Object> files, Map<String,Object> params)static HttpResponseupload(String url, Map<String,Object> files, Map<String,String> headers, Map<String,Object> params)
-
-
-
字段详细资料
-
PROTOCOL_TLSV1
public static String PROTOCOL_TLSV1
-
-
方法详细资料
-
post
public static HttpResponse post(String url, Map<String,Object> params)
-
post
public static HttpResponse post(String url)
-
post
public static HttpResponse post(Map<String,String> headers, String url)
-
post
public static HttpResponse post(String url, String charset, org.apache.http.HttpEntity entity)
-
post
public static HttpResponse post(String url, org.apache.http.HttpEntity entity)
-
post
public static HttpResponse post(Map<String,String> headers, String url, org.apache.http.HttpEntity entity)
-
post
public static HttpResponse post(Map<String,String> headers, String url, String charset, Map<String,Object> params)
-
post
public static HttpResponse post(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)
-
put
public static HttpResponse put(Map<String,String> headers, String url, String charset, Map<String,Object> params)
-
put
public static HttpResponse put(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)
-
stream
public static HttpResponse stream(String url)
-
stream
public static HttpResponse stream(String url, String charset, org.apache.http.HttpEntity entity)
-
stream
public static HttpResponse stream(Map<String,String> headers, String url, String charset, Map<String,Object> params)
-
stream
public static HttpResponse stream(Map<String,String> headers, String url, String charset, org.apache.http.HttpEntity entity)
-
get
public static HttpResponse get(String url)
-
get
public static HttpResponse get(String url, String charset)
-
get
public static HttpResponse get(Map<String,String> headers, String url, String charset, Map<String,Object> params)
-
get
public static HttpResponse get(String url, String charset, List<org.apache.http.NameValuePair> pairs)
-
get
public static HttpResponse get(Map<String,String> headers, String url, String charset, List<org.apache.http.NameValuePair> pairs)
-
get
public static HttpResponse get(Map<String,String> headers, String url)
-
delete
public static HttpResponse delete(Map<String,String> headers, String url, String charset, Map<String,Object> params)
-
delete
public static HttpResponse delete(String url, String charset, List<org.apache.http.NameValuePair> pairs)
-
delete
public static HttpResponse delete(Map<String,String> headers, String url, String charset, org.apache.http.NameValuePair... pairs)
-
delete
public static HttpResponse delete(Map<String,String> headers, String url, String charset, List<org.apache.http.NameValuePair> pairs)
-
status
public static int status(String url)
-
download
public static DownloadTask download(String url, String dst)
-
download
public static DownloadTask download(String url, File dst)
-
download
public static DownloadTask download(String url, String dest, Map<String,String> headers, Map<String,Object> params)
-
download
public static DownloadTask download(String url, File dst, Map<String,String> headers, Map<String,Object> params)
-
download
public static DownloadTask download(String url, String dest, Map<String,String> headers, Map<String,Object> params, boolean override)
-
download
public static DownloadTask download(String url, File dst, Map<String,String> headers, Map<String,Object> params, boolean override)
-
download
public static DownloadTask download(DownloadProgress progress, String url, String dest, boolean override)
-
download
public static DownloadTask download(DownloadProgress progress, String url, File dst, boolean override)
-
download
public static DownloadTask download(DownloadProgress progress, String url, String dest, Map<String,String> headers, Map<String,Object> params, boolean override)
-
download
public static DownloadTask download(DownloadProgress progress, String url, File dst, Map<String,String> headers, Map<String,Object> params, boolean override)
-
upload
public static HttpResponse upload(String url, Map<String,Object> files, Map<String,String> headers, Map<String,Object> params)
-
upload
public static HttpResponse upload(String url, Map<String,Object> files, Map<String,Object> params)
-
upload
public static HttpResponse upload(String url, Map<String,Object> files)
-
upload
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- 参数- 返回:
- HttpResponse
-
createFullPath
public static String createFullPath(String host, String url)
创建完整HTTP路径- 参数:
host- hosturl- url- 返回:
- String
-
parseFileName
public static String parseFileName(String url)
提取一个URL指向的文件名- 参数:
url- url- 返回:
- String
-
read
public static String read(InputStream is, String charset)
-
mergeParam
public static String mergeParam(String url, Map<String,Object> params)
合并参数- 参数:
url- urlparams- params- 返回:
- String
-
mergeParam
public 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)
-
mergeParam
public static String mergeParam(String url, String... params)
合并参数- 参数:
url- urlparams- params- 返回:
- String
-
packNameValuePair
public static List<org.apache.http.NameValuePair> packNameValuePair(Map<String,Object> params)
-
client
public static org.apache.http.impl.client.CloseableHttpClient client(String url)
-
client
public static org.apache.http.impl.client.CloseableHttpClient client(String url, String userAgent)
-
defaultClient
public static org.apache.http.impl.client.CloseableHttpClient defaultClient()
-
defaultClient
public static org.apache.http.impl.client.CloseableHttpClient defaultClient(String userAgent)
-
createClient
public static org.apache.http.impl.client.CloseableHttpClient createClient(String userAgent)
-
createSSLClient
public static org.apache.http.impl.client.CloseableHttpClient createSSLClient(File keyFile, String protocol, String password)
-
defaultSSLClient
public static org.apache.http.impl.client.CloseableHttpClient defaultSSLClient()
-
defaultSSLClient
public static org.apache.http.impl.client.CloseableHttpClient defaultSSLClient(String userAgent)
-
-