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