use of org.apache.webbeans.intercept.ConstructorInterceptorInvocationContext in project meecrowave by apache.
the class JAXRSFieldInjectionInterceptor method doInject.
private void doInject(final InvocationContext ic) throws Exception {
final Message current = JAXRSUtils.getCurrentMessage();
if (current != null) {
final OperationResourceInfoStack stack = OperationResourceInfoStack.class.cast(current.get(OperationResourceInfoStack.class.getName()));
if (stack != null && !stack.isEmpty()) {
final Object instance;
if (ConstructorInterceptorInvocationContext.class.isInstance(ic)) {
final ConstructorInterceptorInvocationContext constructorInterceptorInvocationContext = ConstructorInterceptorInvocationContext.class.cast(ic);
constructorInterceptorInvocationContext.directProceed();
instance = constructorInterceptorInvocationContext.getNewInstance();
} else {
instance = ic.getTarget();
}
Application application = null;
final Object appInfo = current.getExchange().getEndpoint().get(Application.class.getName());
if (ApplicationInfo.class.isInstance(appInfo)) {
application = ApplicationInfo.class.cast(appInfo).getProvider();
}
synchronized (this) {
if (injected.get()) {
return;
}
InjectionUtils.injectContextProxiesAndApplication(stack.lastElement().getMethodInfo().getClassResourceInfo(), instance, application, ProviderFactory.getInstance(current));
injected.compareAndSet(false, true);
}
}
}
}
Aggregations