public class DefaultResource extends ServerResource { @Get public String represent() { return "Default resource, try /hello/resource or /hello/handler"; } }
ServerResource has a no-arg constructor, so you don't need to pass Context, Request, and Response objects to super().
Nice as this is, I still want to inject my resources using Guice, so I've updated the Restlet-Guice classes from my previous post to support both the new ServerResources and the old Handlers. It incorporates the enhancement mentioned in the updates: You can override methods to use different providers for Application, Context, Request, and Response, although for most purposes the default providers should suffice.
Update 2009-Dec-11
I've been working on a Guice extension for Restlet as an incubator project that uses the ideas in this posting. My goal is to make this extension independent of Guice at the interface level, so that people can provide implementations for different DI frameworks, of which Guice is only the first.