dev@jsr311.java.net

Re: JSR311: Re: ContextResolver removal

From: Bill Burke <bburke_at_redhat.com>
Date: Wed, 11 Jun 2008 09:35:00 -0400

Paul Sandoz wrote:
> Marc Hadley wrote:
>> On Jun 10, 2008, at 10:57 AM, Bill Burke wrote:
>>>>> One thing we could consider is to make the JAXBContext usage more
>>>>> obvious.
>>>> I have also to say that I need time to understand what the
>>>> ContextResolver is for. You could add some javadoc, that an example
>>>> use is for JAXBContext.
>>>
>>> Question: Is the container supposed to search for and use
>>> @ProduceMime/_at_ConsumeMime annotations on a ContextResolver?
>>>
>> Not currently.
>>
>>> Makes sense that you might want to have different JAXBContext for the
>>> same type and different mime format. (A Jettison enabled/configured
>>> JAXBContext for JSON for example).
>>>
>> Sounds like an interesting idea.
>>
>
> Jersey provides a JSON specific JAXBContext implementation that inherits
> from JAXBContext. So far there has been no need to utilize
> produce/consume for such support.
>
> An alternative may be to include the media type as an argument to the
> get method i.e. is the direction, consuming or producing important?
>
> It may also be useful to consider using context resolver for obtaining
> the JAXB unmarshaller/marshaller for a type as well since properties can
> be set of these. This straightforward to support.
>

I still think ContextResolver is an implementation detail and ad-hoc
dependency injection. We would be doing this very very differently if
we were building on top of an existing DI mechanism. We would not be
adding a new component type.


-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com