当前位置: 首页>>代码示例>>Java>>正文


Java PersistFilter类代码示例

本文整理汇总了Java中com.google.inject.persist.PersistFilter的典型用法代码示例。如果您正苦于以下问题:Java PersistFilter类的具体用法?Java PersistFilter怎么用?Java PersistFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PersistFilter类属于com.google.inject.persist包,在下文中一共展示了PersistFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureServlets

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
    filter("/services/*").through(PersistFilter.class);

    final Map<String, String> parameters = Maps.newHashMap();

    parameters.put(JSONConfiguration.FEATURE_POJO_MAPPING, "true");
    parameters.put("com.sun.jersey.config.property.packages", "spypunk.ephealth");
    parameters.put("com.sun.jersey.spi.container.ContainerResponseFilters",
        "com.sun.jersey.api.container.filter.GZIPContentEncodingFilter");

    serve("/services/*").with(GuiceContainer.class, parameters);

    bind(LockService.class).to(LockServiceImpl.class);
    bind(EndPointCheckerFactory.class).to(EndPointCheckerFactoryImpl.class);
    bind(EndPointCheckService.class).to(EndPointCheckServiceImpl.class);
    bind(EndPointCheckSchedulerService.class).to(EndPointCheckSchedulerServiceImpl.class);
    bind(EndPointService.class).to(EndPointServiceImpl.class);
    bind(EndPointResource.class).to(EndPointResourceImpl.class);
    bind(EndPointCheckResource.class).to(EndPointCheckResourceImpl.class);
}
 
开发者ID:spypunk,项目名称:endpoint-health,代码行数:22,代码来源:EndPointHealthServletModule.java

示例2: getInjector

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected Injector getInjector() {
  injector = Guice.createInjector(new ServletModule() {
    @Override
    protected void configureServlets() {
      String persistenceUnitName = PersistenceInitializeListener.getPersistenceUnitName();

      install(new JpaPersistModule(persistenceUnitName));
      filter("/*").through(PersistFilter.class);

      requestStaticInjection(EntityOperatorProvider.class);

      bind(GitOperation.class).in(Singleton.class);
      bind(GitApi.class).in(Singleton.class);

      ClassFinder.findClasses("gw.service").forEach(clazz -> bind(clazz).in(Singleton.class));
    }
  });
  return injector;
}
 
开发者ID:kamegu,项目名称:git-webapp,代码行数:21,代码来源:GuiceListener.java

示例3: configureServlets

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void configureServlets() {

	if (LOG.isInfoEnabled()) {
		LOG.info("Installing servlets module.");
	}

	// Filters.
	filter("/*").through(PersistFilter.class);
	filter("/*").through(CacheFilter.class);

	// Servlets.
	serve(ENDPOINT + SecureDispatchService.REMOTE_SERVICE_RELATIVE_PATH).with(SecureDispatchServlet.class);
	serve("/").with(SigmahHostController.class);
	serve("/healthcheck").with(HealthCheckServlet.class);
	serve(ENDPOINT + Servlet.FILE.getPathName()).with(FileServlet.class);
	serve(ENDPOINT + Servlet.MANIFEST.getPathName()).with(ManifestServlet.class);
	serve(ENDPOINT + Servlet.EXPORT.getPathName()).with(ExportServlet.class);
	serve(ENDPOINT + Servlet.IMPORT.getPathName()).with(ImportServlet.class);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:24,代码来源:ServletModule.java

示例4: getInjector

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
	protected Injector getInjector() {
		return Guice.createInjector(new ServletModule() {
										protected void configureServlets() {
											install(new JpaPersistModule("IneFormShowCaseWithEjbs"));
											
											filter("/*").through(PersistFilter.class);
										};
									}
									, new IneFrameBaseServletModule("ineformshowcasewithejbs", ShowcaseDispatchServlet.class)
//									, new IneCoreBaseServletModule("ineformshowcasewithejbs", ShowcaseDispatchServlet.class)
									, new UploadServletModule() 
									, new TestServletModule()
									, new IneFrameBaseActionHanlderModule()
									, new IneFrameBaseModule()
									, new IneFormActionHanlderModule()
									, new IneFormDispatcherGuiceModule()
//									, new IneFrameModuleGuiceModule()
									, new IneModuleGuiceModule(false)
									);
	}
 
开发者ID:inepex,项目名称:ineform,代码行数:22,代码来源:ShowcaseServletConfig.java

示例5: configureServlets

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
	bind(BuildInfo.class).toInstance(buildInfo);
	bind(ServerConfig.class).toInstance(serverConfig);

	// For metrics
	bind(InstrumentedResourceMethodDispatchAdapter.class).in(Singleton.class);

	install(new SecurityModule(servletContext));
	install(new PersistenceModule(serverConfig.getDbConfig(), ""));
	install(new MailModule(serverConfig.getMailConfig()));

	LOG.debug("Configuring servlets and URLs");
	filter("/*").through(PersistFilter.class);
	filter("/*").through(GuiceShiroFilter.class);

	bind(Provisioner.class).in(Scopes.SINGLETON);
	bind(JacksonJsonProvider.class).in(Scopes.SINGLETON);

	final Map<String, String> params = Maps.newHashMap();
	params.put("com.sun.jersey.config.property.packages", "nl.tudelft.ewi.dea.jaxrs");
	params.put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX, "/.*\\.(html|js|gif|png|jpg|jpeg|css|ico)");
	filter("/*").through(GuiceContainer.class, params);
}
 
