diff --git a/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java b/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java
index 5ea9a6d96e..5df849ab30 100644
--- a/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java
+++ b/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java
@@ -494,7 +494,7 @@ public final class ClientProperties {
*
* @since 2.43
*/
- public static final String SNI_HOST_NAME = "jersey.config.client.snihostname";
+ public static final String SNI_HOST_NAME = "jersey.config.client.sniHostName";
/**
* The {@link javax.net.ssl.SSLContext} {@link java.util.function.Supplier} to be used to set ssl context in the current
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java b/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java
index 8c9607bc03..5055c12f61 100644
--- a/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java
+++ b/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java
@@ -18,6 +18,7 @@
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.ClientRequest;
+import org.glassfish.jersey.http.HttpHeaders;
import org.glassfish.jersey.internal.PropertiesResolver;
import javax.net.ssl.SSLEngine;
@@ -29,6 +30,7 @@
import java.net.URI;
import java.net.UnknownHostException;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Optional;
@@ -44,11 +46,11 @@ public final class SSLParamConfigurator {
* Builder of the {@link SSLParamConfigurator} instance.
*/
public static final class Builder {
- private ClientRequest clientRequest;
private URI uri;
- private Map> httpHeaders;
- private boolean setAlways = false;
+ private String sniHostNameHeader = null;
private String sniHostPrecedence = null;
+ private boolean setAlways = false;
+
/**
* Sets the {@link ClientRequest} instance.
@@ -56,9 +58,19 @@ public static final class Builder {
* @return the builder instance
*/
public Builder request(ClientRequest clientRequest) {
- this.clientRequest = clientRequest;
- this.httpHeaders = null;
- this.uri = null;
+ this.sniHostNameHeader = getSniHostNameHeader(clientRequest.getHeaders());
+ this.sniHostPrecedence = resolveSniHostNameProperty(clientRequest);
+ this.uri = clientRequest.getUri();
+ return this;
+ }
+
+ /**
+ * Sets the SNIHostName from the {@link Configuration} instance.
+ * @param configuration the {@link Configuration}
+ * @return the builder instance
+ */
+ public Builder configuration(Configuration configuration) {
+ this.sniHostPrecedence = getSniHostNameProperty(configuration);
return this;
}
@@ -68,7 +80,6 @@ public Builder request(ClientRequest clientRequest) {
* @return the builder instance
*/
public Builder uri(URI uri) {
- this.clientRequest = null;
this.uri = uri;
return this;
}
@@ -79,8 +90,7 @@ public Builder uri(URI uri) {
* @return the builder instance
*/
public Builder headers(Map> httpHeaders) {
- this.clientRequest = null;
- this.httpHeaders = httpHeaders;
+ this.sniHostNameHeader = getSniHostNameHeader(httpHeaders);
return this;
}
@@ -129,7 +139,7 @@ public Builder setSNIHostName(String hostName) {
* @return the builder instance.
*/
public Builder setSNIHostName(Configuration configuration) {
- return setSNIHostName((String) configuration.getProperty(ClientProperties.SNI_HOST_NAME));
+ return setSNIHostName(getSniHostNameProperty(configuration));
}
/**
@@ -148,7 +158,7 @@ public Builder setSNIHostName(Configuration configuration) {
* @return the builder instance.
*/
public Builder setSNIHostName(PropertiesResolver resolver) {
- return setSNIHostName(resolver.resolveProperty(ClientProperties.SNI_HOST_NAME, String.class));
+ return setSNIHostName(resolveSniHostNameProperty(resolver));
}
/**
@@ -158,14 +168,38 @@ public Builder setSNIHostName(PropertiesResolver resolver) {
public SSLParamConfigurator build() {
return new SSLParamConfigurator(this);
}
+
+ private static String getSniHostNameHeader(Map> httpHeaders) {
+ List