On 31/08/17 06:54, NicholaiX wrote:
I need to handle a vendor XML type, e.g. "application/vnd.com.something+xml"
in a REST service.
This is actually a compliant XML document, so I'd like to have CXF treat it
as an XML document during serialization and deserialization. The only
exception would be that I do not want the XML prolog (but IIRC I don't think
it generates that anyway).
I have a service with a POST method defined to Consume and Produce this
type. Question is, how do I tell CXF this is actually just a plain XML, and
to treat it as such, and just change the Content-Type on the response?
Preferably in code (I'd like to stay away from XML).
Currently it seems to be deserializing my document, but it's not serializing
the response back to the client, it is responding with an empty body and the
correct content-type. That's what brought me here. How do I do this the
right way?
Can you type the resource method signature here, return type and input
types ? If JAX-RS Response is returned, what is the type of the entity ?
And for my general knowledge, how are these vendor types handled, is there
any guessing going on? (e.g. since it's +xml, will CXF assume it's an XML
document during marshaling and unmarshaling?
*+xml payloads are handled by default by CXF JAXBElementProvider
What if it's something totally
different, like "application/vnd.com.my+protobuf")?
If JAX-RS MessageBodyWriter or Reader provider's supported media types
can be configured (they can be for most of the providers shipped with
CXF) then you can set custom produces/consumes media types on the given
provider's instance.
Sergey
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html