writer = mc.getContent(XMLStreamWriter.class);
if (writer == null) {
XMLOutputFactory factory = (XMLOutputFactory)mc.get(XMLOutputFactory.class.getName());
if (factory != null) {
try {
writer = factory.createXMLStreamWriter(os);
} catch (XMLStreamException e) {
throw new WebApplicationException(
new RuntimeException("Cant' create XMLStreamWriter", e));
}
}