title: Flash scope warning and Flash not delete after redirect
body: <p>I'm trying to pass an object while redirecting between View1 to View2, using JSF and Primefaces.</p>
  <p>I'm using JSF Flash scope to do so,The object do pass to the second view but I'm still getting this warnning:</p>
  <blockquote>
  <p>com.sun.faces.context.flash.ELFlash setCookie</p>
  <p>WARNING: JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash.  Any values stored to the flash will not be available on the next request.</p>
  </blockquote>
  <p>and the flash cookie is <strong>not deleted</strong> even after few more redirects.</p>
  <p><strong>View1.xhtml</strong></p>
  <pre><code>&lt;ui:composition xmlns=...... template=&quot;../../../BaseTemplate.xhtml&quot;&gt;
      &lt;ui:define name=&quot;templateContent&quot;&gt;
          &lt;mm:MyComponent /&gt;
      &lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  <p><strong>MyComponent.xhtml</strong></p>
  <pre><code>&lt;html xmlns= ......&gt;
  
  &lt;composite:interface componentType=&quot;usersListComponent&quot;&gt;
  &lt;/composite:interface&gt;
  
  &lt;composite:implementation&gt;
  
  &lt;h:form&gt;
      &lt;p:commandButton action=&quot;#{cc.passObject}&quot; value=&quot;passMyObject&quot; /&gt;  
  &lt;/h:form&gt;
  
  &lt;/composite:implementation&gt;
  &lt;/html&gt;
  </code></pre>
  <p><strong>MyComponent.java</strong></p>
  <pre><code>@FacesComponent(&quot;myComponent&quot;)
  public class MyComponent extends UIComponentBase {
          
      private MyObject objectToPass;  
      public String passObject() {
          ExternalContext externalContext= FacesContext.getCurrentInstance().getExternalContext();
          externalContext.getFlash().put(&quot;objectToPass&quot;, objectToPass);
          return &quot;View2&quot;;
      }
  }
  </code></pre>
  <p><strong>View2Controller.java</strong></p>
  <pre><code>@ManagedBean
  @ViewScoped
  public class View2Controller implements Serializable {
      @PostConstruct
      public void init() {
          MyObject ob = (MyObject) FacesContext.getCurrentInstance().getExternalContext().getFlash().get(&quot;objectToPass&quot;);
          ......Do Something with MyObject
      }
  }
  </code></pre>
  <p><strong>SOLVED!!!!!!</strong></p>
  <p>I'm not sure <a href="https://stackoverflow.com/a/21783485">this</a> is the best way but it worked for me..</p>
  <p>The problem is in the http buffer size and jsf lifecycle, the cookies are written after the response is written and the buffer is to small to contain them both.</p>