users@jersey.java.net

Re: [Jersey] _at_Context annotated field in spring bean with prototype scope.

From: Erick Dovale <edovale_at_gmail.com>
Date: Fri, 30 Jan 2009 10:28:01 -0500

Paul,
I didn't know that. Now, if that is the case, that providers can only be
singletons, how can I get the user locale from a MessageBodyWriter? Isn't
the MessageBodyWriter the one responsible for writing the request entity
into the response?
Jersey is not throwing any exception. I guess the reason for this is that I
have a @PerRequest annotation in my provider and the bean definition is a
prototype which make both scopes match. Obviously there is no enforcement of
a particular scope for jersey providers; at least for MessageBodyWriter
instances.
I am on jersey-1.0

Thanks again for the quick responses.

Cheers.

Erick.

On Fri, Jan 30, 2009 at 10:15 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:

>
> On Jan 30, 2009, at 3:34 PM, Erick Dovale wrote:
>
> Folks,
>> I can't get jersey to inject the HttpHeaders instance in a @Provider
>> annotated entity provider (MessageBodyWriter) which is a spring managed bean
>> with scope prototype.
>>
>
> You cannot use providers in anything other than the singleton scope.
>
> I am surprised Jersey is not throwing an runtime exception in such a case
> which states:
>
> "The scope of the component <c> must be a singleton"
>
> What version of Jersey are you using?
>
> It is possible to share a simple maven project that reproduces your
> problem?
>
> Paul.
>
>
>> The bean is defined in a spring context and jersey is successfully
>> discovering it, however, jersey fails to inject the HttpHeaders instance.
>> Has anyone had a similar problem before?
>>
>>
>
> Thanks.
>>
>> Erick.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>