You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2017/09/01 11:09:55 UTC

Re: Handling vnd (vendor) content type

Hi

the easiest option is to register an instance of JAXBElementProvider as 
a custom jaxrs:provider, with its 'marshallerProperties' set as needed, 
example, "jaxb.fragment":true.

Or you can set them dynamically from a CXF jaxrs:outInterceptor (sitting 
on the phase earlier than MARSHALL) on the current message, ex, 
outMessage.set("jaxb.fragment", true);

HTH, Sergey
On 31/08/17 18:14, NicholaiX wrote:
> Hi Sergey,
> I did find one additional issue. Given my prototype:
> 
> @POST
> @Consumes(Constants.MY_TYPE)
> @Produces( Constants.MY_TYPE)
> public MyDocument HandleMyPost(String cmds) { return new MyDocument(); //...
> }
>     
> I see that it is adding an XML prologue to the response. I need to be able
> to turn off this prologue, since the vendor implementation of this xml
> document is getting confused.
> 
> I tried to dump the XML before response:
> 
> private final XmlMapper mapper = new XmlMapper();
> Response resp =
> Response.status(200).entity(response).encoding(Constants.MY_TYPE).build();
> LOG.info(mapper.writeValueAsString(resp));
> 
> and this doesn't contain the prologue.
> 
> 
> What is the proper way to suppress the XML prologue?
> 
> 
> 
> 
> 
> --
> Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
> 


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/