com.sun.jersey.guice.spi.container.servlet.GuiceContainer Java Examples
The following examples show how to use
com.sun.jersey.guice.spi.container.servlet.GuiceContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: hadoop Author: naver File: TestRMWebServicesNodeLabels.java License: Apache License 2.0 | 6 votes |
@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); }
Example #2
Source Project: hadoop Author: naver File: TestRMWebServicesDelegationTokens.java License: Apache License 2.0 | 6 votes |
@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); }
Example #3
Source Project: hadoop Author: naver File: TestHsWebServicesAttempts.java License: Apache License 2.0 | 6 votes |
@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); }
Example #4
Source Project: hadoop Author: naver File: TestHsWebServices.java License: Apache License 2.0 | 6 votes |
@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); }
Example #5
Source Project: hadoop Author: naver File: TestHsWebServicesJobs.java License: Apache License 2.0 | 6 votes |
@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); }
Example #6
Source Project: hadoop Author: naver File: TestHsWebServicesJobsQuery.java License: Apache License 2.0 | 6 votes |
@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); }
Example #7
Source Project: hadoop Author: naver File: TestHsWebServicesTasks.java License: Apache License 2.0 | 6 votes |
@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); }
Example #8
Source Project: big-c Author: yncxcw File: TestRMWebServicesNodeLabels.java License: Apache License 2.0 | 6 votes |
@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); }
Example #9
Source Project: big-c Author: yncxcw File: TestRMWebServicesDelegationTokens.java License: Apache License 2.0 | 6 votes |
@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); }
Example #10
Source Project: big-c Author: yncxcw File: TestHsWebServicesAttempts.java License: Apache License 2.0 | 6 votes |
@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); }
Example #11
Source Project: big-c Author: yncxcw File: TestHsWebServices.java License: Apache License 2.0 | 6 votes |
@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); }
Example #12
Source Project: big-c Author: yncxcw File: TestHsWebServicesJobs.java License: Apache License 2.0 | 6 votes |
@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); }
Example #13
Source Project: big-c Author: yncxcw File: TestHsWebServicesJobsQuery.java License: Apache License 2.0 | 6 votes |
@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); }
Example #14
Source Project: big-c Author: yncxcw File: TestHsWebServicesTasks.java License: Apache License 2.0 | 6 votes |
@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); }
Example #15
Source Project: attic-apex-core Author: apache File: StramWebServicesTest.java License: Apache License 2.0 | 6 votes |
@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); }
Example #16
Source Project: dagger-servlet Author: johnlcox File: SimpleContextListener.java License: Apache License 2.0 | 6 votes |
@Override protected Injector getInjector() { return Guice.createInjector(new JerseyServletModule() { @Override protected void configureServlets() { bind(SimpleService.class); bind(SimpleResource.class); serve("/*").with(GuiceContainer.class); } @Provides String provideDisplay() { return "SimpleDisplay"; } }); }
Example #17
Source Project: Raigad Author: Netflix File: InjectedWebListener.java License: Apache License 2.0 | 6 votes |
@Override protected void configure() { logger.info("** Binding OSS Config classes."); // Fix bug in Jersey-Guice integration exposed by child injectors binder().bind(GuiceContainer.class).asEagerSingleton(); binder().bind(GuiceJobFactory.class).asEagerSingleton(); binder().bind(IRaigadInstanceFactory.class).to(CassandraInstanceFactory.class); // TODO: Use config.getCredentialProvider() instead of IAMCredential binder().bind(ICredential.class).to(IAMCredential.class); binder().bind(AbstractRepository.class).annotatedWith(Names.named("s3")).to(S3Repository.class); binder().bind(AbstractRepositorySettingsParams.class).annotatedWith(Names.named("s3")).to(S3RepositorySettingsParams.class); bind(SchedulerFactory.class).to(StdSchedulerFactory.class).asEagerSingleton(); bind(HostSupplier.class).to(EurekaHostsSupplier.class).in(Scopes.SINGLETON); binder().bind(IConfigSource.class).annotatedWith(Names.named("custom")).to(CompositeConfigSource.class); }
Example #18
Source Project: appstart Author: omerio File: AppServletModule.java License: Apache License 2.0 | 6 votes |
@Override protected void configureServlets() { // filters // Objectify filter filter("/*").through(ObjectifyFilter.class); // servlets serve("/home").with(HomeServlet.class); // Jersey restful servlet HashMap<String, String> params = new HashMap<String, String>(); params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "uk.co.inetria.appstart.frontend.rest"); params.put(JSONConfiguration.FEATURE_POJO_MAPPING, "true"); // speed up jersey startup under appengine params.put(ResourceConfig.FEATURE_DISABLE_WADL, "true"); serve("/api/*").with(GuiceContainer.class, params); }
Example #19
Source Project: staash Author: Netflix File: GuiceServletConfig.java License: Apache License 2.0 | 6 votes |
@Override protected Injector getInjector() { return LifecycleInjector.builder() .withModules( new EurekaModule(), new PaasPropertiesModule(), new JerseyServletModule() { @Override protected void configureServlets() { bind(GuiceContainer.class).asEagerSingleton(); bind(StaashAdminResourceImpl.class); bind(StaashDataResourceImpl.class); serve("/*").with(GuiceContainer.class); } } ) .createInjector(); }
Example #20
Source Project: staash Author: Netflix File: NewPaasGuiceServletConfig.java License: Apache License 2.0 | 6 votes |
@Override protected Injector getInjector() { return LifecycleInjector.builder() .withModules( new MetaModule(), //new EurekaModule(), new JerseyServletModule() { @Override protected void configureServlets() { // Route all requests through GuiceContainer bind(GuiceContainer.class).asEagerSingleton(); serve("/*").with(GuiceContainer.class); } }, new AbstractModule() { @Override protected void configure() { bind(MetaCassandraBootstrap.class).asEagerSingleton(); } } ) .createInjector(); }
Example #21
Source Project: angulardemorestful Author: draptik File: NgDemoApplicationSetup.java License: MIT License | 6 votes |
@Override protected Injector getInjector() { return Guice.createInjector(new ServletModule() { @Override protected void configureServlets() { super.configureServlets(); // Configuring Jersey via Guice: ResourceConfig resourceConfig = new PackagesResourceConfig("ngdemo/web"); for (Class<?> resource : resourceConfig.getClasses()) { bind(resource); } // hook Jackson into Jersey as the POJO <-> JSON mapper bind(JacksonJsonProvider.class).in(Scopes.SINGLETON); serve("/web/*").with(GuiceContainer.class); filter("/web/*").through(ResponseCorsFilter.class); } }, new UserModule()); }
Example #22
Source Project: staash Author: Netflix File: GuiceServletConfig.java License: Apache License 2.0 | 6 votes |
@Override protected Injector getInjector() { return LifecycleInjector.builder() .withModules( new EurekaModule(), new PaasPropertiesModule(), new JerseyServletModule() { @Override protected void configureServlets() { bind(GuiceContainer.class).asEagerSingleton(); bind(StaashAdminResourceImpl.class); bind(StaashDataResourceImpl.class); serve("/*").with(GuiceContainer.class); } } ) .createInjector(); }
Example #23
Source Project: AisAbnormal Author: dma-ais File: RestModule.java License: GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void configureServlets() { ResourceConfig rc = new PackagesResourceConfig( "dk.dma.ais.abnormal.event.rest", "dk.dma.ais.abnormal.stat.rest", "dk.dma.commons.web.rest.defaults", "org.codehaus.jackson.jaxrs" ); for ( Class<?> resource : rc.getClasses() ) { String packageName = resource.getPackage().getName(); if (packageName.equals("dk.dma.commons.web.rest.defaults") || packageName.equals("org.codehaus.jackson.jaxrs")) { bind(resource).in(Scopes.SINGLETON); } else { bind(resource); } } serve("/rest/*").with( GuiceContainer.class ); }
Example #24
Source Project: usergrid Author: apache File: Module.java License: Apache License 2.0 | 6 votes |
protected void configureServlets() { //noinspection unchecked install( new GuicyFigModule( ServletFig.class, CoordinatorFig.class ) ); install( new ChopClientModule() ); // Hook Jersey into Guice Servlet bind( GuiceContainer.class ); // Hook Jackson into Jersey as the POJO <-> JSON mapper bind( JacksonJsonProvider.class ).asEagerSingleton(); bind( IController.class ).to( Controller.class ); bind( RunnerRegistry.class ).to( RunnerRegistryImpl.class ); bind( RunManager.class ).to( RunManagerImpl.class ); bind( ResetResource.class ); bind( StopResource.class ); bind( StartResource.class ); bind( StatsResource.class ); bind( StatusResource.class ); Map<String, String> params = new HashMap<String, String>(); params.put( PACKAGES_KEY, getClass().getPackage().toString() ); serve( "/*" ).with( GuiceContainer.class, params ); }
Example #25
Source Project: jerseyoauth2 Author: hburgmeier File: AppModule.java License: MIT License | 6 votes |
@Override protected void configureServlets() { bind(IUserService.class).to(DefaultPrincipalUserService.class); bind(ITokenGenerator.class).to(MD5TokenGenerator.class); bind(IClientIdGenerator.class).to(UUIDClientIdGenerator.class); bind(IConfiguration.class).to(Configuration.class); bind(IRSConfiguration.class).to(Configuration.class); bind(IAuthorizationFlow.class).to(TestAuthorizationFlow.class); bind(IClientService.class).to(DatabaseClientService.class); bind(IAccessTokenStorageService.class).to(DatabaseAccessTokenStorage.class); serve("/oauth2/auth").with(AuthorizationServlet.class); serve("/oauth2/allow").with(AllowServlet.class); serve("/oauth2/accessToken").with(IssueAccessTokenServlet.class); Map<String, String> params = new HashMap<String, String>(); params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.burgmeier.jerseyoauth2.sample.resources"); //see http://java.net/jira/browse/JERSEY-630 params.put(PackagesResourceConfig.FEATURE_DISABLE_WADL, "true"); params.put(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES, OAuth20FilterFactory.class.getName()); // Route all requests for rest resources through GuiceContainer serve("/rest/*").with(GuiceContainer.class, params); }
Example #26
Source Project: ambari-metrics Author: apache File: TestTimelineWebServices.java License: Apache License 2.0 | 5 votes |
@Override protected void configureServlets() { bind(YarnJacksonJaxbJsonProvider.class); bind(TimelineWebServices.class); bind(GenericExceptionHandler.class); try { metricStore = new TestTimelineMetricStore(); } catch (Exception e) { Assert.fail(); } bind(TimelineMetricStore.class).toInstance(metricStore); serve("/*").with(GuiceContainer.class); }
Example #27
Source Project: hadoop Author: naver File: TestRMWebServicesFairScheduler.java License: Apache License 2.0 | 5 votes |
@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); serve("/*").with(GuiceContainer.class); }
Example #28
Source Project: hadoop Author: naver File: TestRMWebServices.java License: Apache License 2.0 | 5 votes |
@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); serve("/*").with(GuiceContainer.class); }
Example #29
Source Project: hadoop Author: naver File: TestRMWebServicesCapacitySched.java License: Apache License 2.0 | 5 votes |
@Override protected void configureServlets() { bind(JAXBContextResolver.class); bind(RMWebServices.class); bind(GenericExceptionHandler.class); csConf = new CapacitySchedulerConfiguration(); setupQueueConfiguration(csConf); conf = new YarnConfiguration(csConf); conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class, ResourceScheduler.class); rm = new MockRM(conf); bind(ResourceManager.class).toInstance(rm); serve("/*").with(GuiceContainer.class); }
Example #30
Source Project: hadoop Author: naver File: TestRMWebServicesNodes.java License: Apache License 2.0 | 5 votes |
@Override protected void configureServlets() { bind(JAXBContextResolver.class); bind(RMWebServices.class); bind(GenericExceptionHandler.class); rm = new MockRM(new Configuration()); rm.getRMContext().getContainerTokenSecretManager().rollMasterKey(); rm.getRMContext().getNMTokenSecretManager().rollMasterKey(); bind(ResourceManager.class).toInstance(rm); serve("/*").with(GuiceContainer.class); }