users@jersey.java.net

[Jersey] Re: Newbie how to return an XML representation of a class with an arraylist

From: John Yeary <johnyeary_at_gmail.com>
Date: Mon, 9 Apr 2012 20:21:05 -0400

Please take a look at using GenericEntity. You would use it like new
GenericEntity<List<Widget>>(widgets){} This would wrap your Java XML
objects.

John
____________________________

John Yeary
____________________________
*NetBeans Dream Team*
*President Greenville Java Users Group
Java Users Groups Community Leader
Java Enterprise Community Leader*

____________________________

<http://javaevangelist.blogspot.com/> <https://twitter.com/jyeary>
<http://www.youtube.com/johnyeary>
  <http://www.linkedin.com/in/jyeary>
<https://plus.google.com/112146428878473069965>
  <http://www.facebook.com/jyeary>
<http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog>
  <http://netbeans.org/people/84414-jyeary>

"Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits who
neither enjoy much nor suffer much, because they live in the gray twilight
that knows not victory nor defeat."
-- Theodore Roosevelt



On Sat, Apr 7, 2012 at 5:55 AM, <rajeshkhan808_at_gmail.com> wrote:

> Hi I wanted to know how i could return a class as XML which has an
> arraylist in it
> Example
>
> @XmlRootElement
> class someclass
> {
> private ArrayList<AnotherClass> ac;
> public someclass()
> {
> ac = new ArrayList<AnotherClass>();
> }
> }
>
> Also how would i send an arraylist<AnotherClass> back in XML form any
> suggestions would be appreciated.
>