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 org.eclipse.jetty.server.Handler;
|
||||
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.ResourceHandler;
|
||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
|
@ -238,12 +236,12 @@ public class CliOverlord extends ServerRunnable
|
|||
@Override
|
||||
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 ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
||||
|
||||
final ResourceHandler resourceHandler = new ResourceHandler();
|
||||
resourceHandler.setBaseResource(
|
||||
ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
|
||||
|
||||
root.addServlet(holderPwd, "/");
|
||||
root.setBaseResource(
|
||||
new ResourceCollection(
|
||||
new String[]{
|
||||
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);
|
||||
root.setContextPath("/");
|
||||
// Can't use /* here because of Guice and Jetty static content conflicts
|
||||
root.addFilter(GuiceFilter.class, "/druid/*", null);
|
||||
|
||||
HandlerList handlerList = new HandlerList();
|
||||
handlerList.setHandlers(new Handler[]{redirect, resourceHandler, root, new DefaultHandler()});
|
||||
server.setHandler(handlerList);
|
||||
handlerList.setHandlers(new Handler[]{root});
|
||||
|
||||
root.addServlet(new ServletHolder(new DefaultServlet()), "/*");
|
||||
root.addFilter(GzipFilter.class, "/*", null);
|
||||
root.addFilter(GuiceFilter.class, "/*", null);
|
||||
server.setHandler(handlerList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,7 @@ import io.druid.server.http.RedirectFilter;
|
|||
import io.druid.server.initialization.JettyServerInitializer;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
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.ResourceHandler;
|
||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
|
@ -42,22 +40,23 @@ class CoordinatorJettyServerInitializer implements JettyServerInitializer
|
|||
@Override
|
||||
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);
|
||||
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.setHandlers(new Handler[]{redirect, resourceHandler, root, new DefaultHandler()});
|
||||
server.setHandler(handlerList);
|
||||
handlerList.setHandlers(new Handler[]{root});
|
||||
|
||||
root.addServlet(new ServletHolder(new DefaultServlet()), "/*");
|
||||
root.addFilter(GzipFilter.class, "/*", null);
|
||||
root.addFilter(GuiceFilter.class, "/*", null);
|
||||
server.setHandler(handlerList);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue