abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: <content src=>
Date Tue, 08 Aug 2006 19:17:19 GMT
Patched! Thank's Ugo

Ugo Cei wrote:
> 
> On Aug 8, 2006, at 7:23 PM, Garrett Rooney wrote:
> 
>> Does it perhaps have a filename that looks ungood to one of the mail
>> servers in the way?  Perhaps changing it to .txt?
> 
> Let's try.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java
> ===================================================================
> --- java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java	(revision 429733)
> +++ java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java	(working copy)
> @@ -214,6 +214,17 @@
>    Content setContent(String value, String mediatype) throws MimeTypeParseException;
>    
>    /**
> +   * Sets the content for this entry as out of line.
> +   * 
> +   * @param uri URI of the content (value of the "src" attribute).
> +   * @param mediatype Type of the content.
> +   * @return The new content element.
> +   * @throws MimeTypeParseException if the mime type is invalid.
> +   * @throws URISyntaxException if the URI is invalid.
> +   */
> +  Content setContent(URI uri, String mediatype) throws MimeTypeParseException, URISyntaxException;
> +  
> +  /**
>     * Returns the text of the content element
>     */
>    String getContent();
> Index: java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
> ===================================================================
> --- java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java	(revision
429733)
> +++ java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java	(working
copy)
> @@ -259,6 +259,19 @@
>      setContentElement(content);
>      return content;
>    }
> +  
> +  /**
> +   * Sets the content for this entry
> +   * @throws MimeTypeParseException 
> + * @throws URISyntaxException 
> +   */
> +  public Content setContent(URI uri, String mediatype) throws MimeTypeParseException,
URISyntaxException {
> +    FOMFactory factory = (FOMFactory) this.factory;
> +    Content content = factory.newContent(new MimeType(mediatype));
> +    content.setSrc(uri.toString());
> +    setContentElement(content);
> +    return content;
> +  }
>  
>    
>    public List<Person> getContributors() {
> Index: java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java
> ===================================================================
> --- java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java	(revision
429733)
> +++ java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java	(working
copy)
> @@ -17,6 +17,7 @@
>  */
>  package org.apache.abdera.examples.simple;
>  
> +import java.net.URI;
>  import java.util.Date;
>  
>  import org.apache.abdera.factory.Factory;
> @@ -63,6 +64,14 @@
>      entry3.setSummaryAsHtml("<p><a href=\"foo\">Test</a></p>").setBaseUri("http://example.org/site/");
>      entry3.setSource(feed.getAsSource());
>      
> +    // Out-of-line content
> +    Entry entry4 = feed.addEntry();
> +    entry4.setTitle("re: Atom-Powered Robots Run Amok");
> +    entry4.addLink("/2003/12/13/atom03/3");
> +    entry4.setId("urn:uuid:1225c695-cfb8-4ebb-aaaa-cafebabecafe");
> +    entry4.setUpdated(new Date());
> +    entry4.setSummary("An entry with out-of-line content");
> +    entry4.setContent(new URI("http://example.org/0xcafebabe"), "text/html");
>      feed.getDocument().writeTo(System.out);
>    }
>  
> 
> 
> ------------------------------------------------------------------------
> 
> 
>     Ugo

Mime
View raw message