Tabnine Logo
com.google.inject.servlet
Code IndexAdd Tabnine to your IDE (free)

How to use com.google.inject.servlet

Best Java code snippets using com.google.inject.servlet (Showing top 20 results out of 792)

origin: Qihoo360/XLearning

@RequestScoped
public class App {
 final ApplicationContext context;

 @Inject
 App(ApplicationContext context) {
  this.context = context;
 }
}

origin: ninjaframework/ninja

@Override
public void init(FilterConfig filterConfig) throws ServletException {
  this.wrapped.init(filterConfig);
}

origin: ninjaframework/ninja

@Override
public void destroy() {
  this.wrapped.destroy();
}
origin: apache/incubator-gobblin

 @Override
 protected void configureServlets() {
  serve("/*").with(GuiceRestliServlet.class);
 }
});
origin: kairosdb/kairosdb

  @Override
  protected void configureServlets()
  {
    binder().requireExplicitBindings();
    bind(GuiceFilter.class);

    //Bind web server
    bind(WebServer.class);

    //Bind resource classes here
    bind(MetricsResource.class).in(Scopes.SINGLETON);
    bind(MetadataResource.class).in(Scopes.SINGLETON);
    bind(FeaturesResource.class).in(Scopes.SINGLETON);

    bind(GuiceContainer.class);

    bind(LoggingFilter.class).in(Scopes.SINGLETON);
    filter("/*").through(LoggingFilter.class);

    // hook Jackson into Jersey as the POJO <-> JSON mapper
    bind(JacksonJsonProvider.class).in(Scopes.SINGLETON);
    serve("/*").with(GuiceContainer.class);

    //
    bind(InvalidServerTypeExceptionMapper.class).in(Scopes.SINGLETON);
  }
}
origin: apache/shiro

  @Override
  protected void configureServlets() {
    filter(pattern).through(GuiceShiroFilter.class);
  }
};
origin: apache/incubator-gobblin

@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
 close();
 super.contextDestroyed(servletContextEvent);
}
origin: ninjaframework/ninja

@Override
public void contextInitialized(ServletContextEvent servletContextEvent) { 
  contextPath = servletContextEvent.getServletContext().getContextPath();
  
  // websocket enabled servlet containers populate this attribute with JSR 356
  // we save it here so we can inject it later into guice
  if (SwissKnife.doesClassExist(
      WebsocketGuiceModuleCreator.WEBSOCKET_SERVER_CONTAINER_CLASSNAME, 
      this)) {
    
    this.webSocketModule = WebsocketGuiceModuleCreator.getWebsocketServerContainerIfPossible(
        servletContextEvent.getServletContext()); 
  }
  super.contextInitialized(servletContextEvent);
}
origin: ninjaframework/ninja

public NinjaServletFilter() {
  this.wrapped = new GuiceFilter();
}
origin: stackoverflow.com

 @Override
protected Injector getInjector() {
  return Guice.createInjector(
      new ServletModule() {
        @Override protected void configureServlets() {
          serve("/index.html").with(IndexController.class);
        }
      },
      new ListModule());
}
origin: Netflix/Priam

  @Override
  protected void configureServlets() {
    Map<String, String> params = new HashMap<>();
    params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "unbound");
    params.put("com.sun.jersey.config.property.packages", "com.netflix.priam.resources");
    params.put(ServletContainer.PROPERTY_FILTER_CONTEXT_PATH, "/REST");
    serve("/REST/*").with(GuiceContainer.class, params);
  }
}
origin: kairosdb/kairosdb

  @Override
  protected void configureServlets()
  {
    bind(ConsumerTokenStore.class).toInstance(m_tokenStore);

    bind(OAuthFilter.class).in(Singleton.class);
    filter("/api/*").through(OAuthFilter.class);
  }
}
origin: spotbugs/spotbugs

@RequestScoped
public class TestClass2 {
 @Inject
 public TestClass2(String unassisted, @Assisted String assisted) {
 }
}
origin: ninjaframework/ninja

