本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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();
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}