-
1. Re: CDI producer bean with jax-rs dependency
jharting Apr 3, 2012 9:15 AM (in response to skshyamal)JAX-RS injection is not available in plain CDI beans.
-
2. Re: CDI producer bean with jax-rs dependency
skshyamal Apr 5, 2012 4:31 AM (in response to jharting)But it works in Glassfish server which uses WELD for CDI and jersey for JAX-RS. Intersting class I found in jersey is com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer which bridges the CDI and JAX-RS beans.
-
3. Re: CDI producer bean with jax-rs dependency
jharting Apr 6, 2012 9:42 AM (in response to skshyamal)CDI an JAX-RS are bridged in JBoss AS 7 as the specification requires. You can use any CDI component as a JAX-RS resource or provider. This involves dependency injection and other CDI services. The injection you describe works the other way around and is not portable. In your code, you should still be able to get a reference to HttpServletContext and get the information you need from there. Alternatively, you'll have to inject the information you need into a JAX-RS resource/provider and put a CDI producer there.
-
4. Re: CDI producer bean with jax-rs dependency
skshyamal Apr 10, 2012 6:04 AM (in response to jharting)If I put a CDI producer in JAX-RS resource then there is a chance of cyclic injection problem. For ex. I have CDI bean with constructor parameter as String which is nothing but the Path variable from REST resource bean. So I create a producer method to expose this path variable in JAX-RS resource bean, then comes the cyclic dependency problem.