Skip to content

Commit

Permalink
Merge pull request #5491 from eclipse/jetty-9.4.x-5488-jetty-dir.css
Browse files Browse the repository at this point in the history
Fixes #5488 - jetty-dir.css not found when using JPMS.
  • Loading branch information
sbordet committed Nov 2, 2020
2 parents 40acf60 + 4a4a73d commit a1b3d33
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Expand Up @@ -226,12 +226,17 @@ public Resource getStylesheet()
{
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;
Expand Down
File renamed without changes.
Expand Up @@ -41,6 +41,7 @@
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;
Expand Down Expand Up @@ -222,7 +223,7 @@ public void init()
}
if (_stylesheet == null)
{
_stylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css"));
_stylesheet = ResourceHandler.getDefaultStylesheet();
}
}
catch (Exception e)
Expand Down
Expand Up @@ -202,8 +202,11 @@ public void testJPMS() throws Exception
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());
}
}

Expand Down

0 comments on commit a1b3d33

Please sign in to comment.