tech.kronicle.utils.HttpClientFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kronicle-utils Show documentation
Show all versions of kronicle-utils Show documentation
Kronicle utils library that contains utility classes for use by Kronicle and its plugins
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