Using the IBM JAX-RS Guest book sample

The product provides a Guest book sample that demonstrates a simple Representational State Transfer (REST) application using the IBM® Java API for RESTful Web Services (JAX-RS) implementation.

Before you begin

The following table lists the required prerequisites for the Guest book sample:

Product prerequisite Version
Java Technology Edition 5.0 or 6.0
Java 2 Platform, Enterprise Edition (J2EE) 1.4 or Java Enterprise Edition 5 (Java EE) application server WebSphere® Application Server Version 6.1.0.x,

About this task

The Guest book sample application demonstrates a RESTful application using the IBM JAX-RS implementation and the Dojo Toolkit. You can access REST services using various client technologies. In this sample, the IBM JAX-RS implementation provides the server-side implementation while a Dojo-powered AJAX client runs in a Web browser

Limitations
  • The IBM JAX-RS Guest book sample application is not intended for deployment to production servers. It is for development and educational purposes only.
  • All source code for the sample servlets and Web pages is provided as is for you to use, copy, and modify without royalty payment when you develop applications that run with WebSphere software. You can use the sample code either for your own internal use or for redistribution as part of an application, or in your products.

By default, you can install the EAR application with minimal configuration. A Web module that contains the IBM JAX-RS powered service and the Dojo-powered Web page is preconfigured with a context root of /guestbook.

During the installation of the Feature Pack for Web 2.0, you can choose to install the IBM JAX-RS samples. Use the following instructions to install the sample outside of the product installation process.

Procedure

  1. Locate the ibm-sample-guestbook-server.ear file in the <install_root>/web2mobilefep_1.1/samples directory. The <install_root> specifies the directory where the Feature Pack for Web 2.0 is installed on WebSphere Application Server.
  2. Log in to the administrative console for the application server.
  3. Click Applications > Enterprise Application in the console navigation tree.
  4. Browse the file system to locate the Guest book sample application that you located in step 1 and click Next.
  5. Select the Prompt me only when additional information is required option.
  6. Expand Choose to generate default bindings and mappings and select Generate Default bindings.
  7. Click Next and take the default installation options.
  8. Click Next and take the default Map Modules to Servers options.
  9. Click Next and take the default Map virtual hosts for Web modules options.
  10. Click Next and take the defaults on the Summary page.
  11. On the Summary panel, click Finish.
  12. Click OK and then click Save to save the configuration.

Results

You have completed the installation of the Guest book sample.

After the sample is installed, you can go to http://<hostname>:<port>/guestbook to visit the Dojo-powered Web page. If you use the default installation configuration, the following URL is an example of a valid URL: http://localhost:9080/guestbook or http://localhost:8080/guestbook.

You can now begin using Guest book sample, which demonstrates the configuration of services using the IBM JAX-RS server runtime and the use of a stand-alone Apache Wink client.

What to do next

Contents of the Guest book sample

The design of the Guest book sample is to demonstrate the use of an IBM JAX-RS service and a Dojo-powered Web page working together. The sample emulates a simple Web page where people can post messages. By using a Web page with JavaScript, any Web browser can be used to access the service.

A Dojo-powered Web page is provided in the same application. While other clients such as a standalone Java program can access the service simultaneously, the ability to simply access a RESTful service using a Web browser is one of the powerful aspects of REST.




In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Sep 6, 2012 5:50:55 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v610webmob&product=was-nd-mp&topic=twbs_jaxrs_samples_guestbook
File name: twbs_jaxrs_samples_guestbook.html