Package org.apache.abdera.model

Examples of org.apache.abdera.model.Document


  public ClientResponse post(
    String uri,
    Base base,
    RequestOptions options) {
      if (base instanceof Document) {
        Document d = (Document) base;
        if (options.getSlug() == null &&
            d.getSlug() != null)
          options.setSlug(d.getSlug());
      }
      return execute("POST", uri, new BaseRequestEntity(base, options.isUseChunked()), options);
  }
View Full Code Here


      String uri,
      Base base,
      RequestOptions options) {
    if (options == null) options = getDefaultRequestOptions();
    if (base instanceof Document) {
      Document d = (Document) base;
      if (options.getSlug() == null &&
          d.getSlug() != null)
        options.setSlug(d.getSlug());
     
      if (options.isConditionalPut()) {
        if (d.getEntityTag() != null)
          options.setIfMatch(d.getEntityTag());
        else if (d.getLastModified() != null)
          options.setIfUnmodifiedSince(d.getLastModified());
      }
    }
    return execute("PUT", uri, new BaseRequestEntity(base, options.isUseChunked()), options);
  }
View Full Code Here

      throws IOException {
    writer.writeTo(this,out,options);
  }
 
  public void writeTo(OutputStream out) throws IOException {
    Document doc = getDocument();
    String charset = doc != null ? doc.getCharset() : "UTF-8";
    Writer writer = this.getFactory().getAbdera().getWriter();
    writeTo(writer,new OutputStreamWriter(out,charset));
  }
View Full Code Here

    Parser parser = fomfactory.newParser();
    ByteArrayInputStream bais = new ByteArrayInputStream(value.getBytes(getXMLStreamReader().getCharacterEncodingScheme()));
    ParserOptions options = parser.getDefaultParserOptions();
    options.setCharset(getXMLStreamReader().getCharacterEncodingScheme());
    options.setFactory(fomfactory);
    Document doc = parser.parse(bais, (baseUri != null) ? baseUri.toString() : null, options);
    return doc.getRoot();
  }
View Full Code Here

    Encryption enc = absec.getEncryption();
    EncryptionOptions options = enc.getDefaultEncryptionOptions();
    options.setDataEncryptionKey(key);
   
    // Encrypt the document using the generated key
    Document enc_doc = enc.encrypt(entry.getDocument(), options);

    enc_doc.writeTo(System.out);
   
    System.out.println("\n\n");
   
    // Decrypt the document using the generated key
    Document<Entry> entry_doc = enc.decrypt(enc_doc, options);
View Full Code Here

    // Prepare the encryption options
    Encryption enc = absec.getEncryption();
   
    // Encrypt the document using A's DHContext
    EncryptionOptions options = context_a.getEncryptionOptions(enc);
    Document enc_doc = enc.encrypt(entry.getDocument(), options);

    enc_doc.writeTo(System.out);
   
    System.out.println("\n\n");
   
    // Decrypt the document using B's DHContext
    options = context_b.getEncryptionOptions(enc);
View Full Code Here

    Encryption enc = absec.getEncryption();
    EncryptionOptions options = enc.getDefaultEncryptionOptions();
    options.setDataEncryptionKey(key);
   
    // Encrypt the document using the generated key
    Document enc_doc = enc.encrypt(entry.getDocument(), options);

    enc_doc.writeTo(System.out);
   
    System.out.println("\n\n");
   
    // Decrypt the document using the generated key
    Document<Entry> entry_doc = enc.decrypt(enc_doc, options);
View Full Code Here

  }
 
  protected Document domToFom(
    org.w3c.dom.Document dom,
    SecurityOptions options) {
      Document doc = null;
      if (dom != null) {
        try {
          Serializer ser = new XMLSerializer();
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          ser.setOutputByteStream(out);
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public static <T extends Base> String getMimeType(T base) {
        String type = null;
        if (base instanceof Document) {
            Document doc = (Document)base;
            MimeType mt = doc.getContentType();
            type = (mt != null) ? mt.toString() : getMimeType(doc.getRoot());
        } else if (base instanceof Element) {
            Element el = (Element)base;
            if (el.getDocument() != null) {
                MimeType mt = el.getDocument().getContentType();
                type = (mt != null) ? mt.toString() : null;
View Full Code Here

        }
        return dom;
    }

    protected Document domToFom(org.w3c.dom.Document dom, SecurityOptions options) {
        Document doc = null;
        if (dom != null) {
            try {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                TransformerFactory tf = TransformerFactory.newInstance();
                Transformer t = tf.newTransformer();
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Document

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.