Re: First resource page
Hello Tim, thanks a lot for your feed-back. We fully agree with you and have updated the page and source code. best regards, Thierry Boileau This is a nice bit of documentation by example -- I'm glad you added it. FirstResourceApplication is not thread-safe, however. I know you want the example to be simple, but it's important to give readers code that exemplifies good practice. This is different from using an in-memory Map instead of a real database; even a toy application should not be broken. Simplest fix is to use ConcurrentHashMap instead of HashMap for the items field. (And make that field final.) The Resource implementation does *not* need to be thread-safe. A minor point: How about factoring the calls to ((FirstResourceApplication) getApplication()).getItems() into a common method of an abstract class extending Resource that both ItemsResource and ItemResource could extend? Then the toy-ness of the persistence layer wouldn't be so apparent, and dependency on FirstResourceApplicaiton would be confiined to one method. --tim On Tue, Apr 8, 2008 at 9:00 AM, Thierry Boileau [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello all, We've added a new First resource document in the Restlet web site. You can get it at the following URL: http://www.restlet.org/documentation/1.1/firstResource (or http://www.restlet.org/documentation/1.0/firstResource, for Restlet 1.0). It simply describes how to create 2 basic resources illustrating how to handle GET, POST, PUT, DELETE methods. Your comments and questions are of course welcomed. best regards, Thierry Boileau
Re: First resource page
This is a nice bit of documentation by example -- I'm glad you added it. FirstResourceApplication is not thread-safe, however. I know you want the example to be simple, but it's important to give readers code that exemplifies good practice. This is different from using an in-memory Map instead of a real database; even a toy application should not be broken. Simplest fix is to use ConcurrentHashMap instead of HashMap for the items field. (And make that field final.) The Resource implementation does *not* need to be thread-safe. A minor point: How about factoring the calls to ((FirstResourceApplication) getApplication()).getItems() into a common method of an abstract class extending Resource that both ItemsResource and ItemResource could extend? Then the toy-ness of the persistence layer wouldn't be so apparent, and dependency on FirstResourceApplicaiton would be confiined to one method. --tim On Tue, Apr 8, 2008 at 9:00 AM, Thierry Boileau [EMAIL PROTECTED] wrote: Hello all, We've added a new First resource document in the Restlet web site. You can get it at the following URL: http://www.restlet.org/documentation/1.1/firstResource (or http://www.restlet.org/documentation/1.0/firstResource, for Restlet 1.0). It simply describes how to create 2 basic resources illustrating how to handle GET, POST, PUT, DELETE methods. Your comments and questions are of course welcomed. best regards, Thierry Boileau
First resource page
Hello all, We've added a new First resource document in the Restlet web site. You can get it at the following URL: http://www.restlet.org/documentation/1.1/firstResource (or http://www.restlet.org/documentation/1.0/firstResource, for Restlet 1.0). It simply describes how to create 2 basic resources illustrating how to handle GET, POST, PUT, DELETE methods. Your comments and questions are of course welcomed. best regards, Thierry Boileau