From 5ca31e3520189fac3c0447e3083a76756a535723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20D=C3=B3ra?= <47719724+horvathdora@users.noreply.github.com> Date: Wed, 30 Mar 2022 15:15:35 +0200 Subject: [PATCH] CURATOR-630 Upgrade jetty to 9.4.latest (#413) --- curator-x-discovery-server/pom.xml | 4 ++-- .../server/jetty_jersey/TestMapsWithJersey.java | 16 ++++++++++------ .../TestObjectPayloadWithJersey.java | 16 ++++++++++------ .../jetty_jersey/TestStringsWithJersey.java | 16 ++++++++++------ .../jetty_resteasy/TestStringsWithRestEasy.java | 14 ++++++++++---- pom.xml | 6 +++--- 6 files changed, 45 insertions(+), 27 deletions(-) diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml index f5c7f39b4e..ae7b3cb8d0 100644 --- a/curator-x-discovery-server/pom.xml +++ b/curator-x-discovery-server/pom.xml @@ -92,8 +92,8 @@ - org.mortbay.jetty - jetty + org.eclipse.jetty + jetty-webapp test diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java index 997cefea23..2d95bd6a4a 100644 --- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java +++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java @@ -40,12 +40,12 @@ import org.apache.curator.x.discovery.server.entity.ServiceNames; import org.apache.curator.x.discovery.server.mocks.MockServiceDiscovery; import org.apache.curator.x.discovery.strategies.RandomStrategy; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.ServletHolder; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; import java.util.Map; @@ -90,12 +90,16 @@ public Set getSingletons() return singletons; } }; - ServletContainer container = new ServletContainer(application); + ServletContainer container = new ServletContainer(application); port = InstanceSpec.getRandomPort(); server = new Server(port); - Context root = new Context(server, "/", Context.SESSIONS); - root.addServlet(new ServletHolder(container), "/*"); + ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); + root.setContextPath("/"); + final ServletHolder servletHolder = new ServletHolder(container); + root.addServlet(servletHolder, "/*"); + servletHolder.setInitOrder(1); + server.setHandler(root); server.start(); } diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java index 5ef198374d..83dd15535a 100644 --- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java +++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java @@ -38,12 +38,12 @@ import org.apache.curator.x.discovery.server.entity.ServiceNames; import org.apache.curator.x.discovery.server.mocks.MockServiceDiscovery; import org.apache.curator.x.discovery.strategies.RandomStrategy; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.ServletHolder; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; import java.util.Set; @@ -87,12 +87,16 @@ public Set getSingletons() return singletons; } }; - ServletContainer container = new ServletContainer(application); + ServletContainer container = new ServletContainer(application); port = InstanceSpec.getRandomPort(); server = new Server(port); - Context root = new Context(server, "/", Context.SESSIONS); - root.addServlet(new ServletHolder(container), "/*"); + ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); + root.setContextPath("/"); + final ServletHolder servletHolder = new ServletHolder(container); + root.addServlet(servletHolder, "/*"); + servletHolder.setInitOrder(1); + server.setHandler(root); server.start(); } diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java index 3efbc00b54..a86093e60a 100644 --- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java +++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java @@ -39,12 +39,12 @@ import org.apache.curator.x.discovery.server.entity.ServiceNames; import org.apache.curator.x.discovery.server.mocks.MockServiceDiscovery; import org.apache.curator.x.discovery.strategies.RandomStrategy; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.ServletHolder; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; import java.util.Set; @@ -88,12 +88,16 @@ public Set getSingletons() return singletons; } }; - ServletContainer container = new ServletContainer(application); + ServletContainer container = new ServletContainer(application); port = InstanceSpec.getRandomPort(); server = new Server(port); - Context root = new Context(server, "/", Context.SESSIONS); - root.addServlet(new ServletHolder(container), "/*"); + ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); + root.setContextPath("/"); + final ServletHolder servletHolder = new ServletHolder(container); + root.addServlet(servletHolder, "/*"); + servletHolder.setInitOrder(1); + server.setHandler(root); server.start(); } diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java index a6682dba28..e58f66ef5e 100644 --- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java +++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java @@ -27,15 +27,15 @@ import org.apache.curator.x.discovery.ServiceType; import org.apache.curator.x.discovery.server.entity.ServiceInstances; import org.apache.curator.x.discovery.server.entity.ServiceNames; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap; import org.jboss.resteasy.spi.ResteasyProviderFactory; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.ServletHolder; import javax.ws.rs.core.MediaType; import java.io.BufferedReader; import java.io.ByteArrayInputStream; @@ -65,10 +65,16 @@ public void setup() throws Exception port = InstanceSpec.getRandomPort(); server = new Server(port); - Context root = new Context(server, "/", Context.SESSIONS); + + ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); + root.setContextPath("/"); + root.setServer(server); + root.setContextPath("/"); root.getInitParams().put("javax.ws.rs.Application", RestEasyApplication.class.getName()); root.addServlet(new ServletHolder(dispatcher), "/*"); root.addEventListener(new ResteasyBootstrap()); + + server.setHandler(root); server.start(); } diff --git a/pom.xml b/pom.xml index f20689b917..bda4715eef 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ 2.2.11 1.1.1 - 6.1.26 + 9.4.45.v20220203 1.0.2 2.3.5.Final @@ -510,8 +510,8 @@ - org.mortbay.jetty - jetty + org.eclipse.jetty + jetty-webapp ${jetty-version}