Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By

Thread: Disable cache for just specifc directory

  1. #1
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Rep Power

    Default Disable cache for just specifc directory


    I have class to disable the cache for all pages in my project

    Java Code:
    package control;
    import javax.faces.context.FacesContext;
    import javax.faces.event.PhaseEvent;
    import javax.faces.event.PhaseId;
    import javax.faces.event.PhaseListener;
    import javax.servlet.http.HttpServletResponse;
     *disable die Cache in Web browser
    public class CacheListener implements PhaseListener
        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
            response.addHeader("Pragma", "no-cache");
            response.addHeader("Cache-Control", "no-cache");
            // Stronger according to blog comment below that references HTTP spec
            response.addHeader("Cache-Control", "no-store");
            response.addHeader("Cache-Control", "must-revalidate");
            // some date in the past
            response.addHeader("Expires", "Mon, 8 Aug 2006 10:00:00 GMT");
    and in faces-config.xml, added
    Java Code:
            <phase-listener id="nocache">control.CacheListener</phase-listener>

    Any way i want to disable the cache just for specific pages of specific pages under specific directory

    http://localhost:8080/Wirote/index must the cache be active
    but under edit folder must the cache be disabled

    all directory under edit must have no cache other wise the cache must be active

    how to do it??
    Last edited by vector_ever; 06-24-2014 at 12:57 AM.

  2. #2
    Join Date
    Apr 2014
    Rep Power

Similar Threads

  1. Binary Cache
    By Collider in forum New To Java
    Replies: 10
    Last Post: 05-03-2012, 05:22 PM
  2. clear cache
    By Jadellll in forum New To Java
    Replies: 0
    Last Post: 03-20-2008, 10:27 AM
  3. JSP - using connection cache
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-30-2008, 10:54 AM
  4. BuffededImage cache
    By tim in forum New To Java
    Replies: 1
    Last Post: 01-24-2008, 01:00 AM
  5. cache problem in jsp
    By lpwing in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 01-15-2008, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts