Package org.apache.abdera.model

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


    sw.endDocument();
   
    in = new ByteArrayInputStream(out.toByteArray());
    doc = abdera.getParser().parse(in);
    entry = doc.getRoot();
    entry.writeTo(System.out);
  }
 
  public static class MyEntry {
    public String getId() {
      return "tag:example.org,2008:foo";
View Full Code Here


    public void testCompressionCodec() throws Exception {
      Abdera abdera = new Abdera();
      Entry entry = abdera.newEntry();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      OutputStream cout = CompressionUtil.getEncodedOutputStream(out, CompressionCodec.GZIP);
      entry.writeTo(cout);
      cout.close();
      byte[] bytes = out.toByteArray();
      ByteArrayInputStream in = new ByteArrayInputStream(bytes);
      Parser parser = abdera.getParser();
      ParserOptions options = parser.getDefaultParserOptions();
View Full Code Here

                               "application/json");
       
        // add new book
        Entry e = createBookEntry(256, "AtomBook");
        StringWriter w = new StringWriter();
        e.writeTo(w);
       
        PostMethod post = new PostMethod(endpointAddress);
        post.setRequestEntity(
             new StringRequestEntity(w.toString(), "application/atom+xml", null));
        HttpClient httpclient = new HttpClient();
View Full Code Here

   
    Abdera abdera = Abdera.getInstance();
    Entry entry = abdera.newEntry();
    entry.setId(Template.expandAnnotated(id));
    entry.setTitle("This is a test");
    entry.writeTo("prettyxml",System.out);
   
  }
 
  @URITemplate("tag:example.org,2007:/{collection}/{view}/{id}")
  public static class ID {
View Full Code Here

                          + " application/xhtml+xml, image/png, image/jpeg, image/gif,"
                          + " image/x-xbitmap, */*;q=0.1");
       
        Entry e = createBookEntry(256, "AtomBook");
        StringWriter w = new StringWriter();
        e.writeTo(w);
       
        PostMethod post = new PostMethod(endpointAddress);
        post.setRequestEntity(
             new StringRequestEntity(w.toString(), "application/atom+xml", null));
        HttpClient httpclient = new HttpClient();
View Full Code Here

    }
   
    private Entry addEntry(String endpointAddress) throws Exception {
        Entry e = createBookEntry(256, "AtomBook");
        StringWriter w = new StringWriter();
        e.writeTo(w);
       
        PostMethod post = new PostMethod(endpointAddress);
        post.setRequestEntity(
             new StringRequestEntity(w.toString(), "application/atom+xml", null));
        HttpClient httpclient = new HttpClient();
View Full Code Here

    public void testCompressionCodec() throws Exception {
      Abdera abdera = new Abdera();
      Entry entry = abdera.newEntry();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      OutputStream cout = CompressionUtil.getEncodedOutputStream(out, CompressionCodec.GZIP);
      entry.writeTo(cout);
      cout.close();
      byte[] bytes = out.toByteArray();
      ByteArrayInputStream in = new ByteArrayInputStream(bytes);
      Parser parser = abdera.getParser();
      ParserOptions options = parser.getDefaultParserOptions();
View Full Code Here

            Entry entry = feed.getRoot().getEntries().get(getTarget());
            response.setStatus(HttpServletResponse.SC_OK);
            response.setContentType("application/atom+xml; charset=utf-8");
            options = entry.getDefaultWriterOptions();
            options.setCharset("UTF-8");
            entry.writeTo(response.getOutputStream(),options);
          } catch (Exception e) {
            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            break;
          }
          break;
View Full Code Here

              response.setStatus(HttpServletResponse.SC_CREATED);
              response.setHeader("Location", entry.getId().toString());
              response.setHeader("Content-Location", entry.getId().toString());
              WriterOptions woptions = entry.getDefaultWriterOptions();
              woptions.setCharset("UTF-8");
              entry.writeTo(response.getOutputStream(),woptions);
              return;
            }
          }
          if (MimeTypeHelper.isMatch(request.getContentType(), "text/plain")) {
            int n = feed.getRoot().getEntries().size();
View Full Code Here

            response.setStatus(HttpServletResponse.SC_CREATED);
            response.setHeader("Location", entry.getId().toString());
            response.setHeader("Content-Location", entry.getId().toString());
            WriterOptions woptions = entry.getDefaultWriterOptions();
            woptions.setCharset("UTF-8");
            entry.writeTo(response.getOutputStream(),woptions);
            return;
          }
          response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
        } catch (Exception e) {}
        break;
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.