SlideShare una empresa de Scribd logo
1 de 65
Descargar para leer sin conexión
Beyond Blogging:
Feeds in Action
Dave Johnson
Staff Engineer/SW
Sun Microsystems, Inc.
http://rollerweblogger.org/roller

TS-6029

                           2007 JavaOneSM Conference | Session TS-6029 |
Goal
What you’ll learn in this session



 Understand RSS and Atom feed
 formats, the Atom Publishing Protocol.
 Understand how to use ROME to
 consume and produce feeds.



                        2007 JavaOneSM Conference | Session TS-6029 |   2
Agenda

The web is bloggy
Understanding RSS and Atom
Consuming feeds with ROME
Producing feeds with ROME
Publishing with ROME Propono
The future…


               2007 JavaOneSM Conference | Session TS-6029 |   3
Why Talk About Blogging at 2007
JavaOneSM Conference?
    Blogs made the web easier
●


    For writers, readers, and software developers
●


    Blogs brought XML to the masses
●




                     2007 JavaOneSM Conference | Session TS-6029 |   4
Bloggers Didn’t Invent XML
    But they perfected and popularized XML feeds
●

        e.g., Dave Winer, Dan Libby and RSS
    ●


        e.g., Gregorio, Pilgrim, Ruby and Atom
    ●


    And kicked off XML web services
●

        e.g., Dave Winer created XML-RPC, precursor
    ●

        to SOAP, for his Frontier CMS
    And then blogging hit the big time…
●




                         2007 JavaOneSM Conference | Session TS-6029 |   5
State of the Blogosphere




              2007 JavaOneSM Conference | Session TS-6029 |   6
Suddenly Everybody Has a Blog
    Suddenly it’s easy for software to monitor,
●

    parse, publish, filter, and aggregate web content
    And the web is bloggy
●

        Every web site has XML feeds
    ●


        Every web site has a simple XML API
    ●



    Bloggy?
●




                        2007 JavaOneSM Conference | Session TS-6029 |   7
That’s Right, Bloggy
    Everything is a time-stamped, uniquely identified
●

    chunk of data with meta-data
                                                Bug reports
        News stories                       ●
    ●


                                                Wiki changes
        Search results                     ●
    ●


        Uploaded photos                         Source code changes
    ●                                      ●


        Events and meetups                      O/S log messages
    ●                                      ●


        Podcasts and Vodcasts
    ●


    OK, not everything, but you get the idea…
●




                       2007 JavaOneSM Conference | Session TS-6029 |   8
Feeds on the Web Today
                                      Producer

                                                                                            Blogger.com
                                                                   MySpace
                              Ant
  MS Word 2007

                                                                                      Wordpress.com
                                                            Digg.com
                         MarsEdit
         Ecto

                                                                                                    Flickr.com
                                                                           Google Data
                                                 del.icio.us
            w.bloggar

                                                                                      Meetup.com
                                                            YouTube


                    iTunes                                       Google Reader
Client
                                                                                                     Server
          Firefox        Windows Vista                     Tailrank                     Rojo

   FeedDemon            NetNewsWire                                                     BlogLines
                                                           Technorati


                                                                                MyYahoo
         IE7                 Safari
                                                Consumer
                                      2007 JavaOneSM Conference | Session TS-6029 |     9
Meanwhile: Web Services Got Uppity
    SOAP took over where XML-RPC left off
●


    WSDL, UDDI, and Schema exploded into
●

    today’s complex WS-* stack




                    2007 JavaOneSM Conference | Session TS-6029 |   10
But Most Developers Didn’t Follow
    Developers prefer REST
●

        “Amazon has both SOAP and REST interfaces to their
    ●

        web services, and 85% of their usage is of the REST
        interface.”
        —Tim O’Reilly
    And even WS-Advocates agree
●

        “For applications that require Internet scalability (e.g.,
    ●

        mass consumer-oriented services), plain old XML
        (POX) is a much better solution than WS-*.”
         —Anne Thomas Mannes


                           2007 JavaOneSM Conference | Session TS-6029 |   11
And Now RSS and Atom Are Emerging
    As a foundation for simple web services
●


    For example:
●

        Yahoo Pipes for end-user mash-ups via RSS
    ●


        Google Data using Atom Publishing Protocol
    ●


        Lucene—WS using Atom Publishing Protocol
    ●


        Eclipse’s Europa build system
    ●


    Let’s return to the topic of feeds
●




                        2007 JavaOneSM Conference | Session TS-6029 |   12
Agenda

The web is bloggy
Understanding RSS and Atom
Consuming feeds with ROME
Producing feeds with ROME
Publishing with ROME Propono
The future…


               2007 JavaOneSM Conference | Session TS-6029 |   13
What Is a Feed?
    XML representation of uniquely identified,
●

    time-stamped data items with metadata
    Available on the web at a fixed URL
●



                                     Entry
                                     ID
          Feed
                                     Title
          ID
                                     Date
          Title
                                     Author(s)
          Link
                                     Category
          Date
                                     Summary
          Author(s)
                                     Content



                      2007 JavaOneSM Conference | Session TS-6029 |   14
The Birth of the RSS Feed Format
    RSS began life at Netscape™ in 1999
●

        First spec was RSS 0.90 by Dan Libby
    ●


        Created for the My Netscape portal
    ●


        Known as RDF Site Summary (RSS)
    ●


    Dave Winer helped with 0.91, removed RDF
●


    0.9X formats are obsolete but still in use today
●




                        2007 JavaOneSM Conference | Session TS-6029 |   15
The RDF Fork: RSS 1.0
    After RSS 0.91, Winer tried to keep RSS simple
●


    RDF folks argued for extensibility
●


    The RDF folks declared victory and released 1.0
●

        Small set of elements, augmented by RDF
    ●


        And Extension Modules
    ●


    Adopted by Movable Type and many others
●


    RSS 1.0 is still widely used today
●




                        2007 JavaOneSM Conference | Session TS-6029 |   16
Elements of RSS 1.0 (Abridged)
                                                         <title>

                                                        <link>

                                                 <description>

                                                       <items>
                  <channel>
                                                       <xx:yyy>
   <RDF:rdf>
                                                        <title>             Allows
                  <item>                                                   extension
                                                 <description>             elements
  Required
                                                        <link>
                Note: items not
  Optional
               in <channel> as                         <xx:yyy>
               they were in 0.9X
  Extension
                      2007 JavaOneSM Conference | Session TS-6029 |   17
The Simple Fork: RSS 0.92–RSS 2.0
    Winer rejected 1.0 and continued with 0.92, 0.93
●

    and finally 2.0; along the way RSS:
        Added more metadata
    ●


        Added <enclosure> element—Podcasting!
    ●


        Added support for Extension Modules
    ●


        Made elements under <item> optional
    ●



    RSS 2.0 declared to be final version of RSS
●




                      2007 JavaOneSM Conference | Session TS-6029 |   18
Elements of RSS 2.0 (Abridged)
                             <title>

                             <link>
                                                                     <title>      One is
                          <description>                                           required
                                                              <description>
                            <author>
                                                                 <pubDate>

                                                                     <link>
                             <item>
<rss>         <channel>                                                           “Permalink”
                                                                    <guid>

                                                                <enclosure>       Podcast
                            <xx:yyy>

                                                                 <category>
        Required
                                                                   <author>
        Optional             Allows                                <xx:yyy>
                             extension
        Extension            elements

                             2007 JavaOneSM Conference | Session TS-6029 |   19
