On 11/09/10 17:47, Jerome Louvel wrote: > Hi all, > > Marc, Tal, would you mind updating the "Powered by" page in the community > wiki so people can find out themselves about your projects based on Restlet? > http://wiki.restlet.org/community/165-restlet.html > > Back to the original question, this is possible to use FreeMarker or Velocity > templates in Restlet like you would do with JSP, but as Vincent pointed out, > this require manual work for each REST resource you want to expose as HTML, > in addition to JSON/XML. > > Good news, is that we are planning to simplify this binding in version 2.1 > but associating the template files with representation beans based on the > bean qualified class name. The converter service would allow the developer to > indicate where the template lives, for example in the classpath next to the > bean class or in a separate directory.
That would be a nice addition even for other higher level frameworks like Prudence and Kauri as sometimes the ressource representation is right at Restlet level (considering it at the ressource/model layer). Let take an example in my small domain where I need to give XML responses to differents phones (manufacturers dialects) from the exact same ressource. Without your addition I'm forced to make contrieved routes for separating the REST URI added query parameters and then exposing in the REST routes some templating parameters (like a format). either through something like : GET <ressource_path>/queue/200 That list let say attributes for a phone queue 200 and then GET <ressource_path>/queue/200?template=aastra GET <ressource_path>/queue/200?template=cisco or adopting a view separation mapped to a template finder GET <ressource_path>/view/aastra/queue/200 and GET <ressource_path>/view/cisco/queue/200 in both case there is somewhat two layers (model and view) that get mixed still not getting the full view as for example I could have the ressource processed further. Having a bean annotation would do this kind of second routing (kinda like Prudence is doing on its nice routing over Restlets but at a lower level more in par with an OO decomposition). ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2658653