Installing and using the Abdera-based feed libraries
The IBM® support for feeds, using Apache Abdera libraries, primarily consists of the
following items:
- Feeds support libraries: JavaTM archive (JAR) files for Apache
Abdera and the required XML Stax parser support. The information in this document is about this set of libraries and how you can use them to run the feed samples that you create.
- Feeds application: A sample application that demonstrates
the use of the feeds support libraries
Using the Feeds support libraries to build and run a sample
feeds application
- Important: The feeds support libraries do not contain a
sample application. To understand how to build and use a feed-based
application, refer to the Feed sample application that is
packaged along with the feature pack, or refer to the Abdera examples
present at Abdera examples.
- A sample feed application requires the following JAR files.
Refer to the Overview
section to locate these files :
- Abdera JAR files: files have the pattern abdera.*.jar, and
retroweaver*.jar
- Axiom JAR files: axiom-api-1.2.5.jar, axiom-impl-1.2.5.jar
- Stax API support: xlxpScannerUtils.jar, xlxpScanner.jar,
stax-api.jar, xml-apis.jar. These files are for
WebSphere® Application Server Version 6.0.x, 6.1.x and 7.0.0.x.
- Support for the Abdera client calls:
commons-httpclient-3.1-rc1.jar, commons-codec-1.3.jar
- Jaxen API support : Since Abdera uses the jaxen XPath implementation by default.
- For build time, include the previously mentioned JAR files
in the build-time class path, while developing your sample
feeds application
- Deploy your sample WAR file in the application server, and as
part of the deployment process, enter the context root for the application.
For example, use "SampleFeedApp" as the context root. In the case of WebSphere Application
Server Community Edition, the WEB-INF/geronimo-web.xml plan contains the context root.
- In the case of WebSphere
Application Server Version 6.x, and 7.x the previously mentioned Abdera-related
JAR files must be added into the class path. As a recap, the JAR files
referred earlier are of the pattern: abdera.*.jar, retroweaver*.jar, axiom-*.jar, xlxp*.jar,
stax-api.jar, commons-*.jar, jaxen-*.jar, xml-apis.jar. One mechanism is to create a shared
library, and associate it with the applications that need these JAR
files. The following steps illustrate creation of a shared library, and
associating it with the application:
- Create a folder for the shared library option. For example,
name this folder, /feed-library.
- Copy the JAR files into that folder:
abdera-client-0.4.0-incubating-retro.jar, abdera-contrib-rss-0.4.0-incubating-retro.jar,
abdera-core-0.4.0-incubating-retro.jar, abdera-i18n-0.4.0-incubating-retro.jar,
abdera-parser-0.4.0-incubating-retro.jar, abdera-security-0.4.0-incubating-retro.jar,
abdera-server-0.4.0-incubating-retro.jar, retroweaver-rt-2.0.jar,
axiom-api-1.2.5.jar, commons-httpclient-3.1-rc1.jar, xlxpScannerUtils.jar,
axiom-impl-1.2.5.jar, stax-api.jar, commons-codec-1.3.jar,
xlxpScanner.jar, xml-apis.jar, jaxen-1.1.1.jar
- Open the WebSphere Application Server administrative console, and
select your feed sample application. Let's say the name of the sample
application is SampleFeedApp.war. Click Applications >
Enterprise Applications > SampleFeedApp_war.
- Click the Shared library references link. Select
the checkbox for SampleFeedApp_war file, and click Reference
shared libraries.
- Register the shared library, if it is not already present.
Click New, and on the Shared Library Mapping >
New page, enter fslib, for the shared library name, and the class
path to the shared libraries. Enter the following information as an example:
/feed-library/abdera-client-0.4.0-incubating-retro.jar
/feed-library/abdera-contrib-rss-0.4.0-incubating-retro.jar
/feed-library/abdera-core-0.4.0-incubating-retro.jar
/feed-library/abdera-i18n-0.4.0-incubating-retro.jar
/feed-library/abdera-parser-0.4.0-incubating-retro.jar
/feed-library/abdera-security-0.4.0-incubating-retro.jar
/feed-library/abdera-server-0.4.0-incubating-retro.jar
/feed-library/retroweaver-rt-2.0.jar
/feed-library/axiom-api-1.2.5.jar
/feed-library/axiom-impl-1.2.5.jar
/feed-library/stax-api.jar
/feed-library/xlxpScanner.jar
/feed-library/xlxpScannerUtils.jar
/feed-library/xml-apis.jar
/feed-library/commons-httpclient-3.1-rc1.jar
/feed-library/commons-codec-1.3.jar
/feed-library/jaxen-1.1.1.jar
- Click OK to save this information. The
page switches to the Shared library mapping page. Select the "fslib"
library and move it to the Selected list box. Click OK.
- You return to the Shared library references page.
Select the checkbox for the SampleFeedApp_war file, and click OK.
- Click Save to the master configuration
- Similar instructions for adding Abdera-related JAR files as a shared library under
WebSphere Application Server Community Edition 2.x are available at
http://publib.boulder.ibm.com/wasce/V2.1.0/en/shared-library.html
- Start your SampleFeedApp_war application.
Note: The xml-apis.jar is to be used as part of shared library, only by the users on WebSphere Application Server Version 6.0.x/ Java 1.4.2
Atom Publishing Protocol (APP) and mapping to HTTP operations
- The APP samples require HTTP operations to work with the feed
entries. For example:
- HTTP POST is used to create an entry in a feed
- HTTP PUT is used to update a specific entry in a feed
- HTTP GET is used to retrieve a specific entry from a feed, or
the entire feed, or the service document related to the Abdera server
- HTTP DELETE is used to delete a specific entry from a feed
- You can use the following two options to complete these operations on the feed and view the results:
- Use XMLHttpRequest (XHR) object in the browser to perform the
PUT, POST, GET, DELETE operations. The normal form submit operation in
the browser supports only the GET and POST operations.
- The other, simpler, approach is to use a tool like cURL. The cURL tool provides a simple command-line
operation to invoke calls on the APP server. Use this option to use the APP samples.
Troubleshooting
Certain feeds are not being read by the Abdera libraries
- Use FeedValidator to
check the validity of a feed.
- Valid Atom feeds are processed by Abdera.
- RSS processing is still being introduced into Abdera,
therefore some valid RSS feeds may still not be processed by Abdera
- In addition, also use cURL to check if the feeds are being
served correctly. cURL can be obtained from http://curl.haxx.se/download.html.
Try the following link to check if feeds are being served correctly:
curl -X GET http://news.google.com/?output=atom
- The last option is to use this sample Java program to
determine if a feed can be processed.
import java.io.InputStream;
import java.net.URL;
import org.apache.abdera.Abdera;
import org.apache.abdera.model.Document;
import org.apache.abdera.model.Feed;
import org.apache.abdera.parser.Parser;
public class TestFeed {
public static void main(String[] args) throws Exception {
Parser parser = Abdera.getNewParser();
InputStream input;
try {
input = new URL(args[0]).openStream();
Document doc = (Document) parser.parse(input);
Feed feed = (Feed) doc.getRoot();
System.out.println("Feed can be parsed");
System.out.println("Begin feed content -----");
feed.writeTo(System.out);
System.out.println("-------End feed content");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Compile and run the previous Java program by providing a feed as the
program's argument. A command-line example follows: java TestFeed http://www.alphaworks.ibm.com/news/xml/aw.xml
Current Java 2 Security policy reported a potential violation
of Java 2 Security Permission.
- If you see this error in your system out log, notice that this
is a setting that needs to be applied or changed based on the
recommendations in the IBM® WebSphere Application Server information center.
Specifically, refer to: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/csec_rsecmgr2.html
- If this security setting is not necessary, use the following steps to disable it:
- Open the IBM WebSphere Application Server administrative console, and
expand Security. Select Secure administration > applications > infrastructure.
- On the Secure administration, applications, and
infrastructure configuration page, uncheck Use Java 2 security
to restrict application access to local resources. Click Apply.
- Click Save to the master configuration.
- Restart server1.