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

Fixes #5488 - jetty-dir.css not found when using JPMS. #5491

Merged
merged 1 commit into from
Nov 2, 2020
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ -223,7 +224,7 @@ public void init()
}
if (_stylesheet == null)
{
_stylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css"));
_stylesheet = ResourceHandler.getDefaultStylesheet();
}
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
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