users@jersey.java.net

Re: [Jersey] Sending xml to Jersey

From: paradisonoir <pourteymour_at_gmail.com>
Date: Thu, 12 Feb 2009 07:19:02 -0800 (PST)

Hi Paul,


Paul Sandoz wrote:
>
>
>> 1) Does this resource.accept(MediaType.APPLICATION_XML) automatically
>> convert/transform our request to XML?
>
> No. You need to provide a correct Java type is capable of being
> unmarshalled from XML.
>


so in my case, myObject, which is what I am going to send to my server-side
jersey handler, is an instance of a JAXB object (automatically generated
from an xml schema , containing all getters/setters of its xml elements).
So, I can use my myObject in here to send a request in APPLICATION_XML type.

Builder builder = resource.accept(MediaType.APPLICATION_XML);
builder.entity(myObject);


-- 
View this message in context: http://n2.nabble.com/Sending-xml-to-Jersey-tp2286744p2315399.html
Sent from the Jersey mailing list archive at Nabble.com.