Tim and Dhanji are both right, unsurprisingly.

1. My trouble came from my own three-way integration of Guice,
Restlet, and Servlet, not from Tim's Guice-Restlet example at
http://tembrel.blogspot.com/2008/07/resource-dependency-injection-in.html
2. Tim's Restlet FinderFactoryModule obtains the Injector used to
create the Restlet objects by doing @Inject Injector injector.
3. In my integration it got the Injector from the Restlet application,
where it was curried from the Guice Servlet adapter.  When
InjectedHttpServlet disappeared and made this harder, I should have
gone back to step 2.

Tim's "@Inject Injector injector" works for me.

I apologize for the confusion, mostly caused by my failure to realize
that "@Inject Injector injector" was critical to the design.

I don't see how I can have more than one Injector with ServletModule
(i.e., I will have one Injector for all Restlet Applications), but
that's not an important issue for me at the moment.

Leigh.

On Mar 9, 7:29 am, Tim Peierls <tpeie...@gmail.com> wrote:
> The Restlet-Guice integration doesn't have anything to do with
> servlets -- that's one of the joys of Restlet!. ;-)
>
> But Leigh Klotz might be working in a hybrid Restlet/Servlet
> environment. Perhaps Leigh can say why the proposed deprecation would
> inhibit use of FinderFactoryModule in that setting -- I don't see a
> problem.
>
> The other Guice integration work I've done, DWR-Guice, uses a custom
> servlet -- a subclass of DwrServlet -- in conjunction with a user-
> supplied servlet context listener. The user has the choice of
> subclassing one of two abstract servlet context listener
> implementations: (1) the listener is the "root" module with other
> modules installed by its configure method, or (2) the listener
> implements the createInjector() method to return the already-created
> injector. In both cases, the injector is published via a servlet
> context attribute that is independent of the one being deprecated in
> the Guice API.
>
> I like to think I've minimized the diabolism. In particular, I go out
> of my way not to interfere with Guice "standard" bindings for
> requests, responses, and sessions and still allow the "natural"
> bindings for DWR (that have been around since before Guice existed).
> This integration has to work with Guice 1.0, so the implementation is
> a bit tricky in order to shield the user from the gnarliness. Guice
> 2.0 probably would have made things easier, but alas, it will have
> come much too late.
>
> --tim
>
> On Mar 8, 8:23 pm, "Dhanji R. Prasanna" <dha...@gmail.com> wrote:
>
> > On Sun, Mar 8, 2009 at 6:50 AM, Tim Peierls <tpeie...@gmail.com> wrote:
>
> > > On Mar 5, 8:14 pm, "Dhanji R. Prasanna" <dha...@gmail.com> wrote:
> > > > > - It makes it difficult for me to get the Injector for use by Tim
> > > Peierls' Restlet integration
>
> > > > Hmm, I'll ask Tim if I can update his restlet thing for GS2. He will be
> > > > loads happier to use ctor injection I am sure!
>
> > > > (Tim are you still on this list?)
>
> > > Yes, I am, but I don't see what this has to do with the Restlet-Guice
> > > integration, which just provides a special module,
> > > FinderFactoryModule, that can be used like any module.
>
> > Well, then there should be no problem at all. Are you looking up the
> > injector from ServletContext(INJECTOR_NAME)? coz we're going to deprecate
> > this...
>
> > That's the only difference I can think of if you're not using the extremely
> > evil and diabolical InjectedHttpServlet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-guice@googlegroups.com
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to