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

top.jfunc.http.component.apache.SingleApacheClientFactory Maven / Gradle / Ivy

package top.jfunc.http.component.apache;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import top.jfunc.http.component.AbstractRequesterFactory;
import top.jfunc.http.component.CloseNoneCloser;
import top.jfunc.http.request.HttpRequest;

import java.io.IOException;

/**
 * 要配合{@link CloseNoneCloser}不能关闭这个client
 * @see DefaultApacheClientFactory
 * @author xiongshiyan at 2020/1/6 , contact me with email [email protected] or phone 15208384257
 */
public class SingleApacheClientFactory extends AbstractRequesterFactory {
    private static final CloseableHttpClient CLOSEABLE_HTTP_CLIENT = HttpClients.createDefault();

    @Override
    public HttpClient doCreate(HttpRequest httpRequest) throws IOException {
        return CLOSEABLE_HTTP_CLIENT;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy