nbbrd.io.http.HttpContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-io-http Show documentation
Show all versions of java-io-http Show documentation
Common IO utilities - http
The newest version!
package nbbrd.io.http;
import org.checkerframework.checker.index.qual.NonNegative;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
import java.net.ProxySelector;
import java.util.List;
import java.util.function.Supplier;
@lombok.Value
@lombok.Builder(toBuilder = true)
public class HttpContext {
private static final int NO_TIMEOUT = 0;
@NonNegative
@lombok.Builder.Default
int readTimeout = NO_TIMEOUT;
@NonNegative
@lombok.Builder.Default
int connectTimeout = NO_TIMEOUT;
@NonNegative
@lombok.Builder.Default
int maxRedirects = 20;
@lombok.NonNull
@lombok.Builder.Default
Supplier proxySelector = ProxySelector::getDefault;
@lombok.NonNull
@lombok.Builder.Default
Supplier sslSocketFactory = HttpsURLConnection::getDefaultSSLSocketFactory;
@lombok.NonNull
@lombok.Builder.Default
Supplier hostnameVerifier = HttpsURLConnection::getDefaultHostnameVerifier;
@lombok.NonNull
@lombok.Builder.Default
Supplier urlConnectionFactory = URLConnectionFactory::getDefault;
@lombok.NonNull
@lombok.Builder.Default
HttpEventListener listener = HttpEventListener.noOp();
@lombok.Singular
List decoders;
@lombok.NonNull
@lombok.Builder.Default
HttpAuthenticator authenticator = HttpAuthenticator.noOp();
@lombok.Builder.Default
boolean preemptiveAuthentication = false;
@lombok.Builder.Default
String userAgent = null;
public static Builder builder() {
return new Builder()
.decoder(StreamDecoder.gzip())
.decoder(StreamDecoder.deflate());
}
public static final class Builder {
// Fix javadoc compilation
}
}