Dhanji, I solved the problem. Didn't realize that having a servlet
mapping inside the web.xml could cause the problem. Removed it from
web.xml and let GuideServletConfig serve it for us. That worked like a
charm. So only the guicefilter and its listener configuration exists
in web.xml and nothing else.

Finally getting DI, works great!

On Jul 17, 12:04 am, "Dhanji R. Prasanna" <[email protected]> wrote:
> Can you post your web.xml? Are you sure it is getting picked up at all?
>
> Dhanji.
>
>
>
> On Sat, Jul 17, 2010 at 2:47 AM, Jas <[email protected]> wrote:
> > By the way, the filter configuration s really
> > filter("/*").through(RequestAuthenticationServletFilter.class);
>
> > thx.
>
> > On Jul 16, 4:20 pm, Jas <[email protected]> wrote:
> > > So I am trying to inject a few dependencies into a so-called
> > > AuthFilter and I control the invokation of this AuthFilter from within
> > > the configureServlets() override. Something like: (along with custom
> > > binding module)
>
> > > public class GuiceServletConfig extends GuiceServletContextListener {
> > >     @Override
> > >     protected Injector getInjector() {
> > >         return Guice.createInjector(new ServletModule() {
> > >             @Override
> > >             public void configureServlets() {
> > >                 filter("/*").through(AuthenticationFilter.class);
> > >             }
> > >         },
> > >                 new GuiceConfigModule()
> > >         );
> > >     }
>
> > > I do have the web.xml configured as instructed with the GuiceFilter
> > > mapping. I should also mention that the web.xml also contains a
> > > servlet mapping for Jersey with some init-params (not mentioned
> > > below):
>
> > > <servlet>
> > >         <servlet-name>Jersey Web Application</servlet-name>
> > >         <servlet-
> > > class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-
> > > class>
> > > </servlet>
>
> > > The entire application is deployed on Glassfish.
>
> > > The problem is: I don't see my AuthFilter getting invoked in the
> > > chain. Am i missing something in the chain?
>
> > > Here's the signature for the AuthFilter class:
>
> > > @Singleton
> > > public class RequestAuthenticationServletFilter implements Filter {
> > >     private AuthTokenValidator authTokenValidator;
> > >     private UrlAccountIdExtractor urlAccountIdExtractor;
>
> > >     @Inject
> > >     public RequestAuthenticationServletFilter(AuthTokenValidator
> > > authTokenValidator, UrlAccountIdExtractor urlAccountIdExtractor) {
> > >         this.authTokenValidator = authTokenValidator;
> > >         this.urlAccountIdExtractor = urlAccountIdExtractor;
> > >     }
>
> > >     ......
>
> > > }
>
> > > Any help would be most appreciated. I am new to Java for I apologize
> > > if I am missing something very glaring! THANKS.
>
> > --
> > 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%2bunsubscr...@google 
> > groups.com>
> > .
> > 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.

Reply via email to