Open GoogleCodeExporter opened 9 years ago
Small caveat: In warp-servlet all the module configuration went directly into
ServletContextInjector so you could access the protected field directly. In
guice-servlet we implement ServletModule which is not directly bound
GuiceServletContextListener.
This means that the ServletContextInjector.getInjector() implementation will
need to
grab INJECTOR_NAME from the superclass and pass it to the ServletModule
constructor.
This is the cleanest approach that comes to mind.
You could also expose the value using a getter method instead of accessing the
field
directly. Let me know if you have a better idea.
Original comment by gili.tza...@gmail.com
on 7 Feb 2009 at 4:51
Original comment by limpbizkit
on 7 Feb 2009 at 8:45
Why can't you simply inject the Jersey filter directly, and manage it thru
Guice Servlet?
Original comment by dha...@gmail.com
on 7 Feb 2009 at 11:33
Dhanji, I'm not sure what you mean. Can you give an example?
I'm trying to get Jersey to delegate injection of its internal classes to
Guice. In
order to do that I need to pass it a reference to the Injector.
Original comment by gili.tza...@gmail.com
on 8 Feb 2009 at 3:12
A reference to the Injector can be @Injected into any provider--make one for
the Jersey filter and pass the
injector along.
As long as the Jersey Filter is registered in a ServletModule, it can be
injected like any other Guice object.
Btw, we are going to remove the injector from the servlet context (and get rid
of INJECTOR_NAME altogether) so
the preferred way is the use ServletModule from now on.
Original comment by dha...@gmail.com
on 8 Feb 2009 at 7:50
Original issue reported on code.google.com by
gili.tza...@gmail.com
on 7 Feb 2009 at 4:36