users@jersey.java.net

JAXB not working

From: Markus Karg <karg_at_quipsy.de>
Date: Mon, 22 Jun 2009 16:47:06 +0200

I want to provide a XML body to a PUT method, using an application
provided JAXB class.

 

The class is marked as @XmlRootElement, and the method is like this:

 

@PUT

@Path("{fileName}.xml")

@Consumes("application/xml")

public final void put(final MyJaxbClass body)

 

The JAX-RS specification says: "If an application does not supply a
JAXBContext for a particular type, the implementation-supplied entity
provider MUST use its own default context instead."

 

In fact, my implementation of the Application interface does NOT provide
a JAXBContext for MyJaxbClass (while it does for other JAXB classes).

 

The caller sends an "Accept: application/xml" header in the request.

 

So I wonder why Jersey always says that it cannot find a message body
ready for "application/octetstream"...?

 

The used JAX-RS version is 1.0.3.

 

Maybe it is a bug?

 

What is my fault?

 

Thanks

Markus