users@jsr311.java.net

Re: Sorting MessageBodyWriterS

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 06 Jan 2009 09:29:23 -0500

On Jan 6, 2009, at 5:20 AM, Paul Sandoz wrote:
>>
>>> I'm wondering why the
>>> closeness of the java-type seems not to play a role: say we have a
>>> class
>>> Person that is a subclass of Agent and writers for both classes,
>>> shouldn't a jax-rs implementation always select the Person writer
>>> when a
>>> method returns a Person. As I understand the spec it is not
>>> determined
>>> which writer is selected.
>>>
>> Hmm, I can't recall why we didn't do that for MBW but did for
>> ExceptionMappers, Paul do you remember ?
>>
>
> It did not occur to us. I think it a good idea. As it solves the
> issue of the Agent consuming all instances if the isWritable does
> the following:
>
> return Agent.class.isAssignableFrom(clazz);
>
If we added "closeness" as a secondary sort key then I don't think
that would break backwards compatibility since currently the ordering
beyond media type isn't defined so apps shouldn't be relying on it.
Seems like a good candidate for the 1.1 maintenance.

Marc.

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