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


Java GuiceContainer类代码示例

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


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

示例1: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的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: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestRMWebServicesNodeLabels.java

示例3: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration rmconf = new Configuration();
  rmconf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
    YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  rmconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
    ResourceScheduler.class);
  rmconf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  rm = new MockRM(rmconf);
  bind(ResourceManager.class).toInstance(rm);
  if (isKerberosAuth == true) {
    filter("/*").through(TestKerberosAuthFilter.class);
  } else {
    filter("/*").through(TestSimpleAuthFilter.class);
  }
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestRMWebServicesDelegationTokens.java

示例4: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestHsWebServicesAttempts.java

示例5: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestHsWebServices.java

示例6: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestHsWebServicesJobs.java

示例7: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestHsWebServicesJobsQuery.java

示例8: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  rmWebService = new RMWebServices(rm,conf);
  bind(RMWebServices.class).toInstance(rmWebService);
  bind(GenericExceptionHandler.class);
  bind(ResourceManager.class).toInstance(rm);
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TestRMWebServicesNodeLabels.java

示例9: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  if (ENABLE_CORS_FOR.get() != null) {
    filter(API_PATH).through(new CorsFilter(ENABLE_CORS_FOR.get()));
  }
  serve(API_PATH).with(TServlet.class);

  filter(ApiBeta.PATH, ApiBeta.PATH + "/*").through(LeaderRedirectFilter.class);
  filter(ApiBeta.PATH, ApiBeta.PATH + "/*")
      .through(GuiceContainer.class, JettyServerModule.GUICE_CONTAINER_PARAMS);
  bind(ApiBeta.class);

  serve("/apiclient", "/apiclient/*")
      .with(new DefaultServlet(), ImmutableMap.<String, String>builder()
          .put("resourceBase", API_CLIENT_ROOT)
          .put("pathInfoOnly", "true")
          .put("dirAllowed", "false")
          .build());
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:20,代码来源:ApiModule.java

示例10: CCOWContextListener

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
public CCOWContextListener(final ContextState commonContext, final Module... behaviourModules) {
	super();
	SLF4JBridgeHandler.removeHandlersForRootLogger();
	SLF4JBridgeHandler.install();
	logger.info("Starting up servlet ...");
	this.modules = ImmutableList.<Module> builder().add(behaviourModules).add(new EndpointModule(commonContext))
			.add(new JerseyServletModule() {

				@Override
				protected void configureServlets() {
					final Map<String, String> params = ImmutableMap.<String, String> builder()
							.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS,
									GZIPContentEncodingFilter.class.getName())
							.build();
					bind(CORSFilter.class).in(Singleton.class);
					bind(UrlRewriteFilter.class).in(Singleton.class);
					serve("/*").with(GuiceContainer.class, params);
					filter("/*").through(CORSFilter.class);
					filter("/*").through(UrlRewriteFilter.class);

					requestStaticInjection(WebSocketsConfigurator.class);
				}
			}).build();
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:25,代码来源:CCOWContextListener.java

示例11: getInjector

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected Injector getInjector() {

	return Guice.createInjector(new JerseyServletModule() {
		@Override
		protected void configureServlets() {
			bind(ParticipantServlet.class).asEagerSingleton();

			for (final String url : participantsUrl)
				serve("/" + url + "/*").with(GuiceContainer.class);
			// serve("/*").with(GuiceContainer.class);
			// serveRegex("(.)*ContextParticipant(.)*").with(GuiceContainer.class);
			// serve("/*").with(GuiceContainer.class);
			bind(UrlRewriteFilter.class).in(Singleton.class);
			filter("/*").through(UrlRewriteFilter.class);
		}
	});
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:19,代码来源:ParticipantHoster.java

示例12: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets()
{
  LogicalPlan dag = new LogicalPlan();
  String workingDir = new File("target", StramWebServicesTest.class.getName()).getAbsolutePath();
  dag.setAttribute(LogicalPlan.APPLICATION_PATH, workingDir);
  dag.setAttribute(Context.OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(workingDir, null));
  dag.setAttribute(LogicalPlan.METRICS_TRANSPORT, new AutoMetricBuiltInTransport("xyz"));
  final DummyStreamingContainerManager streamingContainerManager = new DummyStreamingContainerManager(dag);

  appContext = new TestAppContext(dag.getAttributes());
  bind(JAXBContextResolver.class);
  bind(StramWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(StramAppContext.class).toInstance(appContext);
  bind(StreamingContainerManager.class).toInstance(streamingContainerManager);
  bind(Configuration.class).toInstance(conf);
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:apache,项目名称:apex-core,代码行数:20,代码来源:StramWebServicesTest.java

示例13: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  bind(RMContext.class).toInstance(rm.getRMContext());
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:TestRMWebServicesNodeLabels.java

示例14: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  conf = new YarnConfiguration();
  conf.setClass(YarnConfiguration.RM_SCHEDULER, FairScheduler.class,
    ResourceScheduler.class);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  bind(RMContext.class).toInstance(rm.getRMContext());
  bind(ApplicationACLsManager.class).toInstance(
      rm.getApplicationACLsManager());
  bind(QueueACLsManager.class).toInstance(rm.getQueueACLsManager());
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:17,代码来源:TestRMWebServicesFairScheduler.java

示例15: configureServlets

import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; //导入依赖的package包/类
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration conf = new Configuration();
  conf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
      ResourceScheduler.class);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  bind(RMContext.class).toInstance(rm.getRMContext());
  bind(ApplicationACLsManager.class).toInstance(
      rm.getApplicationACLsManager());
  bind(QueueACLsManager.class).toInstance(rm.getQueueACLsManager());
  serve("/*").with(GuiceContainer.class);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:17,代码来源:TestRMWebServices.java


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