cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: @Context instantiation
Date Thu, 17 Jan 2013 21:39:17 GMT
Hi

On Thu, Jan 17, 2013 at 5:05 PM, Esteban Wagner
<wagner.esteban@gmail.com> wrote:
> Hi,
>
> I am using Jax-RS I am not understading how the Message Context injection
> works. I have looked at the documentation but its still not clear.
>
> From doing some tests I ve seen that the messageContext only get injected
> when the resource lifecyle its configured as "prototype". Is this correct?
> Can I get the message context injected using "singleton" scope?
>
> Using the singleton scope I am able to get the MessageContext injected as a
> method parameter, but not as a field. Is this Correct?
>
Sometimes the field-level injection due to Spring proxies hiding the
fields, but message-level injection usually works.
Have a look here please for more info:
http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-FromSpring

Cheers, Sergey

> Many Thanks,
>
> Service class was something like this:
>
> @Path("/user")
> *public class UserRestfulService { *
>
> *
> *
>
> * private @Context MessageContext messageContext;*
>
> *
> *
> *
>          @GET
> @Produces("application/json")
> *
>
> * public User getUser() {*
>
> * *
>                          messageContext.someMethod();
>
> * }*
> *
> *
> *
> *
> *
> *



-- 
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com

Mime
View raw message