Open Source for an Open World.

Atomsphere - an Atom feed library written in Java.

Home     Download     API     Bugs
 
Release Notes
Sort Extension
About
  • Atomsphere is a java library that allows you to create and modify atom 1.0 feeds.
  • It is distributed under the GNU GPL license and can be used in any manner complient with the license.
  • It is also packaged as a servlet-lib for use in web applications.
  • It is also packaged as a custom tag library to display feeds on a webapage.
  • It also comes with an example webapp which demonstrates some example uses of the library.
  • It is written to be tied as closely as possible to the current atom 1.0 specification found here.
Requirements
version 2.0.0.0 requires jdk/jre 1.5 or above. Previous versions work with jdk/jre 1.4.2 and above.
 
needed for using the atomsphere library

needed for using the atomsphere-taglib
  • the atomsphere library
  • Any J2EE Servlet Container
needed for using the atomsphere-weblib
  • stax-utils (for pretty printing)
  • the atomsphere library
  • Any J2EE Servlet Container
needed for using the example atomsphere-webapp
  • Any J2EE Servlet Container
Documentation

NOTE: If your are upgrading from series 1 library versions to the 2.0.0.0 versions, you must follow these 2 steps:

  1. for atomsphere-weblib users, change any attribute type="xhtml" to type="html" in the atomsphere configuration serialized xml file. This includes any content, title, subtitle and summary elements who may have an attribute type equal to xhtml.
  2. for all users, change any written xml files that have attribute type="xhtml" to type="html".
  3. The above changes will fix an issue with the handling of xhtml content. Going forward, you can use the xhtml content type with the atomsphere library as well as any other data type supported by the specification. Series 1 library users should strictly use content type "html" instead of "xhtml" to have the documents remain valid with the specification and the widest variety of atom document parsers.

Installation (atomsphere library)

  • Add any of the above Streaming API for XML (StAX) implementations jars to the classpath (WEB-INF/lib for webapps).

Installation (atomsphere-taglib)

  • Add the atomsphere jar to the classpath (WEB-INF/lib for webapps).
  • Add the atomsphereTags.tld tag descriptor to the top of the jsp page (See example below).
  • Add any required attributes and optional attributes to the custom tag (See example below).
  • View the atomsphereTags.tld for a description of the attributes and what they do.

Installation (atomsphere-weblib)

  • Add the atomsphere and atomsphere-weblib jars to the classpath (WEB-INF/lib for webapps).
  • Copy the web-fragrment.xml (embeded in the jar file) to your application's web.xml file.

Installation (atomsphere-webapp)

  • Deploy the war file to any J2EE servlet container.
Examples
Read an atom xml file into a Feed bean
Feed feed = FeedDoc.readFeedToBean(new File(fullPath));
 
Read an atom URL into a Feed bean
Feed feed = FeedDoc.readFeedToBean(new URL("http://www.colorfulsoftware.com/atom.xml"));
 
Read an atom xml file into an xml atom string
String atomXML = FeedDoc.readFeedToString(new File(fullPath));
 
Read an atom xml file into an xml atom string using a custom xml stream writer.
String atomXML = FeedDoc.readFeedToString(feed,"javanet.staxutils.IndentingXMLStreamWriter");
 
Write a feed bean.
FeedDoc.writeFeedDoc(fullPath,feed,FeedDoc.encoding,FeedDoc.xml_version);
 
Write a feed bean using a custom xml stream writer.
XMLStreamWriter writer = new IndentingXMLStreamWriter( XMLOutputFactory.newInstance() .createXMLStreamWriter( new FileOutputStream(outputFilePath) ,encoding)); FeedDoc.writeFeedDoc(writer,myFeed,null,null);
 
Add the custom feed tag to a jsp page.
<%@taglib uri="/WEB-INF/atomsphereTags.tld" prefix="atom" %>
...
<atom:atomFeed
clazz="myFeed"
url="http://www.colorfulsoftware.com/atom.xml"
feedSummary="true"
entryUpdated="true"
entryUpdatedFormat="yyyy-MM-dd" />