users@jersey.java.net

Re: [Jersey] Re: Alternate to HttpRequestContext#getAcceptableMediaType

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 28 Oct 2010 10:01:43 +0200

On Oct 27, 2010, at 8:21 PM, John Lister wrote:

> Just be careful, when you build variant list as described in the
> linked presentation you need to call add() before build() to
> generate the variant combinations for build to return. Slightly odd
> syntax and caught me out the first time.
>
> eg:
> List<Variant> vs = Variant.mediaTypes("a/xml", "a/
> json").languages("en", "fr").build();
> becomes
> List<Variant> vs = Variant.mediaTypes("a/xml", "a/
> json").languages("en", "fr").add().build();
>

Thanks for pointing that out, it has caught me out too! I think that
is a bug in Jersey and potentially in 311.

Would you mind logging another issue against Jersey (if the issue
tracker is not in r/o mode)?

Thanks,
Paul.