From 111af668eb69f4bdbafc1da816519807e890b82c Mon Sep 17 00:00:00 2001 From: Maxim Nesen Date: Fri, 9 Oct 2020 13:08:51 +0200 Subject: [PATCH] Jetty modules handled for JDK less than 11 Signed-off-by: Maxim Nesen --- bom/pom.xml | 48 +++--- connectors/jetty-connector/pom.xml | 138 +++++++++++++++++ .../jetty/connector/JettyConnector.java | 0 .../connector/JettyConnectorProvider.java | 5 + .../connector/JettyHttpClientContract.java | 0 .../connector/JettyHttpClientSupplier.java | 0 .../connector/JettyConnectorProvider.java | 44 ++++++ .../jetty/connector/localization.properties | 3 +- connectors/pom.xml | 10 +- containers/jetty-http/pom.xml | 143 ++++++++++++++++++ .../jetty/JettyHttpContainerProvider.java | 12 +- .../jersey/jetty/JettyHttpContainer.java | 0 .../jetty/JettyHttpContainerFactory.java | 0 .../jersey/jetty/JettyHttpContainer.java | 58 +++++++ .../jetty/internal/localization.properties | 3 +- containers/pom.xml | 12 +- test-framework/providers/jetty/pom.xml | 141 +++++++++++++++++ .../test/jetty/JettyTestContainerFactory.java | 0 .../test/jetty/JettyTestContainerFactory.java | 38 +++++ .../jetty/internal/localization.properties | 18 +++ test-framework/providers/pom.xml | 12 +- 21 files changed, 621 insertions(+), 64 deletions(-) rename connectors/jetty-connector/src/main/{java => java11}/org/glassfish/jersey/jetty/connector/JettyConnector.java (100%) rename connectors/jetty-connector/src/main/{java => java11}/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java (95%) rename connectors/jetty-connector/src/main/{java => java11}/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java (100%) rename connectors/jetty-connector/src/main/{java => java11}/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java (100%) create mode 100644 connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java rename containers/jetty-http/src/main/{java => java11}/org/glassfish/jersey/jetty/JettyHttpContainer.java (100%) rename containers/jetty-http/src/main/{java => java11}/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java (100%) create mode 100644 containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java rename test-framework/providers/jetty/src/main/{java => java11}/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java (100%) create mode 100644 test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java create mode 100644 test-framework/providers/jetty/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties diff --git a/bom/pom.xml b/bom/pom.xml index 33d7b5c62c..30506dda14 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -73,6 +73,11 @@ jersey-grizzly-connector ${project.version} + + org.glassfish.jersey.connectors + jersey-jetty-connector + ${project.version} + org.glassfish.jersey.connectors jersey-jdk-connector @@ -83,6 +88,11 @@ jersey-netty-connector ${project.version} + + org.glassfish.jersey.containers + jersey-container-jetty-http + ${project.version} + org.glassfish.jersey.containers jersey-container-grizzly2-http @@ -93,6 +103,11 @@ jersey-container-grizzly2-servlet ${project.version} + + org.glassfish.jersey.containers + jersey-container-jetty-servlet + ${project.version} + org.glassfish.jersey.containers jersey-container-jdk-http @@ -354,6 +369,11 @@ jersey-test-framework-provider-simple ${project.version} + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-jetty + ${project.version} + org.glassfish.jersey.test-framework jersey-test-framework-util @@ -393,33 +413,5 @@ - - Jetty11 - - [11,) - - - - org.glassfish.jersey.connectors - jersey-jetty-connector - ${project.version} - - - org.glassfish.jersey.containers - jersey-container-jetty-http - ${project.version} - - - org.glassfish.jersey.containers - jersey-container-jetty-servlet - ${project.version} - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-jetty - ${project.version} - - - diff --git a/connectors/jetty-connector/pom.xml b/connectors/jetty-connector/pom.xml index 9d799b626b..63566b94dc 100644 --- a/connectors/jetty-connector/pom.xml +++ b/connectors/jetty-connector/pom.xml @@ -34,6 +34,10 @@ UTF-8 + ${project.basedir}/target + ${project.basedir}/src/main/java8 + ${project.basedir}/target11 + ${project.basedir}/src/main/java11 @@ -119,6 +123,140 @@ true + + JettyExclude + + 1.8 + + + ${java8.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java8.sourceDirectory} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org/glassfish/jersey/jetty/connector/*.java + + + + + + + + Jetty11 + + [11,) + + + ${java11.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java11.sourceDirectory} + + + + + + + + + + copyJDK11FilesToMultiReleaseJar + + + + target11/classes/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.class + + 1.8 + + + + + org.apache.felix + maven-bundle-plugin + true + true + + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + true + + + copy-jdk11-classes + prepare-package + + copy-resources + + + ${java8.build.outputDirectory}/classes/META-INF/versions/11 + + + ${java11.build.outputDirectory}/classes + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-jdk11-sources + package + + + + sources-jar: ${sources-jar} + + + + + + + run + + + + + + + diff --git a/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnector.java b/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnector.java similarity index 100% rename from connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnector.java rename to connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnector.java diff --git a/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java b/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java similarity index 95% rename from connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java rename to connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java index 9fedd0b881..44146c89ab 100644 --- a/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java +++ b/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java @@ -16,6 +16,7 @@ package org.glassfish.jersey.jetty.connector; +import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.core.Configurable; import jakarta.ws.rs.core.Configuration; @@ -25,6 +26,7 @@ import org.glassfish.jersey.client.spi.ConnectorProvider; import org.eclipse.jetty.client.HttpClient; +import org.glassfish.jersey.internal.util.JdkVersion; /** * A {@link ConnectorProvider} for Jersey {@link Connector connector} @@ -82,6 +84,9 @@ public class JettyConnectorProvider implements ConnectorProvider { @Override public Connector getConnector(Client client, Configuration runtimeConfig) { + if (JdkVersion.getJdkVersion().getMajor() < 11) { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } return new JettyConnector(client, runtimeConfig); } diff --git a/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java b/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java similarity index 100% rename from connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java rename to connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java diff --git a/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java b/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java similarity index 100% rename from connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java rename to connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java diff --git a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java b/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java new file mode 100644 index 0000000000..8723025ad3 --- /dev/null +++ b/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.jetty.connector; + +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.core.Configuration; + +import org.glassfish.jersey.client.spi.Connector; +import org.glassfish.jersey.client.spi.ConnectorProvider; + +import org.glassfish.jersey.internal.util.JdkVersion; + +/** + * JDK 1.8 Jetty Connector stub which only throws exception when running on JDK 1.8 + * New Jetty (11+) does not support JDKs prior to 11 + * + * @since 3.0.0 + */ +public class JettyConnectorProvider implements ConnectorProvider { + + @Override + public Connector getConnector(Client client, Configuration runtimeConfig) { + if (JdkVersion.getJdkVersion().getMajor() < 11) { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + return null; // does not work at JDK 1.8 + } + +} diff --git a/connectors/jetty-connector/src/main/resources/org/glassfish/jersey/jetty/connector/localization.properties b/connectors/jetty-connector/src/main/resources/org/glassfish/jersey/jetty/connector/localization.properties index 15d9708e91..af1151850c 100644 --- a/connectors/jetty-connector/src/main/resources/org/glassfish/jersey/jetty/connector/localization.properties +++ b/connectors/jetty-connector/src/main/resources/org/glassfish/jersey/jetty/connector/localization.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License v. 2.0, which is available at @@ -20,3 +20,4 @@ method.not.supported=Method {0} not supported. wrong.proxy.uri.type=The proxy URI ("{0}") property MUST be an instance of String or URI. invalid.configurable.component.type=The supplied component "{0}" is not assignable from JerseyClient or JerseyWebTarget. expected.connector.provider.not.used=The supplied component is not configured to use a JettyConnectorProvider. +not.supported=Jetty connector is not supported on JDK version less than 11. diff --git a/connectors/pom.xml b/connectors/pom.xml index daa8703432..15c1fd6e53 100644 --- a/connectors/pom.xml +++ b/connectors/pom.xml @@ -37,6 +37,7 @@ apache-connector grizzly-connector jdk-connector + jetty-connector netty-connector @@ -86,14 +87,5 @@ helidon-connector - - Jetty11 - - [11,) - - - jetty-connector - - diff --git a/containers/jetty-http/pom.xml b/containers/jetty-http/pom.xml index ddfb891f86..b517d2ac49 100644 --- a/containers/jetty-http/pom.xml +++ b/containers/jetty-http/pom.xml @@ -81,4 +81,147 @@ + + ${project.basedir}/target + ${project.basedir}/src/main/java8 + ${project.basedir}/target11 + ${project.basedir}/src/main/java11 + + + + + JettyExclude + + 1.8 + + + ${java8.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java8.sourceDirectory} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org/glassfish/jersey/jetty/*.java + + + + + + + + Jetty11 + + [11,) + + + ${java11.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java11.sourceDirectory} + + + + + + + + + + copyJDK11FilesToMultiReleaseJar + + + + target11/classes/org/glassfish/jersey/jetty/JettyHttpContainer.class + + 1.8 + + + + + org.apache.felix + maven-bundle-plugin + true + true + + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + true + + + copy-jdk11-classes + prepare-package + + copy-resources + + + ${java8.build.outputDirectory}/classes/META-INF/versions/11 + + + ${java11.build.outputDirectory}/classes + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-jdk11-sources + package + + + + sources-jar: ${sources-jar} + + + + + + + run + + + + + + + + diff --git a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java index 4a2d6c9f55..f4faac678a 100644 --- a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java +++ b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java @@ -19,10 +19,10 @@ import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.core.Application; +import org.glassfish.jersey.internal.util.JdkVersion; +import org.glassfish.jersey.jetty.internal.LocalizationMessages; import org.glassfish.jersey.server.spi.ContainerProvider; -import org.eclipse.jetty.server.Handler; - /** * Container provider for containers based on Jetty Server {@link org.eclipse.jetty.server.Handler}. * @@ -33,7 +33,13 @@ public final class JettyHttpContainerProvider implements ContainerProvider { @Override public T createContainer(final Class type, final Application application) throws ProcessingException { - if (Handler.class == type || JettyHttpContainer.class == type) { + if (JdkVersion.getJdkVersion().getMajor() < 11) { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + if (type != null + && ("org.eclipse.jetty.server.Handler".equalsIgnoreCase(type.getCanonicalName()) + || JettyHttpContainer.class == type) + ) { return type.cast(new JettyHttpContainer(application)); } return null; diff --git a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainer.java b/containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainer.java similarity index 100% rename from containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainer.java rename to containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainer.java diff --git a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java b/containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java similarity index 100% rename from containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java rename to containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java diff --git a/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java b/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java new file mode 100644 index 0000000000..b852e54c22 --- /dev/null +++ b/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.jetty; + +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.core.Application; +import org.glassfish.jersey.jetty.internal.LocalizationMessages; +import org.glassfish.jersey.server.ApplicationHandler; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.spi.Container; + +/** + * Jersey {@code Container} stub based on Jetty {@link org.eclipse.jetty.server.Handler}. + * + * For JDK 1.8 only since Jetty 11 does not support JDKs below 11 + * + */ +public final class JettyHttpContainer implements Container { + + public JettyHttpContainer(Application application) { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + + @Override + public ResourceConfig getConfiguration() { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + + @Override + public ApplicationHandler getApplicationHandler() { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + + @Override + public void reload() { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + + @Override + public void reload(ResourceConfig configuration) { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } + +} diff --git a/containers/jetty-http/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties b/containers/jetty-http/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties index b1528f8624..6d0d06c5fd 100644 --- a/containers/jetty-http/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties +++ b/containers/jetty-http/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License v. 2.0, which is available at @@ -21,3 +21,4 @@ unable.to.close.response=Unable to close response output. uri.cannot.be.null=The URI must not be null. wrong.scheme.when.using.http=The URI scheme should be 'http' when not using SSL. wrong.scheme.when.using.https=The URI scheme should be 'https' when using SSL. +not.supported=Jetty container is not supported on JDK version less than 11. diff --git a/containers/pom.xml b/containers/pom.xml index 25f49f35ec..a197f5cbb7 100644 --- a/containers/pom.xml +++ b/containers/pom.xml @@ -40,6 +40,7 @@ jdk-http jersey-servlet-core jersey-servlet + jetty-http netty-http @@ -76,15 +77,4 @@ - - - Jetty11 - - [11,) - - - jetty-http - - - diff --git a/test-framework/providers/jetty/pom.xml b/test-framework/providers/jetty/pom.xml index fc48a8b99a..a9ddbd8632 100644 --- a/test-framework/providers/jetty/pom.xml +++ b/test-framework/providers/jetty/pom.xml @@ -44,6 +44,13 @@ + + ${project.basedir}/target + ${project.basedir}/src/main/java8 + ${project.basedir}/target11 + ${project.basedir}/src/main/java11 + + testsSkipJdk6 @@ -54,6 +61,140 @@ true + + JettyExclude + + 1.8 + + + ${java8.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java8.sourceDirectory} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org/glassfish/jersey/test/jetty/*.java + + + + + + + + Jetty11 + + [11,) + + + ${java11.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java11.sourceDirectory} + + + + + + + + + + copyJDK11FilesToMultiReleaseJar + + + + target11/classes/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.class + + 1.8 + + + + + org.apache.felix + maven-bundle-plugin + true + true + + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + true + + + copy-jdk11-classes + prepare-package + + copy-resources + + + ${java8.build.outputDirectory}/classes/META-INF/versions/11 + + + ${java11.build.outputDirectory}/classes + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-jdk11-sources + package + + + + sources-jar: ${sources-jar} + + + + + + + run + + + + + + + diff --git a/test-framework/providers/jetty/src/main/java/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java b/test-framework/providers/jetty/src/main/java11/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java similarity index 100% rename from test-framework/providers/jetty/src/main/java/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java rename to test-framework/providers/jetty/src/main/java11/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java diff --git a/test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java b/test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java new file mode 100644 index 0000000000..cd2e33238c --- /dev/null +++ b/test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.test.jetty; + +import jakarta.ws.rs.ProcessingException; +import org.glassfish.jersey.jetty.internal.LocalizationMessages; +import org.glassfish.jersey.test.DeploymentContext; +import org.glassfish.jersey.test.spi.TestContainer; +import org.glassfish.jersey.test.spi.TestContainerFactory; + +import java.net.URI; + +/** + * Jetty test factory stub for JDK 1.8 only + * + * since Jetty 11+ does not support JDKs below 11 + */ +public class JettyTestContainerFactory implements TestContainerFactory { + + @Override + public TestContainer create(final URI baseUri, final DeploymentContext context) throws IllegalArgumentException { + throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); + } +} diff --git a/test-framework/providers/jetty/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties b/test-framework/providers/jetty/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties new file mode 100644 index 0000000000..c362bf0957 --- /dev/null +++ b/test-framework/providers/jetty/src/main/resources/org/glassfish/jersey/jetty/internal/localization.properties @@ -0,0 +1,18 @@ +# +# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +# {0} - status code; {1} - status reason message +not.supported=Jetty container is not supported on JDK version less than 11. diff --git a/test-framework/providers/pom.xml b/test-framework/providers/pom.xml index 10764da335..025ad4a32d 100644 --- a/test-framework/providers/pom.xml +++ b/test-framework/providers/pom.xml @@ -39,18 +39,8 @@ grizzly2 inmemory jdk-http + jetty netty simple - - - Jetty11 - - [11,) - - - jetty - - -