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


Java ContainerRequest.setRequestScopedInitializer方法代码示例

本文整理汇总了Java中org.glassfish.jersey.server.ContainerRequest.setRequestScopedInitializer方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerRequest.setRequestScopedInitializer方法的具体用法?Java ContainerRequest.setRequestScopedInitializer怎么用?Java ContainerRequest.setRequestScopedInitializer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.glassfish.jersey.server.ContainerRequest的用法示例。


在下文中一共展示了ContainerRequest.setRequestScopedInitializer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extendActualJerseyContainerRequest

import org.glassfish.jersey.server.ContainerRequest; //导入方法依赖的package包/类
@Override
protected void extendActualJerseyContainerRequest(ContainerRequest actualContainerRequest,
		JRestlessContainerRequest containerRequest, ServiceRequestAndLambdaContext requestAndLambdaContext) {
	ServiceRequest request = requestAndLambdaContext.getServiceRequest();
	Context lambdaContext = requestAndLambdaContext.getLambdaContext();
	actualContainerRequest.setRequestScopedInitializer(locator -> {
		Ref<ServiceRequest> serviceRequestRef = locator
				.<Ref<ServiceRequest>>getInstance(SERVICE_REQUEST_TYPE);
		if (serviceRequestRef != null) {
			serviceRequestRef.set(request);
		} else {
			LOG.error("ServiceFeature has not been registered. ServiceRequest injection won't work.");
		}
		Ref<Context> contextRef = locator
				.<Ref<Context>>getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE);
		if (contextRef != null) {
			contextRef.set(lambdaContext);
		} else {
			LOG.error("AwsFeature has not been registered. Context injection won't work.");
		}
	});
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:23,代码来源:ServiceRequestHandler.java

示例2: extendActualJerseyContainerRequest

import org.glassfish.jersey.server.ContainerRequest; //导入方法依赖的package包/类
@Override
protected void extendActualJerseyContainerRequest(ContainerRequest actualContainerRequest,
		JRestlessContainerRequest containerRequest, GatewayRequestAndLambdaContext requestAndLambdaContext) {
	GatewayRequest request = requestAndLambdaContext.getGatewayRequest();
	Context lambdaContext = requestAndLambdaContext.getLambdaContext();
	actualContainerRequest.setRequestScopedInitializer(locator -> {
		Ref<GatewayRequest> gatewayRequestRef = locator
				.<Ref<GatewayRequest>>getInstance(GATEWAY_REQUEST_TYPE);
		if (gatewayRequestRef != null) {
			gatewayRequestRef.set(request);
		} else {
			LOG.error("GatewayFeature has not been registered. GatewayRequest injection won't work.");
		}
		Ref<Context> contextRef = locator
				.<Ref<Context>>getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE);
		if (contextRef != null) {
			contextRef.set(lambdaContext);
		} else {
			LOG.error("AwsFeature has not been registered. Context injection won't work.");
		}
	});
	actualContainerRequest.setProperty(GatewayBinaryReadInterceptor.PROPERTY_BASE_64_ENCODED_REQUEST,
			request.isBase64Encoded());
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:25,代码来源:GatewayRequestHandler.java

示例3: extendActualJerseyContainerRequest

import org.glassfish.jersey.server.ContainerRequest; //导入方法依赖的package包/类
@Override
protected void extendActualJerseyContainerRequest(ContainerRequest actualContainerRequest,
		JRestlessContainerRequest containerRequest, SnsRecordAndLambdaContext snsRecordAndContext) {
	SNSRecord snsRecord = snsRecordAndContext.getSnsRecord();
	Context lambdaContext = snsRecordAndContext.getLambdaContext();
	actualContainerRequest.setRequestScopedInitializer(locator -> {
		Ref<SNSRecord> snsRecordRef = locator.<Ref<SNSRecord>>getInstance(SNS_RECORD_TYPE);
		if (snsRecordRef != null) {
			snsRecordRef.set(snsRecord);
		} else {
			LOG.error("SnsFeature has not been registered. SNSRecord injection won't work.");
		}
		Ref<Context> contextRef = locator
				.<Ref<Context>>getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE);
		if (contextRef != null) {
			contextRef.set(lambdaContext);
		} else {
			LOG.error("AwsFeature has not been registered. Context injection won't work.");
		}
	});
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:22,代码来源:SnsRequestHandler.java

示例4: extendActualJerseyContainerRequest

import org.glassfish.jersey.server.ContainerRequest; //导入方法依赖的package包/类
/**
 * Hook that allows you to extend the actual containerRequest passed to the Jersey container.
 */
@Override
protected void extendActualJerseyContainerRequest(ContainerRequest actualContainerRequest,
												JRestlessContainerRequest containerRequest,
												WrappedInput wrappedInput) {
	InputEvent event = wrappedInput.inputEvent;
	actualContainerRequest.setRequestScopedInitializer(locator -> {
		Ref<InputEvent> inputEventRef = locator
				.<Ref<InputEvent>>getInstance(INPUT_EVENT_TYPE);
		if (inputEventRef != null) {
			inputEventRef.set(event);
		}
		Ref<RuntimeContext> contextRef = locator
				.<Ref<RuntimeContext>>getInstance(RUNTIME_CONTEXT_TYPE);
		if (contextRef != null) {
			contextRef.set(rctx);
		}
	});
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:22,代码来源:FnRequestHandler.java

示例5: extendActualJerseyContainerRequest

import org.glassfish.jersey.server.ContainerRequest; //导入方法依赖的package包/类
@Override
protected void extendActualJerseyContainerRequest(ContainerRequest actualContainerRequest,
		JRestlessContainerRequest containerRequest, WebActionRequest request) {
	actualContainerRequest.setRequestScopedInitializer(locator -> {
		Ref<WebActionRequest> webActionRequestRef = locator
				.<Ref<WebActionRequest>>getInstance(WEB_ACTION_REQUEST_TYPE);
		if (webActionRequestRef != null) {
			webActionRequestRef.set(request);
		} else {
			LOG.error("WebActionBinder has not been registered. WebActionRequest injection won't work.");
		}
	});
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:14,代码来源:WebActionRequestHandler.java


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