@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
  ninjaBootstrap.shutdown();
  super.contextDestroyed(servletContextEvent);
}

origin: apache/incubator-gobblin

@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
 ServletContext context = servletContextEvent.getServletContext();
 Enumeration<String> parameters = context.getInitParameterNames();
 Map<String, String> configMap = Maps.newHashMap();
 while (parameters.hasMoreElements()) {
  String key = parameters.nextElement();
  configMap.put(key, context.getInitParameter(key));
 }
 initialize(ConfigFactory.parseMap(configMap));
 super.contextInitialized(servletContextEvent);
}
origin: ninjaframework/ninja

@Override
protected void configureServlets() {
  bind(NinjaServletDispatcher.class).asEagerSingleton();
  serve("/*").with(NinjaServletDispatcher.class);
}
origin: kairosdb/kairosdb

  @Override
  protected void configureServlets()
  {
    bind(MetricReporterService.class).in(Singleton.class);

    bind(MonitorFilter.class).in(Scopes.SINGLETON);
    filter("/*").through(MonitorFilter.class);

    bind(DataPointsMonitor.class).in(Scopes.SINGLETON);

    KairosMetricReporterListProvider reporterProvider = new KairosMetricReporterListProvider();
    bind(KairosMetricReporterListProvider.class).toInstance(reporterProvider);

    bindListener(Matchers.any(), reporterProvider);
  }
}
origin: apache/usergrid

@Path("status")
@RequestScoped
public class StatusResource {
  private static final Logger logger = LoggerFactory.getLogger( StatusResource.class );
origin: Netflix/Priam

@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
  try {
    for (Scheduler scheduler :
        injector.getInstance(SchedulerFactory.class).getAllSchedulers()) {
      scheduler.shutdown();
    }
  } catch (SchedulerException e) {
    throw new RuntimeException(e);
  }
  super.contextDestroyed(servletContextEvent);
}
origin: apache/incubator-druid

@Override
protected void configureServlets()
{
 Binder binder = binder();
 JsonConfigProvider.bind(binder, "druid.server.http", ServerConfig.class);
 JsonConfigProvider.bind(binder, "druid.server.https", TLSServerConfig.class);
 binder.bind(GuiceContainer.class).to(DruidGuiceContainer.class);
 binder.bind(DruidGuiceContainer.class).in(Scopes.SINGLETON);
 binder.bind(CustomExceptionMapper.class).in(Singleton.class);
 binder.bind(ForbiddenExceptionMapper.class).in(Singleton.class);
 serve("/*").with(DruidGuiceContainer.class);
 Jerseys.addResource(binder, StatusResource.class);
 binder.bind(StatusResource.class).in(LazySingleton.class);
 // Adding empty binding for ServletFilterHolders and Handlers so that injector returns an empty set if none
 // are provided by extensions.
 Multibinder.newSetBinder(binder, Handler.class);
 Multibinder.newSetBinder(binder, ServletFilterHolder.class);
 MetricsModule.register(binder, JettyMonitor.class);
}
com.google.inject.servlet

Most used classes

  • ServletModule$ServletKeyBindingBuilder
    See the EDSL examples at ServletModule#configureServlets()
  • ServletModule$FilterKeyBindingBuilder
    See the EDSL examples at ServletModule#configureServlets()
  • RequestScoped
  • GuiceServletContextListener
    As of Guice 2.0 you can still use (your subclasses of) GuiceServletContextListener class as a logica
  • GuiceFilter
    Apply this filter in web.xml above all other filters (typically), to all requests where you plan to
  • ServletScopes,
  • ServletDefinition,
  • FilterPipeline,
  • FilterDefinition,
  • FilterChainInvocation,
  • ManagedFilterPipeline,
  • ManagedServletPipeline,
  • RequestParameters,
  • SessionScoped,
  • UriPatternMatcher,
  • UriPatternType,
  • ContinuingHttpServletRequest,
  • DefaultFilterPipeline,
  • FiltersModuleBuilder$FilterKeyBindingBuilderImpl
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now