Installing and using the Wink-based feed libraries
The IBM® support for feeds, using Apache Wink libraries, primarily
consists of the following items:
- Feeds support libraries: JavaTM archive (JAR) files for Apache
Wink and its dependencies. 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 Wink 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 feeds-based
application, refer to the Feed sample application that is
packaged along with the feature pack, or refer to the
Apache Wink - Feeds Support documentation.
- A sample feed application requires the following JAR files.
Refer to the Overview
section to locate these files:
- JAX-RS JAR files: ibm-wink-jaxrs-*.jar and jsr311-api-*.jar
- JAXB support: ibm-jaxb-*.jar. This file is for
WebSphere® Application Server Version 6.1.x and WebSphere® Application Server Community Edition 2.x.
- JSON4J JAR file: JSON4J.jar
- Logging JAR files: slf4j-api-*.jar, slf4j-jdk14-*.jar and jcl-over-slf4j-*.jar
- Support for the Wink client calls: httpclient-*.jar, httpcore-*.jar and commons-codec-*.jar
- Other Wink dependencies: commons-lang-*.jar
- Only JSON4J is needed for IBM® WebSphere® Application Server version 8.0.
- 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.1.x, and 7.x, the previously mentioned Wink-related
JAR files must be added into the class path. As a recap, the JAR files
referred earlier are of the pattern: ibm-wink-jaxrs*.jar, jsr311-api*.jar, ibm-jaxb*.jar, JSON4J.jar,
slf4j*.jar, jcl-over-slf4j*.jar, httpclient*.jar, httpcore*.jar, commons-codec*.jar and commons-lang*.jar.
Among these, only JSON4J.jar is to be used for WebSphere® Application Server Version 8.0.x.
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 following JAR files into that folder:
ibm-wink-jaxrs*.jar, jsr311-api*.jar, ibm-jaxb*.jar,
slf4j*.jar, jcl-over-slf4j*.jar,
httpclient*.jar, httpcore*.jar, commons-codec*.jar and
commons-lang*.jar
- Open the WebSphere Application Server administrative console, and
select your feed sample application. For example, 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 jaxrslib for the shared library name, and the class
path to the shared libraries. Enter the following information as an example:
/feed-library/commons-codec.jar
/feed-library/commons-lang.jar
/feed-library/httpclient.jar
/feed-library/httpcore.jar
/feed-library/ibm-jaxb.jar
/feed-library/ibm-wink-jaxrs.jar
/feed-library/jcl-over-slf4j.jar
/feed-library/JSON4J.jar
/feed-library/jsr311-api.jar
/feed-library/slf4j-api.jar
/feed-library/slf4j-jdk14.jar
- Click OK to save this information. The
page switches to the "Shared library mapping" page. Select the "jaxrslib"
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 Wink-related JAR files as a shared library under
WebSphere Application Server Community Edition 2.x are available in the
WebSphere Application Server Community Edition documentation.
- Start your SampleFeedApp_war application.
Important: The ibm-jaxb*.jar is to be used as part of shared library, only by the users on WebSphere® Application Server Version 6.1.x/ WebSphere® Application Server Community Edition 2.x. Only JSON4J.jar needs to be added to the shared library in case of WebSphere® Application Server Version 8.0
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.
- 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 such as 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 Wink libraries