ARTEMIS-909 - fix welcome files for root address with Jetty

https://issues.apache.org/jira/browse/ARTEMIS-909


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/58d47897
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/58d47897
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/58d47897

Branch: refs/heads/master
Commit: 58d47897c3a39f95fb10a2cb4dd636668e53896c
Parents: 973265b
Author: Andy Taylor <[email protected]>
Authored: Tue Jan 3 14:16:49 2017 +0000
Committer: Justin Bertram <[email protected]>
Committed: Thu Jan 5 09:07:30 2017 -0600

----------------------------------------------------------------------
 .../activemq/artemis/component/WebServerComponent.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/58d47897/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
----------------------------------------------------------------------
diff --git 
a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
 
b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
index a34d179..e24215c 100644
--- 
a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
+++ 
b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
@@ -37,6 +37,7 @@ import org.eclipse.jetty.server.SecureRequestCustomizer;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.server.handler.ContextHandler;
 import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.HandlerList;
 import org.eclipse.jetty.server.handler.ResourceHandler;
@@ -111,7 +112,12 @@ public class WebServerComponent implements 
ExternalComponent {
       DefaultHandler defaultHandler = new DefaultHandler();
       defaultHandler.setServeIcon(false);
 
-      handlers.addHandler(resourceHandler);
+      ContextHandler context = new ContextHandler();
+      context.setContextPath("/");
+      context.setResourceBase(warDir.toString());
+      context.setHandler(resourceHandler);
+
+      handlers.addHandler(context);
       handlers.addHandler(defaultHandler);
       server.setHandler(handlers);
    }

Reply via email to