I'd like to say at the outset that I'm whole at the moment with the
evil InjectedHTTPServlet and can move forward correcting the other
pre-2.0 changes (removing dependence on multiple @AssistedInject,
etc.) so this is not an urgent issue for me, and I know you're all
busy.

Tim would no doubt be more qualified than me to re-implement or re-
design his Guice/Restlet integration.   That caveat notwithstanding,
one problem I encountered was that the Restlet integration implements
a restlet Finder which is responsible for obtaining injected restlet
Handler objects by Key.  Unlike the Servlet @Singleton, Restlet
Handler objects are per-request, so it's done as a factory.  Perhaps
it could be re-implemented using Mapbinder, but in the current
implementation, the RestletFinderFactory uses injector.getInstance
(key), and so there needs to be a mechanism for the
RestletFinderFactory to get the correct injector for the current
Restlet application.  In the code Tim did, that's through the
Servlet's init method, where it can call getServletContext() and pluck
the InjectedHTTPServlet's Injector out and pass it into the Restlet
Application context.  (Whew).  In the new world, it wasn't clear to me
how to get the correct Injector to put into the each Restlet
application's context.  (I also wasn't able to figure out how to get
the appropriate Context for a Servlet when it's not in a request,
since there's no init method, but that's a side issue if the Injector
isn't in the context anyway.)

So, that pretty much put an end to my working with the new
ServletModule feature.  A three-way among Guice, Restlet, and Servlet
is an ungainly beast anyway, and developing a cleaner one is off track
for the actual value I need to deliver. I'd be happy to use something
new, but like I said, I'm no worse off than I was before, and I don't
intend to write any more servlets than necessary (currently one per
Restlet Application, of which I have two), as they're not the
methodology I want to use.

Leigh


On Mar 5, 5:14 pm, "Dhanji R. Prasanna" <[email protected]> wrote:
> On Fri, Mar 6, 2009 at 10:40 AM, Leigh Klotz <[email protected]> wrote:
>
> > I've gone back to using a copy of InjectedHttpServlet from the
> > previous snapshot, and am whole again with onyl a small amount of
> > code.
>
> > I think the new servlet stuff is cool for people who are using
> > servlets as a programming methodology.
>
> Nope it's for everyone. Jesse made sure I did not exclude anyone =)
>
>
>
> > However, for people like me who aren't writing new servlets, merely
> > using a servlet as an adapter between an existing system and something
> > better (Restlet, in my case), it's too much engineering for too little
> > benefit:
>
> > - It makes it difficult for me to get the Injector for use by Tim
> > Peirels' 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?)
>
>
>
> > - There's no clear place to put the warm-up code that currently goes
> > into myservlet.init, other than a series of eager singletons with
> > sculpted dependencies.
> > - Legacy app developers who look for my entry-point servlets in
> > web.xml will be puzzled when they can't find anything.
>
> > Personally, my preference would be to see the Guice servlet
> > functionality split into two parts
> > - one for bare support for injection of servlets (InjectedHTTPServlet,
> > GuiceServletContextListener)
>
> We already have this--InjectedHttpServlet is evil, GS2 has this support
> natively coz servlets are in the club.
>
>
>
> > - a second with the cool new dispatch, Request/Response/Session
> > injection, and scopes.
>
> it's totally symmetrical to web.xml so I don't get how you can have a
> servlet without registering it for dispatch (in either GS1 or 2). =(
>
> Dhanji
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to