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

tech.kronicle.utils.HttpClientFactory Maven / Gradle / Ivy

Go to download

Kronicle utils library that contains utility classes for use by Kronicle and its plugins

There is a newer version: 0.1.331
Show newest version
package tech.kronicle.utils;

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.time.Duration;

public final class HttpClientFactory {

    public static HttpClient createHttpClient() {
        return createHttpClient(Duration.ofSeconds(60));
    }

    public static HttpClient createHttpClient(Duration timeout) {
        return HttpClient.newBuilder()
                .followRedirects(HttpClient.Redirect.NEVER)
                .connectTimeout(timeout)
                .build();
    }

    public static HttpRequest.Builder createHttpRequestBuilder(Duration timeout) {
        return HttpRequest.newBuilder()
                .timeout(timeout);
    }

    private HttpClientFactory() {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy