From 5a515191ed06a05fd7dedc75720429feb2d05441 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Wed, 18 Dec 2024 16:22:56 -0800 Subject: [PATCH 1/7] Remove jersey wadl logging setting --- .../files/src/main/resources/logging.properties.mustache | 3 --- 1 file changed, 3 deletions(-) diff --git a/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache b/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache index dac99e33461..40e77eff6ea 100644 --- a/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache +++ b/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache @@ -20,9 +20,6 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ # Quiet Weld org.jboss.level=WARNING -# Quiet Jersey wadl support -org.glassfish.jersey.server.wadl.level=SEVERE - # Component specific log levels #io.helidon.config.level=INFO #io.helidon.security.level=INFO From 9a95f8ce4a1057944fc4226670676b5bdf509c72 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Wed, 18 Dec 2024 16:23:23 -0800 Subject: [PATCH 2/7] Configure jersey: disable wadl feature. Disable DATASOURCE provider default --- .../io/helidon/microprofile/server/JaxRsService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index 5acf12c4a75..bab420231b1 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -66,6 +66,7 @@ import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ContainerResponse; import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.ContainerResponseWriter; @@ -96,6 +97,14 @@ private JaxRsService(ResourceConfig resourceConfig, static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) { + // Silence warnings from Jersey. See 9019 + if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE)) { + resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE")); + } + if (!resourceConfig.hasProperty(ServerProperties.WADL_FEATURE_DISABLE)) { + resourceConfig.addProperties(Map.of(ServerProperties.WADL_FEATURE_DISABLE, "true")); + } + InjectionManager ij = injectionManager == null ? null : new InjectionManagerWrapper(injectionManager, resourceConfig); ApplicationHandler appHandler = new ApplicationHandler(resourceConfig, new WebServerBinder(), From a784424d255de684da18a16cbb1ca65f1200999e Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Wed, 18 Dec 2024 17:16:19 -0800 Subject: [PATCH 3/7] Allow configuration of DATASOURCE provider suppression for tck test --- .../io/helidon/microprofile/server/JaxRsService.java | 9 ++++++--- .../resources/META-INF/microprofile-config.properties | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index bab420231b1..54e0145acd5 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -75,6 +75,7 @@ class JaxRsService implements HttpService { * If set to {@code "true"}, Jersey will ignore responses in exceptions. */ static final String IGNORE_EXCEPTION_RESPONSE = "jersey.config.client.ignoreExceptionResponse"; + static final String SUPPRESS_DATASOURCE_PROVIDER = "jersey.config.server.suppressDataSourceProvider"; private static final System.Logger LOGGER = System.getLogger(JaxRsService.class.getName()); private static final Type REQUEST_TYPE = (new GenericType>() { }).getType(); @@ -97,8 +98,11 @@ private JaxRsService(ResourceConfig resourceConfig, static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) { - // Silence warnings from Jersey. See 9019 - if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE)) { + Config config = ConfigProvider.getConfig(); + + // Silence warnings from Jersey. See 9019. Allow overriding to pass tck + Boolean suppressDatasourceProvider = config.getOptionalValue(SUPPRESS_DATASOURCE_PROVIDER, Boolean.class).orElse(true); + if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && suppressDatasourceProvider) { resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE")); } if (!resourceConfig.hasProperty(ServerProperties.WADL_FEATURE_DISABLE)) { @@ -110,7 +114,6 @@ static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injec new WebServerBinder(), ij); Container container = new HelidonJerseyContainer(appHandler); - Config config = ConfigProvider.getConfig(); // This configuration via system properties is for the Jersey Client API. Any // response in an exception will be mapped to an empty one to prevent data leaks diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties index 82d86a2bd88..43ab42c5fee 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties @@ -15,3 +15,4 @@ # jersey.config.client.ignoreExceptionResponse=false +jersey.config.server.suppressDataSourceProvider=false From 788344b23201f25fd33b7bb77474f17b78d59828 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Thu, 19 Dec 2024 08:31:40 -0800 Subject: [PATCH 4/7] Fix copyright --- .../src/test/resources/META-INF/microprofile-config.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties index 43ab42c5fee..39f69790b03 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Oracle and/or its affiliates. +# Copyright (c) 2023, 2024 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. @@ -16,3 +16,4 @@ jersey.config.client.ignoreExceptionResponse=false jersey.config.server.suppressDataSourceProvider=false + From 6e0d784296578d0ed645288f18a48594bef0c366 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Thu, 19 Dec 2024 12:28:23 -0800 Subject: [PATCH 5/7] Use system properties to control datasource provider suppression --- .../java/io/helidon/microprofile/server/JaxRsService.java | 5 ++--- microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml | 1 + .../test/resources/META-INF/microprofile-config.properties | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index 54e0145acd5..8bcfc477331 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -98,10 +98,8 @@ private JaxRsService(ResourceConfig resourceConfig, static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) { - Config config = ConfigProvider.getConfig(); - // Silence warnings from Jersey. See 9019. Allow overriding to pass tck - Boolean suppressDatasourceProvider = config.getOptionalValue(SUPPRESS_DATASOURCE_PROVIDER, Boolean.class).orElse(true); + boolean suppressDatasourceProvider = Boolean.parseBoolean(System.getProperty(SUPPRESS_DATASOURCE_PROVIDER, "true")); if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && suppressDatasourceProvider) { resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE")); } @@ -114,6 +112,7 @@ static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injec new WebServerBinder(), ij); Container container = new HelidonJerseyContainer(appHandler); + Config config = ConfigProvider.getConfig(); // This configuration via system properties is for the Jersey Client API. Any // response in an exception will be mapped to an empty one to prevent data leaks diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml b/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml index 9bc8a92c62d..af4bfa9036d 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml @@ -125,6 +125,7 @@ localhost 8080 false + false true false false diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties index 39f69790b03..5d1380d785d 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties @@ -15,5 +15,3 @@ # jersey.config.client.ignoreExceptionResponse=false -jersey.config.server.suppressDataSourceProvider=false - From be2493c58ad835cfda566c7fa8300729a32518d3 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Mon, 23 Dec 2024 15:52:58 -0800 Subject: [PATCH 6/7] Change property name to disableDataSourceProvider, check MP config and sys props --- .../helidon/microprofile/server/JaxRsService.java | 14 +++++++++----- .../tests/tck/tck-restful/tck-restful-test/pom.xml | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index 8bcfc477331..99ac98b1990 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -75,7 +75,7 @@ class JaxRsService implements HttpService { * If set to {@code "true"}, Jersey will ignore responses in exceptions. */ static final String IGNORE_EXCEPTION_RESPONSE = "jersey.config.client.ignoreExceptionResponse"; - static final String SUPPRESS_DATASOURCE_PROVIDER = "jersey.config.server.suppressDataSourceProvider"; + static final String DISABLE_DATASOURCE_PROVIDER = "jersey.config.server.disableDataSourceProvider"; private static final System.Logger LOGGER = System.getLogger(JaxRsService.class.getName()); private static final Type REQUEST_TYPE = (new GenericType>() { }).getType(); @@ -98,9 +98,14 @@ private JaxRsService(ResourceConfig resourceConfig, static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) { - // Silence warnings from Jersey. See 9019. Allow overriding to pass tck - boolean suppressDatasourceProvider = Boolean.parseBoolean(System.getProperty(SUPPRESS_DATASOURCE_PROVIDER, "true")); - if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && suppressDatasourceProvider) { + Config config = ConfigProvider.getConfig(); + + // Silence warnings from Jersey by disabling the default data source provider. See 9019. + // To pass TCK we support a system property to control whether or not we disable the default provider + // We also support the property via MicroProfile config in case a user wants to control the property. + boolean disableDatasourceProvider = config.getOptionalValue(DISABLE_DATASOURCE_PROVIDER, Boolean.class) + .orElseGet(() -> Boolean.parseBoolean(System.getProperty(DISABLE_DATASOURCE_PROVIDER, "true"))); + if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && disableDatasourceProvider) { resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE")); } if (!resourceConfig.hasProperty(ServerProperties.WADL_FEATURE_DISABLE)) { @@ -112,7 +117,6 @@ static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injec new WebServerBinder(), ij); Container container = new HelidonJerseyContainer(appHandler); - Config config = ConfigProvider.getConfig(); // This configuration via system properties is for the Jersey Client API. Any // response in an exception will be mapped to an empty one to prevent data leaks diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml b/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml index af4bfa9036d..2a5965720fe 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml @@ -125,7 +125,7 @@ localhost 8080 false - false + false true false false From 8213dab340da3d7bdf5b3e5cf5da1097e6532897 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Thu, 2 Jan 2025 11:26:32 -0800 Subject: [PATCH 7/7] Update copyrights --- .../main/java/io/helidon/microprofile/server/JaxRsService.java | 2 +- .../src/test/resources/META-INF/microprofile-config.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index 99ac98b1990..bad1134ed5b 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024 Oracle and/or its affiliates. + * Copyright (c) 2022, 2025 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. diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties index 5d1380d785d..0393d07acb7 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2023, 2024 Oracle and/or its affiliates. +# Copyright (c) 2023, 2025 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.