Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstate ee9 jetty runner. #9383

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jetty-ee9/jetty-ee9-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@

<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>
<scope>test</scope>
</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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@

<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>
<scope>test</scope>
</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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions jetty-ee9/jetty-ee9-runner/src/it/test-jar-manifest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
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;
Expand All @@ -45,12 +45,10 @@
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;
Expand Down Expand Up @@ -322,15 +320,15 @@ else if ("STOP.PORT".equals(sysProps[0]))
}

//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();
Expand All @@ -340,16 +338,16 @@ else if ("STOP.PORT".equals(sysProps[0]))
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)
{
Expand All @@ -375,7 +373,7 @@ else if ("STOP.PORT".equals(sysProps[0]))
}

//ensure a DefaultHandler is present
if (handlers.getChildHandlerByClass(DefaultHandler.class) == null)
if (handlers.getDescendant(DefaultHandler.class) == null)
{
handlers.addHandler(new DefaultHandler());
}
Expand Down Expand Up @@ -493,15 +491,15 @@ else if ("STOP.PORT".equals(sysProps[0]))
}
}

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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
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;

Expand All @@ -38,7 +38,7 @@ public void testGet() throws Exception
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
{
Expand All @@ -62,5 +62,4 @@ private String findServerUri() throws Exception

throw new Exception("cannot find started Jetty");
}

}
2 changes: 1 addition & 1 deletion jetty-ee9/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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>
Expand Down