If you have the choice to run in a servlet container you can go with installing a GuiceFilter the regular way
http://code.google.com/p/google-guice/wiki/ServletModule Then you serve the urls that you want with guice-jersey's com.sun.jersey.guice.spi.container.servlet.GuiceContainer servlet. It will know mount with jersey all valid resources that have binding in the injector. (And they are created by guice) As far as I know guice does not know about Jersey injection annotations. It has never been a problem to me since you can get ServletRequest and Response from ServletModule itself. For the Grizzly way, I got no knowledge. There's a GuiceComponentFactory in jersey-guice so maybe you can feed jersey with that directly. 2010/3/4 nino martinez wael <[email protected]> > Hi Guys > > First of all thank you for creating guice, it's much more light weight than > spring (or at least as spring was before version 2.5). > > I need to use this http://docs.sun.com/app/docs/doc/820-7627/giqdq java's > restfull framework, the grizzly version together with guice. But can't > really see howto integrate? Anyone would know how? > > Bob wrote something on it here : > http://crazybob.org/2009/05/announcing-javaxinjectinject.html I guess just > announcing stuff. But how do I actually integrate? > > The Grizzly archetype produces some different thins, but most interesting > this start up main.java: > > protected static SelectorThread startServer() throws IOException { > final Map<String, String> initParams = new HashMap<String, > String>(); > > initParams.put("com.sun.jersey.config.property.packages", > "com.netdesign.rest"); > > System.out.println("Starting grizzly..."); > SelectorThread threadSelector = > GrizzlyWebContainerFactory.create(BASE_URI, initParams); > return threadSelector; > } > > public static void main(String[] args) throws IOException { > SelectorThread threadSelector = startServer(); > System.out.println(String.format("Jersey app started with WADL > available at " > + "%sapplication.wadl\nHit enter to stop it...", > BASE_URI)); > System.in.read(); > threadSelector.stopEndpoint(); > } > } > > Or should I choose the archetype that builds a war file and add guice as a > filter the ordinary way? > > Regards Nino > > -- > 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]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > -- 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.
