on a similar note, the returned feed does not contain a link. new patch
attached. note that the patch is rooted at: trunk/sandbox/atomprotocol.
Jeff Blattman wrote: the weblog entry author is not returned in the APP GET entries result ... does it make sense to add it? in the included patch, i simply created the ROME Person object and populated it based on the UserData object associate w/ the weblog entry. it's not fully populated because i'm not sure how to set some of the fields, or if they make sense. but regardless, having some info there for the author is better than nothing, i think. |
Index: src/org/roller/presentation/atomapi/RollerAtomHandler.java =================================================================== --- src/org/roller/presentation/atomapi/RollerAtomHandler.java (revision 384337) +++ src/org/roller/presentation/atomapi/RollerAtomHandler.java (working copy) @@ -47,6 +47,8 @@ import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Feed; import com.sun.syndication.feed.atom.Link; +import com.sun.syndication.feed.atom.Person; +import java.util.Collections; import javax.activation.FileTypeMap; import org.roller.RollerException; import org.roller.config.RollerConfig; @@ -211,6 +213,10 @@ max + 1); // maxEntries Feed feed = new Feed(); feed.setTitle("Entries for blog[" + handle + "]"); + Link feedLink = new Link(); + feedLink.setHref(absUrl + "/page/" + handle); + feedLink.setRel("alternate"); + feed.setAlternateLinks(Collections.singletonList(feedLink)); List atomEntries = new ArrayList(); int count = 0; for (Iterator iter = entries.iterator(); iter.hasNext() && count < mMaxEntries; count++) { @@ -704,6 +710,11 @@ atomEntry.setId( absUrl + entry.getPermaLink()); atomEntry.setTitle( entry.getTitle()); + UserData creator = entry.getCreator(); + Person author = new Person(); + author.setName(creator.getUserName()); + author.setEmail(creator.getEmailAddress()); + atomEntry.setAuthors(Collections.singletonList(author)); atomEntry.setContents( contents); atomEntry.setPublished( entry.getPubTime()); atomEntry.setUpdated( entry.getUpdateTime());