Perhaps I should explain what I am trying to do a little better.
I extendi com.sun.jersey.spi.container.servlet.ServletContainer:
public class MyServletContainer extends ServletContainer {
@Override
protected void configure(ServletConfig servletConfig, ResourceConfig rc,
WebApplication wa) {
super.configure(servletConfig, rc, wa);
...
}
}
The guts of that method set up an InjectableProvider that is able to
inject my own resources of various sorts. It works, but it is tedious
to add new things that I want to inject...it's basically a large if
... else ... else block that identifies what is to be injected and
returns an Injectable<Object> for each.
What I'd like to do is replace this with a more generic injection
framework. Guice looks lpretty good. What I don't understand is how
to wire it into jersey's ServletContainer. I did my best to follow
Christian Rivasseau's jersey-guice article, but the link to his source
code is dead, and I wasn't clear where to find the ResourceProvider
interface or how to hook it in so that Jersey uses it.
The sense I get is that I have to write my own resourceConfigClass and
splice it in as an init-param to the ServletContainer. Is this close?
--Chris
On Wed, Jul 1, 2009 at 10:58 PM, Christopher Piggott<cpiggott_at_gmail.com> wrote:
> Hi,
>
> I'm trying to find all the jars I need to add guice to my jersey based
> application. Right now I'm having trouble finding, among other
> things:
>
> com.sun.ws.rest.api.container.ContainerException;
> com.sun.ws.rest.spi.resource.ResourceProvider;
> com.sun.ws.rest.spi.resource.ResourceProviderContext;
>
> Something tells me this shouldn't be quite so dfficult.
>
> 1) Are there any more up-to-date examples?
> 2) Most of the jersey "downloads" page has maven and non-maven links,
> but not the guice side. Would somebody be willing to fix up that
> document to include links to the jars for non-maven users?
>
> Thanks for any pointers.
>
> --Chris
>