title: CDI @Conversation not propagated with handleNavigation()
body: <p>I have a problem with the propagation of a long running conversation when I redirect the view by the <code>handleNavigation()</code> method. Here is my test code:</p>
  <p>I have a <code>conversationscoped</code> bean and two views:</p>
  <p><code>conversationStart.xhtml</code> is called in Browser with URL</p>
  <blockquote>
  <p><code>http://localhost/tests/conversationStart.jsf?paramTestId=ParameterInUrl</code></p>
  </blockquote>
  <pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
     &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
           xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
           xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&gt;
     
     &lt;f:metadata&gt;
         &lt;f:viewParam name=&quot;paramTestId&quot; value=&quot;#{conversationTest.fieldTestId}&quot; /&gt;
         &lt;f:event type=&quot;preRenderView&quot; listener=&quot;#{conversationTest.preRenderView}&quot; /&gt;
     &lt;/f:metadata&gt;
     &lt;h:head&gt;
       &lt;title&gt;Conversation Test&lt;/title&gt;
     &lt;/h:head&gt;
     &lt;h:body&gt;
       &lt;h:form&gt;
         &lt;h2&gt;Startpage Test Conversation with Redirect&lt;/h2&gt;
         &lt;h:messages /&gt;
         &lt;h:outputText value=&quot;Testparameter: #{conversationTest.fieldTestId}&quot;/&gt;&lt;br /&gt;
         &lt;h:outputText value=&quot;Logged In: #{conversationTest.loggedIn}&quot;/&gt;&lt;br /&gt;
         &lt;h:outputText value=&quot;Conversation ID: #{conversationTest.convID}&quot;/&gt;&lt;br /&gt;
         &lt;h:outputText value=&quot;Conversation Transient: #{conversationTest.convTransient}&quot;/&gt;&lt;br /&gt;
         &lt;h:commandButton action=&quot;#{conversationTest.startLogin}&quot; value=&quot;Login -&gt;&quot; rendered=&quot;#{conversationTest.loggedIn==false}&quot; /&gt;&lt;br /&gt;
         &lt;h:commandLink action=&quot;/tests/conversationLogin.xhtml?faces-redirect=true&quot; value=&quot;Login -&gt;&quot; rendered=&quot;#{conversationTest.loggedIn==false}&quot; /&gt;&lt;br /&gt;
       &lt;/h:form&gt;
       &lt;h:link outcome=&quot;/tests/conversationLogin.xhtml&quot; value=&quot;Login Link&quot; rendered=&quot;#{conversationTest.loggedIn==false}&quot;&gt;
        &lt;f:param name=&quot;cid&quot; value=&quot;#{conversationTest.convID}&quot;&gt;&lt;/f:param&gt;
       &lt;/h:link&gt;
     &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The Parameter is written to the <code>beanfield</code> and displayed in the view correctly. There are 3 different possibilities to navigate to the next View. All 3 work fine. The <code>beanfield</code> shows up the next view (<code>conversationLogin.xhtml</code>) too:</p>
  <pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
     &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
           xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
           xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&gt;
   
     &lt;h:head&gt;
       &lt;title&gt;Conversation Test&lt;/title&gt;
     &lt;/h:head&gt;
     &lt;h:body&gt;
       &lt;h:form&gt;
         &lt;h2&gt;Loginpage Test Conversation with Redirect&lt;/h2&gt;
         &lt;h:messages /&gt;
         &lt;h:outputText value=&quot;Testparameter: #{conversationTest.fieldTestId}&quot;/&gt;&lt;br /&gt;
         &lt;h:outputText value=&quot;Logged In: #{conversationTest.loggedIn}&quot;/&gt;&lt;br /&gt;
         &lt;h:outputText value=&quot;Conversation ID: #{conversationTest.convID}&quot;/&gt;&lt;br /&gt;
         &lt;h:outputText value=&quot;Conversation Transient: #{conversationTest.convTransient}&quot;/&gt;&lt;br /&gt;
         &lt;h:commandButton action=&quot;#{conversationTest.login}&quot; value=&quot;Login And Return&quot; /&gt;&lt;br /&gt;
       &lt;/h:form&gt;
     &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>When I return to the Startpage by clicking the button the conversation bean still contains all values. So everything is fine. Here is the bean:</p>
  <pre><code>package test;
  
  import java.io.Serializable;
  
  import javax.annotation.PostConstruct;
  import javax.enterprise.context.Conversation;
  import javax.enterprise.context.ConversationScoped;
  import javax.faces.event.ComponentSystemEvent;
  import javax.inject.Inject;
  import javax.inject.Named;
  
  @Named
  @ConversationScoped
  public class ConversationTest implements Serializable{
  
   private static final long serialVersionUID = 1L;
  
   final String CONVERSATION_NAME=&quot;longRun&quot;;
   
   @Inject Conversation conversation;
   
   private boolean loggedIn;
   private String fieldTestId;
  
   @PostConstruct
   public void init(){
    if(conversation.isTransient()){
     conversation.begin(CONVERSATION_NAME);
     System.out.println(&quot;New Conversation started&quot;);
    }
    loggedIn=false;
   }
   
   public String getConvID(){
    return conversation.getId();
   }
   public boolean isConvTransient(){
    return conversation.isTransient();
   }
   
   public boolean getLoggedIn(){
    return loggedIn;
   }
   
   public String startLogin(){
    return &quot;/tests/conversationLogin.xhtml?faces-redirect=true&quot;;
   }
   
   public String login(){
    loggedIn=true;
    return &quot;/tests/conversationStart.xhtml?faces-redirect=true&quot;;
   }
   
   public void preRenderView(ComponentSystemEvent ev) {
  //  if(!loggedIn){
  //   System.out.println(&quot;Will redirect to Login&quot;);
  //   FacesContext ctx = FacesContext.getCurrentInstance();
  //   ctx.getApplication().getNavigationHandler().handleNavigation(ctx, null, &quot;/tests/conversationLogin.xhtml?faces-redirect=true&quot;);
  //            ctx.renderResponse();
  //  }
   }
  
   public void setFieldTestId(String fieldTestId) {
    System.out.println(&quot;fieldTestID was set to: &quot;+fieldTestId);
    this.fieldTestId = fieldTestId;
   }
  
   public String getFieldTestId() {
    return fieldTestId;
   }
  
  }
  </code></pre>
  <p><strong>Now comes the problem</strong></p>
  <p>As soon as I try to redirect the page in the <strong><code>preRenderView</code></strong> method of the bean (just uncomment the code in the method), using <strong><code>handleNavigation()</code></strong> the bean is created again in the next view instead of using the already created instance. Although the <code>cid</code> parameter is propagated to the next view !</p>
  <p>Has anybody an idea what's wrong ?</p>
  <p>best regards
  Thomas</p>