Skip to content

Commit 70a3c1d

Browse files
committed
Activate useSystemProperties into ApacheConnector (#4458)
Signed-off-by: Julien Blondeau <lounagen@gmail.com>
1 parent f9a8431 commit 70a3c1d

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheClientProperties.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -165,6 +165,20 @@ public final class ApacheClientProperties {
165165
*/
166166
public static final String CONNECTION_CLOSING_STRATEGY = "jersey.config.apache.client.connectionClosingStrategy";
167167

168+
/**
169+
* A value of {@code false} indicates the client will use default ApacheConnector params. A value
170+
* of {@code true} will cause the client to take into account the system properties
171+
* {@code https.protocols}, {@code https.cipherSuites}, {@code http.keepAlive},
172+
* {@code http.maxConnections}.
173+
* <p/>
174+
* The value MUST be an instance of {@link java.lang.Boolean}.
175+
* <p/>
176+
* The default value is {@code false}.
177+
* <p/>
178+
* The name of the configuration property is <tt>{@value}</tt>.
179+
*/
180+
public static final String USE_SYSTEM_PROPERTIES = "jersey.config.apache.client.useSystemProperties";
181+
168182
/**
169183
* Get the value of the specified property.
170184
*

connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -357,12 +357,14 @@ private HttpClientConnectionManager getConnectionManager(final Client client,
357357
}
358358
}
359359

360+
final boolean useSystemProperties = PropertiesHelper.isProperty(config.getProperties(), ApacheClientProperties.USE_SYSTEM_PROPERTIES);
361+
360362
// Create custom connection manager.
361363
return createConnectionManager(
362364
client,
363365
config,
364366
sslContext,
365-
false);
367+
useSystemProperties);
366368
}
367369

368370
private HttpClientConnectionManager createConnectionManager(

core-common/src/main/java/org/glassfish/jersey/internal/util/PropertiesHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at

0 commit comments

Comments
 (0)