[seam-dev] atom/rss jsf tag support

Dan Allen dan.j.allen at gmail.com
Tue Aug 26 11:10:27 EDT 2008


Nik,

It's great to see us putting a focus on native feed integration since
it is only one of the most common tasks in modern web-based
applications. Granted, this is currently possible with Facelets doing
it the manual way, shown below. But that does require a lot of manual
labor (most likely of the copy-paste variety). I would like to see if
we can limit the number of tags because a lot of tags gets closer to
doing it the manual way. Perhaps we can use the attributes for text
only and facets for non-text (just a thought).

I'm not sure I understand why you need the document store, though.
That is typically reserved for sending a binary format over the wire
needing disposition headers. An RSS feed is just an XML stream and
therefore you simply need to set the contentType on the JSF response.

<?xml version="1.0" encoding="UTF-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:f="http://java.sun.com/jsf/core"
 xml:lang="en">
<f:view contentType="application/atom+xml">
 <title>Sample feed</title>
 <link rel="alternate" type="text/html" href="http://example.com/feed"/>
 <modified>2008-04-04T00:00:00Z</modified>
 <tagline>Sample feed</tagline>
 <id>tag:example.com,2008://1</id>
 <generator url="http://seamframework.org/" version="2.0.1.GA">Seam</generator>
 <copyright>Copyright (c) 2008, Dan Allen</copyright>
 <entry>
   <title>Hi there!</title>
   <link rel="alternate" type="text/html" href="http://example.com/1" />
   <modified>2008-04-04T00:00:00Z</modified>
   <issued>2008-04-04T00:00:00Z</issued>
   <id>tag:example.com,2008://1.87</id>
   <created>008-02-24T04:30:06Z</created>
   <summary type="text/plain">Hi there</summary>
   <author>
     <name>Dan Allen</name>
   </author>
   <dc:subject>Subject</dc:subject>
   <content type="text/html" mode="escaped" xml:lang="en"
xml:base="http://example.com">
     Hi there
   </content>
 </entry>
</f:view>
</feed>

On Tue, Aug 26, 2008 at 10:42 AM, Nicklas Karlsson <nickarls at gmail.com> wrote:
> I recently committed (as discussed with Pete) some code to
> org.jboss.seam.rss that enables you to
> use JSF tags for creating rss/atom feeds. It is based around the
> YARFRAW (http://yarfraw.sourceforge.net/)
> library. The only other new dependency is commons-lang. There is a
> quick-and-dirty build.xml included in
> the source dir that requires some modification, I didn't want to mess
> with the main build structure while
> it was in the "collecting feedback" stage.
>
> Any use for it in the trunk? Any considerations/feedback before
> expanding on it? It is currently very simplified,
> using a parent-child Feed -> Entries structure with several
> simplifications (only one author, name only etc).
>
> usage is in the lines of
>
> <r:feed
>        xmlns="http://www.w3.org/1999/xhtml"
>        xmlns:ui="http://java.sun.com/jsf/facelets"
>        xmlns:r="http://jboss.com/products/seam/rss"
>        title="#{rss.feed.title}"
>        uid="#{rss.feed.uid}"
>        subtitle="#{rss.feed.subtitle}"
>        updated="#{rss.feed.updated}"
>        link="#{rss.feed.link}">
>        <ui:repeat value="#{rss.feed.entries}" var="entry">
>                <r:entry
>                        uid="#{entry.uid}"
>                        title="#{entry.title}"
>                        link="#{entry.link}"
>                        author="#{entry.author}"
>                        summary="#{entry.summary}"
>                        published="#{entry.published}"
>                        updated="#{entry.updated}"
>                />
>        </ui:repeat>
> </r:feed>
>
> Some questions that came to mind:
>
> * Delivery mechanism: I currently use the document store. Any better
> alternatives? Some sort of flush + response complete?
>
> * Most attributes support both text and html formats. Should there be
>  1. One "textFormat"-swith at feed level
>  2. titleFormat and title, subtitleFormat and subtitle etc..
>  3. Complex tag structure with <r:title format="html">title</r:title> etc?
>
>  I'm currently leaning towards 1.
>
> * What level of the atom specs to support? All of it? At least r:link,
> r:author, r:contributor, r:category, r:source, r:generator would
> be required (or whatever multi-attribute 0:n stuff are nested in the
> feed/entry elements in the specs)
>
> * Any usage for it in wiki? I haven't really looked that much as the
> wiki, it seems to have an own feed servlet and perhaps some cacheing
> requirements
>
> ---
> Nik
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>



-- 
Dan Allen
Software consultant | Author of Seam in Action

http://mojavelinux.com
http://mojavelinux.com/seaminaction

NOTE: While I make a strong effort to keep up with my email on a daily
basis, life and work come first and, at times, keep me away from my mail
for a while. If you contact me, then don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters. Please don't hesitate to resend a message if
you feel that it did not reach my attention.



More information about the seam-dev mailing list