Sergey thanks for the response.

One more thing if you can clarify about @Context injection.

If the service bean is configured as a SINGLETON, and I have a field of
this service injected like this:

private @Context MessageContext mc;

How is that for example 2 concurrent calls to the same service will manage
to have 2 different Message Contexts? If the underlying instance of the
service will be the same (As its singleton)

I am missing something here?


Many Thanks,




On Thu, Jan 17, 2013 at 9:39 PM, Sergey Beryozkin <[email protected]>wrote:

> Hi
>
> On Thu, Jan 17, 2013 at 5:05 PM, Esteban Wagner
> <[email protected]> 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
>

Reply via email to