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


Java InjectionManager类代码示例

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


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

示例1: delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {
	Context context = mock(Context.class);
	DefaultServiceRequest request = new DefaultServiceRequest(null, new HashMap<>(), URI.create("/"), "GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	Ref<ServiceRequest> serviceRequestRef = mock(Ref.class);
	Ref<Context> contextRef = mock(Ref.class);

	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(SERVICE_REQUEST_TYPE)).thenReturn(serviceRequestRef);
	when(injectionManager.getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE)).thenReturn(contextRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(serviceRequestRef).set(request);
	verify(contextRef).set(context);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:21,代码来源:ServiceRequestHandlerTest.java

示例2: delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {
	Context context = mock(Context.class);
	DefaultGatewayRequest request = new DefaultGatewayRequest();
	request.setPath("/");
	request.setHttpMethod("GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	Ref<GatewayRequest> gatewayRequestRef = mock(Ref.class);
	Ref<Context> contextRef = mock(Ref.class);


	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(GATEWAY_REQUEST_TYPE)).thenReturn(gatewayRequestRef);
	when(injectionManager.getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE)).thenReturn(contextRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(gatewayRequestRef).set(request);
	verify(contextRef).set(context);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:24,代码来源:GatewayRequestHandlerTest.java

示例3: delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {

	Context context = mock(Context.class);
	SNS sns = new SNS();
	sns.setTopicArn(":t");
	SNSRecord snsRecord = new SNSRecord();
	snsRecord.setSns(sns);

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, snsRecord);

	Ref<SNSRecord> snsRef = mock(Ref.class);
	Ref<Context> contextRef = mock(Ref.class);

	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(SNS_RECORD_TYPE)).thenReturn(snsRef);
	when(injectionManager.getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE)).thenReturn(contextRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(snsRef).set(snsRecord);
	verify(contextRef).set(context);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:25,代码来源:SnsRequestHandlerTest.java

示例4: BackendServiceFactory

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@Inject
public BackendServiceFactory(InjectionManager serviceLocator) {
	awsLambdaClient = new AWSLambdaClient();
	awsLambdaClient.configureRegion(BACKEND_SERVICE_REGION);
	backendService = Feign.builder()
			.client(FeignLambdaServiceInvokerClient.builder()
					.setRegion(BACKEND_SERVICE_REGION)
					.setFunctionName(BACKEND_SERVICE_FUNCTION_NAME)
					.build())
			.decoder(new JacksonDecoder())
			.encoder(new JacksonEncoder())
			.logger(new Slf4jLogger())
			.target(new LambdaServiceFunctionTarget<BackendService>(BackendService.class) {
				@Override
				public Request apply(RequestTemplate input) {
					// TODO inject the context directly => requires the context to be bound as proxy
					Context lambdaContext = serviceLocator.getInstance(Context.class);
					// propagate the AWS request ID => the called service can log the original AWS request ID
					input.header("X-Base-Aws-Request-Id", lambdaContext.getAwsRequestId());
					return super.apply(input);
				}
			});
}
 
开发者ID:bbilger,项目名称:jrestless-examples,代码行数:24,代码来源:BackendServiceFactory.java

示例5: configure

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的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

示例6: applyFilter

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
/**
 * /path?filter=p.in(1,2)c.eq('ddd')d.startWith('a')or(f.eq('a')g.startWith(2))
 *
 * @param queryParams uri query params
 * @param query       query
 * @param manager a {@link InjectionManager} object.
 * @param <T> a T object.
 */
public static <T> void applyFilter(MultivaluedMap<String, String> queryParams,
                                   SpiQuery<T> query,
                                   InjectionManager manager) {
    List<String> wheres = queryParams.get(FILTER_PARAM_NAME);
    if (wheres != null && wheres.size() > 0) {
        EbeanExprInvoker invoker = new EbeanExprInvoker(query, manager);
        WhereExprApplier<T> applier = WhereExprApplier.create(query.where());
        for (String w : wheres) {
            QueryDSL.invoke(
                    w,
                    invoker,
                    applier
            );
        }
    }
}
 
开发者ID:icode,项目名称:ameba,代码行数:25,代码来源:ModelInterceptor.java

示例7: applyUriQuery

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
/**
 * apply uri query parameter on query
 *
 * @param queryParams  uri query params
 * @param query        Query
 * @param needPageList need page list
 * @return page list count or null
 * @see #applyFetchProperties
 * @see #applyFilter
 * @see #applyOrderBy
 * @see #applyPageList
 * @param manager a {@link InjectionManager} object.
 */
@SuppressWarnings("unchecked")
public static FutureRowCount applyUriQuery(MultivaluedMap<String, String> queryParams,
                                           SpiQuery query,
                                           InjectionManager manager, boolean needPageList) {
    Set<String> inv = query.validate();
    applyFetchProperties(queryParams, query);
    applyFilter(queryParams, query, manager);
    applyOrderBy(queryParams, query);

    EbeanUtils.checkQuery(
            (SpiQuery<?>) query,
            inv,
            null,
            manager
    );
    if (needPageList)
        return applyPageList(queryParams, query);
    return null;
}
 
开发者ID:icode,项目名称:ameba,代码行数:33,代码来源:ModelInterceptor.java

示例8: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {
	Context context = mock(Context.class);
	DefaultServiceRequest request = new DefaultServiceRequest(null, new HashMap<>(), URI.create("/"), "GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:11,代码来源:ServiceRequestHandlerTest.java

示例9: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {

	Context context = mock(Context.class);
	DefaultGatewayRequest request = new DefaultGatewayRequest();
	request.setPath("/");
	request.setHttpMethod("GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:14,代码来源:GatewayRequestHandlerTest.java

示例10: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {

	Context context = mock(Context.class);
	SNS sns = new SNS();
	sns.setTopicArn(":t");
	SNSRecord snsRecord = new SNSRecord();
	snsRecord.setSns(sns);

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, snsRecord);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:15,代码来源:SnsRequestHandlerTest.java

示例11: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {
	JsonObject jsonRequest = new WebActionRequestBuilder()
			.setHttpMethod("GET")
			.setPath("/")
			.buildJson();

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(jsonRequest);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:13,代码来源:WebActionRequestHandlerTest.java

示例12: getStreamingProcess

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
/**
 * <p>getStreamingProcess.</p>
 *
 * @param entity a T object.
 * @param manager manager
 * @param <T> a T object.
 * @return a {@link ameba.message.internal.StreamingProcess} object.
 */
@SuppressWarnings("unchecked")
public static <T> StreamingProcess<T> getStreamingProcess(T entity, InjectionManager manager) {
    for (StreamingProcess process : getStreamingProcesses(manager)) {
        if (process.isSupported(entity)) {
            return process;
        }
    }
    return null;
}
 
开发者ID:icode,项目名称:ameba,代码行数:18,代码来源:MessageHelper.java

示例13: checkQuery

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
/**
 * <p>checkQuery.</p>
 *
 * @param query     a {@link io.ebean.Query} object.
 * @param whitelist a {@link java.util.Set} object.
 * @param blacklist a {@link java.util.Set} object.
 * @param manager   a {@link InjectionManager} object.
 */
public static void checkQuery(Query<?> query, Set<String> whitelist,
                              Set<String> blacklist, InjectionManager manager) {
    ResourceInfo resource = manager.getInstance(ResourceInfo.class);
    Class<?> rc = resource.getResourceClass();
    Set<String> wl = null, bl = null;
    if (rc != null) {
        Filter filter = rc.getAnnotation(Filter.class);

        if (filter != null) {
            if (filter.whitelist().length > 0) {
                wl = Sets.newLinkedHashSet();
                Collections.addAll(wl, filter.whitelist());
            }
            if (filter.blacklist().length > 0) {
                bl = Sets.newLinkedHashSet();
                Collections.addAll(bl, filter.blacklist());
            }
        }
    }

    if (whitelist != null) {
        if (wl == null) {
            wl = Sets.newLinkedHashSet();
        }
        wl.addAll(whitelist);
    }

    if (blacklist != null) {
        if (bl == null) {
            bl = Sets.newLinkedHashSet();
        }
        bl.addAll(blacklist);
    }
    checkQuery((SpiQuery) query, wl, bl, manager.getInstance(Application.Mode.class).isProd());
}
 
开发者ID:icode,项目名称:ameba,代码行数:44,代码来源:EbeanUtils.java

示例14: onShutdown

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
@Override
public void onShutdown(final Container container) {
    final ApplicationHandler handler = container.getApplicationHandler();
    final InjectionManager injectionManager = handler.getInjectionManager();

    // Call @PreDestroy method on Application.
    injectionManager.preDestroy(getWrappedApplication(handler.getConfiguration()));
    // Shutdown ServiceLocator.
    injectionManager.shutdown();
}
 
开发者ID:icode,项目名称:ameba,代码行数:11,代码来源:ConfigHelper.java

示例15: OptionsMethodProcessor

import org.glassfish.jersey.internal.inject.InjectionManager; //导入依赖的package包/类
/**
 * Creates new instance.
 *
 * @param manager a {@link InjectionManager} object.
 */
@Inject
public OptionsMethodProcessor(InjectionManager manager) {
    methodList = Lists.newArrayList();

    methodList.add(new ModelProcessorUtil.Method(HttpMethod.OPTIONS, WILDCARD_TYPE, WILDCARD_TYPE,
            GenericOptionsInflector.class));

    generators = Providers.getAllRankedSortedProviders(manager, OptionsResponseGenerator.class);
}
 
开发者ID:icode,项目名称:ameba,代码行数:15,代码来源:OptionsMethodProcessor.java


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