3 Replies Latest reply on Mar 22, 2006 10:54 AM by andrew.rw.robinson

    When are interceptors applied?

    andrew.rw.robinson

      Are interceptors (like the conversational interceptor) only applied in the invoke application phase?

      I am using my on load code from jsf-comp to redirect to a new page on load. The code uses the MethodBinding class to get the bean's "action" method. I invoke it then use the result to pass to the navigation handler if not a specific return type. The method I am calling is on a conversational bean. The problem is that it seams the interceptor is never fired, or at least is not working.

      JBoss-seam CVS
      Tomcat 5.5 w/ EJB embedded container

      Code:

      @Name("registerUser")
      @Interceptors(SeamInterceptor.class)
      @Stateful
      @Conversational(ifNotBegunOutcome="choose.registration.type")
      @Intercept(InterceptionType.ALWAYS)
      public class RegisterNewUserAction
       implements RegisterNewUser, Serializable
      {
      ...
       public String validateInConversation()
       {
       if (user == null)
       return "welcome";
       else
       return null;
       }
      


      When I create a method binding on "#{registerUser.validateInConversation}" and execute it, I get "welcome" as the result instead of the expected "choose.registration.type".

      Is this a limitation of Seam, a bug in my setup and/or environment?

      FYI: I am invoking the method binding from inside of a phase listener that is registered after the seam phase listener. The phase listens to the before render response phase.

      Thanks,
      Andrew