On Feb 12, 2008, at 11:35 AM, Bill Burke wrote:
>
> This does not support extensions very easily. How about a pluggable
> InjectionProvider mechanism?
>
> @InjectionPlugin
> public @interface CookieParam {
> String value();
> }
>
>
> @InjectionProvider(CookieParam.class)
> public class CookieInjectionProvider {
>
> @Injector
> Object extractCookie(@Metadata CookieParam metadata, @HttpContext
> HttpHeaders headers) {
> String cookieName = metadata.value();
>
> Cookie cookie = ...; // find cookie from HttpHeaders by
> cookieName
> return cookie.getValue();
> }
> }
>
>
> The InjectionProvider allows you to inject anything from the HTTP
> Request like you would a regular JAX-RS method. Additionally a
> @Metadata annotation is provided so that the provider can get access
> to the injection annotation instance you used in your application
> code.
>
> So, you could do this with all injectors except maybe @HttpContext
> as you would need basic/core access to the request.
>
Seems a bit overkill, I think I'd prefer to add additional specific
annotations like @CookieParam for now.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.