Lab 3 - Using the RESTlet Framework

Due - Thursday, February 14, 2008

The goal of this lab is to give you some practice using the RESTlet framework. For this lab, you will use the RESTlet framework to develop the beginnings of your book download site.

Your application will respond to the following types of requests:

Your responses will be XML documents of the following format, where there may be several Book elements in a single response:

<?xml version="1.0" encoding="UTF-8"?>
<ResultList>
  <Book EtextNum="9548">
    <Author First="J.D" Last="Salinger"/>
    <Title>Catcher in the Rye</Title>
    <Location URI="http://www.host.com/books/9548"/>
    <ReleaseDate>April, 2001</ReleaseDate>
  </Book>
</ResultList>

Implementation Requirements and Hints

  1. Implement a database component that maintains the XML structure and responds to query requests. For the final version of your application, this component will need to support concurrent read and write requests.
  2. Use XPath and the getNodes method of XmlRepresentation to retrieve the appropriate Book elements.
  3. Make sure to appropriately handle errors and exceptional situations.
  4. Updated 2/10/08: When your server starts up it will need to read the contents of the XML database from a file. You can either (a) assume the XML file will be in a specific location relative to where the program is run or (b) specify the location of the XML file in a configuration file that your program processes at start up. In either case, your README must specify where to place the XML file in order to ensure that your program runs correctly. Also, note that your program should work on any OS.

Grading

Testing (Updated 2/10/08)

To test your program, I will run the following command:

java -cp {classpath provided in your readme} BooksiteApplication

This will start an HTTP server that listens at port 3000. I will issue the six types of GET requests shown above. Your server will respond with XML documents in the format shown above.

You do not need to provide a client application, though your server should accept requests from any HTTP client (including a web browser). This means that you should be able to test your server on the same machine on which it is running by launching a web browser and visiting a URL such as http://localhost:3000/books/author?startswith=S.

Due 5:30PM - Thursday, February 14, 2008

  1. Submit all of your code, along with readmes, to your submit directory at /home/submit/cs682-s08/username.
Note: No portion of your code may be copied from any other source including another text book, a web page, or another student (current or former). You must provide citations for any sources you have used in designing and implementing your program.
Sami Rollins