1 Reply Latest reply on Oct 10, 2011 9:25 AM by Jérémy Bogatirsky

    Redirection problem after login with Seam 3 Faces and PrettyFaces' URLMapping

    Jérémy Bogatirsky Newbie

      Hi all,


      I'm using Seam 3 with Seam Faces and PrettyFaces 3.3.0.


      I use PrettyFaces' URLMapping to RESTify the access to pages while Seam Faces helps me to protect the acces to those pages.


      My problem is that after login succeed, the redirection is not made to the REST url of my bean but to the 'viewId' defined in the URLMapping of the bean.


      My RESTify bean :


      import com.ocpsoft.pretty.faces.annotation.URLMapping;
      
      @URLMapping(id="myurlmapping", pattern="/vertical/\#{/[a-z\\.]+/ verticalBean.alias}", 
                   viewId="/private/vertical.jsf")
      public class VerticalBean {
      ...
          private String alias;
      ...
      }



      My Faces configuration to protect private pages :


      import org.jboss.seam.faces.rewrite.FacesRedirect;
      import org.jboss.seam.faces.security.LoginView;
      import org.jboss.seam.faces.view.config.ViewConfig;
      import org.jboss.seam.faces.view.config.ViewPattern;
      
      @ViewConfig
      public interface ViewConfiguration {
          static enum MyPages {
              @FacesRedirect
              @ViewPattern("/private/*")
              @Private
              @LoginView("/login.xhtml")
              PRIVATE,
      
              @ViewPattern("/login.xhtml")
              LOGIN;
          }
      }



      And my @Private :


      import org.jboss.seam.security.annotations.SecurityBindingType;
      
      @SecurityBindingType
      @Retention(RetentionPolicy.RUNTIME)
      @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
      public @interface Private { }




      You can see that all my pages in '/private/*' are protected with the @Private annotation.
      If I use '/vertical/jeremy' to access my bean, I'm redirected to the login page if I'm not logged in, that's great.


      But when the login succeed, I'm redirected to '/private/vertical.jsf?com.ocpsoft.vP_0=jeremy' instead of the original url '/vertical/jeremy'.


      It's like Seam Faces lost the original url (as it has been filtered by PrettyFaces).
      What can I do to be redirected to my REST-url ?


      Thanks in advance for your help.


      Jeremy