LAB-5542: Project Jersey: Building RESTful Web Services in Java

Expected Duration: 120 minutes
Begin Product Tab Sub Links

Exercise 0: Install and Configure Lab Environment

 

In addition to the contents of this lab's zip file you should have the following installed on your computer:

  • Java SE Development Kit, version 1.5.0_11 or 1.6.0 or more recent. Most likely it is already installed on your machine. If not, you can get it from here. Make sure JAVA_HOME environment variable points to the root of the Java installation.

  • Maven 2.0.9 or a more recent stable release. See Maven Download for detailed instructions.

  • NetBeans 6.5 or 6.5.1, either the "Java" or the "All" bundle from http://www.netbeans.org/downloads/index.html. These bundles include GlassFish v2(.1), so there is no need to install GlassFish separately.

  • Firefox 3 web browser - can be downloaded from www.firefox.com.

After installing Firefox we need to install the Poster add-on, which will enable us to send any kind of HTTP requests to our RESTful service and see the raw responses.

  1. If Firefox is not already running, start it.
  2. When Firefox has started, select Tools->Add-ons from the main menu.
  3. In the Add-ons dialog enter "Poster" into the search field and hit Enter.
  4. Poster should appear as the first add-on in the list. Click Add to Firefox.
  5. In the next dialog click Install Now.
  6. After the installation is complete, restart Firefox to complete the changes. If the Add-on dialog pops up after the restart, close it.
  7. You should see the Poster icon in the Firefox statusbar.

We also need to install the Maven plugin into the NetBeans IDE. Here is how to do this:

  1. If NetBeans is not already running, start it.
  2. When NetBeans has started, select Tools->Plugins and select "Maven" in the Available Plugins tab.

  3. Click the Install button.
  4. In the following dialog accept the license and click Install.
  5. After the installation completed, click Finish and close the Plugins dialog.

To make sure the Maven NetBeans plugin is using the right version of Maven:

  1. In NetBeans select Tools->Options (on Mac OS select NetBeans ->Preferences) and switch to Miscellaneous->Maven tab.
  2. Set the patch to your Maven installation in External Maven Home field.

And we need to ensure that GlassFish v2 is registered as a server in NetBeans:
  1. In NetBeans click on the Services tab.

  2. Now expand the Servers node in the Services tab (if possible). If you don't see GlassFish v2 under that node, right-click it and choose Add Server.

  3. In the Add Server Instance dialog that will pop up, select GlassFish V2 and click Next.

  4. In the next dialog screen set the Platform Location to your GlassFish installation directory. Once you do it, Register Local Default Domain should be selected automatically. Click Finish.
 

Back to top
Next exercise