users@jersey.java.net

Re: [Jersey] canonical way to configure the JAXB Context used by the Client API?

From: Arul Dhesiaseelan <arul_at_fluxcorp.com>
Date: Wed, 25 Mar 2009 16:22:13 -0600

James Strachan wrote:
> I remember there used to be an API to add a Provider from the Client
> API which isn't there any more - I just wondered what the correct way
> to do this was now? I didn't see any JAXB configuration in the jaxb
> sample to copy :)
>
> I've a test case trying to GET using a JAXB bean class and its not
> managing to parse it; I just get null returned - yet doing the client
> GET using String.class returns valid XML so I'm asssuming its not got
> the right JAXB context configuration.
>
>
Did you try this?

        // Create the client config
    ClientConfig cc = new DefaultClientConfig();
    // Include the provider class
    cc.getClasses().add(JerseyProvider.class);

    // Create the client
    Client c = Client.create(cc);


-Arul