RSS 2.0 Example
<rss version=quot;2.0quot;>
<channel>
<title>Latest Bugs</title>
<link>http://bugtrack/bugreport</link>

  <item>
    <title>Blue screen on refresh</title>
    <link>http://bugtrack/bugreport?id=132</link>
    <description>
      This is &lt;b&gt;very&lt;b&gt; bad.
    </description>
    <pubDate>Fri, 11 May 2007 15:00:00 EDT</pubDate>
  </item>

</rss>
                    2007 JavaOneSM Conference | Session TS-6029 |   20
Funky RSS: Overuse of Extensions?
<rss version=quot;2.0quot;
   xmlns:dc=quot;http://purl.org/dc/elements/1.1/quot;>
<channel>
<title>Latest Bugs</title>
<link>http://bugtrack/bugreport</link>
  <item>
    <title>Blue screen on refresh</title>
    <link>http://bugtracker/bugreport?id=132</link>
    <description>This is &lt;b&gt;very&lt;b&gt; bad.
    </description>
    <dc:date>2007-05-11T15:00:00-00:00</dc:date>
    <dc:creator>Joe Tester</dc:creator>
  </item>
</rss>
                    2007 JavaOneSM Conference | Session TS-6029 |   21
RSS Limitations
    Spec is too loose and unclear
●

        What fields can be escaped HTML?
    ●


        How many enclosures are allowed per item?
    ●


    Content model is weak
●

        No support for summary and content
    ●


        Content-type and escaping not specified
    ●


    Specification is final and cannot be clarified
●




                         2007 JavaOneSM Conference | Session TS-6029 |   22
What Is Atom?
    From the IETF Atom WG charter:
●

      “Atom defines a feed format for representing and a
      protocol for editing Web resources such as Weblogs,
      online journals, Wikis, and similar content.”
    Feed format is now IETF RFC-4287
●


    Protocol will be finalized in 2007
●




                       2007 JavaOneSM Conference | Session TS-6029 |   23
Atom Publishing Format
    An XML feed format; feed contains entries
●


    Entries are:
●

        Time-stamped, uniquely ID’ed chunks of data
    ●


        With meta-data: title, dates, categories
    ●


        Entry content can be:
    ●

             TEXT, HTML, XHTML or any content-type
         ●


             In-line or out-of-line specified by URI
         ●
                                                                                    Entry
             Binary data w/Base64 encoding           Feed
         ●
                                                                                    Id
                                                                      Title         Title
    It’s generic, not just for blogs
●                                                                     Updated       Updated
                                                                      Link          Link
                                                                                    Content



                               2007 JavaOneSM Conference | Session TS-6029 |   24
Elements of Atom (Abridged)
                        <title>                                         <title>
                     <updated>                                      <updated>               Links can be
                                                                                             permalink,
                                                                                           podcasts, etc.
                        <link>                                            <id>
<feed>
                                                                        <link>
                      <author>         <<person>>
 Self link,
                      <subtitle>
 site link                                                         <published>
and others
                     <category>                                    <summary>
                                                                                             Type can be
                                                                                           text, html, xhtml
                       <entry>                                       <content>              or content type
                                                                       @type                URI if content
                                                                       @src                  is out-of-line
   Required            <xx:yyy>
                                                                    <category>
   Optional                       <name>
                                                                      <author>          <<person>>
   Extension                       <url>
               <<person>>
                                                                      <xx:yyy>
                                  <email>


                                   2007 JavaOneSM Conference | Session TS-6029 |   25
Atom <feed> With One <entry>
<feed xmlns='http://www.w3.org/2005/Atom'>
   <title>Latest Bugs</title>
   <link href='http://bugtracker/bugreport' />
   <link rel='self'
      href='http://bugtracker/feeds/bugreport'/>
   <updated>2007-05-11T15:00:00-00:00</updated>
   <author><name>BugTracker-5000-XL</name></author>
   <entry>
      <title>Blue screen on refresh</title>
      <link href='http://bugtracker/bugreport?id=132' />
      <id>http://bugtracker/bugreport?id=132</id>
      <updated>2007-05-11T15:00:00-00:00</updated>
      <content type='html'>
         This is &lt;b&gt;very&lt;b&gt; bad.
      </content>
   </entry>
</feed>
                       2007 JavaOneSM Conference | Session TS-6029 |   26
RSS and Atom Feed Family Tree
              1999     2000       2001                                             2002   2005

              RSS      RSS
Netscape
              0.90     0.91

Simple Fork            RSS                         RSS
                                  RSS                               RSS            RSS
Dave Winer             0.91                        0.93
                                  0.92                              0.94           2.0

RDF Fork                      RSS
RSS-DEV Group                 1.0

Internet Engineering
                                                                                          Atom
Task Formce (IETF)



                              2007 JavaOneSM Conference | Session TS-6029 |   27
Agenda

The web is bloggy
Understanding RSS and Atom
Consuming feeds with ROME
Producing feeds with ROME
Publishing with ROME Propono
The future…


               2007 JavaOneSM Conference | Session TS-6029 |   28
Parsing and Fetching Feeds
    It’s just XML!
●

        Use your favorite parsing technique
    ●



    Or better yet... use a parser library
●

        ROME: DOM-based feed parser/generator
    ●

        (Java™ platform)
        Abdera: STAX-based Atom-only parser (Java platform)
    ●


        Universal Feed Parser (Python)
    ●


        Windows RSS Platform: Parser built in to IE7
    ●




                         2007 JavaOneSM Conference | Session TS-6029 |   29
ROME RSS/Atom Feed Utilities
    Most capable Java platform-based toolkit
●


    Pros
●

        Parses/generates all forms of RSS and Atom
    ●


        Highly pluggable/extensible, based on JDOM
    ●


        Parses to Atom, RSS, or abstract object model
    ●


    Con: DOM based
●


    Free and open source (Apache license)
●




                         2007 JavaOneSM Conference | Session TS-6029 |   30
How Does ROME Work?

                            SyndFeed



                               SyndEntry
                                                        Co
                        t
                     er                                   nv
                   nv                                       er
                 o          SyndFeed model                         t
             C

 Channel                                                                      Feed


                                                                                Entry
     Item


                                                                         Atom model
 RSS model


                              2007 JavaOneSM Conference | Session TS-6029 |     31
ROME SyndFeed Model                                              SyndContent
                                                                 value
                                                                 src
SyndFeed                                                         type
author
                SyndEntry
copyright
                id                                               SyndLink
description
                published                                        title
encoding
                rights                                           type
feedType
                source                                           rel
image
                summary                                          length
language
                title                                            href
link
                updated
modules
publishedDate
                                                                 SyndCategory
title
                                                                 label
uri
                                                                 term
                                                                 scheme


                 2007 JavaOneSM Conference | Session TS-6029 |    32
Parsing a Feed With ROME SyndFeed
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(
   new InputStreamReader(inputStream));

Iterator entries = feed.getEntries().iterator();

while (entries.hasNext()) {
   SyndEntry entry = (SyndEntry)entries.next();
   System.out.println(quot;Title: quot; + entry.getTitle());
   System.out.println(quot;Link: quot; + entry.getLink());
   System.out.println(quot;nquot;);
}

                    2007 JavaOneSM Conference | Session TS-6029 |   33
How to Fetch Feeds
    Be nice and conserve bandwidth
●

        Use HTTP conditional GET or Etags
    ●


        Don’t poll too often
    ●


    Your parser library might do the work for you
●

        ROME’s Fetcher provides a caching feed-store
    ●


        Other parsers do too
    ●




                        2007 JavaOneSM Conference | Session TS-6029 |   34
