diff --git a/server/src/main/java/io/druid/server/http/BackwardsCompatiableInfoResource.java b/server/src/main/java/io/druid/server/http/BackwardsCompatiableInfoResource.java new file mode 100644 index 00000000000..2d49b0c6884 --- /dev/null +++ b/server/src/main/java/io/druid/server/http/BackwardsCompatiableInfoResource.java @@ -0,0 +1,48 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package io.druid.server.http; + +import com.google.inject.Inject; +import io.druid.client.InventoryView; +import io.druid.client.indexing.IndexingServiceClient; +import io.druid.db.DatabaseRuleManager; +import io.druid.db.DatabaseSegmentManager; +import io.druid.server.master.DruidMaster; + +import javax.annotation.Nullable; +import javax.ws.rs.Path; + +/** + */ +@Path("/static/info") +public class BackwardsCompatiableInfoResource extends InfoResource +{ + @Inject + public BackwardsCompatiableInfoResource( + DruidMaster master, + InventoryView serverInventoryView, + DatabaseSegmentManager databaseSegmentManager, + DatabaseRuleManager databaseRuleManager, + @Nullable IndexingServiceClient indexingServiceClient + ) + { + super(master, serverInventoryView, databaseSegmentManager, databaseRuleManager, indexingServiceClient); + } +} diff --git a/services/src/main/java/io/druid/cli/CliBroker.java b/services/src/main/java/io/druid/cli/CliBroker.java index 23b8a00366d..d27be088956 100644 --- a/services/src/main/java/io/druid/cli/CliBroker.java +++ b/services/src/main/java/io/druid/cli/CliBroker.java @@ -20,6 +20,8 @@ package io.druid.cli; import com.google.common.collect.ImmutableList; +import com.google.inject.Injector; +import com.google.inject.servlet.GuiceFilter; import com.metamx.common.logger.Logger; import io.airlift.command.Command; import io.druid.client.cache.CacheMonitor; @@ -34,11 +36,18 @@ import io.druid.guice.ServerModule; import io.druid.guice.ServerViewModule; import io.druid.guice.annotations.Client; import io.druid.guice.annotations.Self; +import io.druid.server.ClientInfoResource; import io.druid.server.ClientQuerySegmentWalker; import io.druid.server.StatusResource; import io.druid.server.initialization.EmitterModule; import io.druid.server.initialization.JettyServerModule; import io.druid.server.metrics.MetricsModule; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.HandlerList; +import org.eclipse.jetty.servlet.DefaultServlet; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import java.util.List; @@ -68,7 +77,8 @@ public class CliBroker extends ServerRunnable new MetricsModule().register(CacheMonitor.class), new DiscoveryModule().register(Self.class), new ServerModule(), - new JettyServerModule(new QueryJettyServerInitializer()) + new JettyServerModule(new BrokerJettyServerInitializer()) + .addResource(ClientInfoResource.class) .addResource(StatusResource.class), new QueryableModule(ClientQuerySegmentWalker.class), new QueryToolChestModule(), @@ -77,4 +87,21 @@ public class CliBroker extends ServerRunnable new BrokerModule() ); } + + private static class BrokerJettyServerInitializer extends QueryJettyServerInitializer + { + @Override + public void initialize(Server server, Injector injector) + { + super.initialize(server, injector); + + final ServletContextHandler resources = new ServletContextHandler(ServletContextHandler.SESSIONS); + resources.addServlet(new ServletHolder(new DefaultServlet()), "/*"); + resources.addFilter(GuiceFilter.class, "/druid/v2/datasources/*", null); + + final HandlerList handlerList = new HandlerList(); + handlerList.setHandlers(new Handler[]{resources}); + server.setHandler(handlerList); + } + } } diff --git a/services/src/main/java/io/druid/cli/CliCoordinator.java b/services/src/main/java/io/druid/cli/CliCoordinator.java index 039284ab032..027edaf0901 100644 --- a/services/src/main/java/io/druid/cli/CliCoordinator.java +++ b/services/src/main/java/io/druid/cli/CliCoordinator.java @@ -36,6 +36,7 @@ import io.druid.guice.ServerModule; import io.druid.guice.ServerViewModule; import io.druid.guice.annotations.Self; import io.druid.server.StatusResource; +import io.druid.server.http.BackwardsCompatiableInfoResource; import io.druid.server.http.InfoResource; import io.druid.server.http.MasterResource; import io.druid.server.http.RedirectFilter; @@ -87,6 +88,7 @@ public class CliCoordinator extends ServerRunnable new ServerModule(), new JettyServerModule(new CoordinatorJettyServerInitializer()) .addResource(InfoResource.class) + .addResource(BackwardsCompatiableInfoResource.class) .addResource(MasterResource.class) .addResource(StatusResource.class), new ServerViewModule(),