title: make sure a JSF web page is not cached according to YSlow
body: <p>In my Spring JSF facelets web application in Jboss6 server I need to make sure certain web pages do not get cached by the web browser for security reasons. And it should work as cross browser as well. I found out when I ran the test in YSlow plugin in firefox the below recommendations.</p>
  
  <p><img src="https://i.stack.imgur.com/T7THd.jpg" alt="enter image description here"></p>
  
  <p>In my web application I have a Phaselistener set to disable cache as well. But I still couldn't figure why these results are given by YSlow and I want to know how to resolve this issue by setting the far future expiration date to those static components and improve the performance of this page as well.</p>
  
  <p><strong>cache control phaselistener</strong></p>
  
  <pre><code>public class CacheControlPhaseListener implements PhaseListener {
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
      public PhaseId getPhaseId() {
          return PhaseId.RENDER_RESPONSE;
      }
  
      public void afterPhase(PhaseEvent event) {
      }
  
      public void beforePhase(PhaseEvent event) {
          FacesContext facesContext = event.getFacesContext();
          HttpServletResponse response = (HttpServletResponse) facesContext
                  .getExternalContext().getResponse();
          response.addHeader("Pragma", "no-cache");
          response.addHeader("Cache-Control", "no-cache");
          response.addHeader("Cache-Control", "no-store");
          response.addHeader("Cache-Control", "must-revalidate");
          response.addHeader("Expires", "Mon, 8 Aug 2006 10:00:00 GMT");
      }
  }
  </code></pre>
  
  <p><strong>In faceconfig</strong></p>
  
  <pre><code>&lt;lifecycle&gt;
      &lt;phase-listener id="nocache"&gt;com.company.jsf.listener.CacheControlPhaseListener&lt;/phase-listener&gt;
  &lt;/lifecycle&gt;
  </code></pre>
  
  <p><strong>the http header</strong></p>
  
  <p><img src="https://i.stack.imgur.com/u9AJL.jpg" alt="enter image description here"></p>
  
  <p>After adding future dates YSlow still display the following,</p>
  
  <p><img src="https://i.stack.imgur.com/lKVyG.jpg" alt="enter image description here"></p>