Este contenido no está disponible en el idioma seleccionado.
18.2. Using JAXB with the Atom Provider
The
org.jboss.resteasy.plugins.providers.atom.Content
class lets you marshal and unmarshal JAXB-annotated objects that form the body of an entry's content. The following code is an example of sending an Entry
with a Customer
object attached as the body of the entry's content.
The
Content.setJAXBObject()
method tells the content object that you are returning a Java JAXB object to be marshaled. If you use a base format other than XML (for example, application/atom+json
), the attached JAXB object will be marshaled into that format.
If your input is an Atom document, you can also extract JAXB objects from
Content
by using Content.getJAXBObject(Class class)
. The code that follows is an example of extracting a Customer
object from the Content
: