Package org.apache.abdera.model

Examples of org.apache.abdera.model.Feed.writeTo()


        itemsPerPage.setValue(ITEMS_PER_PAGE);
        IntegerElement startIndex = feed.addExtension(OpenSearchConstants.START_INDEX);
        startIndex.setValue(START_INDEX);

        StringWriter writer = new StringWriter();
        feed.writeTo(writer);

        String result = writer.toString();

        System.out.print(result);
View Full Code Here


        feed.addSimpleExtension(OpenSearchConstants.TOTAL_RESULTS, String.valueOf(TOTAL_RESULTS));
        feed.addSimpleExtension(OpenSearchConstants.ITEMS_PER_PAGE, String.valueOf(ITEMS_PER_PAGE));

        StringWriter writer = new StringWriter();
        feed.writeTo(writer);
        String result = writer.toString();

        assertXpathEvaluatesTo(String.valueOf(TOTAL_RESULTS), "//os:totalResults", result);
        assertXpathEvaluatesTo(String.valueOf(ITEMS_PER_PAGE), "//os:itemsPerPage", result);
View Full Code Here

        entry.setUpdated(new Date());
        entry.addLink("http://\u0645\u062b\u0627\u0644.org/ar/blog/1");
        entry
            .setSummaryAsXhtml("<p xml:lang=\"ar\" dir=\"rtl\">\u0648\u0647\u0630\u0627\u0020\u0645\u062b\u0627\u0644\u0020\u0639\u0644\u0649\u0020\u0648\u062c\u0648\u062f\u0020\u0041\u0074\u006f\u006d\u0020\u0031\u002e\u0030\u0020\u0052\u0054\u004c\u0020\u0627\u0644\u0627\u0639\u0644\u0627\u0641\u0020\u0627\u0644\u062a\u064a\u0020\u062a\u062d\u062a\u0648\u064a\u0020\u0639\u0644\u0649\u0020\u0627\u0644\u0646\u0635\u0020\u0627\u0644\u0639\u0631\u0628\u064a</p>");

        feed.writeTo("prettyxml", System.out);

        System.out.println();
        Element el = feed.getEntries().get(0).getSummaryElement().getValueElement().getFirstChild();
        System.out.println("Incorrect: " + el.getText());
        System.out.println("Correct: " + BidiHelper.getBidiElementText(el));
View Full Code Here

                   
                    try {
                    Abdera abdera = new Abdera();
                    WriterFactory wf = abdera.getWriterFactory();
                    org.apache.abdera.writer.Writer json = wf.getWriter("json");
                      feed.writeTo(json, response.getWriter());
                    } catch (Exception e) {
                        throw new ServletException(e);
                    }              

              } else {
View Full Code Here

                    try {
                        Abdera abdera = new Abdera();
                        WriterFactory wf = abdera.getWriterFactory();
                        org.apache.abdera.writer.Writer json = wf.getWriter("json");
                        feed.writeTo(json, response.getWriter());
                    } catch (Exception e) {
                        throw new ServletException(e);
                    }

                } else {
View Full Code Here

    entry.setUpdated(new Date());
    entry.addLink("http://\u0645\u062b\u0627\u0644.org/ar/blog/1");
    entry.setSummaryAsXhtml(
    "<p xml:lang=\"ar\" dir=\"rtl\">\u0648\u0647\u0630\u0627\u0020\u0645\u062b\u0627\u0644\u0020\u0639\u0644\u0649\u0020\u0648\u062c\u0648\u062f\u0020\u0041\u0074\u006f\u006d\u0020\u0031\u002e\u0030\u0020\u0052\u0054\u004c\u0020\u0627\u0644\u0627\u0639\u0644\u0627\u0641\u0020\u0627\u0644\u062a\u064a\u0020\u062a\u062d\u062a\u0648\u064a\u0020\u0639\u0644\u0649\u0020\u0627\u0644\u0646\u0635\u0020\u0627\u0644\u0639\u0631\u0628\u064a</p>");
       
    feed.writeTo("prettyxml", System.out);
   
    System.out.println();
    Element el = feed.getEntries().get(0).getSummaryElement().getValueElement().getFirstChild();
    System.out.println("Incorrect: " + el.getText());
    System.out.println("Correct: " + BidiHelper.getBidiElementText(el));
View Full Code Here

                    try {
                        Abdera abdera = new Abdera();
                        WriterFactory wf = abdera.getWriterFactory();
                        org.apache.abdera.writer.Writer json = wf.getWriter("json");
                        feed.writeTo(json, response.getWriter());
                    } catch (Exception e) {
                        throw new ServletException(e);
                    }              

                } else {
View Full Code Here

                    try {
                        Abdera abdera = new Abdera();
                        WriterFactory wf = abdera.getWriterFactory();
                        org.apache.abdera.writer.Writer json = wf.getWriter("json");
                        feed.writeTo(json, response.getWriter());
                    } catch (Exception e) {
                        throw new ServletException(e);
                    }              

                } else {
View Full Code Here

    private byte[] getAtomObject(String pid, String contentLocation) throws Exception {
        Feed feed = createAtomObject(pid, contentLocation);

        Writer sWriter = new StringWriter();
        feed.writeTo("prettyxml", sWriter);
        return sWriter.toString().getBytes("UTF-8");
    }

    private byte[] getFoxmlObject(String pid, String contentLocation) throws Exception {
        Foxml11Document doc = createFoxmlObject(pid, contentLocation);
View Full Code Here

                    this.populateEntry(context, entry, bitstream);
                }
            }

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            feed.writeTo(baos);
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            return bais;
        }
        catch (SQLException e)
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.