1 package org.ejbca.ui.web.pub; 2 3 import javax.servlet.http.HttpServletResponse ; 4 import org.apache.log4j.Logger; 5 6 12 public class ServletUtils { 13 14 private static Logger log = Logger.getLogger(ServletUtils.class); 15 16 23 public static void removeCacheHeaders(HttpServletResponse res) { 24 if (res.containsHeader("Pragma")) { 25 log.debug("Removing Pragma header to avoid caching issues in IE"); 26 res.setHeader("Pragma","null"); 27 } 28 if (res.containsHeader("Cache-Control")) { 29 log.debug("Removing Cache-Control header to avoid caching issues in IE"); 30 res.setHeader("Cache-Control","null"); 31 } 32 } 33 34 38 public static void addCacheHeaders(HttpServletResponse res) { 39 if (!res.containsHeader("Pragma")) { 40 log.debug("Adding Pragma header"); 41 res.setHeader("Pragma","no-cache"); 42 } 43 if (!res.containsHeader("Cache-Control")) { 44 log.debug("Adding Cache-Control header"); 45 res.setHeader("Cache-Control","no-cache"); 46 } 47 } 48 } 49 | Popular Tags |