8 Replies Latest reply on Sep 3, 2009 5:33 PM by sergio amaya

    Logout: illegal navigation when in a pageflow

    Nicola Ben Novice

      Hi,
      When I am inside a pageflow I cannot logout and I get an illegal navigation message.
      I am using 2.1.0.A1


      Any suggestions?
      Thank you
      Nic

        • 1. Re: Logout: illegal navigation when in a pageflow
          Olivier Thierry Apprentice

          If there is no transition to logout in your pageflow, that's something expected.
          I had the same kind of problem with a logout link in my templates. I solved it by adding end-conversation to the navigation rule for logout action in my faces.xml file :


          <page view-id="*">
             <navigation from-action="#{identity.logout}">
                <end-conversation />
                <redirect view-id="/home.xhtml"></redirect>
             </navigation>
          </page>



          Hope it will help.

          • 2. Re: Logout: illegal navigation when in a pageflow
            Nicola Ben Novice

            Hi,
            I tried what you suggested me, adding to pages.xml (not faces.xml) a second navigation rule:



            <page view-id="*" scheme="http">
                      <navigation>
                           <rule if-outcome="home">
                                <redirect view-id="/home.xhtml" />
                           </rule>
                      </navigation>
                      <navigation from-action="#{identity.logout}">
                            <end-conversation />
                            <redirect view-id="/home.xhtml"/>
                         </navigation>
            </page>




            But I still receive Illegal navigation when trying to logout from inside a pageflow.
            I am using 2.1.0.A1


            Bye
            N

            • 3. Re: Logout: illegal navigation when in a pageflow
              Olivier Thierry Apprentice

              Yes, sorry for the mistake, it was in pages.xml of course, not in faces.xml.


              How do you start your pageflow ? In my case, I start it with @Begin annotation in a Seam component. Something like that :


              @org.jboss.seam.annotations.Create
              @org.jboss.seam.annotations.Begin(pageflow = "simplifiedAbsenceRequest", join = true)
              public String prepare() throws Exception {
                  // some code here
                  return "default";
              }



              default being the transition from start node of the pageflow :


              <pageflow-definition name="simplifiedAbsenceRequest">
                  <start-state name="start">
                      <transition name="default" to="confirmApplicant" />
                  </start-state>
                  <page name="confirmApplicant" view-id="/absence/simplifiedAbsenceRequest/confirmApplicant.xhtml">
                      <redirect/>
                      <transition name="next" to="selectReason"></transition>
                      <transition name="otherApplicant" to="selectApplicant"></transition>
                  </page>
                  ...



              Then I call the Seam component this way :


              <s:link value="Effectuer une demande" action="#{simplifiedAbsenceRequestAction.prepare}" />


              • 4. Re: Logout: illegal navigation when in a pageflow
                Nicola Ben Novice

                Hi,
                I start pageflow with a page descriptor:


                <begin-conversation join="true" pageflow="Analysis_flow"/>



                Everything goes well, but the logout.


                N

                • 5. Re: Logout: illegal navigation when in a pageflow
                  Nicola Ben Novice

                  Thank to Dan Allen that suggested me this:



                  When using a pageflow, every action has to be sanctioned by the pageflow. Otherwise, it is considered an illegal navigation. To allow ad-hoc navigation away from the pageflow, you have to prevent the conversation from being propagated (effectively abandoning the conversation and pageflow). To do that, your logout link would look like this:


                  <s:link view="/home.xhtml" action="#{identity.logout}" value="Logout"
                  propagation="none" />




                  In fact, any global link like the logout link should not propagate the conversation since that is not part of the use case.
                  • 6. Re: Logout: illegal navigation when in a pageflow
                    Olivier Thierry Apprentice

                    It's strange, I did not need this to make it work. I thought the end-conversation I added in pages.xml had the same effect as propagation="none" attribute in <s:link>. But you tried it and it didn't work.

                    • 7. Re: Logout: illegal navigation when in a pageflow
                      Andrew Elegante Newbie

                      I have a custom identity object and to accomplish this I the logout method in this manner:


                              @Override
                           public void logout() {
                                Pageflow pageflow = Pageflow.instance();
                                if(pageflow.isInProcess() && pageflow.isStarted()) {
                                     pageflow.getProcessInstance().end();
                                }
                                super.logout();
                           }
                      



                      This is working fine for me though I'm not sure what some of the background ramifications might be.


                      Drew

                      • 8. Re: Logout: illegal navigation when in a pageflow
                        sergio amaya Newbie

                        Nicola Benaglia wrote on Sep 23, 2008 09:50:


                        Thank to Dan Allen that suggested me this:

                        When using a pageflow, every action has to be sanctioned by the pageflow. Otherwise, it is considered an illegal navigation. To allow ad-hoc navigation away from the pageflow, you have to prevent the conversation from being propagated (effectively abandoning the conversation and pageflow). To do that, your logout link would look like this:


                        <s:link view="/home.xhtml" action="#{identity.logout}" value="Logout"
                        propagation="none" />



                        In fact, any global link like the logout link should not propagate the conversation since that is not part of the use case.

                        this works fine for me thanks!!!