users@jersey.java.net

Re: [Jersey] Problems with jersey-test-framework and Guice

From: Naresh <Srinivas.Bhimisetty_at_Sun.COM>
Date: Tue, 25 Aug 2009 17:26:34 +0530

Hi,

   is your application a web application? If so, can you try with
EmbeddedGlassFish. I hope it should work, if your web.xml defines the
filters.

bea wrote:
> Hi everyone,
>
> I've been trying to use a IoC container with jersey-test-framework in
> order to access a PersistenceManager / Factory within my tests. I've
> found that, in order to use Google Guice, I need to create the web
> container and add to it a filter, used for the IoC container
> bootstrapping. I've been stuck with the problem for a couple of days,
> using Grizzly as the lightweight container, but found that the test
> framework may be missing something necessary to bootstrap Guice.
>
> I've spotted a couple of changes that may help:
>
> Adding the possibility to the GrizzlyWebContainer class of the
> test-framework
> (com.sun.jersey.test.framework.impl.container.grizzly.web) to add a
> filter (so we could add the GuiceFilter to the filter chain).
The latest version (1.1.2-ea-SNAPSHOT) has this option of adding a
filter, but I realized that this filter class isn't being utilized. I
shall try adding this support in the trunk, and let you know once done,
then may be you could check if it works.

Thanks,
Naresh

>
> Adding to the ApplicationDescriptor utility class a list of filters to
> be added.
>
> Do you think that this may help or is there any other kind of IoC
> support that I've missed?
>
> Thanks