Hi Piyush, > I find that the Resource and its representations is a central part of > the dissertation but the tutorial somehow doesn't bring that to the > fore. Would you agree on that?
I do :-) and there is a plan to fill this hole: http://restlet.tigris.org/issues/show_bug.cgi?id=118 The reason for this is that this part of the API was the hardest to define and stabilize. Also, the lack of "Restlet Application" abstraction forces users to manually build the whole server/container. This is not too hard but still it distracts people from the real goal which is to work with Resources and Representations. > And I am still not convinced why Representation should extend > Resource > (We are talking API here)? This took me a while to get straight, so I understand that you are still confused. > Shouldn't Resource have different > Representations? Absolutely, they CAN have different representations. > And if so shouldn't there be a mechanism of asking a > resource it's representation (Or a representation builder > that takes a > resource and builds a suitable representtaion for it)? Resource.getVariants() does exactly that. > Here is a snippet from a draft that I never sent maybe it brings out > the question(s) better than the text I wrote above. > > Why is a Representation also a Resource? If I understand the > dissertation correctly then a Resource has a Representation but not > the other way around. And a resource may have different kinds of > representations depending on the resource identifier that is used. REST says that both a Resource and a Representation are Data Elements. In addition, HTTP clearly gives URIs to representations via the optional "Content-Location" header. In the end, if you think about a world of Resources (as you would think about a world of Objects), then any concept/idea/thing that can be usefully identified is a Resource. So Representations are potentially Resources too which leads to the extension declaration between the Java interfaces. We already use this facility to support the "Content-Location" header for example: we simply check if the Representation.identifier property is defined. > It seems like a resource is a very essential part of the RESTLET > architecture but somehow in all the documentation that I have read > incl. the tutorial somehow this message doesn't come through. I > haven't seen any comncrete example. Agreed, the tutorial needs to be refocused. I'm considering writing a separate tutorial that will focus only on Restlet Applications, Resources and Representations, going through a more real life example. If Chris Winters wants to contribute his BookStore application to the project, maybe we can get this done faster :-) Best regards, Jerome