|
From: Bill B. <bb...@re...> - 2008-06-11 19:56:17
|
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
|