dev@jsr311.java.net

Re: JSR311: _at_Target of FIELD for _at_*Param annotations

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 07 Mar 2008 14:22:13 -0500

On Mar 7, 2008, at 1:49 PM, Stephan Koops wrote:
>
> Marc Hadley schrieb:
>> It would bother me if we added new targets but didn't define what
>> should happen if a developer uses those targets. E.g. if we added
>> FIELD as a target for @PathParam then I think we'd have to require
>> implementations to support that annotation on resource class
>> fields. That's fine for the per-request resource life cycle but
>> what about singleton resources...
> @*Param could be used the same as @Context.

Injecting a thread-local proxy won't work for primitive types.

> Also @Context is not useful on the providers (or which singeltons do
> you mean?)
>
I think @Context is useful on entity providers, e.g. you might need
access to UriInfo to create links in an response entity. @Context is
also used to inject MessageBodyWorkers and ContextResolver in
providers that need those things.

In my original post I mean't a singleton resource class. E.g. if an
implementation defers resource class instantiation to an IoC framework
like Spring and that defines a singleton lifecycle for the resource
class...

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.