From 95d42dcf3401af994a04bb459a99d4dc3ec8494b Mon Sep 17 00:00:00 2001 From: Grzegorz Grzybek <gr.grzybek@gmail.com> Date: Mon, 19 Jun 2023 15:25:28 +0200 Subject: [PATCH] [#1802] Switch pax-web-itest-server from javax to jakarta (only 2 jetty/websocket tests fail!) --- pax-web-itest/pax-web-itest-server/pom.xml | 29 ++-- .../org/ops4j/pax/web/test/tags/TestTag.java | 4 +- .../services/javax.el.ExpressionFactory | 2 +- .../server/MultiContainerTestSupport.java | 32 ++--- ...ServerControllerBasicRegistrationTest.java | 26 ++-- ...erControllerContainerInitializersTest.java | 10 +- .../ServerControllerErrorPagesTest.java | 2 +- ...verControllerResourceRegistrationTest.java | 6 +- .../ServerControllerScopesTest.java | 10 +- .../WebContainerContextParamsTest.java | 8 +- .../WebContainerErrorPagesTest.java | 2 +- .../WebContainerJspConfigurationTest.java | 8 +- .../httpservice/WebContainerJspTest.java | 2 +- ...WebContainerSecurityConfigurationTest.java | 4 +- .../WebContainerSessionConfigurationTest.java | 6 +- .../WebContainerSessionPersistenceTest.java | 6 +- .../WebContainerWebSocketsTest.java | 48 +++---- .../itest/server/support/ErrorServlet.java | 10 +- .../itest/server/support/ProblemServlet.java | 8 +- .../pax/web/itest/server/support/Utils.java | 12 +- .../server/support/war/Cb1IFace3Impl.java | 6 +- .../war/cb1/scis/SCIFromContainerBundle1.java | 6 +- .../war/cb2/scis/SCIFromContainerBundle2.java | 6 +- .../war/cb3/scis/SCIFromContainerBundle3.java | 24 ++-- .../server/support/war/cb3/utils/IFace3.java | 2 +- .../cf1/scis/SCIFromContainerFragment1.java | 6 +- .../cf2/scis/SCIFromContainerFragment2.java | 6 +- .../war/fragment/AnnotatedServlet1.java | 14 +- .../war/fragment/AnnotatedServlet2.java | 12 +- .../war/fragment/AnnotatedServlet3.java | 6 +- .../support/war/fragment/DeclaredFilter.java | 12 +- .../support/war/fragment/JustListener.java | 4 +- .../support/war/jar/scis/SCIFromJar.java | 6 +- .../war/listeners/ListenerAddedInWebXml.java | 6 +- .../support/war/scis/SCIFromTheFragment1.java | 10 +- .../support/war/scis/SCIFromTheFragment2.java | 6 +- .../support/war/scis/SCIFromTheWab1.java | 10 +- .../support/war/scis/SCIFromTheWab2.java | 8 +- .../SCIThatAddsServletContextListener.java | 10 +- .../war/servlets/ServletAddedInWebXml.java | 2 +- .../support/war/servlets/SimplestServlet.java | 8 +- .../itest/server/war/WarClassSpaceTest.java | 2 +- .../itest/server/war/WarListenersTest.java | 2 +- .../WhiteboardAndHttpServiceTest.java | 58 ++++---- .../whiteboard/WhiteboardBasicTest.java | 24 ++-- .../whiteboard/WhiteboardContextsTest.java | 18 +-- .../WhiteboardDynamicContextsTest.java | 10 +- .../whiteboard/WhiteboardErrorPagesTest.java | 4 +- .../WhiteboardEventListenersTest.java | 28 ++-- .../whiteboard/WhiteboardFiltersTest.java | 26 ++-- .../whiteboard/WhiteboardResourcesTest.java | 4 +- .../WhiteboardSecurityConfigurationTest.java | 10 +- .../whiteboard/WhiteboardServletsTest.java | 4 +- .../whiteboard/WhiteboardSessionsTest.java | 22 +-- .../whiteboard/WhiteboardTempdirTest.java | 14 +- .../WhiteboardWelcomeFilesTest.java | 4 +- ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 ...karta.servlet.ServletContainerInitializer} | 0 .../src/test/resources/jetty.xml | 10 +- .../src/test/resources/jsp/error.jsp | 4 +- .../src/test/resources/jsp/jsp-info.jsp | 2 +- .../jetty/internal/JettyServerWrapper.java | 2 +- .../internal/PaxWebServletContextHandler.java | 52 +++++-- .../jetty/internal/PaxWebServletHandler.java | 105 +++++++++------ .../jetty/internal/PaxWebSessionHandler.java | 36 +++-- .../internal/PaxWebSessionIdManager.java | 127 ++++++++++-------- .../PrioritizedHandlerCollection.java | 15 ++- .../jetty/internal/web/DefaultServlet.java | 4 +- .../internal/web/JettyResourceServlet.java | 19 ++- .../jetty/internal/EmbeddedJettyTest.java | 42 ++++++ pax-web-jsp/pom.xml | 2 +- .../services/jakarta.el.ExpressionFactory | 22 +++ ...akarta.servlet.ServletContainerInitializer | 17 +++ .../servlet/DefaultSessionCookieConfig.java | 11 +- .../web/service/spi/servlet/SCIWrapper.java | 11 +- .../tomcat/internal/TomcatFactory.java | 2 +- 83 files changed, 659 insertions(+), 459 deletions(-) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-1/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-2/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-3/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-1/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-2/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-fragment/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/classes/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/lib/the-wab-jar-8.0.0-SNAPSHOT.jar/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) rename pax-web-itest/pax-web-itest-server/src/test/resources/bundles/wab-listeners/WEB-INF/classes/META-INF/services/{javax.servlet.ServletContainerInitializer => jakarta.servlet.ServletContainerInitializer} (100%) create mode 100644 pax-web-jsp/src/main/resources/META-INF/services/jakarta.el.ExpressionFactory create mode 100644 pax-web-jsp/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/pom.xml b/pax-web-itest/pax-web-itest-server/pom.xml index c050fba6a1..cfb3c6c5e3 100644 --- a/pax-web-itest/pax-web-itest-server/pom.xml +++ b/pax-web-itest/pax-web-itest-server/pom.xml @@ -128,11 +128,11 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.ops4j.pax.web.samples</groupId> - <artifactId>the-wab-jar</artifactId> - <scope>test</scope> - </dependency> +<!-- <dependency>--> +<!-- <groupId>org.ops4j.pax.web.samples</groupId>--> +<!-- <artifactId>the-wab-jar</artifactId>--> +<!-- <scope>test</scope>--> +<!-- </dependency>--> <!-- OPS4J dependencies --> @@ -151,11 +151,11 @@ </dependency> <dependency> <groupId>org.osgi</groupId> - <artifactId>osgi.cmpn</artifactId> + <artifactId>org.osgi.service.servlet</artifactId> <scope>test</scope> </dependency> - <!-- JavaEE --> + <!-- JakartaEE --> <dependency> <groupId>jakarta.el</groupId> @@ -172,14 +172,19 @@ <artifactId>jakarta.websocket-api</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>jakarta.websocket</groupId> + <artifactId>jakarta.websocket-client-api</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jsp-api</artifactId> <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.taglibs</groupId> - <artifactId>taglibs-standard-impl</artifactId> + <groupId>org.glassfish.web</groupId> + <artifactId>jakarta.servlet.jsp.jstl</artifactId> <scope>test</scope> </dependency> @@ -273,7 +278,7 @@ </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> + <artifactId>log4j-slf4j2-impl</artifactId> <scope>test</scope> </dependency> @@ -310,6 +315,10 @@ <!-- Testing --> + <!-- + Stay at JUnit 4 with much better @Parameterized support + https://github.com/junit-team/junit5/issues/878 + --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> diff --git a/pax-web-itest/pax-web-itest-server/src/main/java/org/ops4j/pax/web/test/tags/TestTag.java b/pax-web-itest/pax-web-itest-server/src/main/java/org/ops4j/pax/web/test/tags/TestTag.java index 13526137b6..18f65c78f5 100644 --- a/pax-web-itest/pax-web-itest-server/src/main/java/org/ops4j/pax/web/test/tags/TestTag.java +++ b/pax-web-itest/pax-web-itest-server/src/main/java/org/ops4j/pax/web/test/tags/TestTag.java @@ -16,8 +16,8 @@ package org.ops4j.pax.web.test.tags; import java.io.IOException; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.TagSupport; +import jakarta.servlet.jsp.JspException; +import jakarta.servlet.jsp.tagext.TagSupport; public class TestTag extends TagSupport { diff --git a/pax-web-itest/pax-web-itest-server/src/main/resources/META-INF/services/javax.el.ExpressionFactory b/pax-web-itest/pax-web-itest-server/src/main/resources/META-INF/services/javax.el.ExpressionFactory index 9b1fe61e2f..0ace722c70 100644 --- a/pax-web-itest/pax-web-itest-server/src/main/resources/META-INF/services/javax.el.ExpressionFactory +++ b/pax-web-itest/pax-web-itest-server/src/main/resources/META-INF/services/javax.el.ExpressionFactory @@ -18,5 +18,5 @@ org.apache.el.ExpressionFactoryImpl # The service-impl-first in this file is because it's required by jakarta.el:jakarta.el-api:3.0.3 and we treat # it as _canonical_ EL API Jar -# Its javax.el.FactoryFinder class reads only the first line of this file... +# Its jakarta.el.FactoryFinder class reads only the first line of this file... # org.apache.tomcat:tomcat-el skips the comments correctly because it's using generic java.util.ServiceLoader API diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/MultiContainerTestSupport.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/MultiContainerTestSupport.java index 70c72f663c..10f423cb5d 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/MultiContainerTestSupport.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/MultiContainerTestSupport.java @@ -44,10 +44,10 @@ import java.util.concurrent.Executors; import java.util.function.Consumer; import java.util.function.Supplier; -import javax.servlet.Filter; -import javax.servlet.Servlet; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; +import jakarta.servlet.Filter; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; @@ -55,7 +55,7 @@ import org.apache.felix.utils.extender.Extension; import org.apache.jasper.servlet.JspServlet; import org.apache.tomcat.websocket.server.WsSci; -import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer; +import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -133,10 +133,10 @@ import org.osgi.framework.wiring.BundleRevision; import org.osgi.framework.wiring.BundleWire; import org.osgi.framework.wiring.BundleWiring; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; -import org.osgi.service.http.whiteboard.Preprocessor; +import org.ops4j.pax.web.service.http.HttpContext; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.whiteboard.Preprocessor; import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTrackerCustomizer; import org.slf4j.Logger; @@ -257,13 +257,13 @@ public void initAll() throws Exception { when(jspBundle.getBundleId()).thenReturn(101L); when(jspBundle.getState()).thenReturn(Bundle.ACTIVE); when(jspBundle.getEntry("/")).thenReturn(new URL("bundle://101.0:0/")); - when(jspBundle.getResources("META-INF/services/javax.el.ExpressionFactory")) + when(jspBundle.getResources("META-INF/services/jakarta.el.ExpressionFactory")) .thenReturn(Collections.enumeration(Collections.singletonList( - org.ops4j.pax.web.jsp.JspServlet.class.getResource("/META-INF/services/javax.el.ExpressionFactory"))) + org.ops4j.pax.web.jsp.JspServlet.class.getResource("/META-INF/services/jakarta.el.ExpressionFactory"))) ); - when(jspBundle.getResources("META-INF/services/javax.servlet.ServletContainerInitializer")) + when(jspBundle.getResources("META-INF/services/jakarta.servlet.ServletContainerInitializer")) .thenReturn(Collections.enumeration(Collections.singletonList( - org.ops4j.pax.web.jsp.JspServlet.class.getResource("/META-INF/services/javax.servlet.ServletContainerInitializer"))) + org.ops4j.pax.web.jsp.JspServlet.class.getResource("/META-INF/services/jakarta.servlet.ServletContainerInitializer"))) ); when(jspBundle.loadClass(anyString())) .thenAnswer(i -> JspServlet.class.getClassLoader().loadClass(i.getArgument(0, String.class))); @@ -337,7 +337,7 @@ public void initAll() throws Exception { if (enableWebSockets()) { wsGenericBundle = mockBundle("org.ops4j.pax.web.pax-web-websocket", null, false); - wsJettyBundle = mockBundle("org.eclipse.jetty.websocket.javax.server", null, false); + wsJettyBundle = mockBundle("org.eclipse.jetty.ee10.websocket.jakarta.server", null, false); wsTomcatBundle = mockBundle("org.ops4j.pax.web.pax-web-tomcat-websocket", null, false); wsUndertowBundle = mockBundle("org.ops4j.pax.web.pax-web-undertow-websocket", null, false); @@ -353,7 +353,7 @@ public void initAll() throws Exception { when(wsGenericBundle.loadClass(anyString())) .thenAnswer(i -> PaxWebWebSocketsServletContainerInitializer.class.getClassLoader().loadClass(i.getArgument(0, String.class))); when(wsJettyBundle.loadClass(anyString())) - .thenAnswer(i -> JavaxWebSocketServletContainerInitializer.class.getClassLoader().loadClass(i.getArgument(0, String.class))); + .thenAnswer(i -> JakartaWebSocketServletContainerInitializer.class.getClassLoader().loadClass(i.getArgument(0, String.class))); when(wsTomcatBundle.loadClass(anyString())) .thenAnswer(i -> WsSci.class.getClassLoader().loadClass(i.getArgument(0, String.class))); when(wsUndertowBundle.loadClass(anyString())) @@ -482,7 +482,7 @@ protected Bundle mockBundle(String symbolicName, String contextPath, boolean obt } try { - when(bundle.getResources("META-INF/services/javax.servlet.ServletContainerInitializer")) + when(bundle.getResources("META-INF/services/jakarta.servlet.ServletContainerInitializer")) .thenReturn(Collections.emptyEnumeration()); } catch (IOException ignored) { } diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerBasicRegistrationTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerBasicRegistrationTest.java index e382301ca2..bd2fb3416f 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerBasicRegistrationTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerBasicRegistrationTest.java @@ -31,18 +31,18 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequestAttributeEvent; -import javax.servlet.ServletRequestAttributeListener; -import javax.servlet.http.HttpFilter; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequestAttributeEvent; +import jakarta.servlet.ServletRequestAttributeListener; +import jakarta.servlet.http.HttpFilter; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -70,7 +70,7 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerContainerInitializersTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerContainerInitializersTest.java index 41cf4f5e21..96a7c533ff 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerContainerInitializersTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerContainerInitializersTest.java @@ -16,11 +16,11 @@ package org.ops4j.pax.web.itest.server.controller; import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerErrorPagesTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerErrorPagesTest.java index 7806dc81c7..5c70ceb1a8 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerErrorPagesTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerErrorPagesTest.java @@ -18,7 +18,7 @@ import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Collections; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerResourceRegistrationTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerResourceRegistrationTest.java index 4835ff9186..569bc7f4bd 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerResourceRegistrationTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerResourceRegistrationTest.java @@ -21,8 +21,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -37,7 +37,7 @@ import org.ops4j.pax.web.service.spi.ServerController; import org.ops4j.pax.web.service.spi.model.ServerModel; import org.osgi.framework.Bundle; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerScopesTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerScopesTest.java index a0035a5537..5b3e468461 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerScopesTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/controller/ServerControllerScopesTest.java @@ -17,9 +17,9 @@ import java.util.Arrays; import java.util.Collections; -import javax.servlet.Filter; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; +import jakarta.servlet.Filter; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; import org.junit.Test; import org.junit.runner.RunWith; @@ -65,7 +65,7 @@ public void initAll() throws Exception { } /** - * {@link Servlet}, {@link Filter} and {@link org.osgi.service.http.context.ServletContextHelper} + * {@link Servlet}, {@link Filter} and {@link org.osgi.service.servlet.context.ServletContextHelper} * are registered from single {@link Bundle} and associated with each other. * @throws Exception */ @@ -162,7 +162,7 @@ public void singleServletContext() throws Exception { } /** - * {@link Servlet}, {@link Filter} and {@link org.osgi.service.http.context.ServletContextHelper} + * {@link Servlet}, {@link Filter} and {@link org.osgi.service.servlet.context.ServletContextHelper} * are registered through different bundle-scoped instances of {@link WebContainerContext}. * @throws Exception */ diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerContextParamsTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerContextParamsTest.java index c8d1ca2061..ab89f7c5f5 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerContextParamsTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerContextParamsTest.java @@ -18,9 +18,9 @@ import java.io.IOException; import java.util.Dictionary; import java.util.Hashtable; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +34,7 @@ import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.startsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerErrorPagesTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerErrorPagesTest.java index cc11c31c99..5afc83ea63 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerErrorPagesTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerErrorPagesTest.java @@ -28,7 +28,7 @@ import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.startsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspConfigurationTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspConfigurationTest.java index b39df896ad..94cb9962fd 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspConfigurationTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspConfigurationTest.java @@ -16,10 +16,10 @@ package org.ops4j.pax.web.itest.server.httpservice; import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.descriptor.JspConfigDescriptor; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspTest.java index ef477b4651..afd55feebe 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerJspTest.java @@ -29,7 +29,7 @@ import org.ops4j.pax.web.service.spi.model.OsgiContextModel; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpContext; +import org.ops4j.pax.web.service.http.HttpContext; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.startsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSecurityConfigurationTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSecurityConfigurationTest.java index 574551ba75..75b25c206c 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSecurityConfigurationTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSecurityConfigurationTest.java @@ -26,8 +26,8 @@ import org.ops4j.pax.web.service.internal.StoppableHttpService; import org.osgi.framework.Bundle; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.security.Principal; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionConfigurationTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionConfigurationTest.java index e96d922fa7..fa61f4b262 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionConfigurationTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionConfigurationTest.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.httpservice; import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.hc.client5.http.classic.methods.HttpGet; import org.apache.hc.client5.http.cookie.BasicCookieStore; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionPersistenceTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionPersistenceTest.java index 98a8caef5a..16a29b7a14 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionPersistenceTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerSessionPersistenceTest.java @@ -21,9 +21,9 @@ import java.io.ObjectInputStream; import java.util.LinkedHashMap; import java.util.Map; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; import org.apache.hc.client5.http.classic.methods.HttpGet; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerWebSocketsTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerWebSocketsTest.java index c96f54045b..1b17adc6c0 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerWebSocketsTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/httpservice/WebContainerWebSocketsTest.java @@ -21,30 +21,30 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.servlet.DispatcherType; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.websocket.ClientEndpointConfig; -import javax.websocket.ContainerProvider; -import javax.websocket.Endpoint; -import javax.websocket.EndpointConfig; -import javax.websocket.MessageHandler; -import javax.websocket.OnMessage; -import javax.websocket.RemoteEndpoint; -import javax.websocket.Session; -import javax.websocket.WebSocketContainer; -import javax.websocket.server.ServerEndpoint; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.websocket.ClientEndpointConfig; +import jakarta.websocket.ContainerProvider; +import jakarta.websocket.Endpoint; +import jakarta.websocket.EndpointConfig; +import jakarta.websocket.MessageHandler; +import jakarta.websocket.OnMessage; +import jakarta.websocket.RemoteEndpoint; +import jakarta.websocket.Session; +import jakarta.websocket.WebSocketContainer; +import jakarta.websocket.server.ServerEndpoint; import org.apache.tomcat.websocket.Constants; import org.junit.Test; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ErrorServlet.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ErrorServlet.java index 4ff661015d..d48c10675d 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ErrorServlet.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ErrorServlet.java @@ -16,11 +16,11 @@ package org.ops4j.pax.web.itest.server.support; import java.io.IOException; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class ErrorServlet extends HttpServlet { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ProblemServlet.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ProblemServlet.java index b9ffedc50a..b4920e4445 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ProblemServlet.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/ProblemServlet.java @@ -18,10 +18,10 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class ProblemServlet extends HttpServlet { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/Utils.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/Utils.java index 10717cf45b..5cd17c1226 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/Utils.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/Utils.java @@ -32,12 +32,12 @@ import java.util.function.Consumer; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpFilter; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpFilter; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.hc.client5.http.classic.methods.HttpGet; import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/Cb1IFace3Impl.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/Cb1IFace3Impl.java index 3e8be429d4..d293eb3605 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/Cb1IFace3Impl.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/Cb1IFace3Impl.java @@ -23,9 +23,9 @@ /** * A concrete class that implements and interface from container-bundle-1, which extends an interface from - * container-bundle-3, which extends {@link javax.servlet.ServletRegistration}. - * And I want to have a {@link javax.servlet.ServletContainerInitializer} which has {@link javax.servlet.ServletRegistration} - * among values of {@link javax.servlet.annotation.HandlesTypes}. + * container-bundle-3, which extends {@link jakarta.servlet.ServletRegistration}. + * And I want to have a {@link jakarta.servlet.ServletContainerInitializer} which has {@link jakarta.servlet.ServletRegistration} + * among values of {@link jakarta.servlet.annotation.HandlesTypes}. */ public class Cb1IFace3Impl implements Cb1IFace3 { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb1/scis/SCIFromContainerBundle1.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb1/scis/SCIFromContainerBundle1.java index cc8a1eac85..4b60ea2962 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb1/scis/SCIFromContainerBundle1.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb1/scis/SCIFromContainerBundle1.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.support.war.cb1.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; public class SCIFromContainerBundle1 implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb2/scis/SCIFromContainerBundle2.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb2/scis/SCIFromContainerBundle2.java index 9440943e3d..e8a393464f 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb2/scis/SCIFromContainerBundle2.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb2/scis/SCIFromContainerBundle2.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.support.war.cb2.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; public class SCIFromContainerBundle2 implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/scis/SCIFromContainerBundle3.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/scis/SCIFromContainerBundle3.java index 2f20ce4df3..ff5269e1ca 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/scis/SCIFromContainerBundle3.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/scis/SCIFromContainerBundle3.java @@ -17,18 +17,18 @@ import java.io.IOException; import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class SCIFromContainerBundle3 implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/utils/IFace3.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/utils/IFace3.java index c51f8890e0..c4137c20a7 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/utils/IFace3.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cb3/utils/IFace3.java @@ -15,7 +15,7 @@ */ package org.ops4j.pax.web.itest.server.support.war.cb3.utils; -import javax.servlet.ServletRegistration; +import jakarta.servlet.ServletRegistration; /** * An interface not loadable directly from {@code the-wab-itself}, but which implements an interface which is visible diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf1/scis/SCIFromContainerFragment1.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf1/scis/SCIFromContainerFragment1.java index 47ae327e07..5786a04c2b 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf1/scis/SCIFromContainerFragment1.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf1/scis/SCIFromContainerFragment1.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.support.war.cf1.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; public class SCIFromContainerFragment1 implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf2/scis/SCIFromContainerFragment2.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf2/scis/SCIFromContainerFragment2.java index 3056739cce..d2b851bdb5 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf2/scis/SCIFromContainerFragment2.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/cf2/scis/SCIFromContainerFragment2.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.support.war.cf2.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; public class SCIFromContainerFragment2 implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet1.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet1.java index ed20d857d3..223374ee23 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet1.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet1.java @@ -16,13 +16,13 @@ package org.ops4j.pax.web.itest.server.support.war.fragment; import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.annotation.MultipartConfig; -import javax.servlet.annotation.WebInitParam; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.MultipartConfig; +import jakarta.servlet.annotation.WebInitParam; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; @WebServlet(name = "annotatedServlet1", urlPatterns = { "/as1", "/as1/*" }, initParams = { @WebInitParam(name = "param1", value = "value1"), diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet2.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet2.java index 7d8968a39c..c7758c84dd 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet2.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet2.java @@ -16,15 +16,15 @@ package org.ops4j.pax.web.itest.server.support.war.fragment; import java.io.IOException; -import javax.servlet.GenericServlet; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebServlet; +import jakarta.servlet.GenericServlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.annotation.WebServlet; @WebServlet(name = "annotatedServlet2", urlPatterns = { "/as2", "/as2*" }) // according to "8.1.1 @WebServlet", Classes annotated with @WebServlet class MUST extend the -// javax.servlet.http.HttpServlet class. +// jakarta.servlet.http.HttpServlet class. public class AnnotatedServlet2 extends GenericServlet { @Override diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet3.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet3.java index cd43240f30..d1262400c9 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet3.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/AnnotatedServlet3.java @@ -15,9 +15,9 @@ */ package org.ops4j.pax.web.itest.server.support.war.fragment; -import javax.servlet.annotation.WebInitParam; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; +import jakarta.servlet.annotation.WebInitParam; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; @WebServlet(name = "annotatedServlet3", urlPatterns = "/as3", initParams = @WebInitParam(name = "param3", value = "value3")) public class AnnotatedServlet3 extends HttpServlet { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/DeclaredFilter.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/DeclaredFilter.java index a9b44039ea..3283d30974 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/DeclaredFilter.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/DeclaredFilter.java @@ -16,12 +16,12 @@ package org.ops4j.pax.web.itest.server.support.war.fragment; import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; public class DeclaredFilter implements Filter { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/JustListener.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/JustListener.java index 04ceca2c9a..d251e1004f 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/JustListener.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/fragment/JustListener.java @@ -15,8 +15,8 @@ */ package org.ops4j.pax.web.itest.server.support.war.fragment; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; public class JustListener implements ServletContextListener { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/jar/scis/SCIFromJar.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/jar/scis/SCIFromJar.java index 0fd880099a..3a0231d69d 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/jar/scis/SCIFromJar.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/jar/scis/SCIFromJar.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.support.war.jar.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; public class SCIFromJar implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/listeners/ListenerAddedInWebXml.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/listeners/ListenerAddedInWebXml.java index 3bfd3e3f43..19dfe5c5e1 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/listeners/ListenerAddedInWebXml.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/listeners/ListenerAddedInWebXml.java @@ -17,15 +17,15 @@ import org.ops4j.pax.web.itest.server.support.war.StaticList; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; public class ListenerAddedInWebXml implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { try { - // It should be possible to add a listener OTHER than javax.servlet.ServletContextListener + // It should be possible to add a listener OTHER than jakarta.servlet.ServletContextListener // from a listener added in web.xml/web-fragment.xml/@WebListener. But only Jetty allow adding new // ServletContextListeners IF ContextHandler.Context._extendedListenerTypes == true // that's because Jetty invokes SCIs wrapped in listeners... diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment1.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment1.java index 1ba5941719..f4867082a5 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment1.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment1.java @@ -16,11 +16,11 @@ package org.ops4j.pax.web.itest.server.support.war.scis; import java.util.Set; -import javax.servlet.Servlet; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.annotation.HandlesTypes; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HandlesTypes; /** * This SCI is available inside the WAB itself, but declared as /META-INF/service in the fragment. So without a diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment2.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment2.java index 720fe431e2..6a2fe09e22 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment2.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheFragment2.java @@ -16,9 +16,9 @@ package org.ops4j.pax.web.itest.server.support.war.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; /** * This SCI is available inside the WAB itself, but declared as /META-INF/service in the fragment. So without a diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab1.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab1.java index f6336ac713..b3213e783f 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab1.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab1.java @@ -16,11 +16,11 @@ package org.ops4j.pax.web.itest.server.support.war.scis; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.annotation.HandlesTypes; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.annotation.HandlesTypes; @HandlesTypes({ // see https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab2.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab2.java index 931375a23c..5d1ceb17a7 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab2.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIFromTheWab2.java @@ -17,10 +17,10 @@ import java.util.EventListener; import java.util.Set; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.annotation.HandlesTypes; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.HandlesTypes; @HandlesTypes({ EventListener.class }) public class SCIFromTheWab2 implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIThatAddsServletContextListener.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIThatAddsServletContextListener.java index bd9b66a4d4..3c06667d8f 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIThatAddsServletContextListener.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/scis/SCIThatAddsServletContextListener.java @@ -19,11 +19,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletException; import java.util.Set; public class SCIThatAddsServletContextListener implements ServletContainerInitializer { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/ServletAddedInWebXml.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/ServletAddedInWebXml.java index 62deb85362..f7b40e53c4 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/ServletAddedInWebXml.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/ServletAddedInWebXml.java @@ -17,7 +17,7 @@ import org.ops4j.pax.web.itest.server.support.war.StaticList; -import javax.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServlet; public class ServletAddedInWebXml extends HttpServlet { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/SimplestServlet.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/SimplestServlet.java index cc3b6bf83b..c249c8a0bf 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/SimplestServlet.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/support/war/servlets/SimplestServlet.java @@ -17,10 +17,10 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class SimplestServlet extends HttpServlet { diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarClassSpaceTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarClassSpaceTest.java index cda4de892a..d0b5c8ca81 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarClassSpaceTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarClassSpaceTest.java @@ -19,7 +19,7 @@ import java.net.URL; import java.util.Arrays; import java.util.Collections; -import javax.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContainerInitializer; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarListenersTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarListenersTest.java index 7a300df10c..d612d2a29e 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarListenersTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/war/WarListenersTest.java @@ -22,7 +22,7 @@ import org.ops4j.pax.web.itest.server.support.war.StaticList; import org.osgi.framework.Bundle; -import javax.servlet.ServletContainerInitializer; +import jakarta.servlet.ServletContainerInitializer; import java.io.File; import java.net.URL; import java.util.Collections; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardAndHttpServiceTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardAndHttpServiceTest.java index e0ef2d8163..cf44baa943 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardAndHttpServiceTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardAndHttpServiceTest.java @@ -20,12 +20,12 @@ import java.util.Hashtable; import java.util.LinkedList; import java.util.List; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -43,9 +43,9 @@ import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.ops4j.pax.web.service.http.HttpContext; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.equalTo; @@ -107,7 +107,7 @@ public void onlyDefaultContexts() throws Exception { // UPDATE: I made it possible with special tracking of contexts that are EXACTLY the same contexts which are // already used for name+bundle combination in HttpService/WebContainer. So if we Whiteboard-register // a context that comes from org.ops4j.pax.web.service.WebContainer.createDefaultHttpContext() - // (or org.osgi.service.http.HttpService.createDefaultHttpContext()), whiteboard tracker will detect that + // (or org.ops4j.pax.web.service.http.HttpService.createDefaultHttpContext()), whiteboard tracker will detect that // it's the same/existing instance and will updated existing, associated OsgiContextModel, so we: // - can install different OsgiContextModel with proper httpContext that will lower the rank of existing // OsgiContextModel related to the httpxContext, so we can later register DIFFERENT OsgiContextModel @@ -129,7 +129,7 @@ public void onlyDefaultContexts() throws Exception { // service ranking. // wc.registerResources("/", "/", null); - // 2. registration of org.osgi.service.http.HttpContext service, but ensuring it has higher rank than + // 2. registration of org.ops4j.pax.web.service.http.HttpContext service, but ensuring it has higher rank than // "default" context registered for pax-web-extender-whiteboard bundle // Hashtable<String, Object> properties = new Hashtable<>(); // properties.put(PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_ID, "default"); @@ -137,7 +137,7 @@ public void onlyDefaultContexts() throws Exception { // getHttpContextCustomizer().addingService(mockReference(sample1, // HttpContext.class, properties, () -> new DefaultHttpContext(sample1), 0L, 1)); - // 3. Just call org.osgi.service.http.HttpService.createDefaultHttpContext() - the "default" context for "/" + // 3. Just call org.ops4j.pax.web.service.http.HttpService.createDefaultHttpContext() - the "default" context for "/" // path and bundle for which the WebContainer instance is scoped will be created and properly sent to // ServerController and configured in ServerModel. Underneath, an OsgiContextModel will be created // with Integer.MAX_VALUE service ranking. @@ -165,7 +165,7 @@ public void onlyDefaultContexts() throws Exception { // - (rank MAX_VALUE) OsgiContextModel{HS,id=OCM-4,name='default',path='/',bundle=sample1,context=DefaultHttpContext{bundle=Bundle "sample1",contextId='default'}} Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); assertThat("It should be HttpService context", - props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull("It should not be the Whiteboard context", props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat("It should be the \"/\" context specified using Whiteboard property", @@ -187,7 +187,7 @@ public void onlyDefaultContexts() throws Exception { // now, we've explicitly said to register Whiteboard servlet to Whiteboard "default" context props = models.get(0).getContextRegistrationProperties(); assertNull("It should not be HttpService context", - props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY)); + props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY)); assertThat("It should be the Whiteboard context", props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME), equalTo("default")); assertThat("It should be the \"/\" context specified using Whiteboard property", @@ -258,7 +258,7 @@ public boolean handleSecurity(HttpServletRequest request, HttpServletResponse re // servlet should be associated with HttpService context Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/")); @@ -274,7 +274,7 @@ public boolean handleSecurity(HttpServletRequest request, HttpServletResponse re getServletCustomizer().removedService(servletRef, model); props = models.get(0).getContextRegistrationProperties(); - assertNull(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY)); + assertNull(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME), equalTo("default")); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/")); @@ -355,7 +355,7 @@ public boolean handleSecurity(HttpServletRequest request, HttpServletResponse re // servlet should be associated with HttpService context Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/")); @@ -436,12 +436,12 @@ public void overrideHttpContextWithSameInstance() throws Exception { assertThat(httpGET(port, "/new-path/s"), startsWith("HTTP/1.1 404")); Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/")); // register HttpContext with ANY rank, but using the same INSTANCE we've got from - // org.osgi.service.http.HttpService.createDefaultHttpContext() - this should replace the default "default" + // org.ops4j.pax.web.service.http.HttpService.createDefaultHttpContext() - this should replace the default "default" // context - so we have a method to configure context path of the default context for example // also, existing, HttpService-registered servlet should immediately switch to new context path! Hashtable<String, Object> properties = new Hashtable<>(); @@ -456,7 +456,7 @@ public void overrideHttpContextWithSameInstance() throws Exception { assertThat(httpGET(port, "/s"), startsWith("HTTP/1.1 404")); props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/new-path")); @@ -477,7 +477,7 @@ public void overrideHttpContextWithSameInstance() throws Exception { assertThat(httpGET(port, "/s"), startsWith("HTTP/1.1 404")); props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/new-path")); @@ -490,7 +490,7 @@ public void overrideHttpContextWithSameInstance() throws Exception { assertThat(httpGET(port, "/s"), startsWith("HTTP/1.1 404")); props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/new-path2")); @@ -503,7 +503,7 @@ public void overrideHttpContextWithSameInstance() throws Exception { assertThat(httpGET(port, "/s"), endsWith("S(1)")); props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/")); @@ -534,10 +534,10 @@ public void overrideHttpContextWithSameInstanceAndFiltersOnly() throws Exception assertThat(models.size(), equalTo(1)); Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); // register HttpContext with ANY rank, but using the same INSTANCE we've got from - // org.osgi.service.http.HttpService.createDefaultHttpContext() - this should replace the default "default" + // org.ops4j.pax.web.service.http.HttpService.createDefaultHttpContext() - this should replace the default "default" // context Hashtable<String, Object> properties = new Hashtable<>(); properties.put(PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_ID, "default"); @@ -612,7 +612,7 @@ public void overrideHttpContextWithSameInstanceAndFiltersOnly() throws Exception assertThat(models.size(), equalTo(1)); props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); wc.unregisterFilter(filter); @@ -702,7 +702,7 @@ public String getMimeType(String name) { // servlet should be associated with HttpService context Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/")); assertThat(props.get(Constants.SERVICE_RANKING), equalTo(42)); @@ -774,7 +774,7 @@ public String getMimeType(String name) { // servlet should be associated with HttpService context Hashtable<String, Object> props = models.get(0).getContextRegistrationProperties(); - assertThat(props.get(HttpWhiteboardConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); + assertThat(props.get(PaxWebConstants.HTTP_SERVICE_CONTEXT_PROPERTY), equalTo("default")); assertNull(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME)); assertThat(props.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH), equalTo("/c")); @@ -936,7 +936,7 @@ private static class TestServlet extends Utils.MyIdServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // result = {org.ops4j.pax.web.service.spi.servlet.OsgiScopedServletContext@4038} // osgiContext: org.ops4j.pax.web.service.spi.servlet.OsgiServletContext = {org.ops4j.pax.web.service.spi.servlet.OsgiServletContext@4041} - // containerServletContext: javax.servlet.ServletContext = {org.eclipse.jetty.servlet.ServletContextHandler$Context@4046} "ServletContext@o.e.j.s.ServletContextHandler@2dd29a59{/,null,AVAILABLE}" + // containerServletContext: jakarta.servlet.ServletContext = {org.eclipse.jetty.servlet.ServletContextHandler$Context@4046} "ServletContext@o.e.j.s.ServletContextHandler@2dd29a59{/,null,AVAILABLE}" // osgiContextModel: org.ops4j.pax.web.service.spi.model.OsgiContextModel = {org.ops4j.pax.web.service.spi.model.OsgiContextModel@4047} "OsgiContextModel{id=OsgiContextModel-3,name='default',contextPath='/',context=null,bundle=Bundle "org.ops4j.pax.web.pax-web-extender-whiteboard"}" // LOG: org.slf4j.Logger = {org.apache.logging.slf4j.Log4jLogger@4065} // DEFAULT_CONTEXT_MODEL: org.ops4j.pax.web.service.spi.model.OsgiContextModel = {org.ops4j.pax.web.service.spi.model.OsgiContextModel@4047} "OsgiContextModel{id=OsgiContextModel-3,name='default',contextPath='/',context=null,bundle=Bundle "org.ops4j.pax.web.pax-web-extender-whiteboard"}" diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardBasicTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardBasicTest.java index c2d56f29ea..28b2f3783a 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardBasicTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardBasicTest.java @@ -21,17 +21,17 @@ import java.util.IdentityHashMap; import java.util.LinkedList; import java.util.Map; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebFilter; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.annotation.WebFilter; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -176,7 +176,7 @@ public void quickReinitialization() throws Exception { Bundle sample1 = mockBundle("sample1"); // Filters are a bit problematic. When new filter is registered, it has to be added to server's internal - // structures in correct order (web.xml order in JavaEE and service rank order in OSGi Whiteboard). + // structures in correct order (web.xml order in JakartaEE and service rank order in OSGi Whiteboard). // If simply new filter is registered, ONLY if this filter should be added last, we can attempt optimized // registration. Otherwise, we have to recreate the filter list, which SHOULD lead to destroy() + init() // of these filters again. diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardContextsTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardContextsTest.java index 291e9afc44..88f8e74024 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardContextsTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardContextsTest.java @@ -19,11 +19,11 @@ import java.net.URL; import java.util.HashMap; import java.util.Hashtable; -import javax.servlet.Filter; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -44,10 +44,10 @@ import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; import org.osgi.framework.dto.ServiceReferenceDTO; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.runtime.HttpServiceRuntime; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.ops4j.pax.web.service.http.HttpContext; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.runtime.HttpServiceRuntime; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.startsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardDynamicContextsTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardDynamicContextsTest.java index 966a25dea2..1f47f7a82c 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardDynamicContextsTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardDynamicContextsTest.java @@ -16,7 +16,7 @@ package org.ops4j.pax.web.itest.server.whiteboard; import java.util.Hashtable; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,8 +27,8 @@ import org.ops4j.pax.web.service.spi.model.elements.ServletModel; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.startsWith; @@ -38,7 +38,7 @@ /** * This is very complex test that checks how existing servlets, filters, listeners, - * {@link javax.servlet.ServletContainerInitializer SCIs} behave when the highest-ranked + * {@link jakarta.servlet.ServletContainerInitializer SCIs} behave when the highest-ranked * {@link org.ops4j.pax.web.service.spi.servlet.OsgiServletContext} changes for given physical context * (identified by context path) or when contexts come and go during the lifetime of servlet registration. */ @@ -46,7 +46,7 @@ public class WhiteboardDynamicContextsTest extends MultiContainerTestSupport { // CP - context path - // SC - javax.servlet.ServletContext + // SC - jakarta.servlet.ServletContext // SCH - ServletContextHelper (CMPN 140) // HC - HttpContext (CMPN 102) // WCC - WebContainerContext (extension of HC) diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardErrorPagesTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardErrorPagesTest.java index 936f46b0c9..ba52190036 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardErrorPagesTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardErrorPagesTest.java @@ -17,7 +17,7 @@ import java.io.FileNotFoundException; import java.util.Hashtable; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,7 +35,7 @@ import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; import org.osgi.framework.wiring.BundleWiring; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.endsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardEventListenersTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardEventListenersTest.java index eb9b1b0c1c..cf2dd157ab 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardEventListenersTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardEventListenersTest.java @@ -24,18 +24,18 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import javax.servlet.Servlet; -import javax.servlet.ServletContextAttributeEvent; -import javax.servlet.ServletContextAttributeListener; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletException; -import javax.servlet.ServletRequestAttributeEvent; -import javax.servlet.ServletRequestAttributeListener; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSessionAttributeListener; -import javax.servlet.http.HttpSessionBindingEvent; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContextAttributeEvent; +import jakarta.servlet.ServletContextAttributeListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequestAttributeEvent; +import jakarta.servlet.ServletRequestAttributeListener; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSessionAttributeListener; +import jakarta.servlet.http.HttpSessionBindingEvent; import org.junit.Test; import org.junit.runner.RunWith; @@ -48,7 +48,7 @@ import org.ops4j.pax.web.service.whiteboard.ListenerMapping; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; @@ -147,7 +147,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se public void servletContextListeners() { Bundle sample1 = mockBundle("sample1"); - // here we check that IF javax.servlet.ServletContextListener is registered before first "active" + // here we check that IF jakarta.servlet.ServletContextListener is registered before first "active" // web element (i.e., one that can handle requests), then such listener should get "context initialized" // event diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardFiltersTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardFiltersTest.java index 5f0e87ed28..7541192273 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardFiltersTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardFiltersTest.java @@ -18,15 +18,15 @@ import java.io.IOException; import java.util.LinkedList; import java.util.List; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,9 +39,9 @@ import org.ops4j.pax.web.service.whiteboard.FilterMapping; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; -import org.osgi.service.http.whiteboard.Preprocessor; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.whiteboard.Preprocessor; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.equalTo; @@ -58,7 +58,7 @@ public class WhiteboardFiltersTest extends MultiContainerTestSupport { public void twoWaysToRegisterFilter() throws Exception { Bundle sample1 = mockBundle("sample1"); - // 1. Whiteboard registration as javax.servlet.Filter OSGi service + // 1. Whiteboard registration as jakarta.servlet.Filter OSGi service ServiceReference<Filter> filterRef = mockFilterReference(sample1, "filter1", () -> new Utils.MyIdFilter("1"), 0L, 0, "/s"); diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardResourcesTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardResourcesTest.java index 6c6c64db81..340b707d6c 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardResourcesTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardResourcesTest.java @@ -30,8 +30,8 @@ import org.ops4j.pax.web.service.whiteboard.ResourceMapping; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.startsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSecurityConfigurationTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSecurityConfigurationTest.java index b94fa4406e..791ed0c072 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSecurityConfigurationTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSecurityConfigurationTest.java @@ -31,12 +31,12 @@ import org.ops4j.pax.web.service.whiteboard.SecurityConfigurationMapping; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; -import javax.servlet.Servlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Servlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.security.Principal; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardServletsTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardServletsTest.java index e450024b18..3e0cf0006c 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardServletsTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardServletsTest.java @@ -15,7 +15,7 @@ */ package org.ops4j.pax.web.itest.server.whiteboard; -import javax.servlet.Servlet; +import jakarta.servlet.Servlet; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,7 +41,7 @@ public class WhiteboardServletsTest extends MultiContainerTestSupport { public void twoWaysToRegisterServlet() throws Exception { Bundle sample1 = mockBundle("sample1"); - // 1. Whiteboard registration as javax.servlet.Servlet OSGi service + // 1. Whiteboard registration as jakarta.servlet.Servlet OSGi service ServiceReference<Servlet> servletRef = mockServletReference(sample1, "servlet1", () -> new Utils.MyIdServlet("1"), 0L, 0, "/s"); diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSessionsTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSessionsTest.java index 11c94a9bd3..9b2b8f933d 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSessionsTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardSessionsTest.java @@ -20,15 +20,15 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionAttributeListener; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionEvent; -import javax.servlet.http.HttpSessionListener; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSessionAttributeListener; +import jakarta.servlet.http.HttpSessionBindingEvent; +import jakarta.servlet.http.HttpSessionEvent; +import jakarta.servlet.http.HttpSessionListener; import org.apache.hc.client5.http.classic.methods.HttpGet; import org.apache.hc.client5.http.config.RequestConfig; @@ -47,8 +47,8 @@ import org.ops4j.pax.web.service.spi.model.elements.ServletModel; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardTempdirTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardTempdirTest.java index e1d7ba957a..dab6670c8e 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardTempdirTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardTempdirTest.java @@ -19,11 +19,11 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,8 +33,8 @@ import org.ops4j.pax.web.service.spi.model.elements.ServletModel; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardWelcomeFilesTest.java b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardWelcomeFilesTest.java index e2f2d37eaf..6cb79bca4b 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardWelcomeFilesTest.java +++ b/pax-web-itest/pax-web-itest-server/src/test/java/org/ops4j/pax/web/itest/server/whiteboard/WhiteboardWelcomeFilesTest.java @@ -33,8 +33,8 @@ import org.ops4j.pax.web.service.whiteboard.WelcomeFileMapping; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; -import org.osgi.service.http.context.ServletContextHelper; -import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.startsWith; diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-1/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-1/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-1/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-1/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-2/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-2/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-2/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-2/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-3/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-3/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-3/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-bundle-3/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-1/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-1/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-1/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-1/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-2/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-2/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-2/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/container-fragment-2/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-fragment/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-fragment/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-fragment/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-fragment/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/classes/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/classes/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/lib/the-wab-jar-8.0.0-SNAPSHOT.jar/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/lib/the-wab-jar-8.0.0-SNAPSHOT.jar/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/lib/the-wab-jar-8.0.0-SNAPSHOT.jar/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/the-wab-itself/WEB-INF/lib/the-wab-jar-8.0.0-SNAPSHOT.jar/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/wab-listeners/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer b/pax-web-itest/pax-web-itest-server/src/test/resources/bundles/wab-listeners/WEB-INF/classes/META-INF/services/jakarta.servlet.ServletContainerInitializer similarity index 100% rename from pax-web-itest/pax-web-itest-server/src/test/resources/bundles/wab-listeners/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer rename to pax-web-itest/pax-web-itest-server/src/test/resources/bundles/wab-listeners/WEB-INF/classes/META-INF/services/jakarta.servlet.ServletContainerInitializer diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/jetty.xml b/pax-web-itest/pax-web-itest-server/src/test/resources/jetty.xml index bb677d051a..7bfa651e74 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/resources/jetty.xml +++ b/pax-web-itest/pax-web-itest-server/src/test/resources/jetty.xml @@ -21,12 +21,18 @@ <Get name="threadPool"> <Set name="name">different-prefix</Set> </Get> + <Call id="ResourceFactory" class="org.eclipse.jetty.util.resource.ResourceFactory" name="of"> + <Arg><Ref refid="Server" /></Arg> + <Call id="realmResource" name="newResource"> + <!-- File will be loaded relatively to pax-web-itest-jetty module --> + <Arg>target/test-classes/jetty-realm.properties</Arg> + </Call> + </Call> <Call name="addBean"> <Arg> <New class="org.eclipse.jetty.security.HashLoginService"> <Set name="name">test</Set> - <!-- File will be loaded relatively to pax-web-itest-jetty module --> - <Set name="config">target/test-classes/jetty-realm.properties</Set> + <Set name="config"><Ref refid="realmResource" /></Set> </New> </Arg> </Call> diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/error.jsp b/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/error.jsp index 26eed2fee8..0a065ea1d7 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/error.jsp +++ b/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/error.jsp @@ -24,7 +24,7 @@ <meta charset="UTF-8"> </head> <body> - <div id="code">${requestScope["javax.servlet.error.status_code"]}</div> - <div id="exception">${requestScope["javax.servlet.error.exception_type"].name}</div> + <div id="code">${requestScope["jakarta.servlet.error.status_code"]}</div> + <div id="exception">${requestScope["jakarta.servlet.error.exception_type"].name}</div> </body> </html> diff --git a/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/jsp-info.jsp b/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/jsp-info.jsp index 5713f3c30c..5b702a8dbb 100644 --- a/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/jsp-info.jsp +++ b/pax-web-itest/pax-web-itest-server/src/test/resources/jsp/jsp-info.jsp @@ -30,6 +30,6 @@ <h2><%= application.getAttribute("generated-attribute") %></h2> <h4>${applicationScope['osgi-bundlecontext']}</h4> <h5>${applicationScope['org.springframework.osgi.web.org.osgi.framework.BundleContext']}</h5> - <h6>${fn:length(applicationScope['javax.servlet.context.orderedLibs'])}</h6> + <h6>${fn:length(applicationScope['jakarta.servlet.context.orderedLibs'])}</h6> </body> </html> diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerWrapper.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerWrapper.java index 5799b7980b..41dfb66244 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerWrapper.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerWrapper.java @@ -1581,7 +1581,7 @@ public void visitFilterStateChange(FilterStateChange change) { sch.getServletHandler().setFilterMappings(new FilterMapping[0]); for (PaxWebFilterHolder fh : newFilterHolders) { - if ("org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter".equals(fh.getName())) { + if ("org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter".equals(fh.getName())) { sch.getServletContext().removeAttribute("org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter"); } sch.getServletHandler().addFilter(fh); diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletContextHandler.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletContextHandler.java index 4bff608a8b..d1aaef782c 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletContextHandler.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletContextHandler.java @@ -26,18 +26,29 @@ import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; + +import jakarta.servlet.DispatcherType; import jakarta.servlet.ServletContext; import jakarta.servlet.ServletContextEvent; import jakarta.servlet.ServletContextListener; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.jetty.ee10.servlet.ServletContextRequest; import org.eclipse.jetty.ee10.servlet.SessionHandler; +import org.eclipse.jetty.http.HttpField; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.ee10.servlet.ServletContextHandler; +import org.eclipse.jetty.server.handler.ContextRequest; +import org.eclipse.jetty.session.ManagedSession; +import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.resource.PathResourceFactory; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler; @@ -251,8 +262,7 @@ protected void startContext() throws Exception { servletContainerInitializers.forEach(wrapper -> { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { - // setExtendedListenerTypes() is no longer used in Jetty 12 -// getServletContext().setExtendedListenerTypes(true); + getContext().setExtendedListenerTypes(true); Thread.currentThread().setContextClassLoader(getClassLoader()); isCallingSCI.set(true); wrapper.onStartup(); @@ -261,7 +271,7 @@ protected void startContext() throws Exception { } finally { isCallingSCI.remove(); Thread.currentThread().setContextClassLoader(tccl); -// getServletContext().setExtendedListenerTypes(false); + getContext().setExtendedListenerTypes(false); } }); @@ -342,20 +352,44 @@ protected void requestInitialized(Request baseRequest, HttpServletRequest reques String sid = request.getRequestedSessionId(); if (sid != null && baseRequest.getSession(false) == null) { String baseSid = sessionHandler.getSessionIdManager().getId(sid); -// baseSid += PaxWebSessionIdManager.getSessionIdSuffix(request); + baseSid += PaxWebSessionIdManager.getSessionIdSuffix(baseRequest); sid = sessionHandler.getSessionIdManager().getExtendedId(baseSid, baseRequest); -// HttpSession session = sessionHandler.getManagedSession(sid); + ManagedSession session = sessionHandler.getManagedSession(sid); -// if (session != null && sessionHandler.isValid(session)) { -// baseRequest.enterSession(session); -// baseRequest.setSession(session); -// } + if (session != null && session.isValid()) { + scr.setManagedSession(session); + } } } super.requestInitialized(baseRequest, request); } + @Override + protected boolean handleByContextHandler(String pathInContext, ContextRequest request, Response response, Callback callback) { + if ("TRACE".equals(request.getMethod())) { + // PAXWEB-229 - prevent https://owasp.org/www-community/attacks/Cross_Site_Tracing + Response.writeError(request, response, callback, HttpServletResponse.SC_METHOD_NOT_ALLOWED, null); + return true; + } + + return super.handleByContextHandler(pathInContext, request, response, callback); + } + + @Override + protected void handleMovedPermanently(Request request, Response response, Callback callback) { + // Pax Web - copied original code, but switching 301 to 302 (just as for Tomcat and Undertow) + String location = getContextPath() + "/"; + if (request.getHttpURI().getParam() != null) + location += ";" + request.getHttpURI().getParam(); + if (request.getHttpURI().getQuery() != null) + location += ";" + request.getHttpURI().getQuery(); + + response.setStatus(HttpStatus.MOVED_TEMPORARILY_302); + response.getHeaders().add(new HttpField(HttpHeader.LOCATION, location)); + callback.succeeded(); + } + /** * Special override for libraries using {@link ContextHandler#getCurrentContext()} directly. It should eventually * deletage to {@link org.ops4j.pax.web.service.spi.servlet.OsgiServletContext#getResource(String)}. diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletHandler.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletHandler.java index 251fc1783a..a95681452d 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletHandler.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebServletHandler.java @@ -308,48 +308,44 @@ public void removeServletWithMapping(ServletModel model) { */ @Override public boolean handle(Request request, Response response, Callback callback) throws Exception { - ServletContextRequest req = Request.as(request, ServletContextRequest.class); - ServletContextResponse res = req.getResponse(); - if ("TRACE".equals(request.getMethod())) { - // PAXWEB-229 - prevent https://owasp.org/www-community/attacks/Cross_Site_Tracing - response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - return true; - } - - // whether there are filters or not, we *copy* code from super.doHandle() to ensure that - // getOsgiFilterChain() is called - - // this should never be null because of ServletHandler.setEnsureDefaultServlet(true) - PaxWebServletHolder servletHolder = (PaxWebServletHolder) req.getMappedServlet().getServletHolder(); - - try { - // we always create the chain, because we have to call handleSecurity()/finishSecurity() - String target = Request.getPathInContext(req); - FilterChain chain = getOsgiFilterChain(req, target, servletHolder); - - // unwrap any tunnelling of base Servlet request/responses -// if (req.getServletApiRequest() instanceof ServletRequestHttpWrapper) { -// req = ((ServletRequestHttpWrapper) req).getRequest(); -// } -// if (res instanceof ServletResponseHttpWrapper) { -// res = ((ServletResponseHttpWrapper) res).getResponse(); + return super.handle(request, response, callback); +// ServletContextRequest req = Request.as(request, ServletContextRequest.class); +// ServletContextResponse res = req.getResponse(); +// +// // whether there are filters or not, we *copy* code from super.doHandle() to ensure that +// // getOsgiFilterChain() is called +// +// // this should never be null because of ServletHandler.setEnsureDefaultServlet(true) +// PaxWebServletHolder servletHolder = (PaxWebServletHolder) req.getMappedServlet().getServletHolder(); +// +// try { +// // we always create the chain, because we have to call handleSecurity()/finishSecurity() +// String target = Request.getPathInContext(req); +// FilterChain chain = getOsgiFilterChain(req, target, servletHolder); +// +// // unwrap any tunnelling of base Servlet request/responses +//// if (req.getServletApiRequest() instanceof ServletRequestHttpWrapper) { +//// req = ((ServletRequestHttpWrapper) req).getRequest(); +//// } +//// if (res instanceof ServletResponseHttpWrapper) { +//// res = ((ServletResponseHttpWrapper) res).getResponse(); +//// } +// +// // set some attributes in the request +// servletHolder.prepare(req.getServletApiRequest(), res.getServletApiResponse()); +// +// // chain still can be null if the servlet is default404Servlet +// if (chain != null) { +// chain.doFilter(req.getServletApiRequest(), res.getServletApiResponse()); +// } else { +// servletHolder.handle(req.getServletApiRequest(), res.getServletApiResponse()); // } - - // set some attributes in the request - servletHolder.prepare(req.getServletApiRequest(), res.getServletApiResponse()); - - // chain still can be null if the servlet is default404Servlet - if (chain != null) { - chain.doFilter(req.getServletApiRequest(), res.getServletApiResponse()); - } else { - servletHolder.handle(req.getServletApiRequest(), res.getServletApiResponse()); - } - } finally { -// if (servletHolder != null) { -// baseRequest.setHandled(true); -// } - } - return true; +// } finally { +//// if (servletHolder != null) { +//// baseRequest.setHandled(true); +//// } +// } +// return true; } protected FilterChain getOsgiFilterChain(final ServletContextRequest baseRequest, String pathInContext, ServletHolder servletHolder) { @@ -422,7 +418,14 @@ protected FilterChain getFilterChain(HttpServletRequest baseRequest, String path FilterChain chain = _chainCache[dispatch].get(key); if (chain != null) { - return chain; + List<Preprocessor> preprocessorInstances = preprocessors.stream().map(PreprocessorFilterConfig::getInstance).toList(); + if (!holder.is404()) { + return new OsgiFilterChain(new ArrayList<>(preprocessorInstances), holder.getOsgiServletContext(), + holder.getWebContainerContext(), chain, osgiSessionsBridge); + } else { + return new OsgiFilterChain(new ArrayList<>(preprocessorInstances), defaultServletContext, + defaultWebContainerContext, chain, osgiSessionsBridge); + } } // always clear contextlessKey in parent cache, so super.getFilterChain will create new filter chain @@ -447,7 +450,23 @@ protected FilterChain getFilterChain(HttpServletRequest baseRequest, String path _chainCache[dispatch].put(key, chain); } - return chain; + // We need different FilterChain that will invoke (in this order): + // 1. all org.osgi.service.http.whiteboard.Preprocessors + // 2. handleSecurity() (on HttpContext or ServletContextHelper) + // 3. original chain + if (chain == null) { + // 3a. even if there's only a ServletHolder there == null chain + // 3b. if the holder is for known 404 servlet, we still need a chain that calls 404 servlet + chain = holder::handle; + } + List<Preprocessor> preprocessorInstances = preprocessors.stream().map(PreprocessorFilterConfig::getInstance).toList(); + if (!holder.is404()) { + return new OsgiFilterChain(new ArrayList<>(preprocessorInstances), holder.getOsgiServletContext(), + holder.getWebContainerContext(), chain, osgiSessionsBridge); + } else { + return new OsgiFilterChain(new ArrayList<>(preprocessorInstances), defaultServletContext, + defaultWebContainerContext, chain, osgiSessionsBridge); + } } @Override diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionHandler.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionHandler.java index db29bd54fc..6c50ee6fad 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionHandler.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionHandler.java @@ -16,9 +16,21 @@ package org.ops4j.pax.web.service.jetty.internal; import org.eclipse.jetty.ee10.servlet.SessionHandler; +import org.eclipse.jetty.http.HttpCookie; +import org.eclipse.jetty.session.ManagedSession; public class PaxWebSessionHandler extends SessionHandler { + @Override + public HttpCookie getSessionCookie(ManagedSession session, boolean requestIsSecure) { + HttpCookie cookie = super.getSessionCookie(session, requestIsSecure); + if (cookie != null) { + String id = getExtendedId(cookie.getValue()); + return HttpCookie.from(cookie.getName(), id, getSessionAttributes()); + } + return cookie; + } + @Override public void renewSessionId(String oldId, String oldExtendedId, String newId, String newExtendedId) { int id1 = oldId.indexOf("~"); @@ -34,18 +46,16 @@ public void renewSessionId(String oldId, String oldExtendedId, String newId, Str } } -// @Override -// public String getExtendedId(HttpSession session) { -// String eid = super.getExtendedId(session); -// int tilde = eid.indexOf("~"); -// if (tilde == -1) { -// return eid; -// } -// int dot = eid.indexOf(".", tilde); -// if (dot == -1) { -// return eid.substring(0, tilde); -// } -// return eid.substring(0, tilde) + eid.substring(dot); -// } + public String getExtendedId(String eid) { + int tilde = eid.indexOf("~"); + if (tilde == -1) { + return eid; + } + int dot = eid.indexOf(".", tilde); + if (dot == -1) { + return eid.substring(0, tilde); + } + return eid.substring(0, tilde) + eid.substring(dot); + } } diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionIdManager.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionIdManager.java index c849fc23ad..306267e6c3 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionIdManager.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PaxWebSessionIdManager.java @@ -15,73 +15,82 @@ */ package org.ops4j.pax.web.service.jetty.internal; +import org.eclipse.jetty.ee10.servlet.ServletContextRequest; +import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.session.DefaultSessionIdManager; +import org.eclipse.jetty.session.SessionManager; +import org.ops4j.pax.web.service.spi.model.OsgiContextModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PaxWebSessionIdManager extends DefaultSessionIdManager { + public static final Logger LOG = LoggerFactory.getLogger(PaxWebSessionIdManager.class); + public PaxWebSessionIdManager(Server server) { super(server); } -// public static String getSessionIdSuffix(HttpServletRequest request) { -// if (request instanceof Request) { -// Request r = (Request) request; -// UserIdentity.Scope uis = r.getUserIdentityScope(); -// if (uis instanceof PaxWebServletHolder) { -// PaxWebServletHolder holder = (PaxWebServletHolder) uis; -// OsgiContextModel ocm = holder.getOsgiContextModel(); -// // we can't replace '/' to '_' because of how -// // org.eclipse.jetty.server.session.FileSessionDataStore.initializeStore() analyzes the -// // session files. -// if (ocm == null || ocm.getTemporaryLocation() == null) { -// return ""; -// } -// return "~" + ocm.getTemporaryLocation().replaceAll("/", "#").replaceAll("_", "#"); -// } -// } -// return ""; -// } -// -// @Override -// public String renewSessionId(String oldClusterId, String oldNodeId, HttpServletRequest request) { -// // copy from org.eclipse.jetty.server.session.DefaultSessionIdManager.renewSessionId() -// // with OsgiContextModel suffix -// -// String newClusterId = newSessionId(request.hashCode()); -// int id1 = oldClusterId.indexOf("~"); -// if (id1 > 0) { -// newClusterId += oldClusterId.substring(id1); -// } -// -// for (SessionHandler manager : getSessionHandlers()) { -// manager.renewSessionId(oldClusterId, oldNodeId, newClusterId, getExtendedId(newClusterId, request)); -// } -// -// return newClusterId; -// } -// -// @Override -// public String newSessionId(HttpServletRequest request, long created) { -// if (request == null) { -// // org.eclipse.jetty.server.session.DefaultSessionIdManager.newSessionId(long) will be called -// // only with "created" as a seed -// return newSessionId(created); -// } -// -// // request's hashCode + created will be used to get ID, but it'll be altered depending on the context -// String suffix = getSessionIdSuffix(request); -// if (suffix != null) { -// // it means that we may be accessing existing session for a context, but through a different -// // OsgiContextModel. This means we have to create another session, but with the same JSESSIONID prefix -// String rsid = request.getRequestedSessionId(); -// if (rsid == null) { -// return super.newSessionId(request, created) + suffix; -// } -// String sid = getId(rsid); -// return sid + suffix; -// } -// return super.newSessionId(request, created); -// } + public static String getSessionIdSuffix(Request r) { + ServletContextRequest req = Request.as(r, ServletContextRequest.class); + if (req.getMappedServlet() != null && req.getMappedServlet().getServletHolder() instanceof PaxWebServletHolder holder) { + OsgiContextModel ocm = holder.getOsgiContextModel(); + // we can't replace '/' to '_' because of how + // org.eclipse.jetty.server.session.FileSessionDataStore.initializeStore() analyzes the + // session files. + if (ocm == null || ocm.getTemporaryLocation() == null) { + return ""; + } + return "~" + ocm.getTemporaryLocation().replaceAll("/", "#").replaceAll("_", "#"); + } + + return ""; + } + + @Override + public String renewSessionId(String oldClusterId, String oldNodeId, Request request) { + // copy from org.eclipse.jetty.server.session.DefaultSessionIdManager.renewSessionId() + // with OsgiContextModel suffix + + String newClusterId = newSessionId(request.hashCode()); + int id1 = oldClusterId.indexOf("~"); + if (id1 > 0) { + newClusterId += oldClusterId.substring(id1); + } + + for (SessionManager manager : getSessionManagers()) { + try { + manager.renewSessionId(oldClusterId, oldNodeId, newClusterId, getExtendedId(newClusterId, request)); + } catch (Exception e) { + LOG.warn("Problem renewing session id {} to {}", oldClusterId, newClusterId, e); + } + } + + return newClusterId; + } + + @Override + public String newSessionId(Request request, String requestedId, long created) { + if (request == null) { + // org.eclipse.jetty.server.session.DefaultSessionIdManager.newSessionId(long) will be called + // only with "created" as a seed + return newSessionId(created); + } + + // request's hashCode + created will be used to get ID, but it'll be altered depending on the context + String suffix = getSessionIdSuffix(request); + if (suffix != null) { + // it means that we may be accessing existing session for a context, but through a different + // OsgiContextModel. This means we have to create another session, but with the same JSESSIONID prefix + if (requestedId == null) { + return super.newSessionId(request, requestedId, created) + suffix; + } + String sid = getId(requestedId); + return sid + suffix; + } + + return super.newSessionId(request, requestedId, created); + } } diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PrioritizedHandlerCollection.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PrioritizedHandlerCollection.java index cddfb4901f..dc982520cd 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PrioritizedHandlerCollection.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/PrioritizedHandlerCollection.java @@ -58,8 +58,14 @@ public void setPriorityHandlers(Set<PriorityValue<Handler>> handlers) { handlersAfter.add(pv); } }); - handlerCollectionBefore.setHandlers(handlersBefore.stream().map(PriorityValue::getValue).toArray(Handler[]::new)); - handlerCollectionAfter.setHandlers(handlersAfter.stream().map(PriorityValue::getValue).toArray(Handler[]::new)); + Handler[] handlersA = handlersBefore.stream().map(PriorityValue::getValue).toArray(Handler[]::new); + if (handlersA.length > 0) { + handlerCollectionBefore.setHandlers(handlersA); + } + Handler[] handlersZ = handlersAfter.stream().map(PriorityValue::getValue).toArray(Handler[]::new); + if (handlersZ.length > 0) { + handlerCollectionAfter.setHandlers(handlersZ); + } } @Override @@ -93,10 +99,11 @@ public boolean handle(Request request, Response response, Callback callback) thr } // User should know what (s)he's doing - if a handler marks the request as handled, there's // no need to call real context handlers. - super.handle(request, response, callback); + handled = super.handle(request, response, callback); } // however, let's allow the "after" handlers to run - whatever they are - return handlerCollectionAfter.handle(request, response, callback); + handled |= handlerCollectionAfter.handle(request, response, callback); + return handled; } catch (IOException | RuntimeException e) { throw e; } catch (Exception e) { diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/DefaultServlet.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/DefaultServlet.java index 21b0d884af..de226aa7cc 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/DefaultServlet.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/DefaultServlet.java @@ -198,6 +198,8 @@ public class DefaultServlet extends HttpServlet private Resource _baseResource; private boolean _isPathInfoOnly; + protected boolean redirectWelcome = false; + public ResourceService getResourceService() { return _resourceService; @@ -297,7 +299,7 @@ public void init() throws ServletException _resourceService.setAcceptRanges(getInitBoolean("acceptRanges", _resourceService.isAcceptRanges())); _resourceService.setDirAllowed(getInitBoolean("dirAllowed", _resourceService.isDirAllowed())); - boolean redirectWelcome = getInitBoolean("redirectWelcome", false); + boolean redirectWelcome = getInitBoolean("redirectWelcome", this.redirectWelcome); _resourceService.setWelcomeMode(redirectWelcome ? ResourceService.WelcomeMode.REDIRECT : ResourceService.WelcomeMode.SERVE); _resourceService.setPrecompressedFormats(precompressedFormats); _resourceService.setEtags(getInitBoolean("etags", _resourceService.isEtags())); diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/JettyResourceServlet.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/JettyResourceServlet.java index 83167b4656..3d75c3b45e 100644 --- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/JettyResourceServlet.java +++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/web/JettyResourceServlet.java @@ -16,6 +16,7 @@ package org.ops4j.pax.web.service.jetty.internal.web; import java.io.IOException; +import java.net.MalformedURLException; import java.net.URI; import java.net.URL; @@ -85,7 +86,15 @@ public void init() throws ServletException { @Override protected Resource configureBaseResource() { - return baseUrlResource; + if (chroot != null) { + return new EmptyResource() { + @Override + public Resource resolve(String subUriPath) { + return getResource(URI.create(subUriPath)); + } + }; + } + return baseUrlResource == null ? new EmptyResource() : baseUrlResource; } /** @@ -100,8 +109,12 @@ public void setWelcomeFiles(String[] welcomeFiles) { } public void setWelcomeFilesRedirect(boolean welcomeFilesRedirect) { - getResourceService().setWelcomeMode(welcomeFilesRedirect - ? ResourceService.WelcomeMode.REDIRECT : ResourceService.WelcomeMode.SERVE); + redirectWelcome = welcomeFilesRedirect; + if (getResourceService() != null) { + // already init()ed + getResourceService().setWelcomeMode(welcomeFilesRedirect + ? ResourceService.WelcomeMode.REDIRECT : ResourceService.WelcomeMode.SERVE); + } } @Override diff --git a/pax-web-jetty/src/test/java/org/ops4j/pax/web/service/jetty/internal/EmbeddedJettyTest.java b/pax-web-jetty/src/test/java/org/ops4j/pax/web/service/jetty/internal/EmbeddedJettyTest.java index 522f2a0cd4..47a858f0cd 100644 --- a/pax-web-jetty/src/test/java/org/ops4j/pax/web/service/jetty/internal/EmbeddedJettyTest.java +++ b/pax-web-jetty/src/test/java/org/ops4j/pax/web/service/jetty/internal/EmbeddedJettyTest.java @@ -379,6 +379,48 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws server.join(); } + @Test + public void embeddedServerWithServletContextHandlerAnd404Servlet() throws Exception { + Server server = new Server(); + ServerConnector connector = new ServerConnector(server, 1, 1, new HttpConnectionFactory()); + connector.setPort(0); + server.setConnectors(new Connector[] { connector }); + + ContextHandlerCollection chc = new ContextHandlerCollection(); + + ServletContextHandler h = new ServletContextHandler(null, "/c1", ServletContextHandler.NO_SESSIONS); + h.setAllowNullPathInContext(false); + h.addServlet(new ServletHolder("default-servlet", new ServletHandler.Default404Servlet()), "/*"); + + chc.addHandler(h); + + server.setHandler(chc); + server.start(); + + int port = connector.getLocalPort(); + + Socket s1 = new Socket(); + s1.connect(new InetSocketAddress("127.0.0.1", port)); + + s1.getOutputStream().write(( + "GET /c1/anything HTTP/1.1\r\n" + + "Host: 127.0.0.1:" + connector.getLocalPort() + "\r\n" + + "Connection: close\r\n\r\n").getBytes()); + + byte[] buf = new byte[64]; + int read; + StringWriter sw = new StringWriter(); + while ((read = s1.getInputStream().read(buf)) > 0) { + sw.append(new String(buf, 0, read)); + } + s1.close(); + + assertTrue(sw.toString().startsWith("HTTP/1.1 404")); + + server.stop(); + server.join(); + } + @Test public void embeddedServerWithServletContextHandlerAndDynamicInitializers() throws Exception { Server server = new Server(); diff --git a/pax-web-jsp/pom.xml b/pax-web-jsp/pom.xml index 74ba11b1cc..ea16913381 100644 --- a/pax-web-jsp/pom.xml +++ b/pax-web-jsp/pom.xml @@ -451,7 +451,7 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>${dependency.org.assertj}</version> + <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> diff --git a/pax-web-jsp/src/main/resources/META-INF/services/jakarta.el.ExpressionFactory b/pax-web-jsp/src/main/resources/META-INF/services/jakarta.el.ExpressionFactory new file mode 100644 index 0000000000..db4c65ecef --- /dev/null +++ b/pax-web-jsp/src/main/resources/META-INF/services/jakarta.el.ExpressionFactory @@ -0,0 +1,22 @@ +org.apache.el.ExpressionFactoryImpl + +# +# Copyright 2019 OPS4J. +# +# 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. +# + +# The service-imp-first in this file is because it's required by jakarta.el:jakarta.el-api:3.0.3 and we treat +# it as _canonical_ EL API Jar +# Its jakarta.el.FactoryFinder class reads only the first line of this file... +# org.apache.tomcat:tomcat-el skips the comments correctly because it's using generic java.util.ServiceLoader API diff --git a/pax-web-jsp/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer b/pax-web-jsp/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer new file mode 100644 index 0000000000..d4d266a4f7 --- /dev/null +++ b/pax-web-jsp/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer @@ -0,0 +1,17 @@ +# +# Copyright 2021 OPS4J. +# +# 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. +# + +org.ops4j.pax.web.jsp.JasperInitializer diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java index 8835b685a7..ac180c0912 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/DefaultSessionCookieConfig.java @@ -17,6 +17,8 @@ import jakarta.servlet.SessionCookieConfig; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.Map; public class DefaultSessionCookieConfig implements SessionCookieConfig { @@ -28,6 +30,7 @@ public class DefaultSessionCookieConfig implements SessionCookieConfig { private boolean secure = false; private boolean httpOnly = true; private int maxAge = -1; + private Map<String, String> attributes = new LinkedHashMap(); @Override public String getName() { @@ -103,19 +106,17 @@ public void setMaxAge(int maxAge) { @Override public void setAttribute(String name, String value) { - // TODO: JakartaEE 10 + attributes.put(name, value); } @Override public String getAttribute(String name) { - // TODO: JakartaEE 10 - return null; + return attributes.get(name); } @Override public Map<String, String> getAttributes() { - // TODO: JakartaEE 10 - return null; + return Collections.unmodifiableMap(attributes); } } diff --git a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java index 90f29a0c13..0dff6e7afd 100644 --- a/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java +++ b/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/servlet/SCIWrapper.java @@ -40,7 +40,16 @@ public SCIWrapper(OsgiDynamicServletContext context, ContainerInitializerModel m * @throws ServletException */ public void onStartup() throws ServletException { - model.getContainerInitializer().onStartup(model.getClasses(), context); + ServletContainerInitializer sci = model.getContainerInitializer(); + if (!sci.getClass().getName().startsWith("org.eclipse.jetty")) { + sci.onStartup(model.getClasses(), context); + } else { + // org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer.onStartup() + // uses org.eclipse.jetty.ee10.servlet.ServletContextHandler.getServletContextHandler() which was + // more flexible before Jetty 12... + // here we'll pass proper context ourselves + sci.onStartup(model.getClasses(), context.getContainerServletContext()); + } context.rememberAttributesFromSCIs(); } diff --git a/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatFactory.java b/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatFactory.java index 4bece59309..81deb6bc56 100644 --- a/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatFactory.java +++ b/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatFactory.java @@ -232,7 +232,7 @@ public Connector createSecureConnector(Server server, String address, Executor e String sslKeystore = secc.getSslKeystore(); if (sslKeystore != null) { - sslHostCertificate.setCertificateKeyFile(sslKeystore); + sslHostCertificate.setCertificateKeystoreFile(sslKeystore); } if (secc.getSslKeystorePassword() != null) { sslHostCertificate.setCertificateKeystorePassword(secc.getSslKeystorePassword());