Package com.luna.common.net.high
Class AsyncHttpUtils
java.lang.Object
com.luna.common.net.high.AsyncHttpUtils
Example of asynchronous HTTP/1.1 request execution.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voiddestroy()static voiddigestAuth(String userName, String password, String host) static <T> CustomAsyncHttpResponsedoAsyncRequest(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, AsyncHttpClientResponseHandler<T> responseHandler) static CustomAsyncHttpResponsedoAsyncRequest(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.concurrent.FutureCallback<CustomAsyncHttpResponse> callback) static <T> TdoAsyncRequest(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> consumer, org.apache.hc.core5.concurrent.FutureCallback<T> callback) static Future<CustomAsyncHttpResponse>doAsyncRequestFuture(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.concurrent.FutureCallback<CustomAsyncHttpResponse> callback) static <T> Future<T>doAsyncRequestFuture(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> consumer, org.apache.hc.core5.concurrent.FutureCallback<T> callback) static <T> CustomAsyncHttpResponsedoGet(String host, String path, Map<String, String> headers, Map<String, String> queries, AsyncHttpClientResponseHandler<T> responseHandler) static <T> CustomAsyncHttpResponsedoPost(String host, String path, Map<String, String> headers, Map<String, String> queries, AsyncHttpClientResponseHandler<T> responseHandler) static <T> CustomAsyncHttpResponsedoPost(String host, String path, Map<String, String> headers, Map<String, String> queries, File file, AsyncHttpClientResponseHandler<T> responseHandler) static <T> CustomAsyncHttpResponsedoPost(String host, String path, Map<String, String> headers, Map<String, String> queries, String body, AsyncHttpClientResponseHandler<T> responseHandler) static <T> CustomAsyncHttpResponsedoPost(String host, String path, Map<String, String> headers, Map<String, String> queries, Path file, AsyncHttpClientResponseHandler<T> responseHandler) static org.apache.hc.core5.http.nio.AsyncRequestProducergetProducer(String host, String path, Map<String, String> headers, Map<String, String> queries, String method) static org.apache.hc.core5.http.nio.AsyncRequestProducergetProducer(String host, String path, Map<String, String> headers, Map<String, String> queries, org.apache.hc.core5.http.nio.AsyncEntityProducer entityProducer, String method) static voidinit()static voidrefresh()static voidstatic voidstatic voidstatic void使用代理访问static void
-
Constructor Details
-
AsyncHttpUtils
public AsyncHttpUtils()
-
-
Method Details
-
refresh
public static void refresh() -
init
public static void init() -
basicAuth
-
digestAuth
-
setProxy
-
setProxy
-
setProxy
使用代理访问- Parameters:
host- 代理地址port- 代理端口
-
destroy
public static void destroy() -
setAuth
-
setAuth
-
doPost
public static <T> CustomAsyncHttpResponse doPost(String host, String path, Map<String, String> headers, Map<String, throws IOExceptionString> queries, Path file, AsyncHttpClientResponseHandler<T> responseHandler) - Throws:
IOException
-
doPost
-
doPost
-
doGet
public static <T> CustomAsyncHttpResponse doGet(String host, String path, Map<String, String> headers, Map<String, String> queries, AsyncHttpClientResponseHandler<T> responseHandler) -
doPost
public static <T> CustomAsyncHttpResponse doPost(String host, String path, Map<String, String> headers, Map<String, String> queries, AsyncHttpClientResponseHandler<T> responseHandler) -
getProducer
-
getProducer
-
doAsyncRequest
public static <T> CustomAsyncHttpResponse doAsyncRequest(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, AsyncHttpClientResponseHandler<T> responseHandler) -
doAsyncRequest
public static CustomAsyncHttpResponse doAsyncRequest(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.concurrent.FutureCallback<CustomAsyncHttpResponse> callback) -
doAsyncRequest
public static <T> T doAsyncRequest(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> consumer, org.apache.hc.core5.concurrent.FutureCallback<T> callback) -
doAsyncRequestFuture
public static Future<CustomAsyncHttpResponse> doAsyncRequestFuture(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.concurrent.FutureCallback<CustomAsyncHttpResponse> callback) -
doAsyncRequestFuture
public static <T> Future<T> doAsyncRequestFuture(org.apache.hc.core5.http.nio.AsyncRequestProducer producer, org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> consumer, org.apache.hc.core5.concurrent.FutureCallback<T> callback)
-