Hi,

I have the an interceptor that doesn't get invoked and I'm unable to figure
out why. I was wondering if you had any insight. I have an annotation called
LoggedIn that triggers the Interceptor.

 I have setup the interceptor as follows:

public class WebModule extends ServletModule {

    @Override
    protected void configureServlets() {

        LoggedInInterceptor loggedInInterceptor = new LoggedInInterceptor();
        bindInterceptor(Matchers.any(),
Matchers.annotatedWith(LoggedIn.class), loggedInInterceptor);
        requestInjection(loggedInInterceptor);
....

 }
}


public class MyGuiceServletConfig extends GuiceServletContextListener {

    @Override
    protected Injector getInjector() {

        Injector injector = Guice.createInjector(Stage.PRODUCTION, new
WebModule(), new LoggingModule());
        GrabBag.put(GrabBag.GUICE_INJECTOR, injector);
        return injector;

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        super.contextDestroyed(servletContextEvent);
    }
}



@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LoggedIn {

}


public class LoggedInInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("LoggedInInterceptor.invoke called");
       ....
    }
}



MyServlet extends HttpServlet  {

    @LoggedIn
    private void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
        System.out.println("doPost called");
.....
    }
}

-- 
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