> I'm using a tweaked version of contribs/jersey-guice, part of the
> jersey project. See
> https://jersey.dev.java.net/nonav/apidocs/1.1.5/contribs/jersey-guice/index.html
Here is the an example of code that I use to setup JAXRS/ Jersey with
Guice, but you have to read through the fluff a bit since we built a
mini framework around Guice.
Settings settings = new Settings();
settings.setSetting("com.sun.jersey.config.property.packages",
ErrorTrapTest.class.getPackage().getName());
Dependencies dependencies = new Dependencies(settings,
new ServletModule(), new
LocalServiceRegistryModule(),
testModule, new SchedulerModule(settings),
new ErrorTrapModule());
ServletAdapter adapter = new ServletAdapter();
JerseyGuiceContainer container = dependencies
.getInstance(JerseyGuiceContainer.class);
adapter.setServletInstance(container);
GuiceFilter filter = new GuiceFilter();
adapter.addFilter(filter, "guiceFilter", null);
SelectorThread threadSelector = GrizzlyServerFactory.create(
"http://localhost:9998/", adapter);
In the code above, Settings is a boosted properties loader and
Dependencies a wrapper around Injector (which is created in the
constructor) that amongst other things binds settings to Names
(Names.bindProperties(binder(), settings.getProperties());).
JerseyGuiceContainer is a slightly tweaked version of GuiceContainer
(https://jersey.dev.java.net/nonav/apidocs/1.1.5/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/GuiceContainer.html).
Hope that helps,
Eelco
--
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.