Search in sources :

Example 1 with JettisonMarshaller

use of org.glassfish.jersey.jettison.JettisonMarshaller in project jersey by jersey.

the class JettisonJaxbElementProvider method writeTo.

@Override
protected final void writeTo(JAXBElement<?> t, MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException {
    JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m);
    if (isFormattedOutput()) {
        jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true);
    }
    jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c));
}
Also used : JettisonMarshaller(org.glassfish.jersey.jettison.JettisonMarshaller) OutputStreamWriter(java.io.OutputStreamWriter)

Example 2 with JettisonMarshaller

use of org.glassfish.jersey.jettison.JettisonMarshaller in project jersey by jersey.

the class JettisonRootElementProvider method writeTo.

@Override
protected void writeTo(Object t, MediaType mediaType, Charset c, Marshaller m, OutputStream entityStream) throws JAXBException {
    JettisonMarshaller jsonMarshaller = JettisonJaxbContext.getJSONMarshaller(m);
    if (isFormattedOutput()) {
        jsonMarshaller.setProperty(JettisonMarshaller.FORMATTED, true);
    }
    jsonMarshaller.marshallToJSON(t, new OutputStreamWriter(entityStream, c));
}
Also used : JettisonMarshaller(org.glassfish.jersey.jettison.JettisonMarshaller) OutputStreamWriter(java.io.OutputStreamWriter)

Aggregations

OutputStreamWriter (java.io.OutputStreamWriter)2 JettisonMarshaller (org.glassfish.jersey.jettison.JettisonMarshaller)2