Package org.apache.abdera

Examples of org.apache.abdera.Abdera


     * Passes if the test does not throw a parse exception
     */
  @Test
    public void testXMLRestrictedChar2() throws Exception {
      String s = "<?xml version='1.0'?><t t='\u0002' />";
      Abdera abdera = new Abdera();
      Parser parser = abdera.getParser();
      ParserOptions options = parser.getDefaultParserOptions();
      options.setFilterRestrictedCharacters(true);
      options.setCharset("UTF-8");
      Document<Element> doc = parser.parse(new ByteArrayInputStream(s.getBytes("UTF-8")), null, options);
      doc.getRoot().toString();
View Full Code Here


    /**
     * Passes if the test does not throw any exceptions
     */
  @Test
    public void testWriterOptions() throws Exception {
      Abdera abdera = new Abdera();
      Entry entry = abdera.newEntry();
      entry.setTitle("1");
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      WriterOptions writeoptions = entry.getDefaultWriterOptions();
      writeoptions.setCompressionCodecs(CompressionCodec.DEFLATE);
      writeoptions.setCharset("UTF-16");
      writeoptions.setAutoClose(true);
      entry.getDocument().writeTo(out,writeoptions);   
      out.close();
     
      byte[] bytes = out.toByteArray();
     
      ByteArrayInputStream in = new ByteArrayInputStream(bytes);
      Parser parser = abdera.getParser();
      ParserOptions options = parser.getDefaultParserOptions();
      options.setCompressionCodecs(CompressionCodec.DEFLATE);
      Document<Entry> doc = abdera.getParser().parse(in,null,options);
     
      doc.getRoot().toString();
    }
View Full Code Here

  protected final Abdera abdera;
  protected final Cache cache;
  private final HttpClient client;

  public AbderaClient() {
    this(new Abdera(),DEFAULT_USER_AGENT);
  }
View Full Code Here

  /**
   * Create an AbderaClient instance using the specified useragent name
   * @param useragent
   */
  public AbderaClient(String useragent) {
    this(new Abdera(), useragent);
  }
View Full Code Here

   * Create an Abdera using a preconfigured HttpClient object
   * @param client An Apache HttpClient object
   */
  public AbderaClient(
    HttpClient client) {
      this(new Abdera(),client);
  }
View Full Code Here

  }
 
  public static synchronized Abdera getAbdera() {
    if (abdera == null) {
      log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE","Abdera"));
      abdera = new Abdera();
    }
    return abdera;
  }
View Full Code Here

    return abdera;
  }
 
  public Provider newProvider (
    Map<String,String> properties) {
    Abdera abdera = getAbdera();
    String instance = properties.get(PROVIDER);
    log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE","Provider"));
    Provider provider =
      (Provider) Discover.locate(
        PROVIDER,
View Full Code Here

public class EncodingTest extends Assert {
   
  @Test
    public void testContentEncoding() throws Exception {
        Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();
        entry.setId("http://example.com/entry/1");
        entry.setTitle("Whatever");
        entry.setUpdated(new Date());
        Content content = entry.getFactory().newContent(Content.Type.XML);
        String s = "<x>" + new Character((char) 224) + "</x>";
View Full Code Here

    /**
     * Passes if the test does not throw a parse exception
     */
  @Test
    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();
      options.setCompressionCodecs(CompressionCodec.GZIP);
      Document<Entry> doc = abdera.getParser().parse(in,null,options);
      entry = doc.getRoot();
    }
View Full Code Here

    /**
     * Constructor the user will be using inside javaScript
     */
    public Scriptable jsConstructor() {
        Abdera abdera = new Abdera();
        Factory factory = abdera.getFactory();
        feed = factory.newFeed();
        return this;
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.Abdera

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.