I'm looking at using Guice with Restlets in a system that uses a small
number of servlets (one per application) as entry points.  Guice has a
servlet filter that will perform dependency injection on servlets at
init time, but it requires that the injected servlets descend from an
abstract class InjectibleHttpServlet.  

I'd like to obtain the Restlet Application or Context objects in the
ServetServlet subclasses in order to pass them on throughout my
application code, so that I can use Guice Modules to manage objects
implementing Resources, so that they can be instantiated with their
Applications and Contexts bound.

It's easy enough to reparent a copy of
com.noelios.restlet.ext.servlet.ServerServlet to descend from
com.google.inject.servlet.InjectedHttpServlet to obtain the init
behavior, but I'm having some difficulty putting the Context and
Application into Guice, since ServerServlet creates them itself.

I have seen some of the other Restlet/Guice work that's gone on, but it
seems that it avoids this area, perhaps on purpose, or perhaps because
the developers were not using ServerServlet, but instead a pure Restlet
application.

I would like to know if anybody has re-written ServerServlet to use
Guice injection and Providers to abstract out the creation and binding
of Application and Context.  If so (or if not and I do it), is there any
interest in putting this together with some of the other Guice work for
Restlet and contributing it back as an extension?

Thank you,
Leigh.

Reply via email to