Вы можете вернуть javax.ws.rs.core.StreamingOutput
из службы JAX-RS.В вашей реализации StreamingOutput
вы можете использовать JAXB с XSLT и XSD.
public class MyStreamingOutput implements StreamingOutput {
private JAXBContext jc;
private Transformer t;
private XmlSchema s;
private Object o;
public MyStreamingOutput(JAXBContext jc, Transformer t, XmlSchema s, Object o) {
this.jc = jc;
this.t = t;
this.s = s;
this.o = o;
}
public void write(java.io.OutputStream output) throws java.io.IOException, WebApplicationException
Marshaller m = jc.createMarshaller();
m.setSchema(s);
JAXBSource source = new JAXBSource(m,o):
StreamResult result = new StreamResult(output);
t.transform(source, result);
}
}