code: @Override
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
              throws IOException, ServletException {
          HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
          StringBuilder cacheControl = new StringBuilder(cacheability.getValue()).append(", max-age=").append(expiration);
          if (mustRevalidate) {
              cacheControl.append(", must-revalidate");
          }
  
          // Set cache directives
          httpServletResponse.setHeader(HTTPCacheHeader.CACHE_CONTROL.getName(), cacheControl.toString());
          httpServletResponse.setDateHeader(HTTPCacheHeader.EXPIRES.getName(), System.currentTimeMillis() + expiration
                  * 1000L);
  
          // Set Vary field
          if (vary != null && !vary.isEmpty()) {
              httpServletResponse.setHeader(HTTPCacheHeader.VARY.getName(), vary);
          }
  
          /*
           * By default, some servers (e.g. Tomcat) will set headers on any SSL content to deny caching. Omitting the
           * Pragma header takes care of user-agents implementing HTTP/1.0.
           */
          filterChain.doFilter(servletRequest, new HttpServletResponseWrapper(httpServletResponse) {
              @Override
              public void addHeader(String name, String value) {
                  if (!HTTPCacheHeader.PRAGMA.getName().equalsIgnoreCase(name)) {
                      super.addHeader(name, value);
                  }
              }
  
              @Override
              public void setHeader(String name, String value) {
                  if (!HTTPCacheHeader.PRAGMA.getName().equalsIgnoreCase(name)) {
                      super.setHeader(name, value);
                  }
              }
          });
      }
docs: <p>
  Set HTTP cache headers.
  </p>
  {@inheritDoc}