You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Tobias Gutzmann <To...@ist.com> on 2014/02/17 12:33:52 UTC

Features and @Context injection

Hi,

I have a class "MyFeature extends AbstractFeature" that adds two InInterceptors to the interceptor chain.
I then have a service class that is annotated with @Features(classes = MyFeature.class). The interceptors are called as expected, however, they contain @Context fields that are not being injected (injection works well on the service class). I dug a bit into the CXF internals, but cannot seem to find a way to register the interceptors for context-search. Is there a way?

I'm using the latest CXF 2.7.10.

Regards,
Tobias

Re: Features and @Context injection

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 17/02/14 11:33, Tobias Gutzmann wrote:
> Hi,
>
> I have a class "MyFeature extends AbstractFeature" that adds two InInterceptors to the interceptor chain.
> I then have a service class that is annotated with @Features(classes = MyFeature.class). The interceptors are called as expected, however, they contain @Context fields that are not being injected (injection works well on the service class). I dug a bit into the CXF internals, but cannot seem to find a way to register the interceptors for context-search. Is there a way?

JAX-RS contexts can not be injected into the native CXF interceptors, 
one can get all the request properties from the current Message at the 
CXF interceptor level, you can wrap Message into implementation objects 
like UriInfoImpl, etc, if you prefer to work against JAX-RS contexts,

Cheers, Sergey
>
> I'm using the latest CXF 2.7.10.
>
> Regards,
> Tobias
>