mirror of https://github.com/apache/druid.git
fix redirects in druid
This commit is contained in:
parent
48d677d135
commit
bbb2754a7c
|
@ -79,9 +79,7 @@ import io.druid.tasklogs.TaskLogStreamer;
|
||||||
import io.druid.tasklogs.TaskLogs;
|
import io.druid.tasklogs.TaskLogs;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
|
||||||
import org.eclipse.jetty.server.handler.HandlerList;
|
import org.eclipse.jetty.server.handler.HandlerList;
|
||||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.eclipse.jetty.servlet.FilterHolder;
|
import org.eclipse.jetty.servlet.FilterHolder;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
@ -238,12 +236,12 @@ public class CliOverlord extends ServerRunnable
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Server server, Injector injector)
|
public void initialize(Server server, Injector injector)
|
||||||
{
|
{
|
||||||
final ServletContextHandler redirect = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
||||||
redirect.setContextPath("/");
|
|
||||||
redirect.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null);
|
|
||||||
|
|
||||||
final ResourceHandler resourceHandler = new ResourceHandler();
|
ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
|
||||||
resourceHandler.setBaseResource(
|
|
||||||
|
root.addServlet(holderPwd, "/");
|
||||||
|
root.setBaseResource(
|
||||||
new ResourceCollection(
|
new ResourceCollection(
|
||||||
new String[]{
|
new String[]{
|
||||||
TaskMaster.class.getClassLoader().getResource("static").toExternalForm(),
|
TaskMaster.class.getClassLoader().getResource("static").toExternalForm(),
|
||||||
|
@ -251,17 +249,17 @@ public class CliOverlord extends ServerRunnable
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
//root.setResourceBase(DruidCoordinator.class.getClassLoader().getResource("static").toExternalForm());
|
||||||
|
root.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null);
|
||||||
|
root.addFilter(GzipFilter.class, "/*", null);
|
||||||
|
|
||||||
final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
// Can't use /* here because of Guice and Jetty static content conflicts
|
||||||
root.setContextPath("/");
|
root.addFilter(GuiceFilter.class, "/druid/*", null);
|
||||||
|
|
||||||
HandlerList handlerList = new HandlerList();
|
HandlerList handlerList = new HandlerList();
|
||||||
handlerList.setHandlers(new Handler[]{redirect, resourceHandler, root, new DefaultHandler()});
|
handlerList.setHandlers(new Handler[]{root});
|
||||||
server.setHandler(handlerList);
|
|
||||||
|
|
||||||
root.addServlet(new ServletHolder(new DefaultServlet()), "/*");
|
server.setHandler(handlerList);
|
||||||
root.addFilter(GzipFilter.class, "/*", null);
|
|
||||||
root.addFilter(GuiceFilter.class, "/*", null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,7 @@ import io.druid.server.http.RedirectFilter;
|
||||||
import io.druid.server.initialization.JettyServerInitializer;
|
import io.druid.server.initialization.JettyServerInitializer;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
|
||||||
import org.eclipse.jetty.server.handler.HandlerList;
|
import org.eclipse.jetty.server.handler.HandlerList;
|
||||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.eclipse.jetty.servlet.FilterHolder;
|
import org.eclipse.jetty.servlet.FilterHolder;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
@ -42,22 +40,23 @@ class CoordinatorJettyServerInitializer implements JettyServerInitializer
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Server server, Injector injector)
|
public void initialize(Server server, Injector injector)
|
||||||
{
|
{
|
||||||
final ServletContextHandler redirect = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
|
||||||
redirect.setContextPath("/");
|
|
||||||
redirect.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null);
|
|
||||||
|
|
||||||
final ResourceHandler resourceHandler = new ResourceHandler();
|
|
||||||
resourceHandler.setResourceBase(DruidCoordinator.class.getClassLoader().getResource("static").toExternalForm());
|
|
||||||
|
|
||||||
final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
||||||
root.setContextPath("/");
|
|
||||||
|
ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
|
||||||
|
|
||||||
|
root.addServlet(holderPwd, "/");
|
||||||
|
root.setResourceBase(DruidCoordinator.class.getClassLoader().getResource("static").toExternalForm());
|
||||||
|
root.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null);
|
||||||
|
root.addFilter(GzipFilter.class, "/*", null);
|
||||||
|
|
||||||
|
// Can't use '/*' here because of Guice and Jetty static content conflicts
|
||||||
|
// The coordinator really needs a standarized api path
|
||||||
|
root.addFilter(GuiceFilter.class, "/info/*", null);
|
||||||
|
root.addFilter(GuiceFilter.class, "/coordinator/*", null);
|
||||||
|
|
||||||
HandlerList handlerList = new HandlerList();
|
HandlerList handlerList = new HandlerList();
|
||||||
handlerList.setHandlers(new Handler[]{redirect, resourceHandler, root, new DefaultHandler()});
|
handlerList.setHandlers(new Handler[]{root});
|
||||||
server.setHandler(handlerList);
|
|
||||||
|
|
||||||
root.addServlet(new ServletHolder(new DefaultServlet()), "/*");
|
server.setHandler(handlerList);
|
||||||
root.addFilter(GzipFilter.class, "/*", null);
|
|
||||||
root.addFilter(GuiceFilter.class, "/*", null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue