5 Replies Latest reply on Feb 10, 2012 3:53 PM by ole .

    Seam 3 @ViewConfig not working

    ole . Newbie



      I'm trying to configure some access restrictions by using the @ViewConfig annotation. Here is my interface:



      public interface AppViewConfig {
          static enum Pages {



      I also have defined some dummy security rules:




      public class SecurityRules {
          public @Secures @User boolean ownerChecker(Identity identity) {
              if (identity.getUser() == null) {
                  return false;
              } else {
                  return true;
          public @Secures @Admin boolean adminChecker(Identity identity) {
              if (identity.getUser() == null) {
                  return false;
              } else {
                  return "admin".equals(identity.getUser().getId());




      I expect that if I call a page /admin/test.xhtml and if I'm not logged in that I will be redirected to the login.xhtml, but this is not happening. I can access all pages every time


      Any idea what Im doing wrong?

        • 1. Re: Seam 3 @ViewConfig not working
          bram meijboom Newbie


          i think it is the way how the pretty filter works, you call the xhtml directly and the pretty filter is not called then.

          if you map the /admin/test.xhtml to a url /admin/test it prolly will work if you call /admin/test but not if you call /admin/test.jsf (not tested it myself).

          • 2. Re: Seam 3 @ViewConfig not working
            ole . Newbie



            is there any other solution or workaround available? I think in seam 2 this could be done by using the pages.xml.

            • 3. Re: Seam 3 @ViewConfig not working
              Jason Porter Master

              There's also been some people talking about bugs in this, a work around may be to make sure your restrictions are taking place in the RESTORE_VIEW phase. I don't know if this will fix your particular issue or not, but it certainly couldn't hurt.

              • 4. Re: Seam 3 @ViewConfig not working
                ole . Newbie

                I think I have already defined the security binding to take place in the restore_view phase:




                @Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})

                public @interface Admin {



                • 5. Re: Seam 3 @ViewConfig not working
                  ole . Newbie

                  Hi all,


                  I figured out what the problem is. I just have forgot to include the seam-faces in my pom file:










                  As soon as I include the faces lib the redirecting to the login page is working but now i get an observer exception by every self executed redirect . Does anyone has an idea what I have forgot? The online workaround is to remove the seam-faces dependency from the pom file.