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


Java GuiceIntoHK2Bridge类代码示例

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


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

示例1: JerseyApplication

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public JerseyApplication(ServiceLocator serviceLocator) {
	GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
	GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    guiceBridge.bridgeGuiceInjector(AppLoader.injector);
    
    String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(
    		CommonProperties.MOXY_JSON_FEATURE_DISABLE,
               getConfiguration().getRuntimeType());
       property(disableMoxy, true);
       property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

       // add the default Jackson exception mappers
       register(JsonParseExceptionMapper.class);
       register(JsonMappingExceptionMapper.class);
       register(JacksonJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
       
       packages(JerseyApplication.class.getPackage().getName());
       
    for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) {
    	configurator.configure(this);
    }
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:JerseyApplication.java

示例2: configure

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
	InjectionManager injectionManager = InjectionManagerProvider.getInjectionManager(context);
	ServiceLocator locator;
	if (injectionManager instanceof ImmediateHk2InjectionManager) {
		locator = ((ImmediateHk2InjectionManager) injectionManager).getServiceLocator();
	} else if (injectionManager instanceof DelayedHk2InjectionManager) {
		locator = ((DelayedHk2InjectionManager) injectionManager).getServiceLocator();
	} else {
		throw new IllegalStateException("expected an hk2 injection manager");
	}
	GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
	// register all your modules, here
	Injector injector = Guice.createInjector(new GreetingModule());
	GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class);
	guiceBridge.bridgeGuiceInjector(injector);
	return true;
}
 
开发者ID:bbilger,项目名称:jrestless-examples,代码行数:19,代码来源:GuiceFeature.java

示例3: Application

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public Application(ServiceLocator serviceLocator) {

       //Since Jersey doesn't support Guice, setup a bridge so that Guice will work
	GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
	GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
	
	guiceBridge.bridgeGuiceInjector(Main.injector);

       //Gets Jackson all squared away with Jersey
	register(Jackson1Feature.class);
	register(DefaultObjectMapperProvider.class);

       //Register apis and other Jersey things here
       register(TestApi.class);
       register(TestExceptionMapper.class);
}
 
开发者ID:tommyschnabel,项目名称:SimpleJavaServer,代码行数:18,代码来源:Application.java

示例4: MyApplication

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public MyApplication(ServiceLocator serviceLocator) {
    packages(Resource.class.getPackage().getName()); // todo: try class

    // todo: test!

    Injector injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bind(Service.class);
        }
    });

    // todo: auth intercept (will not work with Guice - make dual mapping or use jersey interceptors or try jersey2-guice)

    GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);

    GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    guiceBridge.bridgeGuiceInjector(injector);
}
 
开发者ID:nhekfqn,项目名称:jersey2-guice-embedded-jetty-poc,代码行数:21,代码来源:MyApplication.java

示例5: DashAppConfig

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
    public DashAppConfig(ServiceLocator serviceLocator) {
        logger.info("Registering packages on {}", DashContants.DASH_REST_PACKAGE);
        // Register package for rest endpoints and fasterxml for JSON support
        packages(DashContants.DASH_REST_PACKAGE, DashContants.FASTERXML_PACKAGE);

        logger.info("Building Injectors");
        Injector injector = Guice.createInjector(
                new ConfigurationInjection(),
                new DashGuiceH4ServletModule(),
                new DashH4ServiceInjection(),
                //new DashGuiceH4Module(),
                new JSONInjection()
        );

//        PersistentInit persistenceInit = new PersistentInit();
        PersistenceInit persistenceInit = new PersistenceInit();

        GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
        GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
        guiceBridge.bridgeGuiceInjector(injector);
    }
 
开发者ID:TechnoJays,项目名称:First-Dash-Service,代码行数:23,代码来源:DashAppConfig.java

示例6: ApiConfig

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public ApiConfig(ServiceLocator serviceLocator) {
  register(JacksonFeature.class);
  register(ValidationFeature.class);
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");

  register(AuthenticationRequestFilter.class);
  register(AdminNecessaryRequestFilter.class);
  register(RepositoryControllRequestFilter.class);

  register(HttpCacheControlFilter.class);

  register(ApiForbiddenExceptionMapper.class);
  register(ApiNotFoundExceptionMapper.class);
  register(ApiLoginRequiredExceptionMapper.class);
  register(AjaxValidationErrorExceptionMapper.class);
  register(PostErrorResponseFilter.class);

  GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
  GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
  guiceBridge.bridgeGuiceInjector(GuiceListener.get());

  packages(false, this.getClass().getPackage() + ".rs");
}
 
开发者ID:kamegu,项目名称:git-webapp,代码行数:25,代码来源:ApiConfig.java

示例7: AppConfig

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public AppConfig(ServiceLocator serviceLocator) {
  register(FreemarkerMvcFeature.class);
  property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/templates");
  property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, FlexibleConfiguration.class);

  register(AttachContextInterceptor.class);
  register(ValidationFeature.class);
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");

  register(AuthenticationRequestFilter.class);
  register(AdminNecessaryRequestFilter.class);
  register(RepositoryControllRequestFilter.class);
  register(HtmlLoginRequiredExceptionMapper.class);

  register(HttpCacheControlFilter.class);

  GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
  GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
  guiceBridge.bridgeGuiceInjector(GuiceListener.get());

  packages(false, this.getClass().getPackage() + ".html");
}
 
