1 Reply Latest reply on Jun 17, 2011 3:32 PM by Brian Leathem

    pages.xml in Seam 3 and login-required

    Thomas Hamacher Novice

      Hi,


      when using Seam 2 there was a very nice mechanism within pages.xml that redirected a user directly to the login page in case he hasn´t been logged in yet.


      I could simply insert the following snippet into the pages.xml and everything worked fine:


      <page view-id="/protected/*" login-required="true"/>


      Is there anything like this in Seam 3?


      Is the pages.xml still recognized by Seam 3?


      Any answer is greatly appriciated.


      Thomas

        • 1. Re: pages.xml in Seam 3 and login-required
          Brian Leathem Master

          You'll want to use the @ViewConfig view configuration from Seam Faces.  It looks like:




          @ViewConfig
          public interface MyAppViewConfig {
          
              static enum Pages {
          
                  @ViewPattern("/admin.xhtml")
                  @Admin
                  ADMIN,
                  
                  @ViewPattern("/item.xhtml")
                  @UrlMapping(pattern="/item/#{id}/")
                  @Owner
                  ITEM,
                  
                  @ViewPattern("/*")
                  @FacesRedirect
                  @AccessDeniedView("/denied.xhtml")
                  @LoginView("/login.xhtml")
                  ALL;
                  
              }
          }



          See the Seam Faces reference documentation for more details, and a proper explanation.

          http://docs.jboss.org/seam/3/faces/latest/reference/en-US/html