diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java index ee300048872..49ae8e06a98 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java @@ -226,12 +226,17 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory, { if (_defaultStylesheet == null) { - _defaultStylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css")); + _defaultStylesheet = getDefaultStylesheet(); } return _defaultStylesheet; } } + public static Resource getDefaultStylesheet() + { + return Resource.newResource(ResourceHandler.class.getResource("/jetty-dir.css")); + } + public String[] getWelcomeFiles() { return _welcomes; diff --git a/jetty-util/src/main/resources/jetty-dir.css b/jetty-server/src/main/resources/jetty-dir.css similarity index 100% rename from jetty-util/src/main/resources/jetty-dir.css rename to jetty-server/src/main/resources/jetty-dir.css diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java index 04dcd3e2193..6e661378d62 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java @@ -41,6 +41,7 @@ import org.eclipse.jetty.server.ResourceContentFactory; import org.eclipse.jetty.server.ResourceService; import org.eclipse.jetty.server.ResourceService.WelcomeFactory; import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -222,7 +223,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc } if (_stylesheet == null) { - _stylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css")); + _stylesheet = ResourceHandler.getDefaultStylesheet(); } } catch (Exception e) diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java index b5fb2eaf69f..57956fdc1e7 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java @@ -202,8 +202,11 @@ public class DemoBaseTests extends AbstractDistributionTest assertTrue(run.awaitConsoleLogsFor("Started @", 10, TimeUnit.SECONDS)); startHttpClient(); - ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/hello"); - assertEquals(HttpStatus.OK_200, response.getStatus()); + ContentResponse helloResponse = client.GET("http://localhost:" + httpPort + "/test/hello"); + assertEquals(HttpStatus.OK_200, helloResponse.getStatus()); + + ContentResponse cssResponse = client.GET("http://localhost:" + httpPort + "/jetty-dir.css"); + assertEquals(HttpStatus.OK_200, cssResponse.getStatus()); } }