From 54113576452abf6a7269fe47311070667b3b5312 Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Fri, 12 May 2023 11:23:01 -0400 Subject: [PATCH 1/3] Module helidon-reactive-webclient-jaxrs is no longer needed. Module helidon-jersey-client provides an executor for Jersey and the logic about default providers for native image can be revisited later. --- reactive/webclient/jaxrs/pom.xml | 76 ---------------- .../reactive/webclient/jaxrs/JaxRsClient.java | 86 ------------------- .../jaxrs/JerseyClientAutoDiscoverable.java | 77 ----------------- .../webclient/jaxrs/package-info.java | 27 ------ .../jaxrs/src/main/java/module-info.java | 38 -------- reactive/webclient/pom.xml | 1 - 6 files changed, 305 deletions(-) delete mode 100644 reactive/webclient/jaxrs/pom.xml delete mode 100644 reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JaxRsClient.java delete mode 100644 reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JerseyClientAutoDiscoverable.java delete mode 100644 reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/package-info.java delete mode 100644 reactive/webclient/jaxrs/src/main/java/module-info.java diff --git a/reactive/webclient/jaxrs/pom.xml b/reactive/webclient/jaxrs/pom.xml deleted file mode 100644 index 60a0f9d0f7e..00000000000 --- a/reactive/webclient/jaxrs/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - helidon-reactive-webclient-project - io.helidon.reactive.webclient - 4.0.0-SNAPSHOT - - 4.0.0 - - helidon-reactive-webclient-jaxrs - Helidon WebClient JAX-RS - - - - io.helidon.jersey - helidon-jersey-client - - - io.helidon.jersey - helidon-jersey-common - - - io.helidon.common - helidon-common-context - - - io.helidon.config - helidon-config - - - io.helidon.common - helidon-common-configurable - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - --enable-preview - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - --enable-preview - - - - - - diff --git a/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JaxRsClient.java b/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JaxRsClient.java deleted file mode 100644 index 31d02e15102..00000000000 --- a/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JaxRsClient.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.reactive.webclient.jaxrs; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; - -import io.helidon.common.config.Config; -import io.helidon.common.configurable.ThreadPoolSupplier; -import io.helidon.common.context.Contexts; - -/** - * Point of access to {@link jakarta.ws.rs.client.ClientBuilder} to support Helidon features, - * such as propagation of tracing, correct handling of {@link io.helidon.common.context.Context}. - */ -public final class JaxRsClient { - private static final AtomicReference> EXECUTOR_SUPPLIER = - new AtomicReference<>(ThreadPoolSupplier.builder() - .threadNamePrefix("helidon-jaxrs-client-") - .build()); - - private JaxRsClient() { - } - - /** - * Configure defaults for all clients created. - * Configuration options: - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Configuration parameters
keydefault valuedescription
executor{@link io.helidon.common.configurable.ThreadPoolSupplier#create(io.helidon.common.config.Config, String)}Default executor service to use for asynchronous operations. For configuration options - * of {@code executor}, please refer to - * {@link io.helidon.common.configurable.ThreadPoolSupplier.Builder#config(io.helidon.common.config.Config)}
- * - * @param config configuration to use to configure JAX-RS clients defaults - */ - public static void configureDefaults(Config config) { - EXECUTOR_SUPPLIER.set(ThreadPoolSupplier.create(config, "jaxrs-client-thread-pool")); - } - - /** - * Configure the default executor supplier to be used for asynchronous requests when explicit supplier is not - * provided. - * - * @param executorServiceSupplier supplier that provides the executor service - */ - public static void defaultExecutor(Supplier executorServiceSupplier) { - Supplier wrapped = () -> Contexts.wrap(executorServiceSupplier.get()); - - EXECUTOR_SUPPLIER.set(wrapped); - } - - /** - * The executor supplier configured as default. - * - * @return supplier of {@link java.util.concurrent.ExecutorService} to use for client - * asynchronous operations - */ - static Supplier executor() { - return EXECUTOR_SUPPLIER.get(); - } -} diff --git a/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JerseyClientAutoDiscoverable.java b/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JerseyClientAutoDiscoverable.java deleted file mode 100644 index 64bbaf9f59b..00000000000 --- a/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/JerseyClientAutoDiscoverable.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.reactive.webclient.jaxrs; - -import java.lang.System.Logger.Level; -import java.util.concurrent.ExecutorService; - -import jakarta.annotation.Priority; -import jakarta.ws.rs.ConstrainedTo; -import jakarta.ws.rs.RuntimeType; -import jakarta.ws.rs.core.Configuration; -import jakarta.ws.rs.core.FeatureContext; -import org.glassfish.jersey.client.ClientAsyncExecutor; -import org.glassfish.jersey.internal.spi.AutoDiscoverable; -import org.glassfish.jersey.model.internal.CommonConfig; -import org.glassfish.jersey.spi.ExecutorServiceProvider; - -import static org.glassfish.jersey.CommonProperties.PROVIDER_DEFAULT_DISABLE; - -/** - * Auto discoverable feature to use a custom executor service - * for all client asynchronous operations. - * This is needed to support {@link io.helidon.common.context.Context} for - * outbound calls. - * Also disables default providers, unless configured by user. - */ -@ConstrainedTo(RuntimeType.CLIENT) -@Priority(121) -public class JerseyClientAutoDiscoverable implements AutoDiscoverable { - private static final System.Logger LOGGER = System.getLogger(JerseyClientAutoDiscoverable.class.getName()); - - @Override - public void configure(FeatureContext context) { - context.register(new EsProvider()); - Configuration jaxRsConfiguration = context.getConfiguration(); - if (jaxRsConfiguration instanceof CommonConfig) { - // this should be always true, as we are in Jersey - CommonConfig configuration = (CommonConfig) jaxRsConfiguration; - - Object property = configuration.getProperty(PROVIDER_DEFAULT_DISABLE); - if (null == property) { - LOGGER.log(Level.DEBUG, "Disabling all Jersey default providers (DOM, SAX, Rendered Image, XML Source, and " - + "XML Stream Source). You can enabled them by setting system property " - + PROVIDER_DEFAULT_DISABLE + " to NONE"); - configuration.property(PROVIDER_DEFAULT_DISABLE, "ALL"); - } else if ("NONE".equals(property)) { - configuration.property(PROVIDER_DEFAULT_DISABLE, null); - } - } - } - - @ClientAsyncExecutor - private static final class EsProvider implements ExecutorServiceProvider { - @Override - public ExecutorService getExecutorService() { - return JaxRsClient.executor().get(); - } - - @Override - public void dispose(ExecutorService executorService) { - // no-op, as we use a shared executor instance - } - } -} diff --git a/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/package-info.java b/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/package-info.java deleted file mode 100644 index 42346d992a3..00000000000 --- a/reactive/webclient/jaxrs/src/main/java/io/helidon/reactive/webclient/jaxrs/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Helidon support for JAX-RS (Jersey) client. - * You can create the JAX-RS client as usual using {@link jakarta.ws.rs.client.ClientBuilder#newBuilder()} - * and {@link jakarta.ws.rs.client.ClientBuilder#newClient()}. - *

- * If you want to configure defaults for asynchronous executor service, - * you can use {@link io.helidon.reactive.webclient.jaxrs.JaxRsClient#configureDefaults(io.helidon.config.Config)} - * or {@link io.helidon.reactive.webclient.jaxrs.JaxRsClient#defaultExecutor(java.util.function.Supplier)}. - * - * @see io.helidon.reactive.webclient.jaxrs.JaxRsClient - */ -package io.helidon.reactive.webclient.jaxrs; diff --git a/reactive/webclient/jaxrs/src/main/java/module-info.java b/reactive/webclient/jaxrs/src/main/java/module-info.java deleted file mode 100644 index 3ee24259e1e..00000000000 --- a/reactive/webclient/jaxrs/src/main/java/module-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import io.helidon.reactive.webclient.jaxrs.JerseyClientAutoDiscoverable; - -import org.glassfish.jersey.internal.spi.AutoDiscoverable; - -/** - * Basic integration with JAX-RS client. - */ -module io.helidon.reactive.webclient.jaxrs { - requires jakarta.annotation; - - requires jakarta.ws.rs; - requires io.helidon.jersey.client; - requires io.helidon.jersey.common; - - requires io.helidon.common; - requires io.helidon.common.configurable; - requires io.helidon.common.context; - - exports io.helidon.reactive.webclient.jaxrs; - - provides AutoDiscoverable with JerseyClientAutoDiscoverable; -} diff --git a/reactive/webclient/pom.xml b/reactive/webclient/pom.xml index 89c296fe20e..c6669cb8431 100644 --- a/reactive/webclient/pom.xml +++ b/reactive/webclient/pom.xml @@ -34,7 +34,6 @@ pom - jaxrs webclient metrics security From 71b5c6d91ffed969a226ea91cc53c5ca952e00f3 Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Fri, 12 May 2023 13:47:20 -0400 Subject: [PATCH 2/3] Removed references to helidon-reactive-webclient-jaxrs module. --- bom/pom.xml | 5 ----- security/integration/jersey-client/pom.xml | 4 ---- .../integration/jersey-client/src/main/java/module-info.java | 1 - security/integration/jersey/pom.xml | 4 ---- security/integration/jersey/src/main/java/module-info.java | 1 - security/providers/oidc-common/pom.xml | 4 ---- .../providers/oidc-common/src/main/java/module-info.java | 1 - tracing/jersey-client/pom.xml | 4 ---- tracing/jersey-client/src/main/java/module-info.java | 3 +-- 9 files changed, 1 insertion(+), 26 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index 73f1c98eb53..cf0d0512e69 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -110,11 +110,6 @@ ${helidon.version} - - io.helidon.reactive.webclient - helidon-reactive-webclient-jaxrs - ${helidon.version} - io.helidon.reactive.webclient helidon-reactive-webclient diff --git a/security/integration/jersey-client/pom.xml b/security/integration/jersey-client/pom.xml index e65cacac90e..79aaf1987e7 100644 --- a/security/integration/jersey-client/pom.xml +++ b/security/integration/jersey-client/pom.xml @@ -58,10 +58,6 @@ helidon-jersey-client provided - - io.helidon.reactive.webclient - helidon-reactive-webclient-jaxrs - org.junit.jupiter junit-jupiter-api diff --git a/security/integration/jersey-client/src/main/java/module-info.java b/security/integration/jersey-client/src/main/java/module-info.java index 7db0ee8df06..394d74bf1ae 100644 --- a/security/integration/jersey-client/src/main/java/module-info.java +++ b/security/integration/jersey-client/src/main/java/module-info.java @@ -30,7 +30,6 @@ requires io.helidon.common.uri; requires io.helidon.jersey.common; requires io.helidon.security.integration.common; - requires io.helidon.reactive.webclient.jaxrs; requires jersey.common; requires jersey.client; diff --git a/security/integration/jersey/pom.xml b/security/integration/jersey/pom.xml index a851b7c5a51..8397b6190e8 100644 --- a/security/integration/jersey/pom.xml +++ b/security/integration/jersey/pom.xml @@ -73,10 +73,6 @@ helidon-jersey-client provided - - io.helidon.reactive.webclient - helidon-reactive-webclient-jaxrs - io.helidon.jersey helidon-jersey-server diff --git a/security/integration/jersey/src/main/java/module-info.java b/security/integration/jersey/src/main/java/module-info.java index e1581fbfdc9..551f1281746 100644 --- a/security/integration/jersey/src/main/java/module-info.java +++ b/security/integration/jersey/src/main/java/module-info.java @@ -42,7 +42,6 @@ requires io.helidon.jersey.server; requires io.helidon.jersey.client; requires io.helidon.security.integration.common; - requires io.helidon.reactive.webclient.jaxrs; requires jakarta.inject; diff --git a/security/providers/oidc-common/pom.xml b/security/providers/oidc-common/pom.xml index 1290011d50a..565f4b20153 100644 --- a/security/providers/oidc-common/pom.xml +++ b/security/providers/oidc-common/pom.xml @@ -62,10 +62,6 @@ io.helidon.reactive.webclient helidon-reactive-webclient-tracing - - io.helidon.reactive.webclient - helidon-reactive-webclient-jaxrs - io.helidon.reactive.media helidon-reactive-media-jsonp diff --git a/security/providers/oidc-common/src/main/java/module-info.java b/security/providers/oidc-common/src/main/java/module-info.java index a3a5a08760b..e50fc818561 100644 --- a/security/providers/oidc-common/src/main/java/module-info.java +++ b/security/providers/oidc-common/src/main/java/module-info.java @@ -30,7 +30,6 @@ requires io.helidon.security.providers.common; requires io.helidon.security.jwt; requires io.helidon.security.providers.httpauth; - requires io.helidon.reactive.webclient.jaxrs; requires io.helidon.reactive.webclient.security; requires io.helidon.reactive.webclient.tracing; requires io.helidon.reactive.media.jsonp; diff --git a/tracing/jersey-client/pom.xml b/tracing/jersey-client/pom.xml index 87dc275660e..46154c9cdae 100644 --- a/tracing/jersey-client/pom.xml +++ b/tracing/jersey-client/pom.xml @@ -53,10 +53,6 @@ io.helidon.common helidon-common-context - - io.helidon.reactive.webclient - helidon-reactive-webclient-jaxrs - io.helidon.common.features helidon-common-features-api diff --git a/tracing/jersey-client/src/main/java/module-info.java b/tracing/jersey-client/src/main/java/module-info.java index 0cddd1ac598..03752447f2a 100644 --- a/tracing/jersey-client/src/main/java/module-info.java +++ b/tracing/jersey-client/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,6 @@ requires io.helidon.tracing.config; requires io.helidon.common; requires io.helidon.common.context; - requires io.helidon.reactive.webclient.jaxrs; exports io.helidon.tracing.jersey.client; From 21d6993f443dfd758d01e5b8371aa6608b9765a6 Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Mon, 15 May 2023 09:52:03 -0400 Subject: [PATCH 3/3] Restored transitive dependency. Signed-off-by: Santiago Pericasgeertsen --- examples/translator-app/frontend/pom.xml | 4 ++++ security/providers/oidc-common/pom.xml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/examples/translator-app/frontend/pom.xml b/examples/translator-app/frontend/pom.xml index ba82960c9fa..def27be845d 100644 --- a/examples/translator-app/frontend/pom.xml +++ b/examples/translator-app/frontend/pom.xml @@ -61,6 +61,10 @@ io.helidon.common helidon-common + + io.helidon.jersey + helidon-jersey-client + jakarta.inject jakarta.inject-api diff --git a/security/providers/oidc-common/pom.xml b/security/providers/oidc-common/pom.xml index 565f4b20153..cafcabb8c18 100644 --- a/security/providers/oidc-common/pom.xml +++ b/security/providers/oidc-common/pom.xml @@ -66,6 +66,10 @@ io.helidon.reactive.media helidon-reactive-media-jsonp + + io.helidon.jersey + helidon-jersey-client + io.helidon.jersey helidon-jersey-media-jsonp