Reinstate ee9 jetty runner. (#9383)

This commit is contained in:
Jan Bartel 2023-02-17 08:34:14 +11:00 committed by GitHub
parent af78d13030
commit ea042776bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 47 deletions

View File

@ -106,7 +106,7 @@
<configuration>
<archive>
<manifest>
<mainClass>org.eclipse.jetty.runner.Runner</mainClass>
<mainClass>org.eclipse.jetty.ee9.runner.Runner</mainClass>
</manifest>
<manifestEntries>
<Comment>Jetty Runner</Comment>
@ -132,7 +132,7 @@
<artifactId>jetty-ee9-jaas</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9</groupId>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jetty-server</artifactId>
</dependency>
<dependency>
@ -158,7 +158,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<artifactId>jetty-ee9-demo-simple-webapp</artifactId>
<type>war</type>
<scope>test</scope>
</dependency>

View File

@ -15,13 +15,13 @@
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
<classifier>tests</classifier>
<type>test-jar</type>
@ -29,7 +29,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<artifactId>jetty-ee9-demo-simple-webapp</artifactId>
<version>@project.version@</version>
<type>war</type>
</dependency>
@ -64,8 +64,8 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
<type>jar</type>
<overWrite>false</overWrite>
@ -74,7 +74,7 @@
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<artifactId>jetty-ee9-demo-simple-webapp</artifactId>
<version>@project.version@</version>
<type>war</type>
<overWrite>false</overWrite>
@ -130,7 +130,7 @@
<systemPropertyVariables>
</systemPropertyVariables>
<dependenciesToScan>
<dependency>org.eclipse.jetty:jetty-runner</dependency>
<dependency>org.eclipse.jetty.ee9:jetty-ee9-runner</dependency>
</dependenciesToScan>
</configuration>
</plugin>

View File

@ -15,13 +15,13 @@
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
<classifier>tests</classifier>
<type>test-jar</type>
@ -29,7 +29,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<artifactId>jetty-ee9-demo-simple-webapp</artifactId>
<version>@project.version@</version>
<type>war</type>
</dependency>
@ -64,8 +64,8 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
<type>jar</type>
<overWrite>false</overWrite>
@ -74,7 +74,7 @@
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<artifactId>jetty-ee9-demo-simple-webapp</artifactId>
<version>@project.version@</version>
<type>war</type>
<overWrite>false</overWrite>
@ -130,7 +130,7 @@
<systemPropertyVariables>
</systemPropertyVariables>
<dependenciesToScan>
<dependency>org.eclipse.jetty:jetty-runner</dependency>
<dependency>org.eclipse.jetty.ee9:jetty-ee9-runner</dependency>
</dependenciesToScan>
</configuration>
</plugin>

View File

@ -15,8 +15,8 @@
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
</dependency>
</dependencies>
@ -38,8 +38,8 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-runner</artifactId>
<version>@project.version@</version>
<type>jar</type>
<overWrite>false</overWrite>

View File

@ -8,4 +8,4 @@ JarFile jar = new JarFile( artifact );
Attributes manifest = jar.getManifest().getMainAttributes();
assert manifest.getValue( new Attributes.Name( "Main-Class" ) ).equals( "org.eclipse.jetty.runner.Runner" )
assert manifest.getValue( new Attributes.Name( "Main-Class" ) ).equals( "org.eclipse.jetty.ee9.runner.Runner" )

View File

@ -28,13 +28,13 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.eclipse.jetty.ee9.nested.ContextHandler;
import org.eclipse.jetty.ee9.nested.SessionHandler;
import org.eclipse.jetty.ee9.security.ConstraintMapping;
import org.eclipse.jetty.ee9.security.ConstraintSecurityHandler;
import org.eclipse.jetty.ee9.security.HashLoginService;
import org.eclipse.jetty.ee9.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;
import org.eclipse.jetty.ee9.servlet.StatisticsServlet;
import org.eclipse.jetty.ee9.webapp.MetaInfConfiguration;
import org.eclipse.jetty.ee9.webapp.WebAppContext;
import org.eclipse.jetty.io.ConnectionStatistics;
@ -45,12 +45,10 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.ShutdownMonitor;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.StatisticsHandler;
import org.eclipse.jetty.session.SessionHandler;
import org.eclipse.jetty.util.FileID;
import org.eclipse.jetty.util.RolloverFileOutputStream;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.resource.Resource;
@ -322,15 +320,15 @@ public class Runner
}
//check that everything got configured, and if not, make the handlers
HandlerCollection handlers = _server.getChildHandlerByClass(HandlerCollection.class);
Handler.Sequence handlers = _server.getDescendant(Handler.Sequence.class);
if (handlers == null)
{
handlers = new HandlerList();
handlers = new Handler.Sequence();
_server.setHandler(handlers);
}
//check if contexts already configured
_contexts = handlers.getChildHandlerByClass(ContextHandlerCollection.class);
_contexts = handlers.getDescendant(ContextHandlerCollection.class);
if (_contexts == null)
{
_contexts = new ContextHandlerCollection();
@ -340,16 +338,16 @@ public class Runner
if (_enableStats)
{
//if no stats handler already configured
if (handlers.getChildHandlerByClass(StatisticsHandler.class) == null)
if (handlers.getDescendant(StatisticsHandler.class) == null)
{
StatisticsHandler statsHandler = new StatisticsHandler();
Handler oldHandler = _server.getHandler();
statsHandler.setHandler(oldHandler);
_server.setHandler(statsHandler);
ServletContextHandler statsContext = new ServletContextHandler(_contexts, "/stats");
statsContext.addServlet(new ServletHolder(new StatisticsServlet()), "/");
statsContext.setSessionHandler(new SessionHandler());
if (_statsPropFile != null)
{
@ -375,7 +373,7 @@ public class Runner
}
//ensure a DefaultHandler is present
if (handlers.getChildHandlerByClass(DefaultHandler.class) == null)
if (handlers.getDescendant(DefaultHandler.class) == null)
{
handlers.addHandler(new DefaultHandler());
}
@ -493,15 +491,15 @@ public class Runner
}
}
protected void prependHandler(Handler handler, HandlerCollection handlers)
protected void prependHandler(Handler handler, Handler.Sequence handlers)
{
if (handler == null || handlers == null)
return;
Handler[] existing = handlers.getChildHandlers();
Handler[] children = new Handler[existing.length + 1];
children[0] = handler;
System.arraycopy(existing, 0, children, 1, existing.length);
List<Handler> existing = handlers.getHandlers();
List<Handler> children = new ArrayList<>(existing.size() + 1);
children.add(handler);
children.addAll(existing);
handlers.setHandlers(children);
}

View File

@ -18,8 +18,8 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.eclipse.jetty.client.ContentResponse;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
@ -38,7 +38,7 @@ public class IntegrationTestJettyRunner
httpClient.start();
ContentResponse response = httpClient.newRequest(serverUri).send();
String res = response.getContentAsString();
assertThat(res, Matchers.containsString("Hello World!"));
assertThat(res, Matchers.containsString("Hello World EE9!"));
}
finally
{
@ -62,5 +62,4 @@ public class IntegrationTestJettyRunner
throw new Exception("cannot find started Jetty");
}
}

View File

@ -65,7 +65,7 @@
<module>jetty-ee9-plus</module>
<module>jetty-ee9-proxy</module>
<module>jetty-ee9-quickstart</module>
<!-- <module>jetty-ee9-runner</module>-->
<module>jetty-ee9-runner</module>
<module>jetty-ee9-websocket</module>
<module>jetty-ee9-tests</module>
<module>jetty-ee9-bom</module>