All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.httpcomponent.httpclient.ApacheAsyncHttpClientProvider Maven / Gradle / Ivy

The newest version!
package com.aliyun.httpcomponent.httpclient;

import com.aliyun.core.http.HttpClient;
import com.aliyun.core.http.HttpClientProvider;
import com.aliyun.core.utils.HttpClientOptions;

public class ApacheAsyncHttpClientProvider implements HttpClientProvider {

    @Override
    public HttpClient createInstance() {
        return new ApacheAsyncHttpClientBuilder().build();
    }
    @Override
    public HttpClient createInstance(HttpClientOptions clientOptions) {
        ApacheAsyncHttpClientBuilder builder = new ApacheAsyncHttpClientBuilder();
        if(clientOptions != null) {
            builder.proxy(clientOptions.getProxyOptions())
                    .configuration(clientOptions.getConfiguration())
                    .responseTimeout(clientOptions.getResponseTimeout());
        }
        return builder.build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy