1.) By implementing Filter in addition to manually overriding the cache controls. See code below (note: non my master copy I institute this somewhere else long fourth dimension ago):
@WebFilter(servletNames = { "Faces Servlet" }) world flat NoCacheFilter implements Filter { @Override world void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest asking = (HttpServletRequest) req; HttpServletResponse answer = (HttpServletResponse) res; if (!request.getRequestURI().startsWith( request.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) { // Skip JSF resources (CSS/JS/Images/etc) response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. response.setHeader("Pragma", "no-cache"); // HTTP 1.0. response.setDateHeader("Expires", 0); // Proxies. } chain.doFilter(req, res); } @Override world void init(FilterConfig filterConfig) throws ServletException { } @Override world void destroy() { } }
2.) The i I preferred, using omnifaces' CacheControlFilter. More data available at: http://showcase.omnifaces.org/filters/CacheControlFilter. To role but involve to add together the filter in addition to integrate alongside facesServlet.
<filter> <filter-name>noCache</filter-name> <filter-class>org.omnifaces.filter.CacheControlFilter</filter-class> </filter> <filter-mapping> <filter-name>noCache</filter-name> <servlet-name>Faces Servlet</servlet-name> </filter-mapping>
0 komentar:
Please comment if there are any that need to be asked.