开发者ID:kamegu,项目名称:git-webapp,代码行数:24,代码来源:AppConfig.java

示例8: WebApp

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public WebApp(Injector injector, ServiceLocator serviceLocator) {
    log.info("Setting up Web Application");

    register(SseFeature.class);
    register(MultiPartFeature.class);
    register(ExposrExceptionMapper.class);

    // Resources.
    register(BuildResource.class);
    register(ExposrResource.class);
    register(ProjectResource.class);
    register(SyncResource.class);
    register(TaskResource.class);

    GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);

    final GuiceIntoHK2Bridge bridge = serviceLocator
            .getService(GuiceIntoHK2Bridge.class);

    bridge.bridgeGuiceInjector(injector);
}
 
开发者ID:udoprog,项目名称:exposr,代码行数:23,代码来源:WebApp.java

示例9: onStartup

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Override
public void onStartup(Container container) {
    logger.trace("Setting up Guice bridge {}", container);
    ServiceLocator locator = container.getApplicationHandler()
            .getServiceLocator();
    GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
    GuiceIntoHK2Bridge guiceBridge = locator
            .getService(GuiceIntoHK2Bridge.class);
    guiceBridge.bridgeGuiceInjector(injector);
    logger.trace("Finished setting up Guice bridge {}", container);

    logger.trace("Starting up catalogue synchroniser");
    backgroundSync = injector.getInstance(BackgroundSync.class);
    backgroundSync.start();
    logger.trace("Started up catalogue synchroniser");
}
 
开发者ID:KolonelKustard,项目名称:discodj,代码行数:17,代码来源:DiscoDjContainerLifecycleListener.java

示例10: Hk2GuiceBridgeFeature

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public Hk2GuiceBridgeFeature(final ServiceLocator serviceLocator) {
    GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
    final GuiceIntoHK2Bridge g2h = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    final Injector injector = Guice.createInjector(new AppModule());
    g2h.bridgeGuiceInjector(injector);
}
 
开发者ID:cluttered-code,项目名称:netty-jersey-guice-swagger,代码行数:8,代码来源:Hk2GuiceBridgeFeature.java

示例11: createBiDirectionalGuiceBridge

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
private Injector createBiDirectionalGuiceBridge(ServiceLocator serviceLocator) {
    GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
    Injector injector = RestApiServerImpl.injector;
    GuiceIntoHK2Bridge g2h = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    g2h.bridgeGuiceInjector(injector);

    return injector;
}
 
开发者ID:sparkled,项目名称:sparkled,代码行数:9,代码来源:JerseyResourceConfig.java

示例12: setupGuiceBridge

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
/**
 * Adds the binding between guice and hk2. This binding is one directional.
 * You can add guice services into hk2 (jersey) resources. You cannot add
 * a hk2 service into guice.
 * <p>
 * <a href="https://hk2.java.net/guice-bridge/">about the bridge</a>
 * </p>
 *
 * @param resourceConfig the jersey resource configuration
 */
protected void setupGuiceBridge(ResourceConfig resourceConfig) {
    LogManager.getLogger().info("Initialize hk2 - guice bridge...");
    resourceConfig.register(new AbstractContainerLifecycleListener() {
        @Override
        public void onStartup(Container container) {
            ServiceLocator serviceLocator = container.getApplicationHandler().getServiceLocator();
            Injector injector = MCRInjectorConfig.injector();
            GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
            GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
            guiceBridge.bridgeGuiceInjector(injector);
        }
    });
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:24,代码来源:MCRJerseyDefaultConfiguration.java

示例13: configure

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
	ServiceLocator serviceLocator = ServiceLocatorProvider.getServiceLocator(context);

	GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
	GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
	guiceBridge.bridgeGuiceInjector(injector);

	return true;
}
 
开发者ID:Coreoz,项目名称:Plume,代码行数:11,代码来源:JerseyGuiceFeature.java

示例14: configure

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext fc) {
	GuiceBridge.getGuiceBridge().initializeGuiceBridge(hk2);
	Injector guice = (Injector) fc.getConfiguration().getProperty(KEY_INJECTOR);
	hk2.getService(GuiceIntoHK2Bridge.class).bridgeGuiceInjector(guice);
	return true;
}
 
开发者ID:dohbot,项目名称:knives,代码行数:8,代码来源:GuiceBridgeFeature.java

示例15: WidowAnalyzeResourceConfig

import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入依赖的package包/类
@Inject
public WidowAnalyzeResourceConfig(ServiceLocator serviceLocator) {
    // Set package to look for resources in
    packages("com.widowcrawler.analyze");

    GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);

    GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    guiceBridge.bridgeGuiceInjector(WidowAnalyzeServletContextListener.getCachedInjector());
}
 
开发者ID:ScottMansfield,项目名称:widow,代码行数:11,代码来源:WidowAnalyzeResourceConfig.java


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