From 28e23068f72fd3068d3662ac101e96a19b0c3072 Mon Sep 17 00:00:00 2001 From: Tomas Hofman Date: Thu, 8 Sep 2022 14:47:56 +0200 Subject: [PATCH] Rest client classic: make configuration methods in RestClientBase protected This is to accommodate kogito extension that accesses these methods. --- .../restclient/runtime/RestClientBase.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java b/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java index fab97f03429f58..4380c9ef7b333f 100644 --- a/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java +++ b/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java @@ -66,7 +66,7 @@ public Object create() { return builder.build(proxyType); } - void configureBuilder(RestClientBuilder builder) { + protected void configureBuilder(RestClientBuilder builder) { configureBaseUrl(builder); configureTimeouts(builder); configureProviders(builder); @@ -77,7 +77,7 @@ void configureBuilder(RestClientBuilder builder) { configureCustomProperties(builder); } - private void configureCustomProperties(RestClientBuilder builder) { + protected void configureCustomProperties(RestClientBuilder builder) { Optional connectionPoolSize = oneOf(clientConfigByClassName().connectionPoolSize, clientConfigByConfigKey().connectionPoolSize, configRoot.connectionPoolSize); if (connectionPoolSize.isPresent()) { @@ -92,7 +92,7 @@ private void configureCustomProperties(RestClientBuilder builder) { } } - private void configureProxy(RestClientBuilder builder) { + protected void configureProxy(RestClientBuilder builder) { Optional proxyAddress = oneOf(clientConfigByClassName().proxyAddress, clientConfigByConfigKey().proxyAddress, configRoot.proxyAddress); if (proxyAddress.isPresent() && !NONE.equals(proxyAddress.get())) { @@ -116,7 +116,7 @@ private void configureProxy(RestClientBuilder builder) { } } - private void configureRedirects(RestClientBuilder builder) { + protected void configureRedirects(RestClientBuilder builder) { Optional followRedirects = oneOf(clientConfigByClassName().followRedirects, clientConfigByConfigKey().followRedirects, configRoot.followRedirects); if (followRedirects.isPresent()) { @@ -124,7 +124,7 @@ private void configureRedirects(RestClientBuilder builder) { } } - private void configureQueryParamStyle(RestClientBuilder builder) { + protected void configureQueryParamStyle(RestClientBuilder builder) { Optional queryParamStyle = oneOf(clientConfigByClassName().queryParamStyle, clientConfigByConfigKey().queryParamStyle, configRoot.queryParamStyle); if (queryParamStyle.isPresent()) { @@ -132,7 +132,7 @@ private void configureQueryParamStyle(RestClientBuilder builder) { } } - private void configureSsl(RestClientBuilder builder) { + protected void configureSsl(RestClientBuilder builder) { Optional trustStore = oneOf(clientConfigByClassName().trustStore, clientConfigByConfigKey().trustStore, configRoot.trustStore); if (trustStore.isPresent() && !trustStore.get().isBlank() && !NONE.equals(trustStore.get())) { @@ -249,7 +249,7 @@ private InputStream locateStream(String path) throws FileNotFoundException { } } - private void configureProviders(RestClientBuilder builder) { + protected void configureProviders(RestClientBuilder builder) { Optional providers = oneOf(clientConfigByClassName().providers, clientConfigByConfigKey().providers, configRoot.providers); @@ -277,7 +277,7 @@ private Class providerClassForName(String name) { } } - private void configureTimeouts(RestClientBuilder builder) { + protected void configureTimeouts(RestClientBuilder builder) { Long connectTimeout = oneOf(clientConfigByClassName().connectTimeout, clientConfigByConfigKey().connectTimeout).orElse(this.configRoot.connectTimeout); if (connectTimeout != null) { @@ -291,7 +291,7 @@ private void configureTimeouts(RestClientBuilder builder) { } } - private void configureBaseUrl(RestClientBuilder builder) { + protected void configureBaseUrl(RestClientBuilder builder) { Optional baseUrlOptional = oneOf(clientConfigByClassName().uri, clientConfigByConfigKey().uri); if (baseUrlOptional.isEmpty()) { baseUrlOptional = oneOf(clientConfigByClassName().url, clientConfigByConfigKey().url); @@ -333,7 +333,7 @@ private RestClientConfig clientConfigByClassName() { @SafeVarargs private static Optional oneOf(Optional... optionals) { for (Optional o : optionals) { - if (o.isPresent()) { + if (o != null && o.isPresent()) { return o; } }