Fetching a Feed With ROME Fetcher
FeedFetcherCache cache =
   new DiskFeedInfoCache(quot;/var/rome-fetcher/cachequot;);
FeedFetcher fetcher = new HttpURLFeedFetcher(cache);

SyndFeed feed = fetcher.retrieveFeed(
   new URL(quot;http://bugtracker/feeds/bugreportquot;));

Iterator entries = feed.getEntries().iterator();
while (entries.hasNext()) {
   SyndEntry entry = (SyndEntry)entries.next();
   // ... omitted: print out entry ...
}



                      2007 JavaOneSM Conference | Session TS-6029 |   35
Agenda

The web is bloggy
Understanding RSS and Atom
Consuming feeds with ROME
Producing feeds with ROME
Publishing with ROME Propono
The future…


               2007 JavaOneSM Conference | Session TS-6029 |   36
Serving Feeds: Generate XML
    Use your favorite XML tools or…
●


    Templates languages like JavaServer Pages™
●

    (JSP) technology, PHP, ASP.Net
    Or better yet: a feed toolkit like ROME
●




                    2007 JavaOneSM Conference | Session TS-6029 |   37
Generating Atom With ROME, Pt. 1/2
SyndFeed syndFeed = new SyndFeedImpl();
syndFeed.setTitle(quot;Latest bugsquot;);
syndFeed.setAuthor(quot;BugTrack-9000-XLquot;);
syndFeed.setPublishedDate(BugManager.getUpdateDate());
syndFeed.setLink(quot;http://localhost/bugtrackerquot;);
syndFeed.setUri(syndFeed.getLink());
                                                                         Atom ID
SyndLink selfLink = new SyndLinkImpl();
selfLink.setRel(quot;selfquot;);
selfLink.setHref(quot;http://localhost/bugtracker/latest.atomquot;);
syndFeed.setLinks(Collections.singletonList(selfLink));

List entries = new ArrayList();
syndFeed.setEntries(entries);

                         2007 JavaOneSM Conference | Session TS-6029 |   38
Generating Atom With ROME, Pt. 2/2
Iterator bugs = BugManager.getLatestBugs(20).iterator();
while (bugs.hasNext()) {
   Bug bug = (Bug)bugs.next();
   SyndEntry entry = new SyndEntryImpl();
   entry.setTitle(bug.getTitle());
   entry.setUpdatedDate(bug.getDateAdded());
   entry.setLink(
      quot;http://bugtracker/?bugid=quot; + bug.getId());
   entry.setUri(entry.getLink());
                                                  Atom ID
   SyndContent content = new SyndContentImpl();
   content.setValue(bug.getDescription());
   content.setType(quot;htmlquot;);
   entry.setContents(Collections.singletonList(content));
   entries.add(entry);
}
                      2007 JavaOneSM Conference | Session TS-6029 |   39
Serving Feeds: Serve It Up
    Set the right content-type
●

    application/rss+xml
    application/atom+xml
    Cache, cache, cache!
●

        On client-side via HTTP Conditional GET
    ●


        On proxy servers via HTTP headers
    ●


        On server side via your favorite cache tech
    ●




                          2007 JavaOneSM Conference | Session TS-6029 |   40
Serving Atom With ROME, Pt. 1/2
public class BugFeedServlet extends HttpServlet {
   LRUCache cache = new LRUCache(5, 5400);

   protected void doGet(HttpServletRequest req, // ...omitted

     Date since = new Date(
        req.getDateHeader(quot;If-Modified-Sincequot;));
     if (sinceDate != null) {
        if (BugManager.getUpdateDate().compareTo(since) <= 0) {
           res.sendError(HttpServletResponse.SC_NOT_MODIFIED);
           return;
        }
     }
     res.setDateHeader(quot;Last-Modifiedquot;,
        BugManager.getUpdateDate().getTime());
     res.setHeader(quot;Cache-Controlquot;,
        quot;max-age=5400, must-revalidatequot;);

                        2007 JavaOneSM Conference | Session TS-6029 |   41
Serving Atom With ROME, Pt. 2/2
        String url = request.getRequestURL().toString();
        if (cache.get(url) == null) {

           SyndFeed syndFeed = // ...omitted
           syndFeed.setFeedType(quot;atom_1.0quot;);

           StringWriter stringWriter = new StringWriter();
           SyndFeedOutput output = new SyndFeedOutput();
           output.output(syndFeed, stringWriter);

           cache.put(request.getRequestURL().toString(),
                     stringWriter.toString());
        }
        response.setContentType(
           quot;application/xml+atom;charset=utf-8quot;);
        response.getWriter().write((String)cache.get(url));
    }
}                       2007 JavaOneSM Conference | Session TS-6029 |   42
Feed Auto-Discovery
    Make it easy for applications to find your feeds
●


    Firefox can do it
●




    Safari can too
●




    And even IE
●




                        2007 JavaOneSM Conference | Session TS-6029 |   43
Feed Auto-Discovery
<html>
<head>
<meta http-equiv=quot;Content-Typequot; content=quot;text/html” />

  <link rel=quot;alternatequot;
    type=quot;application/atom+xmlquot; title=quot;Latest bugs (Atom)quot;
    href=quot;http://bugtracker/feeds/bugreportquot; />

  <link rel=quot;alternatequot;
    type=quot;application/rss+xmlquot; title=quot;Latest bugs (RSS)quot;
    href=quot;http://bugtracker/feeds/bugreport?format=rssquot; />

...

                      2007 JavaOneSM Conference | Session TS-6029 |   44
Serving Valid Feeds
    Ensure HTML is properly escaped
●


    Ensure XML is well formed
●


    Validate!
●


    feedvalidator.org
●




                    2007 JavaOneSM Conference | Session TS-6029 |   45
Agenda

The web is bloggy
Understanding RSS and Atom
Consuming feeds with ROME
Producing feeds with ROME
Publishing with ROME Propono
The future…


              2007 JavaOneSM Conference | Session TS-6029 |   46
Feed Publishing Protocols
    Blogger API: Simple XML-RPC based protocol
●

    (by Blogger.com)
    MetaWeblog API: Extends Blogger API by
●

    adding RSS-based metadata (by Dave Winer)
    Atom Publishing Protocol: REST-based web
●

    publishing protocol uses Atom format (IETF)




                    2007 JavaOneSM Conference | Session TS-6029 |   47
The MetaWeblog API
getUserBlogs     Get blogs as array of structures

newPost          Create new blog post by passing in structure*

getPost          Get blog post by id

getRecentPosts   Get most recent N blog posts

editPost         Update existing blog post

deletePost       Delete blog post specified by id

newMediaObject   Upload file to blog (e.g., picture of my cat)

getCategories    Get categories allowed in blog
                     2007 JavaOneSM Conference | Session TS-6029 |   48
The Atom Publishing Protocol
“Application-level protocol for publishing
  and editing Web resources using HTTP”
    Based on Atom Publishing Format
●



    Began as a replacement old blogging APIs
●


        Grew into a generic publishing protocol
    ●




                         2007 JavaOneSM Conference | Session TS-6029 |   49
What Does Atom Protocol Do?
    Everything MetaWeblog API does
●


    But it’s generic, not just for blogs
●


    Entry can be any type of data
●


    CRUD on entries organized in collections
●


    Where CRUD = create, retrieve, update,
●

    and delete
    Based on principals of REST
●




                     2007 JavaOneSM Conference | Session TS-6029 |   50
How Does It Do All That?
    The REST way:
●

        Everything’s a resource, addressable by URI
    ●


        HTTP verbs used for all operations
    ●


    HTTP POST to create entries
●


    HTTP GET to retrieve entries and collections
●


    HTTP PUT to update entries
●


    HTTP DELETE to delete entries
●




                         2007 JavaOneSM Conference | Session TS-6029 |   51
APP Introspection


          GET from endpoint URI
                                                                     server
 client
            Service document




                2007 JavaOneSM Conference | Session TS-6029 |   52
APP Introspection Document
<?xml version=quot;1.0quot; encoding='utf-8'?>
<service xmlns=quot;http://purl.org/atom/app#quot;>
    <workspace title=quot;Order Management issuesquot; >
        <collection title=quot;Bug Reportsquot;
            href=quot;http://bugtrack/app/om/entriesquot; >
            <accept>entry</accept>
        </collection>
        <collection title=quot;Screenshotsquot;
            href=quot;http://bugtrack/app/om/screenshotsquot; >
            <accept>image/*</accept>
        </collection>
    </workspace>
</service>


                      2007 JavaOneSM Conference | Session TS-6029 |   53
An Atom Collection <feed>
<feed xmlns=quot;http://www.w3.org/2005/Atomquot;>

  <link rel=quot;nextquot;
      href=quot;http://example.org/blog/app/entries/60quot; />
  <link rel=quot;previousquot;
      href=quot;http://example.org/entries/20quot; />
  ...
  <entry> ... </entry>                     URIs for
                                      next and previous
  <entry> ... </entry>               portions of collection
  <entry> ... </entry>
  <entry> ... </entry>
  ...
</feed>

                      2007 JavaOneSM Conference | Session TS-6029 |   54
Creating an Entry


                    entry.xml


          POST to collection URI
                                                                     server
 client
           Resulting Atom entry




                2007 JavaOneSM Conference | Session TS-6029 |   55
<entry> in a Collection
  <entry>
    <title>NPE on new order query</title> Edit URI for entry
    <link rel=quot;alternatequot;
        href=quot;http://bugtracker/bugreport?id=757” />
    <link rel=quot;editquot;
        href=quot;http://bugtracker/app/bug/757quot; />
    <id>http://bugtracker/bugreport?id=757</id>
    <updated>2007-05-08T22:08:03Z</updated>
    <published>2007-05-11T01:07:59Z</published>
    <content type=quot;htmlquot;>This is &lt;bad&gt; bad.
    </content>
  </entry>
</feed>
                       2007 JavaOneSM Conference | Session TS-6029 |   56
ROME Propono
    APP Client Library
●

        Makes it easy to build an APP client app
    ●



    APP Server Library
●

        Makes it easy to add an APP server to your web app
    ●


    Blog Client Library
●

        Suports both MetaWeblog API and APP
    ●


        Blog centric and not as generic as APP Client Library
    ●




                         2007 JavaOneSM Conference | Session TS-6029 |   57
ROME Propono: Atom Client API
                                                                  Feed
    ClientAtomService
                                                                                 ROME
                                                                                 Atom
                Has 1..N
                                                                                 model
                                                            Entry
    ClientWorkspace
    getEntry( uri )
    findCollection(title)

                                                         ClientEntry
                Has 1..N
                                                         update()
                                                         remove()
    ClientCollection               CRUD
    isWritable()
    createEntry()
    createMediaEntry()
                                                    ClientMediaEntry
    addEntry( entry )
                                                    getInputStream()
    getEntries()
                                                    setInputStream()
                                  CRUD
    getEntry( uri )


                            2007 JavaOneSM Conference | Session TS-6029 |   58
ROME Propono: Posting an Entry
ClientAtomService service =
  AtomClientFactory.getAtomService(endpoint, uname, pword);

ClientWorkspace ws =
  (ClientWorkspace)service.findWorkspace(quot;Order Systemquot;);

ClientCollection collection =
  (ClientCollection)ws.findCollection(null, quot;entryquot;);

ClientEntry entry = collection.createEntry();
entry.setTitle(quot;NPE on submitting new order queryquot;);
entry.setContent(Content.HTML, quot;This is a <b>bad</b> one!quot;);
collection.addEntry(entry);



                      2007 JavaOneSM Conference | Session TS-6029 |   59
Agenda

The web is bloggy
Understanding RSS and Atom
Consuming feeds with ROME
Producing feeds with ROME
Publishing with ROME Propono
The future…


               2007 JavaOneSM Conference | Session TS-6029 |   60
RSS/Atom Trends
    Better RSS/Atom support in Java platform
●

        Thanks to ROME and Abdera; time for a Java™
    ●

        Specification Request?
    More REST-based web services in general
●

        Made easy by REST API, Restlets, etc.
    ●


    More web services based on Atom
●

        APP as canonical REST protocol
    ●




                        2007 JavaOneSM Conference | Session TS-6029 |   61
For More Information
    Sun™ Web Developer Pack
●

        http://developers.sun.com/web/swdp
    ●



    Related open source projects
●

        http://rome.dev.java.net
    ●


        http://incubator.apache.org/abdera
    ●


        http://blogapps.dev.java.net
    ●


    RSS and Atom in Action
●

        http://manning.com/dmjohnson
    ●




                         2007 JavaOneSM Conference | Session TS-6029 |   62
Summary
    RSS and Atom: not just for blogs anymore
●


    Feeds should be part of every developers toolkit
●


    ROME has the tools you need for:
●

        Consuming and producing RSS and Atom feeds
    ●


        Publishing to blogs via MetaWeblog API
    ●


        Publishing to other systems via Atom protocol
    ●




                        2007 JavaOneSM Conference | Session TS-6029 |   63
Q&A
Dave Johnson




               2007 JavaOneSM Conference | Session TS-6029 |   64
Beyond Blogging:
Feeds in Action
Dave Johnson
Staff Engineer/SW
Sun Microsystems, Inc.
http://rollerweblogger.org/roller

TS-6029

                           2007 JavaOneSM Conference | Session TS-6029 |

Más contenido relacionado

Similar a Beyond Blogging: Feeds in Action

Behind the scenes Web & App
Behind the scenes Web & AppBehind the scenes Web & App
Behind the scenes Web & Appsanketest7
 
Podcasting and iTunes U - Developments at UCL
Podcasting and iTunes U - Developments at UCLPodcasting and iTunes U - Developments at UCL
Podcasting and iTunes U - Developments at UCLJeremy Speller
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Shreeraj Shah
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?jbandi
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationMarakana Inc.
 
Web 2.0: new definition of web
Web 2.0: new definition of webWeb 2.0: new definition of web
Web 2.0: new definition of webNeeraj Singh
 
Web 2.0 & Mashups: How People can Tap into the "Grid" for Fun & Profit
Web 2.0 & Mashups: How People can Tap into the "Grid" for Fun & ProfitWeb 2.0 & Mashups: How People can Tap into the "Grid" for Fun & Profit
Web 2.0 & Mashups: How People can Tap into the "Grid" for Fun & ProfitPamela Fox
 
The spring 32 update final
The spring 32 update finalThe spring 32 update final
The spring 32 update finalJoshua Long
 
DrupalCamp ATL 2010: Not all CMSs are created equal
DrupalCamp ATL 2010: Not all CMSs are created equalDrupalCamp ATL 2010: Not all CMSs are created equal
DrupalCamp ATL 2010: Not all CMSs are created equalandrewmriley
 
OpenID Foundation Retail Advisory Committee Webinar
OpenID Foundation Retail Advisory Committee WebinarOpenID Foundation Retail Advisory Committee Webinar
OpenID Foundation Retail Advisory Committee WebinarMatterport
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Arun Gupta
 
UCL and iTunes U: EduCamp London 2010
UCL and iTunes U: EduCamp London 2010UCL and iTunes U: EduCamp London 2010
UCL and iTunes U: EduCamp London 2010Jeremy Speller
 
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignalITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignalITCamp
 
The State of WebSockets in Django
The State of WebSockets in DjangoThe State of WebSockets in Django
The State of WebSockets in DjangoRami Sayar
 
Collaborative Media Annotation with YUMA
Collaborative Media Annotation with YUMACollaborative Media Annotation with YUMA
Collaborative Media Annotation with YUMAaboutgeo
 
LA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented ArchitectureLA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented ArchitectureDan Yoder
 
RSS and Atom in the Social Web
RSS and Atom in the Social WebRSS and Atom in the Social Web
RSS and Atom in the Social Webhchen1
 

Similar a Beyond Blogging: Feeds in Action (20)

Behind the scenes Web & App
Behind the scenes Web & AppBehind the scenes Web & App
Behind the scenes Web & App
 
Podcasting and iTunes U - Developments at UCL
Podcasting and iTunes U - Developments at UCLPodcasting and iTunes U - Developments at UCL
Podcasting and iTunes U - Developments at UCL
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
 
Atom and rss
Atom and rssAtom and rss
Atom and rss
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovation
 
Web 2.0: new definition of web
Web 2.0: new definition of webWeb 2.0: new definition of web
Web 2.0: new definition of web
 
Web 2.0 & Mashups: How People can Tap into the "Grid" for Fun & Profit
Web 2.0 & Mashups: How People can Tap into the "Grid" for Fun & ProfitWeb 2.0 & Mashups: How People can Tap into the "Grid" for Fun & Profit
Web 2.0 & Mashups: How People can Tap into the "Grid" for Fun & Profit
 
The spring 32 update final
The spring 32 update finalThe spring 32 update final
The spring 32 update final
 
DrupalCamp ATL 2010: Not all CMSs are created equal
DrupalCamp ATL 2010: Not all CMSs are created equalDrupalCamp ATL 2010: Not all CMSs are created equal
DrupalCamp ATL 2010: Not all CMSs are created equal
 
OpenID Foundation Retail Advisory Committee Webinar
OpenID Foundation Retail Advisory Committee WebinarOpenID Foundation Retail Advisory Committee Webinar
OpenID Foundation Retail Advisory Committee Webinar
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010
 
Spring Mvc
Spring MvcSpring Mvc
Spring Mvc
 
UCL and iTunes U: EduCamp London 2010
UCL and iTunes U: EduCamp London 2010UCL and iTunes U: EduCamp London 2010
UCL and iTunes U: EduCamp London 2010
 
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignalITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
 
The State of WebSockets in Django
The State of WebSockets in DjangoThe State of WebSockets in Django
The State of WebSockets in Django
 
Keynote I
Keynote IKeynote I
Keynote I
 
Collaborative Media Annotation with YUMA
Collaborative Media Annotation with YUMACollaborative Media Annotation with YUMA
Collaborative Media Annotation with YUMA
 
LA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented ArchitectureLA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented Architecture
 
RSS and Atom in the Social Web
RSS and Atom in the Social WebRSS and Atom in the Social Web
RSS and Atom in the Social Web
 

Más de David M. Johnson

Apache Usergrid for JavaScript Developers
Apache Usergrid for JavaScript DevelopersApache Usergrid for JavaScript Developers
Apache Usergrid for JavaScript DevelopersDavid M. Johnson
 
Introduction to Usergrid - ApacheCon EU 2014
Introduction to Usergrid - ApacheCon EU 2014Introduction to Usergrid - ApacheCon EU 2014
Introduction to Usergrid - ApacheCon EU 2014David M. Johnson
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache UsergridDavid M. Johnson
 
Shindig for Blogs and Wikis
Shindig for Blogs and WikisShindig for Blogs and Wikis
Shindig for Blogs and WikisDavid M. Johnson
 

Más de David M. Johnson (8)

Apache Usergrid for JavaScript Developers
Apache Usergrid for JavaScript DevelopersApache Usergrid for JavaScript Developers
Apache Usergrid for JavaScript Developers
 
Introduction to Usergrid - ApacheCon EU 2014
Introduction to Usergrid - ApacheCon EU 2014Introduction to Usergrid - ApacheCon EU 2014
Introduction to Usergrid - ApacheCon EU 2014
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
Innovate 2010-oslc-jazz
Innovate 2010-oslc-jazzInnovate 2010-oslc-jazz
Innovate 2010-oslc-jazz
 
Barcamprdu linkeddata
Barcamprdu linkeddataBarcamprdu linkeddata
Barcamprdu linkeddata
 
Whats New In Roller5
Whats New In Roller5Whats New In Roller5
Whats New In Roller5
 
Shindig for Blogs and Wikis
Shindig for Blogs and WikisShindig for Blogs and Wikis
Shindig for Blogs and Wikis
 
Social Software at work
Social Software at workSocial Software at work
Social Software at work
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Beyond Blogging: Feeds in Action

  • 1. Beyond Blogging: Feeds in Action Dave Johnson Staff Engineer/SW Sun Microsystems, Inc. http://rollerweblogger.org/roller TS-6029 2007 JavaOneSM Conference | Session TS-6029 |
  • 2. Goal What you’ll learn in this session Understand RSS and Atom feed formats, the Atom Publishing Protocol. Understand how to use ROME to consume and produce feeds. 2007 JavaOneSM Conference | Session TS-6029 | 2
  • 3. Agenda The web is bloggy Understanding RSS and Atom Consuming feeds with ROME Producing feeds with ROME Publishing with ROME Propono The future… 2007 JavaOneSM Conference | Session TS-6029 | 3
  • 4. Why Talk About Blogging at 2007 JavaOneSM Conference? Blogs made the web easier ● For writers, readers, and software developers ● Blogs brought XML to the masses ● 2007 JavaOneSM Conference | Session TS-6029 | 4
  • 5. Bloggers Didn’t Invent XML But they perfected and popularized XML feeds ● e.g., Dave Winer, Dan Libby and RSS ● e.g., Gregorio, Pilgrim, Ruby and Atom ● And kicked off XML web services ● e.g., Dave Winer created XML-RPC, precursor ● to SOAP, for his Frontier CMS And then blogging hit the big time… ● 2007 JavaOneSM Conference | Session TS-6029 | 5
  • 6. State of the Blogosphere 2007 JavaOneSM Conference | Session TS-6029 | 6
  • 7. Suddenly Everybody Has a Blog Suddenly it’s easy for software to monitor, ● parse, publish, filter, and aggregate web content And the web is bloggy ● Every web site has XML feeds ● Every web site has a simple XML API ● Bloggy? ● 2007 JavaOneSM Conference | Session TS-6029 | 7
  • 8. That’s Right, Bloggy Everything is a time-stamped, uniquely identified ● chunk of data with meta-data Bug reports News stories ● ● Wiki changes Search results ● ● Uploaded photos Source code changes ● ● Events and meetups O/S log messages ● ● Podcasts and Vodcasts ● OK, not everything, but you get the idea… ● 2007 JavaOneSM Conference | Session TS-6029 | 8
  • 9. Feeds on the Web Today Producer Blogger.com MySpace Ant MS Word 2007 Wordpress.com Digg.com MarsEdit Ecto Flickr.com Google Data del.icio.us w.bloggar Meetup.com YouTube iTunes Google Reader Client Server Firefox Windows Vista Tailrank Rojo FeedDemon NetNewsWire BlogLines Technorati MyYahoo IE7 Safari Consumer 2007 JavaOneSM Conference | Session TS-6029 | 9
  • 10. Meanwhile: Web Services Got Uppity SOAP took over where XML-RPC left off ● WSDL, UDDI, and Schema exploded into ● today’s complex WS-* stack 2007 JavaOneSM Conference | Session TS-6029 | 10
  • 11. But Most Developers Didn’t Follow Developers prefer REST ● “Amazon has both SOAP and REST interfaces to their ● web services, and 85% of their usage is of the REST interface.” —Tim O’Reilly And even WS-Advocates agree ● “For applications that require Internet scalability (e.g., ● mass consumer-oriented services), plain old XML (POX) is a much better solution than WS-*.” —Anne Thomas Mannes 2007 JavaOneSM Conference | Session TS-6029 | 11
  • 12. And Now RSS and Atom Are Emerging As a foundation for simple web services ● For example: ● Yahoo Pipes for end-user mash-ups via RSS ● Google Data using Atom Publishing Protocol ● Lucene—WS using Atom Publishing Protocol ● Eclipse’s Europa build system ● Let’s return to the topic of feeds ● 2007 JavaOneSM Conference | Session TS-6029 | 12
  • 13. Agenda The web is bloggy Understanding RSS and Atom Consuming feeds with ROME Producing feeds with ROME Publishing with ROME Propono The future… 2007 JavaOneSM Conference | Session TS-6029 | 13
  • 14. What Is a Feed? XML representation of uniquely identified, ● time-stamped data items with metadata Available on the web at a fixed URL ● Entry ID Feed Title ID Date Title Author(s) Link Category Date Summary Author(s) Content 2007 JavaOneSM Conference | Session TS-6029 | 14
  • 15. The Birth of the RSS Feed Format RSS began life at Netscape™ in 1999 ● First spec was RSS 0.90 by Dan Libby ● Created for the My Netscape portal ● Known as RDF Site Summary (RSS) ● Dave Winer helped with 0.91, removed RDF ● 0.9X formats are obsolete but still in use today ● 2007 JavaOneSM Conference | Session TS-6029 | 15
  • 16. The RDF Fork: RSS 1.0 After RSS 0.91, Winer tried to keep RSS simple ● RDF folks argued for extensibility ● The RDF folks declared victory and released 1.0 ● Small set of elements, augmented by RDF ● And Extension Modules ● Adopted by Movable Type and many others ● RSS 1.0 is still widely used today ● 2007 JavaOneSM Conference | Session TS-6029 | 16
  • 17. Elements of RSS 1.0 (Abridged) <title> <link> <description> <items> <channel> <xx:yyy> <RDF:rdf> <title> Allows <item> extension <description> elements Required <link> Note: items not Optional in <channel> as <xx:yyy> they were in 0.9X Extension 2007 JavaOneSM Conference | Session TS-6029 | 17
  • 18. The Simple Fork: RSS 0.92–RSS 2.0 Winer rejected 1.0 and continued with 0.92, 0.93 ● and finally 2.0; along the way RSS: Added more metadata ● Added <enclosure> element—Podcasting! ● Added support for Extension Modules ● Made elements under <item> optional ● RSS 2.0 declared to be final version of RSS ● 2007 JavaOneSM Conference | Session TS-6029 | 18
  • 19. Elements of RSS 2.0 (Abridged) <title> <link> <title> One is <description> required <description> <author> <pubDate> <link> <item> <rss> <channel> “Permalink” <guid> <enclosure> Podcast <xx:yyy> <category> Required <author> Optional Allows <xx:yyy> extension Extension elements 2007 JavaOneSM Conference | Session TS-6029 | 19
  • 20. RSS 2.0 Example <rss version=quot;2.0quot;> <channel> <title>Latest Bugs</title> <link>http://bugtrack/bugreport</link> <item> <title>Blue screen on refresh</title> <link>http://bugtrack/bugreport?id=132</link> <description> This is &lt;b&gt;very&lt;b&gt; bad. </description> <pubDate>Fri, 11 May 2007 15:00:00 EDT</pubDate> </item> </rss> 2007 JavaOneSM Conference | Session TS-6029 | 20
  • 21. Funky RSS: Overuse of Extensions? <rss version=quot;2.0quot; xmlns:dc=quot;http://purl.org/dc/elements/1.1/quot;> <channel> <title>Latest Bugs</title> <link>http://bugtrack/bugreport</link> <item> <title>Blue screen on refresh</title> <link>http://bugtracker/bugreport?id=132</link> <description>This is &lt;b&gt;very&lt;b&gt; bad. </description> <dc:date>2007-05-11T15:00:00-00:00</dc:date> <dc:creator>Joe Tester</dc:creator> </item> </rss> 2007 JavaOneSM Conference | Session TS-6029 | 21
  • 22. RSS Limitations Spec is too loose and unclear ● What fields can be escaped HTML? ● How many enclosures are allowed per item? ● Content model is weak ● No support for summary and content ● Content-type and escaping not specified ● Specification is final and cannot be clarified ● 2007 JavaOneSM Conference | Session TS-6029 | 22
  • 23. What Is Atom? From the IETF Atom WG charter: ● “Atom defines a feed format for representing and a protocol for editing Web resources such as Weblogs, online journals, Wikis, and similar content.” Feed format is now IETF RFC-4287 ● Protocol will be finalized in 2007 ● 2007 JavaOneSM Conference | Session TS-6029 | 23
  • 24. Atom Publishing Format An XML feed format; feed contains entries ● Entries are: ● Time-stamped, uniquely ID’ed chunks of data ● With meta-data: title, dates, categories ● Entry content can be: ● TEXT, HTML, XHTML or any content-type ● In-line or out-of-line specified by URI ● Entry Binary data w/Base64 encoding Feed ● Id Title Title It’s generic, not just for blogs ● Updated Updated Link Link Content 2007 JavaOneSM Conference | Session TS-6029 | 24
  • 25. Elements of Atom (Abridged) <title> <title> <updated> <updated> Links can be permalink, podcasts, etc. <link> <id> <feed> <link> <author> <<person>> Self link, <subtitle> site link <published> and others <category> <summary> Type can be text, html, xhtml <entry> <content> or content type @type URI if content @src is out-of-line Required <xx:yyy> <category> Optional <name> <author> <<person>> Extension <url> <<person>> <xx:yyy> <email> 2007 JavaOneSM Conference | Session TS-6029 | 25
  • 26. Atom <feed> With One <entry> <feed xmlns='http://www.w3.org/2005/Atom'> <title>Latest Bugs</title> <link href='http://bugtracker/bugreport' /> <link rel='self' href='http://bugtracker/feeds/bugreport'/> <updated>2007-05-11T15:00:00-00:00</updated> <author><name>BugTracker-5000-XL</name></author> <entry> <title>Blue screen on refresh</title> <link href='http://bugtracker/bugreport?id=132' /> <id>http://bugtracker/bugreport?id=132</id> <updated>2007-05-11T15:00:00-00:00</updated> <content type='html'> This is &lt;b&gt;very&lt;b&gt; bad. </content> </entry> </feed> 2007 JavaOneSM Conference | Session TS-6029 | 26
  • 27. RSS and Atom Feed Family Tree 1999 2000 2001 2002 2005 RSS RSS Netscape 0.90 0.91 Simple Fork RSS RSS RSS RSS RSS Dave Winer 0.91 0.93 0.92 0.94 2.0 RDF Fork RSS RSS-DEV Group 1.0 Internet Engineering Atom Task Formce (IETF) 2007 JavaOneSM Conference | Session TS-6029 | 27
  • 28. Agenda The web is bloggy Understanding RSS and Atom Consuming feeds with ROME Producing feeds with ROME Publishing with ROME Propono The future… 2007 JavaOneSM Conference | Session TS-6029 | 28
  • 29. Parsing and Fetching Feeds It’s just XML! ● Use your favorite parsing technique ● Or better yet... use a parser library ● ROME: DOM-based feed parser/generator ● (Java™ platform) Abdera: STAX-based Atom-only parser (Java platform) ● Universal Feed Parser (Python) ● Windows RSS Platform: Parser built in to IE7 ● 2007 JavaOneSM Conference | Session TS-6029 | 29
  • 30. ROME RSS/Atom Feed Utilities Most capable Java platform-based toolkit ● Pros ● Parses/generates all forms of RSS and Atom ● Highly pluggable/extensible, based on JDOM ● Parses to Atom, RSS, or abstract object model ● Con: DOM based ● Free and open source (Apache license) ● 2007 JavaOneSM Conference | Session TS-6029 | 30
  • 31. How Does ROME Work? SyndFeed SyndEntry Co t er nv nv er o SyndFeed model t C Channel Feed Entry Item Atom model RSS model 2007 JavaOneSM Conference | Session TS-6029 | 31
  • 32. ROME SyndFeed Model SyndContent value src SyndFeed type author SyndEntry copyright id SyndLink description published title encoding rights type feedType source rel image summary length language title href link updated modules publishedDate SyndCategory title label uri term scheme 2007 JavaOneSM Conference | Session TS-6029 | 32
  • 33. Parsing a Feed With ROME SyndFeed SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build( new InputStreamReader(inputStream)); Iterator entries = feed.getEntries().iterator(); while (entries.hasNext()) { SyndEntry entry = (SyndEntry)entries.next(); System.out.println(quot;Title: quot; + entry.getTitle()); System.out.println(quot;Link: quot; + entry.getLink()); System.out.println(quot;nquot;); } 2007 JavaOneSM Conference | Session TS-6029 | 33
  • 34. How to Fetch Feeds Be nice and conserve bandwidth ● Use HTTP conditional GET or Etags ● Don’t poll too often ● Your parser library might do the work for you ● ROME’s Fetcher provides a caching feed-store ● Other parsers do too ● 2007 JavaOneSM Conference | Session TS-6029 | 34
  • 35. Fetching a Feed With ROME Fetcher FeedFetcherCache cache = new DiskFeedInfoCache(quot;/var/rome-fetcher/cachequot;); FeedFetcher fetcher = new HttpURLFeedFetcher(cache); SyndFeed feed = fetcher.retrieveFeed( new URL(quot;http://bugtracker/feeds/bugreportquot;)); Iterator entries = feed.getEntries().iterator(); while (entries.hasNext()) { SyndEntry entry = (SyndEntry)entries.next(); // ... omitted: print out entry ... } 2007 JavaOneSM Conference | Session TS-6029 | 35
  • 36. Agenda The web is bloggy Understanding RSS and Atom Consuming feeds with ROME Producing feeds with ROME Publishing with ROME Propono The future… 2007 JavaOneSM Conference | Session TS-6029 | 36
  • 37. Serving Feeds: Generate XML Use your favorite XML tools or… ● Templates languages like JavaServer Pages™ ● (JSP) technology, PHP, ASP.Net Or better yet: a feed toolkit like ROME ● 2007 JavaOneSM Conference | Session TS-6029 | 37
  • 38. Generating Atom With ROME, Pt. 1/2 SyndFeed syndFeed = new SyndFeedImpl(); syndFeed.setTitle(quot;Latest bugsquot;); syndFeed.setAuthor(quot;BugTrack-9000-XLquot;); syndFeed.setPublishedDate(BugManager.getUpdateDate()); syndFeed.setLink(quot;http://localhost/bugtrackerquot;); syndFeed.setUri(syndFeed.getLink()); Atom ID SyndLink selfLink = new SyndLinkImpl(); selfLink.setRel(quot;selfquot;); selfLink.setHref(quot;http://localhost/bugtracker/latest.atomquot;); syndFeed.setLinks(Collections.singletonList(selfLink)); List entries = new ArrayList(); syndFeed.setEntries(entries); 2007 JavaOneSM Conference | Session TS-6029 | 38
  • 39. Generating Atom With ROME, Pt. 2/2 Iterator bugs = BugManager.getLatestBugs(20).iterator(); while (bugs.hasNext()) { Bug bug = (Bug)bugs.next(); SyndEntry entry = new SyndEntryImpl(); entry.setTitle(bug.getTitle()); entry.setUpdatedDate(bug.getDateAdded()); entry.setLink( quot;http://bugtracker/?bugid=quot; + bug.getId()); entry.setUri(entry.getLink()); Atom ID SyndContent content = new SyndContentImpl(); content.setValue(bug.getDescription()); content.setType(quot;htmlquot;); entry.setContents(Collections.singletonList(content)); entries.add(entry); } 2007 JavaOneSM Conference | Session TS-6029 | 39
  • 40. Serving Feeds: Serve It Up Set the right content-type ● application/rss+xml application/atom+xml Cache, cache, cache! ● On client-side via HTTP Conditional GET ● On proxy servers via HTTP headers ● On server side via your favorite cache tech ● 2007 JavaOneSM Conference | Session TS-6029 | 40
  • 41. Serving Atom With ROME, Pt. 1/2 public class BugFeedServlet extends HttpServlet { LRUCache cache = new LRUCache(5, 5400); protected void doGet(HttpServletRequest req, // ...omitted Date since = new Date( req.getDateHeader(quot;If-Modified-Sincequot;)); if (sinceDate != null) { if (BugManager.getUpdateDate().compareTo(since) <= 0) { res.sendError(HttpServletResponse.SC_NOT_MODIFIED); return; } } res.setDateHeader(quot;Last-Modifiedquot;, BugManager.getUpdateDate().getTime()); res.setHeader(quot;Cache-Controlquot;, quot;max-age=5400, must-revalidatequot;); 2007 JavaOneSM Conference | Session TS-6029 | 41
  • 42. Serving Atom With ROME, Pt. 2/2 String url = request.getRequestURL().toString(); if (cache.get(url) == null) { SyndFeed syndFeed = // ...omitted syndFeed.setFeedType(quot;atom_1.0quot;); StringWriter stringWriter = new StringWriter(); SyndFeedOutput output = new SyndFeedOutput(); output.output(syndFeed, stringWriter); cache.put(request.getRequestURL().toString(), stringWriter.toString()); } response.setContentType( quot;application/xml+atom;charset=utf-8quot;); response.getWriter().write((String)cache.get(url)); } } 2007 JavaOneSM Conference | Session TS-6029 | 42
  • 43. Feed Auto-Discovery Make it easy for applications to find your feeds ● Firefox can do it ● Safari can too ● And even IE ● 2007 JavaOneSM Conference | Session TS-6029 | 43
  • 44. Feed Auto-Discovery <html> <head> <meta http-equiv=quot;Content-Typequot; content=quot;text/html” /> <link rel=quot;alternatequot; type=quot;application/atom+xmlquot; title=quot;Latest bugs (Atom)quot; href=quot;http://bugtracker/feeds/bugreportquot; /> <link rel=quot;alternatequot; type=quot;application/rss+xmlquot; title=quot;Latest bugs (RSS)quot; href=quot;http://bugtracker/feeds/bugreport?format=rssquot; /> ... 2007 JavaOneSM Conference | Session TS-6029 | 44
  • 45. Serving Valid Feeds Ensure HTML is properly escaped ● Ensure XML is well formed ● Validate! ● feedvalidator.org ● 2007 JavaOneSM Conference | Session TS-6029 | 45
  • 46. Agenda The web is bloggy Understanding RSS and Atom Consuming feeds with ROME Producing feeds with ROME Publishing with ROME Propono The future… 2007 JavaOneSM Conference | Session TS-6029 | 46
  • 47. Feed Publishing Protocols Blogger API: Simple XML-RPC based protocol ● (by Blogger.com) MetaWeblog API: Extends Blogger API by ● adding RSS-based metadata (by Dave Winer) Atom Publishing Protocol: REST-based web ● publishing protocol uses Atom format (IETF) 2007 JavaOneSM Conference | Session TS-6029 | 47
  • 48. The MetaWeblog API getUserBlogs Get blogs as array of structures newPost Create new blog post by passing in structure* getPost Get blog post by id getRecentPosts Get most recent N blog posts editPost Update existing blog post deletePost Delete blog post specified by id newMediaObject Upload file to blog (e.g., picture of my cat) getCategories Get categories allowed in blog 2007 JavaOneSM Conference | Session TS-6029 | 48
  • 49. The Atom Publishing Protocol “Application-level protocol for publishing and editing Web resources using HTTP” Based on Atom Publishing Format ● Began as a replacement old blogging APIs ● Grew into a generic publishing protocol ● 2007 JavaOneSM Conference | Session TS-6029 | 49
  • 50. What Does Atom Protocol Do? Everything MetaWeblog API does ● But it’s generic, not just for blogs ● Entry can be any type of data ● CRUD on entries organized in collections ● Where CRUD = create, retrieve, update, ● and delete Based on principals of REST ● 2007 JavaOneSM Conference | Session TS-6029 | 50
  • 51. How Does It Do All That? The REST way: ● Everything’s a resource, addressable by URI ● HTTP verbs used for all operations ● HTTP POST to create entries ● HTTP GET to retrieve entries and collections ● HTTP PUT to update entries ● HTTP DELETE to delete entries ● 2007 JavaOneSM Conference | Session TS-6029 | 51
  • 52. APP Introspection GET from endpoint URI server client Service document 2007 JavaOneSM Conference | Session TS-6029 | 52
  • 53. APP Introspection Document <?xml version=quot;1.0quot; encoding='utf-8'?> <service xmlns=quot;http://purl.org/atom/app#quot;> <workspace title=quot;Order Management issuesquot; > <collection title=quot;Bug Reportsquot; href=quot;http://bugtrack/app/om/entriesquot; > <accept>entry</accept> </collection> <collection title=quot;Screenshotsquot; href=quot;http://bugtrack/app/om/screenshotsquot; > <accept>image/*</accept> </collection> </workspace> </service> 2007 JavaOneSM Conference | Session TS-6029 | 53
  • 54. An Atom Collection <feed> <feed xmlns=quot;http://www.w3.org/2005/Atomquot;> <link rel=quot;nextquot; href=quot;http://example.org/blog/app/entries/60quot; /> <link rel=quot;previousquot; href=quot;http://example.org/entries/20quot; /> ... <entry> ... </entry> URIs for next and previous <entry> ... </entry> portions of collection <entry> ... </entry> <entry> ... </entry> ... </feed> 2007 JavaOneSM Conference | Session TS-6029 | 54
  • 55. Creating an Entry entry.xml POST to collection URI server client Resulting Atom entry 2007 JavaOneSM Conference | Session TS-6029 | 55
  • 56. <entry> in a Collection <entry> <title>NPE on new order query</title> Edit URI for entry <link rel=quot;alternatequot; href=quot;http://bugtracker/bugreport?id=757” /> <link rel=quot;editquot; href=quot;http://bugtracker/app/bug/757quot; /> <id>http://bugtracker/bugreport?id=757</id> <updated>2007-05-08T22:08:03Z</updated> <published>2007-05-11T01:07:59Z</published> <content type=quot;htmlquot;>This is &lt;bad&gt; bad. </content> </entry> </feed> 2007 JavaOneSM Conference | Session TS-6029 | 56
  • 57. ROME Propono APP Client Library ● Makes it easy to build an APP client app ● APP Server Library ● Makes it easy to add an APP server to your web app ● Blog Client Library ● Suports both MetaWeblog API and APP ● Blog centric and not as generic as APP Client Library ● 2007 JavaOneSM Conference | Session TS-6029 | 57
  • 58. ROME Propono: Atom Client API Feed ClientAtomService ROME Atom Has 1..N model Entry ClientWorkspace getEntry( uri ) findCollection(title) ClientEntry Has 1..N update() remove() ClientCollection CRUD isWritable() createEntry() createMediaEntry() ClientMediaEntry addEntry( entry ) getInputStream() getEntries() setInputStream() CRUD getEntry( uri ) 2007 JavaOneSM Conference | Session TS-6029 | 58
  • 59. ROME Propono: Posting an Entry ClientAtomService service = AtomClientFactory.getAtomService(endpoint, uname, pword); ClientWorkspace ws = (ClientWorkspace)service.findWorkspace(quot;Order Systemquot;); ClientCollection collection = (ClientCollection)ws.findCollection(null, quot;entryquot;); ClientEntry entry = collection.createEntry(); entry.setTitle(quot;NPE on submitting new order queryquot;); entry.setContent(Content.HTML, quot;This is a <b>bad</b> one!quot;); collection.addEntry(entry); 2007 JavaOneSM Conference | Session TS-6029 | 59
  • 60. Agenda The web is bloggy Understanding RSS and Atom Consuming feeds with ROME Producing feeds with ROME Publishing with ROME Propono The future… 2007 JavaOneSM Conference | Session TS-6029 | 60
  • 61. RSS/Atom Trends Better RSS/Atom support in Java platform ● Thanks to ROME and Abdera; time for a Java™ ● Specification Request? More REST-based web services in general ● Made easy by REST API, Restlets, etc. ● More web services based on Atom ● APP as canonical REST protocol ● 2007 JavaOneSM Conference | Session TS-6029 | 61
  • 62. For More Information Sun™ Web Developer Pack ● http://developers.sun.com/web/swdp ● Related open source projects ● http://rome.dev.java.net ● http://incubator.apache.org/abdera ● http://blogapps.dev.java.net ● RSS and Atom in Action ● http://manning.com/dmjohnson ● 2007 JavaOneSM Conference | Session TS-6029 | 62
  • 63. Summary RSS and Atom: not just for blogs anymore ● Feeds should be part of every developers toolkit ● ROME has the tools you need for: ● Consuming and producing RSS and Atom feeds ● Publishing to blogs via MetaWeblog API ● Publishing to other systems via Atom protocol ● 2007 JavaOneSM Conference | Session TS-6029 | 63
  • 64. Q&A Dave Johnson 2007 JavaOneSM Conference | Session TS-6029 | 64
  • 65. Beyond Blogging: Feeds in Action Dave Johnson Staff Engineer/SW Sun Microsystems, Inc. http://rollerweblogger.org/roller TS-6029 2007 JavaOneSM Conference | Session TS-6029 |