2 Replies Latest reply on Mar 29, 2008 3:54 PM by pmuir

    ConversationId in PageContext - FacesPage not cleared before redirect

    ccurban

      Hi,


      I am using Seam 1.2.1, Myfaces 1.1.4 (facelets) and Richfaces 3.1.4 and am actually encountering a problem with using end-before-redirect and conversation propagation.


      Here is what I do:


      1. Show an object list backed by a SFSB and begin a long running conversation while creating the SFSB.


      @Scope(ScopeType.CONVERSATION)
      @Stateful
      @Name("adjustInputAction")
      public class AdjustInputAction implements AdjustInputLocal {
        // List with all available customers
        @DataModel
        private List<Distribution> validateDistributionList;
        .
        .
        @Begin
        @Create
        public void init() {
          refreshList();
        .
        .
      



      2. Select an object of the list and redirect to a second page backed by a Java Bean which joins the conversation


      @Name("acquisitionAction")
      @Scope(ScopeType.CONVERSATION)
      public class AcquisitionAction {
        // the selected distribution to show 
        @In(required = false, scope = ScopeType.CONVERSATION)
        private Distribution selectedDistribution;
        .
        .
        @Begin(join = true)
        @Create
        public void init() {
        .
        .
        @End(beforeRedirect = true)
        public String createOrder() {
        .
        .
      



      3. Create an order and redirect back to the list page while ending the conversation before redirect. Therefore the list SFSB would be created in a new conversation and reload the list with the changes of step 3.



      And here is my problem:


      During step 3 I get an exception stating The conversation ended, timed out or was processing another request.


      And this is happening:


      After the invocation of createOrder the conversation is correctly destroyed and the redirect to my list page is executed (no Render-Response phase during this request).
      In the second request SEAM tries to restore the conversation in Manager.restoreConversation. Unfortunately Seam still finds the destroyed conversation due to the following lines


      if ( isMissing(storedConversationId) )
      {
        if ( Contexts.isPageContextActive() )
        {
          //if it is not passed as a request parameter,
          //try to get it from the page context
          org.jboss.seam.core.FacesPage page =
              org.jboss.seam.core.FacesPage.instance();
          storedConversationId = page.getConversationId();
          storedParentConversationId = null;
          isLongRunningConversation =
              page.isConversationLongRunning();
          //if (isLongRunningConversation==null)
          isLongRunningConversation = false;
        }
      }
      



      Is this the intended behaviour? And if intended how  can I really destroy the conversation before a redirect?


      Thanks in advance


      Christian