Hi Mike,
I think you need to register a ContextResolver<JAXBContext> with the
client side such that for the type BaseTestClass it will return a
JAXBContext that knows about it and all the sub classes.
ClientConfig cc = new DefaultClientConfig();
cc.getClasses().add(MyContextResolver.class);
Client c = Client.create(cc);
On Jun 8, 2010, at 2:02 AM, Mike Rother wrote:
> I am trying to return entities that all are in the same class
> hierarchy.
>
> BaseTestClass, Subclass1TestClass (extends BaseTestClass) and
> SubClass2TestClass (extends BaseTestClass).
>
>
>
> I see the xml response contains the XML for the correct entity class
> @XmlRootElement(). How do I have the Jersey client know how to parse
> the response to the correct entities?
>
>
>
> When I try this:
>
> BaseTestClass result =
> res.type(MediaType.APPLICATION_JSON).get(new GenericType<
> BaseTestClass>() {});
>
>
>
Not that "new GenericType< BaseTestClass>() {}" is redundant. You can
just declare the class "BaseTestClass.class" instead. The former is
only require if you need to preserve generic type information.
Paul.
> I get an instance of the BaseTestClass and not the subclass as
> desired. How can I get an instance or a list of instance of the
> correct classes?
>
>
>