Package org.apache.abdera.writer

Examples of org.apache.abdera.writer.Writer


    public void writeTo(T element, Class<?> clazz, Type type, Annotation[] a,
                        MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
        throws IOException {
        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) {
            Writer w = createWriter("json");
            if (w == null) {
                throw ExceptionUtils.toNotSupportedException(null, null);
            }
            element.writeTo(w, os);  
        } else if (formattedOutput) {
            Writer w = createWriter("prettyxml");
            if (w != null) {
                element.writeTo(w, os);
            } else {
                element.writeTo(os);
            }
View Full Code Here


            element.writeTo(os);
        }
    }

    protected Writer createWriter(String writerName) {
        Writer w = ATOM_ENGINE.getWriterFactory().getWriter(writerName);
        if (w == null) {
            LOG.fine("Atom writer \"" + writerName + "\" is not available");
        }
        return w;
    }
View Full Code Here

            reportError("Atom element can not be serialized", ex);
        }
    }
   
    private void writeAtomElement(Element atomElement, OutputStream os) throws IOException {
        Writer w = formattedOutput ? createWriter("prettyxml") : null;
        if (w != null) {
            atomElement.writeTo(w, os);
        } else {
            atomElement.writeTo(os);
        }
View Full Code Here

                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException {
        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("json");
            feed.writeTo(w, entityStream);
        } else {
            feed.writeTo(entityStream);
        }
    }
View Full Code Here

                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException {
        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("json");
            entry.writeTo(w, entityStream);
        } else {
            entry.writeTo(entityStream);
        }
    }
View Full Code Here

    public void writeTo(T element, Class<?> clazz, Type type, Annotation[] a,
                        MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
        throws IOException {
        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("json");
            element.writeTo(w, os);  
        } else if (formattedOutput) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("prettyxml");
            element.writeTo(w, os);
        } else {
            element.writeTo(os);
        }
    }
View Full Code Here

        }
    }
   
    private void writeAtomElement(Element atomElement, OutputStream os) throws IOException {
        if (formattedOutput) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("prettyxml");
            atomElement.writeTo(w, os);
        } else {
            atomElement.writeTo(os);
        }
    }
View Full Code Here

*/
public class AtomTestCaseUtils {

    public static void prettyPrint(Abdera abdera, Base doc) throws IOException {
        WriterFactory factory = abdera.getWriterFactory();
        Writer writer = factory.getWriter("prettyxml");
        writer.writeTo(doc, System.out);
        System.out.println();
    }
View Full Code Here

        }
    }
   
    private void writeAtomElement(Element atomElement, OutputStream os) throws IOException {
        if (formattedOutput) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("prettyxml");
            atomElement.writeTo(w, os);
        } else {
            atomElement.writeTo(os);
        }
    }
View Full Code Here

        }
    }
   
    private void writeAtomElement(Element atomElement, OutputStream os) throws IOException {
        if (formattedOutput) {
            Writer w = ATOM_ENGINE.getWriterFactory().getWriter("prettyxml");
            atomElement.writeTo(w, os);
        } else {
            atomElement.writeTo(os);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.writer.Writer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.