Skip to content

Commit

Permalink
CURATOR-630 Upgrade jetty to 9.4.latest (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
horvathdora authored Mar 30, 2022
1 parent ab58c4c commit 5ca31e3
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 27 deletions.
4 changes: 2 additions & 2 deletions curator-x-discovery-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
</dependency>

<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,12 +90,16 @@ public Set<Object> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,12 +87,16 @@ public Set<Object> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -88,12 +88,16 @@ public Set<Object> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<!-- See https://stackoverflow.com/questions/43574426#comment93992044_43574427 -->
<jaxb-version>2.2.11</jaxb-version>
<javax-activation-version>1.1.1</javax-activation-version>
<jetty-version>6.1.26</jetty-version>
<jetty-version>9.4.45.v20220203</jetty-version>
<scannotation-version>1.0.2</scannotation-version>
<!-- resteasy-jaxrs dependency cannot be higher than 2.x for compatibility with Jersey 1.x -->
<resteasy-jaxrs-version>2.3.5.Final</resteasy-jaxrs-version>
Expand Down Expand Up @@ -510,8 +510,8 @@
</dependency>

<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty-version}</version>
</dependency>

Expand Down

0 comments on commit 5ca31e3

Please sign in to comment.