What is representational state transfer (REST)? REST is an transfer architectural protocol for client and server interaction. The web is one example of an implementation architecture where clients may request web pages through the GET or POST protocol. As a JSP developer, I am familiar with the fundamental concepts of GET and POST protocols, but I have never used the remainder transfer protocols of PUT, DELETE, and HEADER. Although this REST architecture exist, there still exist the problem of its implementation. This is where the Restlet Java famework comes in. Basically, the goal of the Restlet framework is provide an easy to implement REST based resources to facilitate Java web development due to limitation in the JSP servlet’s scalability.
For this assignment, I updated a date service from an existing project to include output for the hour, minute, and seconds. In order to create a new resource, a class extending ServerResource must be created then linked to a web URI. By following the already implemented year resource, I was able to create the hour, minute, and seconds resource within thirty minutes.
After linking the new time resources, I overrode the Application.getLogger() method to record the logs to a file. In order for the program to be flexible, I had to read a properties file in the “~\.dateservice\logging.properties” to decide whether to record the logs to a files at a specific directory. Essentially, my logging.properties consisted of two properties: logToFile and dir. The hardest part of this kata was finding the correct place to create the new logger.
The hardest part of the third kata was understanding that the ChallengeAuthenticator class implemented the security. Following the example on the Restlet web site, the implementation the basic HTTP authentication was straight forward. All I needed to accomplish was the creatation of the ChallengeAuthenticator object with some DateServer parameters with a map of local user name and passwords; then the ChallengeAuthenticator is attached to the web server.
Whenever I thought of a data source for dynamic websites, the first thing that comes to mind is a database connection implemented using JDBC. But with Restlet service a wicket application can interact with the Restlet server without needing a database implementation. This method of accessing data separates the web application logic layer from the data source layer to support the model view controller development.