Pages

Tuesday, January 18, 2011

Restlet Katas

Overview
This is the first time that I have ever worked with Restlet, which is web framework for Java that specializes in computer-computer interaction. As of right now, I still don't know too much about it and I'm not sure how we would use this in a larger project. For me there was quite a bit of a steep learning curve, as I was not able to find many examples of the code actually in use (mainly for the basic http authentication kata). Though, it seemed the longer that I worked with it the more familiar it became; hopefully as the semester progresses it will become easier to use.

Restlet Katas
By completing these Katas we were able to see a little of what Restlet does. We were able to set up a restlet web server that can authenticate the client and then spit out date and time to the user.
  • Kata 1: Add three new resources called "hour", "minute" and "second" which return the current hour, minute and second.
    Completed: Yes
    Time Spent: 35 minutes

    Summary: This exercise was pretty straight forward as I just copied the existing "month" resource and then proceeded to look up Java's Calendar API, to get the appropriate method name for the hour, minute, and second.

  • Kata 2: Setup logging by making restlet read in a logging.properties file.
    Completed: Yes
    Time Spent: 1 hour 45 minutes

    Summary: This took quite a bit longer than the first kata as the documentation wasn't very specific. Finding the bit of code to put in our server to make restlet read the properties file was easy, but finding the code to put inside of the properties file took much longer. I tried putting a few different things in the properties file which didn't work, after searching for about an hour I eventually found the correct settings for the file.

  • Kata 3: Authenticate requests with basic HTTP authentication.
    Completed: Yes
    Time Spent: 2 hours 35 minutes

    Summary: This took a really long time to figure out due to the restlet documentation not being very good. I searched for the proper code for about 2 hours trying many different pieces of code which I found; nothing seemed to work. At one point I had it authenticating, but still showing the data on the page before you type in your username and password. Eventually I found a good example of how to authenticate on StackOverflow, which can be seen here.

  • Kata 4: For this Kata, create a new client for the DateService server that is a web application using Wicket rather than a command line application.
    Completed: Yes
    Time Spent: 3 hours 25 minutes

    Summary: The biggest problem I ran into was that I was unable to get Jetty to work with Eclipse. I added jetty to the build.xml file for Ant, but regardless Eclipse would not recognize the jetty imports in my Jetty.java file even though they were in the lib directory of the project. I tried numerous ways of trying to import the Jetty libraries, eventually I realized I had to add the new Jetty jar files to Eclipse's build path for the project. After nearly three hours of frustration and making no progress, I finally was able to move on and work on the actual Wicket programing. The programing I had to do in Wicket was very simple: I just had to make a simple getResource method that calls on the Dateserver to request the resource. Even though this kata took me the longest to complete, it wasn't the hardest, both the logging and authentication katas were more difficult.
Deliverables

No comments:

Post a Comment