On 7/9/07, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
>
>
> I presume that the 'canAccept' method would get called n times where n
> is the product of the number of items on each acceptable axis. And the
> runtime has to order the calls w.r.t. to the quality parameters.
> Although there could still be ambiguity, which takes precedence a
> "application/xml;q=0.8" with "en;q=0.6" or "application/json;q=0.6" with
> "fr;q=0.8"?
Hmm good point I suppose this is where Jerome's List<Variant> holds its own
in terms of simplicity.
However, i think that AcceptabilityEvaluator could be
> extended to a builder pattern (a nice parallel to Response.Builder) that
> could get around this issue:
>
> ae.accept(languages, type).
> accept(type, languages).build();
Yea that's a good idea. I likes me builders =)
if the static method can get access to a runtime context from the
> current thread (although i am not sure if this is bad practice or not).
It feels ugly but I think it is such an entrenched practice that it is
probably ok (I mean servlet is built around ThreadLocal).
Where would one call the builder from? Im assuming it is a one-time action,
per-resource.
Just thinking aloud, we could also allow the AE to be injected to the
http-method...
I find that the introduction of a method calling order contract with the
> runtime can introduce complexities for the developer (which may be OK
> but we need to be aware of the consequences).
Ok this is a very sensible point I concede it to you. It's important enough
that an additional api-contract is mitigatory.
Dhanji.