users@jersey.java.net

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

From: James Strachan <james.strachan_at_gmail.com>
Date: Thu, 26 Mar 2009 08:58:37 +0000

2009/3/25 Arul Dhesiaseelan <arul_at_fluxcorp.com>:
> 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);

That did the trick, many thanks!

For some reason after staring at ClientConfig and Client for a while -
my brain must have filtered out the regex of "getClass.*" :)

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/