|
From: Bill B. <bb...@re...> - 2008-06-11 22:56:19
|
I'll ask the spec committee. There have been no plans.
I'm wondering if it should even be something we support as its so user
specific. I mean, its kinda silly, we're just saving like 4 lines of code.
Olivier Brand wrote:
> Yes, this is what I meant on my previous email: Is that in the plan of JAX-RS to make such annotation or is it going to be specific to resteasy? From what I have seen in CXF and Jersey, people have similar needs.
>
> Olivier
>
> ----- Original Message ----
> From: Bill Burke <bb...@re...>
> To: Olivier Brand <ol...@mu...>
> Cc: Ryan McDonough <rmc...@sa...>; res...@li...
> Sent: Wednesday, June 11, 2008 2:59:45 PM
> Subject: Re: [Resteasy-developers] List<JAXBStuff>
>
>
>
> Olivier Brand wrote:
>> Not sure if JAXB annotations can be used with a collection of non-primitive types though.
>> I have tried the @XmlElement annotation as: @XmlElement(name=listOfStuff) and the annotation is not picked up by the read provider method in the annotations field.
>>
>
>
> You'll have to show what you tried to do.
>
> The Annotation[] array past into MessageBodyReader should be annotations
> on the parameter, setter method, or field you're injecting into.
>
> Since @XmlElement can't be a parameter annotation, then we'd have to
> make up our own.
>
>> Olivier
>>
>> ----- Original Message ----
>> From: Bill Burke <bb...@re...>
>> To: Olivier Brand <ol...@mu...>
>> Cc: Ryan McDonough <rmc...@sa...>; res...@li...
>> Sent: Wednesday, June 11, 2008 1:06:10 PM
>> Subject: Re: [Resteasy-developers] List<JAXBStuff>
>>
>> It would be a parameter, method, and field annotation.
>>
>> I didn't understand the 2nd part of your question.
>>
>> Olivier Brand wrote:
>>> What type of annotation would this be? I that in the plan of JAX-RS?
>>>
>>> Olivier
>>>
>>> ----- Original Message ----
>>> From: Bill Burke <bb...@re...>
>>> To: Olivier Brand <ol...@mu...>
>>> Cc: Ryan McDonough <rmc...@sa...>; res...@li...
>>> Sent: Wednesday, June 11, 2008 12:58:24 PM
>>> Subject: Re: [Resteasy-developers] List<JAXBStuff>
>>>
>>> Yeah, adding an annotation could easily be done as the Reader/Writer
>>> receives a list of annotations that are on the parameter, method, or
>>> field you are (un)marshalling.
>>>
>>> You could also do a multipart encoding.
>>>
>>>
>>>
>>> Olivier Brand wrote:
>>>> I actually implemented the class myself as well. I did follow a similar approach. I just appended the name of the class of the objects stored in the collection to the tag name:
>>>>
>>>> collectionOf<class name>
>>>>
>>>>
>>>> I have also took a peak at the Jersey implementation. Someone did something more complex as taking the class name stored in the collection and making it a plurial.
>>>> Frankly I do not like this at all...
>>>>
>>>> Could there be an approach where the name of the collection could be added as an annotation somewhere? That would be the cleanest way as it would not force any naming conventions and not intrusive to the code.
>>>>
>>>> Olivier
>>>>
>>>>
>>>> ----- Original Message ----
>>>> From: Bill Burke <bb...@re...>
>>>> To: Ryan McDonough <rmc...@sa...>
>>>> Cc: Olivier Brand <ol...@mu...>; res...@li...
>>>> Sent: Wednesday, June 11, 2008 12:14:54 PM
>>>> Subject: Re: [Resteasy-developers] List<JAXBStuff>
>>>>
>>>> Well, then you have to get such an approach to work with JAXB. How to
>>>> do that? Any ideas?
>>>>
>>>> Ryan McDonough wrote:
>>>>> It could be something like:
>>>>>
>>>>> <collection>
>>>>> <foo></foo>
>>>>> <foo></foo>
>>>>> </collection>
>>>>>
>>>>> That way, we don't care of the actual collection implementation. I think
>>>>> it's a good easy way for the quick and dirty.
>>>>>
>>>>> Ryan-
>>>>>
>>>>>
>>>>> On 6/11/08 1:58 PM, "Bill Burke" <bb...@re...> wrote:
>>>>>
>>>>>> If I wrote a provider for (un)marshalling Collections of JAXB objects
>>>>>> how should the output look?
>>>>>>
>>>>>> @GET
>>>>>> @ProduceMime("application/xml")
>>>>>> List<Foo> get();
>>>>>>
>>>>>> Output:
>>>>>> <foo></foo>
>>>>>> <foo></foo>
>>>>>>
>>>>>>
>>>>>>
>>>>>> The problem with this approach is that the browser gives you an error
>>>>>> and doesn't display the XML.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Ryan J. McDonough
>>>>> Platform, Specialist Java EE | Sapient
>>>>> 131 Dartmouth St.
>>>>> Boston, MA 02116
>>>>> mobile: +1 508 735 4503
>>>>> fax: +1 617 621 1300
>>>>>
>>>>>
>>>>> The information transmitted is intended only for the person or entity to
>>>>> which it is addressed and may contain confidential and/or privileged
>>>>> material. Any review, retransmission, dissemination or other use of, or
>>>>> taking of any action in reliance upon, this information by persons or
>>>>> entities other than the intended recipient is prohibited. If you received
>>>>> this in error, please contact the sender and delete the material from any
>>>>> computer.
>>>>>
>>>>>
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|