use of org.codehaus.jettison.badgerfish.BadgerFishXMLOutputFactory in project cxf by apache.
the class BadgerFishProvider method writeTo.
public void writeTo(Object obj, Class<?> clazz, Type genericType, Annotation[] annotations, MediaType m, MultivaluedMap<String, Object> headers, OutputStream os) {
try {
if (!new Locale("badgerFishLanguage").equals(requestHeaders.getLanguage())) {
throw new RuntimeException();
}
JAXBContext context = getJAXBContext(obj.getClass());
Marshaller marshaller = context.createMarshaller();
XMLOutputFactory factory = new BadgerFishXMLOutputFactory();
XMLStreamWriter xsw = factory.createXMLStreamWriter(os);
marshaller.marshal(obj, xsw);
xsw.close();
} catch (JAXBException e) {
e.printStackTrace();
} catch (XMLStreamException e) {
e.printStackTrace();
}
}
Aggregations