users@jersey.java.net

Re: [Jersey] Injection question - Guice + HttpServletRequest

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 07 Oct 2009 10:27:33 -0400

On Oct 7, 2009, at 10:09 AM, DirkM wrote:
>
> Paul Sandoz wrote:
>>
>> Moises is referring to the Guice Provider interface
>>
>
> Aha! Wow that really was easy :) Thanks Paul and Moises.
>
>
> Paul Sandoz wrote:
>>
>> Unfortunately it is not possible to mix Jersey-based and Guice-based
>> injection with constructors.
>>
>
> That's unfortunate. I like List<Locale>
> HttpHeaders.getAcceptableLanguages()
> much more than Enumeration<Locale> HttpServletRequest.getLocales().
> Enumerations are so 1995.

You can still get the HttpHeaders as a field:

@Context HttpHeaders headers;

Just not as a constructor parameter.

Marc.