Package org.apache.abdera.writer

Examples of org.apache.abdera.writer.Writer


                        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"); //$NON-NLS-1$
            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"); //$NON-NLS-1$
            entry.writeTo(w, entityStream);
        } else {
            entry.writeTo(entityStream);
        }
    }
View Full Code Here

    }

    /** Pretty print the document body. */
    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

        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();

        entry.setContent(new IRI("http://example.org/xml"), "text/xml");

        Writer json = abdera.getWriterFactory().getWriter("json");
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        entry.writeTo(json, outputStream);
        String output = outputStream.toString();
        assertTrue(output.contains("\"type\":\"text/xml\""));
        assertTrue(output.contains("\"src\":\"http://example.org/xml\""));
View Full Code Here

        server.stop();
    }

    protected void prettyPrint(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

        res = client.get(location.toString() + "Invalid");
        assertEquals(404, res.getStatus());
    }

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

    public void testJson() throws IOException {
        Abdera abdera = Abdera.getInstance();
        Feed f = abdera.newFeed();
        IntegerElement ext = f.addExtension(OpenSearchConstants.START_INDEX);
        ext.setValue(101);
        Writer json = abdera.getWriterFactory().getWriter("json");

        StringWriter stWriter = new StringWriter();
        PrintWriter pWriter = new PrintWriter(stWriter);
        f.writeTo(json, pWriter);
        assertTrue(stWriter.toString().contains("101"));
View Full Code Here

        res.release();
    }

    protected 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

    protected IRI _resolve(IRI base, IRI value) {
        return base != null ? base.resolve(value) : value;
    }

    public void writeTo(OutputStream out, WriterOptions options) throws IOException {
        Writer writer = this.getFactory().getAbdera().getWriter();
        writer.writeTo(this, out, options);
    }
View Full Code Here

        Writer writer = this.getFactory().getAbdera().getWriter();
        writer.writeTo(this, out, options);
    }

    public void writeTo(java.io.Writer out, WriterOptions options) throws IOException {
        Writer writer = this.getFactory().getAbdera().getWriter();
        writer.writeTo(this, out, options);
    }
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.