diff --git a/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorConfig.java b/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorConfig.java index d53d53cf664..571e70ee3bd 100644 --- a/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorConfig.java +++ b/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorConfig.java @@ -59,4 +59,10 @@ public abstract class DruidCoordinatorConfig { return new Duration(15 * 60 * 1000); } + + @Config("druid.coordinator.console.static") + public String getConsoleStatic() + { + return null; + } } diff --git a/services/src/main/java/io/druid/cli/CliCoordinator.java b/services/src/main/java/io/druid/cli/CliCoordinator.java index 1c551c3e402..f50eb538ce8 100644 --- a/services/src/main/java/io/druid/cli/CliCoordinator.java +++ b/services/src/main/java/io/druid/cli/CliCoordinator.java @@ -108,7 +108,9 @@ public class CliCoordinator extends ServerRunnable LifecycleModule.register(binder, DruidCoordinator.class); - binder.bind(JettyServerInitializer.class).toInstance(new CoordinatorJettyServerInitializer()); + binder.bind(JettyServerInitializer.class) + .to(CoordinatorJettyServerInitializer.class); + Jerseys.addResource(binder, BackwardsCompatibleInfoResource.class); Jerseys.addResource(binder, InfoResource.class); Jerseys.addResource(binder, BackwardsCompatibleCoordinatorResource.class); diff --git a/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java b/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java index 5f1ad32edd7..099f742d560 100644 --- a/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java +++ b/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java @@ -19,9 +19,11 @@ package io.druid.cli; +import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.servlet.GuiceFilter; import io.druid.server.coordinator.DruidCoordinator; +import io.druid.server.coordinator.DruidCoordinatorConfig; import io.druid.server.http.RedirectFilter; import io.druid.server.initialization.JettyServerInitializer; import org.eclipse.jetty.server.Handler; @@ -32,11 +34,20 @@ import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlets.GzipFilter; +import org.eclipse.jetty.util.resource.Resource; /** */ class CoordinatorJettyServerInitializer implements JettyServerInitializer { + private final DruidCoordinatorConfig config; + + @Inject + CoordinatorJettyServerInitializer(DruidCoordinatorConfig config) + { + this.config = config; + } + @Override public void initialize(Server server, Injector injector) { @@ -45,7 +56,12 @@ class CoordinatorJettyServerInitializer implements JettyServerInitializer ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class); root.addServlet(holderPwd, "/"); - root.setResourceBase(DruidCoordinator.class.getClassLoader().getResource("static").toExternalForm()); + if(config.getConsoleStatic() == null) { + root.setBaseResource(Resource.newClassPathResource("static")); + } else { + root.setResourceBase(config.getConsoleStatic()); + } + root.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null); root.addFilter(GzipFilter.class, "/*", null);