Skip to content

Commit

Permalink
ARTEMIS-5226 Jetty choking on bad URI
Browse files Browse the repository at this point in the history
When the broker is started on Windows Jetty logs an exception at DEBUG
level regarding a malformed URL which is set via the
setBaseResourceAsString method on either
org.eclipse.jetty.server.handler.ResourceHandler or
org.eclipse.jetty.server.handler.ContextHandler.

This commit fixes that by using setBaseResourceAsPath instead. It also
removes 2 instances of setBaseResourceAsString on the ResourceHandler.
These are not necessary because the value set on the ContextHandler will
suffice.
  • Loading branch information
jbertram authored and gemmellr committed Jan 9, 2025
1 parent a069a14 commit 3bac04a
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,22 @@ public void requestDestroyed(ServletRequestEvent sre) {
server.setConnectors(connectors);

ResourceHandler homeResourceHandler = new ResourceHandler();
homeResourceHandler.setBaseResourceAsString(homeWarDir.toString());
homeResourceHandler.setDirAllowed(false);
homeResourceHandler.setWelcomeFiles("index.html");

ContextHandler homeContext = new ContextHandler();
homeContext.setContextPath("/");
homeContext.setBaseResourceAsString(homeWarDir.toString());
homeContext.setBaseResourceAsPath(homeWarDir);
homeContext.setHandler(homeResourceHandler);
homeContext.setVirtualHosts(Arrays.asList(virtualHosts));

ResourceHandler instanceResourceHandler = new ResourceHandler();
instanceResourceHandler.setBaseResourceAsString(instanceWarDir.toString());
instanceResourceHandler.setDirAllowed(false);
instanceResourceHandler.setWelcomeFiles("index.html");

ContextHandler instanceContext = new ContextHandler();
instanceContext.setContextPath("/");
instanceContext.setBaseResourceAsString(instanceWarDir.toString());
instanceContext.setBaseResourceAsPath(instanceWarDir);
instanceContext.setHandler(instanceResourceHandler);
instanceContext.setVirtualHosts(Arrays.asList(virtualHosts));

Expand Down

0 comments on commit 3bac04a

Please sign in to comment.