users@jersey.java.net

[Jersey] Returned List of wrong type with Jersey

From: Eric Reagan <reaganej_at_gmail.com>
Date: Thu, 7 Jul 2011 14:31:28 -0400

Hello,
     I am using Jersey for as my front end client and I am getting a weird
return result. I have a web service that has


          public ListWrapper getPeople(....){....}

    and my ListWrapper is

    @XmlType
    @XmlRootElement
    public ListWrapper<T>
    {
         ...... constructor (both default and to set a list)....and a list
setter....
        T getList();
    }

When I do
          ListWrapper lw = webResource.get(ListWrapper .class, QueryParams)

          for(Object obj : lw.getList())
          {
               o.cast(MyObjectClass.class)
          }

I get a class cast exception in my GUI code because the list I created in my
ListWrapper is a list of ElementNSImpl not a list of MyObject . When I
browse to my web service with firefox I see all of the data I would be
expecting to get from MyObject. Is there an easy way to reconfigure Jersey
to put in the MyObject class instead of the ElementNSImpl?

Thank you,


-- 
Eric Reagan