开发者ID:devhub-tud,项目名称:devhub-prototype,代码行数:25,代码来源:WebModule.java

示例6: configureServlets

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
  install(new JpaPersistModule("transactions-optional"));
  filterRegex("^/(?!_ah/(upload|admin)).*$").through(PersistFilter.class);
  MethodInterceptor finderInterceptor = new JpaFinderProxy();
  requestInjection(finderInterceptor);
  bindInterceptor(Matchers.any(), Matchers.annotatedWith(Finder.class), finderInterceptor);

  filter(ProxyFilter.PROXY_PATH + "*").through(ProxyFilter.class);
  if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) {
    filter("/_ah/api/" + "*").through(LocalDevServerFilter.class);
  }

  Set<Class<?>> serviceClasses = new HashSet<Class<?>>();
  serviceClasses.add(DeviceEndpoint.class);
  serviceClasses.add(AccountEndpoint.class);
  serviceClasses.add(PresenceEndpoint.class);
  serviceClasses.add(AppEngineChannelService.class);
  serviceClasses.add(GoogleCloudMessaging.class);
  serviceClasses.add(ApplePushNotification.class);
  this.serveGuiceSystemServiceServlet("/_ah/spi/*", serviceClasses);
}
 
开发者ID:larrytin,项目名称:realtime-server-appengine,代码行数:23,代码来源:RealtimeApisModule.java

示例7: getInjector

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected Injector getInjector() {
    try {
        injector = Guice.createInjector(new GeeMvcModule(), new GeeTicketModule(), new ServletModule() {
            @Override
            protected void configureServlets() {
                install(new JpaPersistModule("geeticketPU"));

                filter("/*").through(PersistFilter.class);

                Map<String, String> params = new HashMap<String, String>();
                params.put(Configuration.VIEW_PREFIX_KEY, "/jsp/pages");
                params.put(Configuration.VIEW_SUFFIX_KEY, ".jsp");
                params.put(Configuration.SUPPORTED_LOCALES_KEY, "en, de_DE, fr_FR, es_ES, ru_RU:UTF-8, ja_JP:Shift_JIS, zh:UTF-8");
                params.put(Configuration.DEFAULT_CHARACTER_ENCODING_KEY, "UTF-8");
                params.put(Configuration.DEFAULT_CONTENT_TYPE_KEY, "text/html");

                serve("/geeticket/*").with(DispatcherServlet.class, params);
            }
        });

    } catch (Throwable t) {
        System.out.println("!! An error occured during initialization of the GeeticketGuiceServletContextListener.");

        if (t instanceof com.google.inject.CreationException) {
            System.out.println("It seems that Guice was not able to create the injector due to problems with unregistered or incorrectly registered classes. Please check the Guice errors below!");
        }

        t.printStackTrace();
    }

    return injector;
}
 
开发者ID:geetools,项目名称:geeMVC-Java-MVC-Framework,代码行数:34,代码来源:GeeticketGuiceServletContextListener.java

示例8: beforeEach

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
public void beforeEach(final ExtensionContext context) throws Exception {
	final Injector injector = GuiceExtension.getInjector(context);

	final PersistFilter filter = injector.getInstance(PersistFilter.class);

	final Requestor requestor = injector.getInstance(Requestor.class);
	requestor.addFilter(new ServletFilterAdapter(filter));

	filter.init(null);
}
 
开发者ID:stickfigure,项目名称:gstrap,代码行数:12,代码来源:GuicePersistExtension.java

示例9: afterEach

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
public void afterEach(final ExtensionContext context) throws Exception {
	final Injector injector = GuiceExtension.getInjector(context);

	final PersistFilter filter = injector.getInstance(PersistFilter.class);

	filter.destroy();
}
 
开发者ID:stickfigure,项目名称:gstrap,代码行数:9,代码来源:GuicePersistExtension.java

示例10: configureServlets

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
protected void configureServlets() {
    h4Properties = new Properties();
    String configFile = System.getProperty(FDC.DASH_H4_CONFIG_FILE);
    logger.info("Building Persistence Manager - Servlet Persistence");
    JpaPersistModule persistModule = new JpaPersistModule(FDC.H4_MANAGER);
    persistModule.properties(ConfigUtil.loadConfig(h4Properties, configFile));
    logger.info("Installing Persistence Manager for filter {}", FDC.PERSISTENCE_FILTER);
    install(persistModule);
    filter(FDC.PERSISTENCE_FILTER).through(PersistFilter.class);
}
 
开发者ID:TechnoJays,项目名称:First-Dash-Service,代码行数:11,代码来源:DashGuiceH4ServletModule.java

