From 3aed75e3597d49ae3e6e06ce23cb27415e7b872a Mon Sep 17 00:00:00 2001 From: Jan Supol Date: Wed, 30 Sep 2020 20:25:25 +0200 Subject: [PATCH] Remove Jersey 3.x incompatible extension modules Signed-off-by: Jan Supol --- examples/pom.xml | 8 +- ext/pom.xml | 5 +- ext/servlet-portability/pom.xml | 77 ------ .../portability/PortableServletContainer.java | 228 ------------------ .../servlet/portability/package-info.java | 21 -- .../localization.properties | 18 -- .../scope/JaxrsServletRequestAttributes.java | 55 ----- tests/integration/pom.xml | 8 +- .../integration/portability-jersey-1/pom.xml | 107 -------- .../portability/HelloWorldResource.java | 33 --- .../portability/Jersey1Application.java | 32 --- .../portability/Jersey1Resource.java | 32 --- .../portability/Jersey2Application.java | 35 --- .../portability/Jersey2Resource.java | 32 --- .../src/main/webapp/WEB-INF/web.xml | 38 --- .../portability/PortabilityITCase.java | 89 ------- .../integration/portability-jersey-2/pom.xml | 81 ------- .../portability/HelloWorldResource.java | 33 --- .../portability/Jersey1Application.java | 32 --- .../portability/Jersey1Resource.java | 32 --- .../portability/Jersey2Application.java | 35 --- .../portability/Jersey2Resource.java | 32 --- .../src/main/webapp/WEB-INF/web.xml | 38 --- .../portability/PortabilityITCase.java | 58 ----- .../servlet-3-init-provider/pom.xml | 4 - .../src/main/webapp/WEB-INF/web.xml | 2 +- .../servlet-request-wrapper-binding-2/pom.xml | 4 - .../servlet-request-wrapper-binding/pom.xml | 4 - 28 files changed, 12 insertions(+), 1161 deletions(-) delete mode 100644 ext/servlet-portability/pom.xml delete mode 100644 ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/PortableServletContainer.java delete mode 100644 ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/package-info.java delete mode 100644 ext/servlet-portability/src/main/resources/org.glassfish.jersey.servlet.portability/localization.properties delete mode 100644 ext/spring3/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java delete mode 100644 tests/integration/portability-jersey-1/pom.xml delete mode 100644 tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java delete mode 100644 tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java delete mode 100644 tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java delete mode 100644 tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java delete mode 100644 tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java delete mode 100644 tests/integration/portability-jersey-1/src/main/webapp/WEB-INF/web.xml delete mode 100644 tests/integration/portability-jersey-1/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java delete mode 100644 tests/integration/portability-jersey-2/pom.xml delete mode 100644 tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java delete mode 100644 tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java delete mode 100644 tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java delete mode 100644 tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java delete mode 100644 tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java delete mode 100644 tests/integration/portability-jersey-2/src/main/webapp/WEB-INF/web.xml delete mode 100644 tests/integration/portability-jersey-2/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java diff --git a/examples/pom.xml b/examples/pom.xml index ba3e4c3b62..840bcedcb3 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -78,8 +78,8 @@ helloworld-pure-jax-rs helloworld-webapp helloworld-weld - helloworld-spring-webapp - helloworld-spring-annotations + + http-patch http-trace https-clientserver-grizzly @@ -89,8 +89,8 @@ jaxrs-types-injection jersey-ejb json-binding-webapp - json-jackson - json-jettison + + json-moxy json-with-padding diff --git a/ext/pom.xml b/ext/pom.xml index 2213741239..7fe8970a08 100644 --- a/ext/pom.xml +++ b/ext/pom.xml @@ -51,11 +51,14 @@ mvc-mustache proxy-client rx - servlet-portability + wadl-doclet + diff --git a/ext/servlet-portability/pom.xml b/ext/servlet-portability/pom.xml deleted file mode 100644 index bc2b4d5947..0000000000 --- a/ext/servlet-portability/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - 4.0.0 - - - project - org.glassfish.jersey.ext - 3.0.0-SNAPSHOT - - - jersey-servlet-portability - jar - jersey-ext-servlet-portability - - - Library that enables writing web applications that run with both Jersey 1.x and Jersey 2.x servlet containers. - - - - - - com.sun.istack - istack-commons-maven-plugin - true - - - org.codehaus.mojo - build-helper-maven-plugin - true - - - - - - - jakarta.ws.rs - jakarta.ws.rs-api - provided - - - com.sun.jersey - jersey-servlet - ${jersey1.version} - provided - - - org.glassfish.jersey.containers - jersey-container-servlet-core - ${project.version} - provided - - - jakarta.servlet - jakarta.servlet-api - ${servlet5.version} - provided - - - diff --git a/ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/PortableServletContainer.java b/ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/PortableServletContainer.java deleted file mode 100644 index c37cdf25ec..0000000000 --- a/ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/PortableServletContainer.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2012, 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.servlet.portability; - -import java.io.IOException; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; - -import jakarta.servlet.Filter; -import jakarta.servlet.FilterChain; -import jakarta.servlet.FilterConfig; -import jakarta.servlet.Servlet; -import jakarta.servlet.ServletConfig; -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletException; -import jakarta.servlet.ServletRequest; -import jakarta.servlet.ServletResponse; - -/** - * Jersey Servlet/Filter class that can be referenced in web.xml instead of Jersey 1.x specific - * {@code com.sun.jersey.spi.container.servlet.ServletContainer} and Jersey 2.x specific - * {@link org.glassfish.jersey.servlet.ServletContainer} to enable web application portability between - * Jersey 1.x and Jersey 2.x servlet containers. - *

- * Since for some of the {@link org.glassfish.jersey.servlet.ServletProperties servlet init parameters} that can be - * specified in web.xml you may want different values depending on which version of Jersey container is present, - * You can prefix the init parameter name either with {@code jersey1#} or {@code jersey2#} to - * make it specific to a given version. For example, to specify different values for - * {@code jakarta.ws.rs.Application} init parameter depending on the version of Jersey used, you can include - * the following in your web.xml: - *

- *     <servlet>
- *         <servlet-name>Jersey Web Application</servlet-name>
- *         <servlet-class>org.glassfish.jersey.servlet.portability.PortableServletContainer</servlet-class>
- *         <init-param>
- *             <param-name>jersey1#jakarta.ws.rs.Application</param-name>
- *             <param-value>myapp.jersey1specific.Jersey1Application</param-value>
- *         </init-param>
- *         <init-param>
- *             <param-name>jersey2#jakarta.ws.rs.Application</param-name>
- *             <param-value>myapp.jersey2specific.Jersey2Application</param-value>
- *         </init-param>
- *     </servlet>
- *     
- *

- * - * @author Martin Matula - */ -public class PortableServletContainer implements Filter, Servlet { - - private static final String JERSEY_1_PREFIX = "jersey1#"; - private static final String JERSEY_2_PREFIX = "jersey2#"; - - private final Servlet wrappedServlet; - private final Filter wrappedFilter; - private final String includePrefix; - private final String excludePrefix; - - /** - * Create a new servlet container. - */ - @SuppressWarnings("unchecked") - public PortableServletContainer() { - Class servletClass; - boolean isJersey1 = false; - try { - servletClass = (Class) Class.forName("com.sun.jersey.spi.container.servlet.ServletContainer"); - isJersey1 = true; - } catch (ClassNotFoundException e) { - // Jersey 1.x not present, try Jersey 2.x - try { - servletClass = (Class) Class.forName("org.glassfish.jersey.servlet.ServletContainer"); - } catch (ClassNotFoundException ex) { - throw new IllegalStateException(LocalizationMessages.JERSEY_NOT_AVAILABLE()); - } - } - - try { - wrappedServlet = servletClass.newInstance(); - wrappedFilter = (Filter) wrappedServlet; - } catch (Exception e) { - throw new RuntimeException(LocalizationMessages.JERSEY_CONTAINER_CANT_LOAD(), e); - } - includePrefix = isJersey1 ? JERSEY_1_PREFIX : JERSEY_2_PREFIX; - excludePrefix = isJersey1 ? JERSEY_2_PREFIX : JERSEY_1_PREFIX; - } - - @Override - public void init(final FilterConfig filterConfig) throws ServletException { - wrappedFilter.init(new FilterConfigWrapper(filterConfig)); - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { - wrappedFilter.doFilter(request, response, chain); - } - - @Override - public void init(ServletConfig config) throws ServletException { - wrappedServlet.init(new ServletConfigWrapper(config)); - } - - @Override - public ServletConfig getServletConfig() { - return wrappedServlet.getServletConfig(); - } - - @Override - public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { - wrappedServlet.service(req, res); - } - - @Override - public String getServletInfo() { - return wrappedServlet.getServletInfo(); - } - - @Override - public void destroy() { - wrappedServlet.destroy(); - } - - private abstract class InitParamsWrapper { - - private final HashMap filteredInitParams = new HashMap(); - - void init() { - for (Enumeration e = getInitParamNames(); e.hasMoreElements(); ) { - String name = (String) e.nextElement(); - String value = getInitParamValue(name); - if (name.startsWith(includePrefix)) { - name = name.substring(includePrefix.length()); - } else if (name.startsWith(excludePrefix)) { - continue; - } - filteredInitParams.put(name, value); - } - } - - abstract String getInitParamValue(String name); - - abstract Enumeration getInitParamNames(); - - public String getInitParameter(String name) { - return filteredInitParams.get(name); - } - - public Enumeration getInitParameterNames() { - return Collections.enumeration(filteredInitParams.keySet()); - } - } - - private class FilterConfigWrapper extends InitParamsWrapper implements FilterConfig { - - private final FilterConfig wrapped; - - FilterConfigWrapper(FilterConfig wrapped) { - this.wrapped = wrapped; - init(); - } - - @Override - public String getFilterName() { - return wrapped.getFilterName(); - } - - @Override - public ServletContext getServletContext() { - return wrapped.getServletContext(); - } - - @Override - String getInitParamValue(String name) { - return wrapped.getInitParameter(name); - } - - @Override - Enumeration getInitParamNames() { - return wrapped.getInitParameterNames(); - } - } - - private class ServletConfigWrapper extends InitParamsWrapper implements ServletConfig { - - private final ServletConfig wrapped; - - ServletConfigWrapper(ServletConfig wrapped) { - this.wrapped = wrapped; - init(); - } - - @Override - String getInitParamValue(String name) { - return wrapped.getInitParameter(name); - } - - @Override - Enumeration getInitParamNames() { - return wrapped.getInitParameterNames(); - } - - @Override - public String getServletName() { - return wrapped.getServletName(); - } - - @Override - public ServletContext getServletContext() { - return wrapped.getServletContext(); - } - } -} diff --git a/ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/package-info.java b/ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/package-info.java deleted file mode 100644 index 2629627a62..0000000000 --- a/ext/servlet-portability/src/main/java/org/glassfish/jersey/servlet/portability/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2012, 2018 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 containing utility classes enabling web applications to be portable between different versions of Jersey - * runtime. - */ -package org.glassfish.jersey.servlet.portability; diff --git a/ext/servlet-portability/src/main/resources/org.glassfish.jersey.servlet.portability/localization.properties b/ext/servlet-portability/src/main/resources/org.glassfish.jersey.servlet.portability/localization.properties deleted file mode 100644 index 03f03a4054..0000000000 --- a/ext/servlet-portability/src/main/resources/org.glassfish.jersey.servlet.portability/localization.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2012, 2018 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 -# - -jersey.container.cant.load=Unable to instantiate Jersey ServletContainer. -jersey.not.available=No Jersey runtime found on the application classpath. diff --git a/ext/spring3/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java b/ext/spring3/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java deleted file mode 100644 index e09c3f88ec..0000000000 --- a/ext/spring3/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, 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.server.spring.scope; - -import jakarta.ws.rs.container.ContainerRequestContext; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.web.context.request.ServletRequestAttributes; - -/** - * JAX-RS based Spring RequestAttributes implementation for Servlet-based applications. - * - * @author Marek Potociar - */ -class JaxrsServletRequestAttributes extends ServletRequestAttributes { - - private final ContainerRequestContext requestContext; - - /** - * Create a new JAX-RS ServletRequestAttributes instance for the given request. - * - * @param request current HTTP request - * @param requestContext JAX-RS request context - */ - public JaxrsServletRequestAttributes(final HttpServletRequest request, final ContainerRequestContext requestContext) { - super(request); - this.requestContext = requestContext; - } - - @Override - public Object resolveReference(String key) { - if (REFERENCE_REQUEST.equals(key)) { - return this.requestContext; - } else if (REFERENCE_SESSION.equals(key)) { - return super.getSession(true); - } else { - return null; - } - } -} diff --git a/tests/integration/pom.xml b/tests/integration/pom.xml index c989c1b860..55a42c2abb 100644 --- a/tests/integration/pom.xml +++ b/tests/integration/pom.xml @@ -87,9 +87,7 @@ jersey-4321 jersey-4507 jetty-response-close - microprofile - - + property-check security-digest servlet-2.5-autodiscovery-1 @@ -129,8 +127,8 @@ servlet-request-wrapper-binding servlet-tests sonar-test - spring4 - spring5 + + tracing-support diff --git a/tests/integration/portability-jersey-1/pom.xml b/tests/integration/portability-jersey-1/pom.xml deleted file mode 100644 index 9cddefaa76..0000000000 --- a/tests/integration/portability-jersey-1/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - 4.0.0 - - - org.glassfish.jersey.tests.integration - project - 3.0-SNAPSHOT - - - portability-jersey-1 - war - jersey-tests-integration-portability-jersey-1 - - Servlet portability test - testing co-bundling with Jersey 1 - - - - org.glassfish.jersey.ext - jersey-servlet-portability - - - com.sun.jersey.jersey-test-framework - jersey-test-framework-external - ${jersey1.version} - test - - - com.sun.jersey.jersey-test-framework - jersey-test-framework-core - ${jersey1.version} - test - - - org.glassfish.jersey.core - jersey-server - provided - - - com.sun.jersey - jersey-servlet - ${jersey1.version} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-failsafe-plugin - - - org.glassfish.jersey.core:jersey-common - org.glassfish.jersey.core:jersey-server - org.glassfish.jersey.core:jersey-client - - - - - org.mortbay.jetty - jetty-maven-plugin - - - - - - jdk11+ - - [11,) - - - - jakarta.xml.bind - jakarta.xml.bind-api - - - com.sun.xml.bind - jaxb-osgi - test - - - - - - diff --git a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java b/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java deleted file mode 100644 index 71345e51cf..0000000000 --- a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; - -/** - * @author Martin Matula - */ -@Path("helloworld") -public class HelloWorldResource { - @GET - @Produces("text/plain") - public String get() { - return "Hello World!"; - } -} diff --git a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java b/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java deleted file mode 100644 index c56b9fadd9..0000000000 --- a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, 2018 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.tests.integration.portability; - -import com.sun.jersey.api.core.PackagesResourceConfig; - -/** - * @author Martin Matula - */ -public class Jersey1Application extends PackagesResourceConfig { - public Jersey1Application() { - // do the package scanning - super("org.glassfish.jersey.tests.integration.portability"); - - // explicitly add unannotated Jersey 1 specific resource - getExplicitRootResources().put("jersey", Jersey1Resource.class); - } -} diff --git a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java b/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java deleted file mode 100644 index 8b2c8a317d..0000000000 --- a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -/** - * @author Martin Matula - */ -public class Jersey1Resource { - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getJersey1() { - return "Using Jersey 1.x"; - } -} diff --git a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java b/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java deleted file mode 100644 index 91e0e1b195..0000000000 --- a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2012, 2018 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.tests.integration.portability; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.model.Resource; - -/** - * @author Martin Matula - */ -public class Jersey2Application extends ResourceConfig { - - public Jersey2Application() { - // do the package scanning - packages("org.glassfish.jersey.tests.integration.portability"); - - // explicitly add unannotated Jersey 2 specific resource - Resource.Builder rb = Resource.builder(Jersey2Resource.class); - registerResources(rb.path("jersey").build()); - } -} diff --git a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java b/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java deleted file mode 100644 index 6fc84f1978..0000000000 --- a/tests/integration/portability-jersey-1/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -/** - * @author Martin Matula - */ -public class Jersey2Resource { - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getJersey2() { - return "Using Jersey 2.x"; - } -} diff --git a/tests/integration/portability-jersey-1/src/main/webapp/WEB-INF/web.xml b/tests/integration/portability-jersey-1/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d2434efb0d..0000000000 --- a/tests/integration/portability-jersey-1/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - Jersey Web Application - org.glassfish.jersey.servlet.portability.PortableServletContainer - - jersey1#com.sun.jersey.config.property.resourceConfigClass - org.glassfish.jersey.tests.integration.portability.Jersey1Application - - - jersey2#jakarta.ws.rs.Application - org.glassfish.jersey.tests.integration.portability.Jersey2Application - - 1 - - - Jersey Web Application - /* - - diff --git a/tests/integration/portability-jersey-1/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java b/tests/integration/portability-jersey-1/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java deleted file mode 100644 index 8d805e8371..0000000000 --- a/tests/integration/portability-jersey-1/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2012, 2018 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.tests.integration.portability; - -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.test.framework.AppDescriptor; -import com.sun.jersey.test.framework.JerseyTest; -import com.sun.jersey.test.framework.WebAppDescriptor; -import com.sun.jersey.test.framework.spi.container.TestContainerException; -import com.sun.jersey.test.framework.spi.container.TestContainerFactory; -import com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * @author Martin Matula - */ -public class PortabilityITCase extends JerseyTest { - - @Override - protected AppDescriptor configure() { - return new WebAppDescriptor.Builder().build(); - } - - @Override - protected TestContainerFactory getTestContainerFactory() throws TestContainerException { - return new ExternalTestContainerFactory(); - } - - @Test - public void testHelloWorld() throws Exception { - String s = resource().path("helloworld").get(String.class); - assertEquals("Hello World!", s); - } - - @Test - public void testJersey() { - ClientResponse r = resource().path("jersey").get(ClientResponse.class); - assertEquals(200, r.getStatus()); - assertEquals("Using Jersey 1.x", r.getEntity(String.class)); - } - - /** - * The whole project is setup for Jersey 2. Need to get the effective port number - * from Jersey 2 properties to make Hudson happy. - * - * @param defaultPort to use if no other configuration is available - * @return port number to use by the client - */ - @Override - protected int getPort(int defaultPort) { - - String port = System.getProperty("jersey.config.test.container.port"); - if (null != port) { - try { - return Integer.parseInt(port); - } catch (NumberFormatException e) { - throw new TestContainerException("jersey.config.test.container.port with a " - + "value of \"" + port + "\" is not a valid integer.", e); - } - } - - port = System.getProperty("JERSEY_TEST_PORT"); - if (null != port) { - try { - return Integer.parseInt(port); - } catch (NumberFormatException e) { - throw new TestContainerException("JERSEY_TEST_PORT with a " - + "value of \"" + port + "\" is not a valid integer.", e); - } - } - return defaultPort; - } -} diff --git a/tests/integration/portability-jersey-2/pom.xml b/tests/integration/portability-jersey-2/pom.xml deleted file mode 100644 index 62fa63b5c0..0000000000 --- a/tests/integration/portability-jersey-2/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - 4.0.0 - - - org.glassfish.jersey.tests.integration - project - 3.0-SNAPSHOT - - - portability-jersey-2 - war - jersey-tests-integration-portability-jersey-2 - - Servlet portability test - testing co-bundling with Jersey 2 - - - - org.glassfish.jersey.ext - jersey-servlet-portability - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-external - test - - - org.glassfish.jersey.containers - jersey-container-servlet-core - - - com.sun.jersey - jersey-servlet - ${jersey1.version} - provided - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-failsafe-plugin - - - com.sun.jersey:jersey-core - com.sun.jersey:jersey-server - com.sun.jersey:jersey-servlet - - - - - org.mortbay.jetty - jetty-maven-plugin - - - - - diff --git a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java b/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java deleted file mode 100644 index 71345e51cf..0000000000 --- a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/HelloWorldResource.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; - -/** - * @author Martin Matula - */ -@Path("helloworld") -public class HelloWorldResource { - @GET - @Produces("text/plain") - public String get() { - return "Hello World!"; - } -} diff --git a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java b/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java deleted file mode 100644 index c56b9fadd9..0000000000 --- a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Application.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, 2018 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.tests.integration.portability; - -import com.sun.jersey.api.core.PackagesResourceConfig; - -/** - * @author Martin Matula - */ -public class Jersey1Application extends PackagesResourceConfig { - public Jersey1Application() { - // do the package scanning - super("org.glassfish.jersey.tests.integration.portability"); - - // explicitly add unannotated Jersey 1 specific resource - getExplicitRootResources().put("jersey", Jersey1Resource.class); - } -} diff --git a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java b/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java deleted file mode 100644 index 8b2c8a317d..0000000000 --- a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey1Resource.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -/** - * @author Martin Matula - */ -public class Jersey1Resource { - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getJersey1() { - return "Using Jersey 1.x"; - } -} diff --git a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java b/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java deleted file mode 100644 index 91e0e1b195..0000000000 --- a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Application.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2012, 2018 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.tests.integration.portability; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.model.Resource; - -/** - * @author Martin Matula - */ -public class Jersey2Application extends ResourceConfig { - - public Jersey2Application() { - // do the package scanning - packages("org.glassfish.jersey.tests.integration.portability"); - - // explicitly add unannotated Jersey 2 specific resource - Resource.Builder rb = Resource.builder(Jersey2Resource.class); - registerResources(rb.path("jersey").build()); - } -} diff --git a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java b/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java deleted file mode 100644 index 6fc84f1978..0000000000 --- a/tests/integration/portability-jersey-2/src/main/java/org/glassfish/jersey/tests/integration/portability/Jersey2Resource.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -/** - * @author Martin Matula - */ -public class Jersey2Resource { - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getJersey2() { - return "Using Jersey 2.x"; - } -} diff --git a/tests/integration/portability-jersey-2/src/main/webapp/WEB-INF/web.xml b/tests/integration/portability-jersey-2/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d2434efb0d..0000000000 --- a/tests/integration/portability-jersey-2/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - Jersey Web Application - org.glassfish.jersey.servlet.portability.PortableServletContainer - - jersey1#com.sun.jersey.config.property.resourceConfigClass - org.glassfish.jersey.tests.integration.portability.Jersey1Application - - - jersey2#jakarta.ws.rs.Application - org.glassfish.jersey.tests.integration.portability.Jersey2Application - - 1 - - - Jersey Web Application - /* - - diff --git a/tests/integration/portability-jersey-2/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java b/tests/integration/portability-jersey-2/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java deleted file mode 100644 index e9b9d814df..0000000000 --- a/tests/integration/portability-jersey-2/src/test/java/org/glassfish/jersey/tests/integration/portability/PortabilityITCase.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2012, 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.tests.integration.portability; - -import jakarta.ws.rs.core.Application; -import jakarta.ws.rs.core.Response; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.test.JerseyTest; -import org.glassfish.jersey.test.external.ExternalTestContainerFactory; -import org.glassfish.jersey.test.spi.TestContainerException; -import org.glassfish.jersey.test.spi.TestContainerFactory; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * @author Martin Matula - */ -public class PortabilityITCase extends JerseyTest { - @Override - protected Application configure() { - // dummy resource config - return new ResourceConfig(); - } - - @Override - protected TestContainerFactory getTestContainerFactory() throws TestContainerException { - return new ExternalTestContainerFactory(); - } - - @Test - public void testHelloWorld() throws Exception { - String s = target("helloworld").request().get(String.class); - assertEquals("Hello World!", s); - } - - @Test - public void testJersey() { - Response r = target("jersey").request().get(); - assertEquals(200, r.getStatus()); - assertEquals("Using Jersey 2.x", r.readEntity(String.class)); - } -} diff --git a/tests/integration/servlet-3-init-provider/pom.xml b/tests/integration/servlet-3-init-provider/pom.xml index 61f88363f4..80ca2357da 100644 --- a/tests/integration/servlet-3-init-provider/pom.xml +++ b/tests/integration/servlet-3-init-provider/pom.xml @@ -37,10 +37,6 @@ org.glassfish.jersey.containers jersey-container-servlet - - org.glassfish.jersey.ext - jersey-servlet-portability - jakarta.servlet jakarta.servlet-api diff --git a/tests/integration/servlet-3-init-provider/src/main/webapp/WEB-INF/web.xml b/tests/integration/servlet-3-init-provider/src/main/webapp/WEB-INF/web.xml index 9d683f692d..6d7a64d4a4 100644 --- a/tests/integration/servlet-3-init-provider/src/main/webapp/WEB-INF/web.xml +++ b/tests/integration/servlet-3-init-provider/src/main/webapp/WEB-INF/web.xml @@ -34,7 +34,7 @@ application3 - org.glassfish.jersey.servlet.portability.PortableServletContainer + org.glassfish.jersey.servlet.ServletContainer jersey2#jakarta.ws.rs.Application org.glassfish.jersey.tests.integration.servlet_3_init_provider.Application3 diff --git a/tests/integration/servlet-request-wrapper-binding-2/pom.xml b/tests/integration/servlet-request-wrapper-binding-2/pom.xml index 5340baeaae..7b8ec8d4ac 100644 --- a/tests/integration/servlet-request-wrapper-binding-2/pom.xml +++ b/tests/integration/servlet-request-wrapper-binding-2/pom.xml @@ -37,10 +37,6 @@ org.glassfish.jersey.containers jersey-container-servlet - - org.glassfish.jersey.ext - jersey-servlet-portability - jakarta.servlet jakarta.servlet-api diff --git a/tests/integration/servlet-request-wrapper-binding/pom.xml b/tests/integration/servlet-request-wrapper-binding/pom.xml index 8b97ff6981..e16f4cbc32 100644 --- a/tests/integration/servlet-request-wrapper-binding/pom.xml +++ b/tests/integration/servlet-request-wrapper-binding/pom.xml @@ -37,10 +37,6 @@ org.glassfish.jersey.containers jersey-container-servlet - - org.glassfish.jersey.ext - jersey-servlet-portability - jakarta.servlet jakarta.servlet-api