public class HttpClientHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_TYPE_FORM_URL_ENCODED |
static String |
CONTENT_TYPE_OCTET_STREAM |
static String |
CONTENT_TYPE_TEXT_PLAIN |
static String |
DEFAULT_CHARSET
编码方式
|
static String |
HEADER_CONTENT_DISPOSITION |
static int |
HTTP_STATUS_CODE_SUCCESS |
Modifier and Type | Method and Description |
---|---|
HttpClientHelper |
connectionTimeout(int connectionTimeout) |
static HttpClientHelper |
create() |
static HttpClientHelper |
create(IHttpClientConfigurable configurable) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(SSLContext sslContext) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(SSLContext sslContext,
String[] supportedProtocols,
String[] supportedCipherSuites) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(SSLContext sslContext,
String[] supportedProtocols,
String[] supportedCipherSuites,
HostnameVerifier hostnameVerifier) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(String[] supportedProtocols,
String[] supportedCipherSuites) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(String certType,
URL certFilePath,
char[] passwordChars) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(String certType,
URL certFilePath,
char[] passwordChars,
String[] supportedProtocols,
String[] supportedCipherSuites) |
static org.apache.http.conn.ssl.SSLConnectionSocketFactory |
createConnectionSocketFactory(URL certFilePath,
char[] passwordChars) |
HttpClientHelper |
customSSL(org.apache.http.conn.ssl.SSLConnectionSocketFactory socketFactory) |
void |
download(String url,
org.apache.http.entity.ContentType contentType,
String content,
org.apache.http.Header[] headers,
IFileHandler handler) |
void |
download(String url,
org.apache.http.Header[] headers,
IFileHandler handler) |
void |
download(String url,
IFileHandler handler) |
void |
download(String url,
String content,
IFileHandler handler) |
void |
execHttpDownload(org.apache.http.client.methods.RequestBuilder requestBuilder,
IFileHandler handler) |
<T> T |
execute(IHttpRequestExecutor<T> requestExecutor) |
IHttpResponse |
execute(org.apache.http.client.methods.RequestBuilder requestBuilder,
String defaultResponseCharset) |
IHttpResponse |
get(String url) |
IHttpResponse |
get(String url,
org.apache.http.Header[] headers) |
IHttpResponse |
get(String url,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
get(String url,
Map<String,String> params) |
IHttpResponse |
get(String url,
Map<String,String> params,
Charset charset,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
get(String url,
Map<String,String> params,
org.apache.http.Header[] headers) |
IHttpResponse |
get(String url,
Map<String,String> params,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
org.apache.http.impl.client.CloseableHttpClient |
getHttpClient() |
IHttpResponse |
post(String url,
byte[] content) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
byte[] content) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
byte[] content,
org.apache.http.Header[] headers) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
InputStream content,
org.apache.http.Header[] headers) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
InputStream content,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
Map<String,String> params,
org.apache.http.Header[] headers) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
Map<String,String> params,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
String content) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
String content,
org.apache.http.Header[] headers) |
IHttpResponse |
post(String url,
org.apache.http.entity.ContentType contentType,
String content,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
post(String url,
Map<String,String> params) |
IHttpResponse |
post(String url,
Map<String,String> params,
org.apache.http.Header[] headers) |
IHttpResponse |
post(String url,
String content) |
HttpClientHelper |
requestTimeout(int requestTimeout) |
HttpClientHelper |
socketTimeout(int socketTimeout) |
IHttpResponse |
upload(String url,
File uploadFile) |
IHttpResponse |
upload(String url,
File uploadFile,
org.apache.http.Header[] headers) |
IHttpResponse |
upload(String url,
org.apache.http.entity.mime.FormBodyPart[] formBodyParts,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
upload(String url,
String fieldName,
org.apache.http.entity.mime.content.ContentBody contentBody,
org.apache.http.Header[] headers) |
IHttpResponse |
upload(String url,
String fieldName,
org.apache.http.entity.mime.content.ContentBody contentBody,
org.apache.http.Header[] headers,
String defaultResponseCharset) |
IHttpResponse |
upload(String url,
String fieldName,
File uploadFile) |
IHttpResponse |
upload(String url,
String fieldName,
File uploadFile,
org.apache.http.Header[] headers) |
public static final String DEFAULT_CHARSET
public static final int HTTP_STATUS_CODE_SUCCESS
public static final String HEADER_CONTENT_DISPOSITION
public static final String CONTENT_TYPE_FORM_URL_ENCODED
public static final String CONTENT_TYPE_TEXT_PLAIN
public static final String CONTENT_TYPE_OCTET_STREAM
public static HttpClientHelper create()
public static HttpClientHelper create(IHttpClientConfigurable configurable)
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(URL certFilePath, char[] passwordChars) throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(String certType, URL certFilePath, char[] passwordChars) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(String certType, URL certFilePath, char[] passwordChars, String[] supportedProtocols, String[] supportedCipherSuites) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(SSLContext sslContext, String[] supportedProtocols, String[] supportedCipherSuites, HostnameVerifier hostnameVerifier)
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(SSLContext sslContext, String[] supportedProtocols, String[] supportedCipherSuites)
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(SSLContext sslContext)
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory createConnectionSocketFactory(String[] supportedProtocols, String[] supportedCipherSuites)
public HttpClientHelper customSSL(org.apache.http.conn.ssl.SSLConnectionSocketFactory socketFactory)
public HttpClientHelper connectionTimeout(int connectionTimeout)
public HttpClientHelper requestTimeout(int requestTimeout)
public HttpClientHelper socketTimeout(int socketTimeout)
public org.apache.http.impl.client.CloseableHttpClient getHttpClient()
public IHttpResponse execute(org.apache.http.client.methods.RequestBuilder requestBuilder, String defaultResponseCharset) throws Exception
Exception
public <T> T execute(IHttpRequestExecutor<T> requestExecutor) throws Exception
Exception
public IHttpResponse get(String url) throws Exception
Exception
public IHttpResponse get(String url, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse get(String url, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse get(String url, Map<String,String> params) throws Exception
Exception
public IHttpResponse get(String url, Map<String,String> params, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse get(String url, Map<String,String> params, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse get(String url, Map<String,String> params, Charset charset, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, String content, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, String content, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, String content) throws Exception
Exception
public IHttpResponse post(String url, String content) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, byte[] content, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, InputStream content, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, InputStream content, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, byte[] content) throws Exception
Exception
public IHttpResponse post(String url, byte[] content) throws Exception
Exception
public IHttpResponse post(String url, Map<String,String> params, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, Map<String,String> params, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse post(String url, org.apache.http.entity.ContentType contentType, Map<String,String> params, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse post(String url, Map<String,String> params) throws Exception
Exception
public IHttpResponse upload(String url, String fieldName, org.apache.http.entity.mime.content.ContentBody contentBody, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse upload(String url, String fieldName, org.apache.http.entity.mime.content.ContentBody contentBody, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse upload(String url, org.apache.http.entity.mime.FormBodyPart[] formBodyParts, org.apache.http.Header[] headers, String defaultResponseCharset) throws Exception
Exception
public IHttpResponse upload(String url, String fieldName, File uploadFile, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse upload(String url, File uploadFile, org.apache.http.Header[] headers) throws Exception
Exception
public IHttpResponse upload(String url, String fieldName, File uploadFile) throws Exception
Exception
public IHttpResponse upload(String url, File uploadFile) throws Exception
Exception
public void execHttpDownload(org.apache.http.client.methods.RequestBuilder requestBuilder, IFileHandler handler) throws Exception
Exception
public void download(String url, org.apache.http.entity.ContentType contentType, String content, org.apache.http.Header[] headers, IFileHandler handler) throws Exception
Exception
public void download(String url, String content, IFileHandler handler) throws Exception
Exception
public void download(String url, org.apache.http.Header[] headers, IFileHandler handler) throws Exception
Exception
public void download(String url, IFileHandler handler) throws Exception
Exception
Copyright © 2022. All rights reserved.