Search in sources :

Example 1 with ServletFilterHolder

use of io.druid.server.initialization.jetty.ServletFilterHolder in project druid by druid-io.

the class JettyTest method setupInjector.

@Override
protected Injector setupInjector() {
    return Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of(new Module() {

        @Override
        public void configure(Binder binder) {
            JsonConfigProvider.bindInstance(binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", null));
            binder.bind(JettyServerInitializer.class).to(JettyServerInit.class).in(LazySingleton.class);
            Multibinder<ServletFilterHolder> multibinder = Multibinder.newSetBinder(binder, ServletFilterHolder.class);
            multibinder.addBinding().toInstance(new ServletFilterHolder() {

                @Override
                public String getPath() {
                    return "/*";
                }

                @Override
                public Map<String, String> getInitParameters() {
                    return null;
                }

                @Override
                public Class<? extends Filter> getFilterClass() {
                    return DummyAuthFilter.class;
                }

                @Override
                public Filter getFilter() {
                    return null;
                }

                @Override
                public EnumSet<DispatcherType> getDispatcherType() {
                    return null;
                }
            });
            Jerseys.addResource(binder, SlowResource.class);
            Jerseys.addResource(binder, ExceptionResource.class);
            Jerseys.addResource(binder, DefaultResource.class);
            LifecycleModule.register(binder, Server.class);
        }
    }));
}
Also used : EnumSet(java.util.EnumSet) Self(io.druid.guice.annotations.Self) ServletFilterHolder(io.druid.server.initialization.jetty.ServletFilterHolder) Binder(com.google.inject.Binder) Filter(javax.servlet.Filter) DruidNode(io.druid.server.DruidNode) Module(com.google.inject.Module) LifecycleModule(io.druid.guice.LifecycleModule) Map(java.util.Map)

Aggregations

Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 LifecycleModule (io.druid.guice.LifecycleModule)1 Self (io.druid.guice.annotations.Self)1 DruidNode (io.druid.server.DruidNode)1 ServletFilterHolder (io.druid.server.initialization.jetty.ServletFilterHolder)1 EnumSet (java.util.EnumSet)1 Map (java.util.Map)1 Filter (javax.servlet.Filter)1