How to control cache in JSP page?

前端 未结 4 1606
温柔的废话
温柔的废话 2020-12-16 06:44

I created a Servlet filter with the following code in doFilter:

HttpServletResponse httpResponse = (HttpServletResponse)response;

httpResponse.setHeader(\"C         


        
4条回答
  •  时光取名叫无心
    2020-12-16 07:18

    I found this in the oracle docs where they mention that you should never use

    httpResponse.setDateHeader("Expires", 0);
    

    instead of it you should use

    setDateHeader("Last-Modified", (new Date()).getTime() );
    

    http://docs.oracle.com/cd/E13158_01/alui/wci/docs103/devguide/tsk_pagelets_settingcaching_httpexpires.html

提交回复
热议问题