示例11: bindDatabaseModule

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
private void bindDatabaseModule() {
    install(new DbModule());

    filter("/*").through(PersistFilter.class);
    requireBinding(EntityManager.class);
    requireBinding(EntityManagerFactory.class);
}
 
开发者ID:MoodCat,项目名称:MoodCat.me-Core,代码行数:8,代码来源:BulkInsertApp.java

示例12: configureJetty

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
/**
 * Function used to configure Jetty and return a Server instance.
 * @param port the port to run Jetty on.
 * @return the {@link Server} instance.
 */
protected Server configureJetty(final int port) {
    final Server server = new Server();
    final ServerConnector connector = new ServerConnector(server);
    final ServletContextHandler sch = getServletContextHandler();

    // TODO: make all of this configurable
    connector.setIdleTimeout((int)TimeUnit.HOURS.toMillis(1));
    connector.setSoLingerTime(-1);
    connector.setPort(port);

    server.addConnector(connector);

    // set the injector as an attribute in the context
    sch.setAttribute("guice-injector", getInjector());

    // prevent the JSESSIONID from getting set via a URL argument
    sch.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none");

    // if we're using a database, then install the filter
    if(!settings.getDatabaseSettings().getNotUsed()) {
        // setup a FilterHolder for the Guice Persistence
        final FilterHolder persistFilter = new FilterHolder(getInjector().getInstance(PersistFilter.class));

        // add the filter to the context
        sch.addFilter(persistFilter, "/*", DISPATCHER_TYPES);
    }

    // configure a FilterHolder for Guice
    final FilterHolder filterHolder = new FilterHolder(GuiceFilter.class);

    sch.addFilter(filterHolder, "/*", DISPATCHER_TYPES);
    sch.addServlet(DefaultServlet.class, "/*");

    //server.setDumpAfterStart(true);
    server.setHandler(sch);


    return server;
}
 
开发者ID:Metrink,项目名称:croquet,代码行数:45,代码来源:CroquetRest.java

示例13: configureServlets

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
   // start the JPA service
   bind(JPAInitializer.class).asEagerSingleton();

   // PersistFilter
   filter("/*").through(PersistFilter.class);

   // jpa + guice
   install(new JpaPersistModule("persistenceUnit")); // same as persistence.xml

   // Guice bindings
   bind(UserService.class).to(UserServiceImpl.class);
}
 
开发者ID:tulsidas,项目名称:Jersey2-Guice3-JPA2,代码行数:15,代码来源:GuiceModule.java

示例14: bindDatabaseModule

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
private void bindDatabaseModule() {
    install(new DbModule());
    filter("/*").through(PersistFilter.class);
    requireBinding(EntityManager.class);
    requireBinding(EntityManagerFactory.class);
}
 
开发者ID:MoodCat,项目名称:MoodCat.me-Core,代码行数:7,代码来源:MoodcatServletModule.java

示例15: configureJetty

import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
/**
 * Function used to configure Jetty and return a Server instance.
 * @param port the port to run Jetty on.
 * @return the {@link Server} instance.
 */
protected Server configureJetty(final int port) {
    final Server server = new Server();
    final ServerConnector connector = new ServerConnector(server);

    // TODO: make all of this configurable
    connector.setIdleTimeout((int)TimeUnit.HOURS.toMillis(1));
    connector.setSoLingerTime(-1);
    connector.setPort(port);

    server.addConnector(connector);

    // set the injector as an attribute in the context
    sch.setAttribute("guice-injector", injector);

    // prevent the JSESSIONID from getting set via a URL argument
    sch.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none");

    // add the font mime type by default
    sch.getMimeTypes().addMimeMapping("woff", "application/x-font-woff");

    // if we're using a database, then install the filter
    if(!settings.getDatabaseSettings().getNotUsed()) {
        // setup a FilterHolder for the Guice Persistence
        final FilterHolder persistFilter = new FilterHolder(injector.getInstance(PersistFilter.class));

        // add the filter to the context
        sch.addFilter(persistFilter, "/*", DISPATCHER_TYPES);
    }

    // setup a FilterHolder for WebSockets
    final FilterHolder webSocketFilter = new FilterHolder(Jetty9WebSocketFilter.class);

    // set the app factor as the Guice Web App Factory
    webSocketFilter.setInitParameter("applicationFactoryClassName", GuiceWebApplicationFactory.class.getName());

    // tell the filter to use the injector in the context instead of making a new one
    webSocketFilter.setInitParameter("injectorContextAttribute", "guice-injector");

    // setup the filter mapping
    webSocketFilter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");

    webSocketFilter.setInitParameter("configuration", "deployment");

    // add the filter to the context
    sch.addFilter(webSocketFilter, "/*", DISPATCHER_TYPES);

    // add the default servlet as Guice & Wicket will take care of everything for us
    sch.addServlet(DefaultServlet.class,  "/*");

    server.setHandler(sch);

    return server;
}
 
开发者ID:Metrink,项目名称:croquet,代码行数:59,代码来源:CroquetWicket.java


注:本文中的com.google.inject.persist.PersistFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。