title: Problems with Omnifaces GzipResponseFilter and page redirect (Glassfish only)
body: <p>I get an error when I try to redirect a page in JSF action with a h:commandLink when I use the Omnifaces GzipResponseFilter (only in Glassfish).</p>
  
  <p>Exception: java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END</p>
  
  <p>Environment
  Glassfish 3
  Omnifaces 1.7 (GzipResponseFilter)
  Mojarra 2.1.27
  JDK 6</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;gzipResponseFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.omnifaces.filter.GzipResponseFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;gzipResponseFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;dispatcher&gt;ERROR&lt;/dispatcher&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>MyBean.doAction()</p>
  
  <pre><code>Faces.redirect("anotherPage.jsf");
  </code></pre>
  
  <p>page.xhtml</p>
  
  <pre><code>&lt;h:commandLink action="#{myBean.doAction()}"&gt;Click&lt;/h:commandLink&gt;
  </code></pre>
  
  <p>The problem happens only in Glassfish, I tested in Tomcat and it works.<br>
  If I remove the GzipResponseFilter declaration, the redirect works normally on both servers.</p>
  
  <p>Do you know if it's a bug on Omnifaces or in my code?
  Thanks in advance.</p>
  
  <p>Stack trace</p>
  
  <pre><code>java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END
      at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:951)
      at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:537)
      at sun.nio.cs.StreamEncoder.flushLeftoverChar(StreamEncoder.java:223)
      at sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:282)
      at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:130)
      at java.io.OutputStreamWriter.close(OutputStreamWriter.java:216)
      at org.omnifaces.io.ResettableBufferedWriter.close(ResettableBufferedWriter.java:98)
      at java.io.PrintWriter.close(PrintWriter.java:295)
      at org.omnifaces.servlet.HttpServletResponseOutputWrapper.close(HttpServletResponseOutputWrapper.java:149)
      at org.omnifaces.servlet.GzipHttpServletResponse.close(GzipHttpServletResponse.java:133)
      at org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:150)
      at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
  </code></pre>