3 Replies Latest reply on Oct 2, 2009 12:22 PM by mcohnen

    ViewExpiredExpection and login redirection Issue

      Hi!


      I have searched the forums for topics realted to ViewExpiredException, but none of them could help me. This is my scenario.


      I'm using Seam 2.2.0GA and JBoss 5.1GA


      I have a view /confirm.xhtml that has a restriction for logged users. So in my confirm.page.xml I have the following line:


      <restrict>#{identity.loggedIn}</restrict>



      If I access the /confirm.xhtml directly, there is no problem. I am redirected to the login page, enter my credentials, and then I'm redirect back to /confirm.xhtml.


      But I have another page, where I do some work /flexc.xhtml . There I have a link like this


      <h:commandLink value="Add" action="#{reservation.createReservation(_r)}"/>



      This link launches createReservation which returns confirm as String result.


      In flexc.page.xml I have the following redirect:




      <navigation>
         <rule if-outcome="confirm">
            <redirect view-id="/confirm.xhtml"/>
          </rule> 
       </navigation>



      So when clicking that link, I'm redirected to the login page, like before, but after entering my credentials I receive a ViewExpiredException saying that it can not restore /confirm.xhtml. In debug mode I have checked that the conversation is succesfully propagated ALL the time, even in the error page I have configured for ViewExpiredExceptions. Of course I'm not waiting a lot of time to enter my credentials, and my timeouts have default values. If after failing I try to enter /confirm.xhtml with the proper conversationId, all my data are there, and what is worst, I'm logged In! How can I be logged In and get a ViewExpiredException?


      Any idea of why this is happening? I'm starting to get crazy with this stuff!


      Thank you a lot! If you need more information or something is not clear, please let me know.






        • 1. Re: ViewExpiredExpection and login redirection Issue
          oneworld95

          This seems to be a common problem. Even the RichFaces LiveDemo on Exadel throws this error when a session timeout occurs.

          • 2. Re: ViewExpiredExpection and login redirection Issue

            The thing is that session has not timed out! Session is set to last over 1 hour, and I only receive this message when I follow the steps I described before. If not, I can use the application without receiving that exception...


            Quite strange! Any advice? This thing is driving me nuts! :D


            Thank you!

            • 3. Re: ViewExpiredExpection and login redirection Issue

              I have been investigating and narrowing the issue. This is what I have so far:


              I have a page, flexc.xhtml. In that page I have 2 h:commandLink links as following:


              <h:commandLink value="#{messages['Search']}" action="#{flexC.nothing()}"/>
              
              <h:commandLink action="#{flexC.redirect}" value="Redirect" />



              FlexC is a Conversation scoped bean. The relevant methods are:




              public void nothing(){     
              }
              
              public String redirect(){
                  return "confirm";
              }



              flexc.page.xml looks like this:



              <navigation>
                   <rule if-outcome="confirm">
                        <redirect view-id="/confirm.xhtml" include-page-params="true"/>
                      </rule>
              </navigation>



              confirm.xhtml has a restriction that only logged users can access it. If you are not logged, it redirects you to the login page. Once you log in, it brings you back to confirm.xhtml. This is what is happening:




              • If I enter flexc.seam and click on redirect, I'm redirected to the login page, log in, and then redirected successfully to confirm.xhtml




              • If I enter flexc.seam and click on Search Button, the one that calls the empty function in my conversation bean, I'm redirected to the login page, log in, and then the ViewExpiredException is thrown.




              • If I change the h:commandButton to s:button, and click it etc... it works! but I don't wanna use s:button, as I want to submit the form!



              How can I get rid of this? Pleeeeease ;)


              Thanks!