users@jersey.java.net

Maven Archetypes <was> Re: [Jersey] _at_Context annotated field in spring bean with prototype scope.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 02 Feb 2009 17:17:01 +0100

On Jan 30, 2009, at 4:29 PM, Erick Dovale wrote:

> As for the maven project, is there a maven archetype I can use to
> generate everything?

Yes, there are two:

1) Grizzly:

   http://download.java.net/maven/2/com/sun/jersey/archetypes/jersey-quickstart-grizzly/1.0.1/

2) WebApp

   http://download.java.net/maven/2/com/sun/jersey/archetypes/jersey-quickstart-webapp/1.0.1/

Do this:

   mvn archetype:generate -DarchetypeCatalog=http://download.java.net/maven/2

See here for more details:

   http://blogs.sun.com/enterprisetechtips/entry/configuring_json_for_restful_web

Paul.

>
>
> On Fri, Jan 30, 2009 at 10:28 AM, Erick Dovale <edovale_at_gmail.com>
> wrote:
> 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
>
>
>