code: public static void setDateExpiresHeader(HttpServletResponse res, long dateExpires, long maxAge) {
  
          long now = System.currentTimeMillis();
          if ((dateExpires > now) && (dateExpires != CmsResource.DATE_EXPIRED_DEFAULT)) {
  
              // important: many caches (browsers or proxy) use the "Expires" header
              // to avoid re-loading of pages that are not expired
              // while this is right in general, no changes before the expiration date
              // will be displayed
              // therefore it is better to not use an expiration to far in the future
  
              // if no valid max age is set, restrict it to 24 hrs
              if (maxAge < 0L) {
                  maxAge = 86400000;
              }
  
              if ((dateExpires - now) > maxAge) {
                  // set "Expires" header max one day into the future
                  dateExpires = now + maxAge;
              }
              res.setDateHeader(CmsRequestUtil.HEADER_EXPIRES, dateExpires);
  
              // setting the "Expires" header only is not sufficient - even expired documents seems to be cached
              // therefore, the "cache-control: max-age" is also set
              res.setHeader(CmsRequestUtil.HEADER_CACHE_CONTROL, CmsRequestUtil.HEADER_VALUE_MAX_AGE + (maxAge / 1000L));
          }
      }
docs: Sets the <code>Expires</code> date header for a given http request.<p>
  
  Also sets the <code>cache-control: max-age</code> header to the time of the expiration.
  A certain upper limit is imposed on the expiration date parameter to ensure the resources are
  not cached to long in proxies. This can be controlled by the <code>maxAge</code> parameter.
  If <code>maxAge</code> is lower then 0, then a default max age of 86400000 msec (1 day) is used.<p>
  
  @param res the response to set the "Expires" date header for
  @param maxAge maximum amount of time in milliseconds the response remains valid
  @param dateExpires the date to set (if this is not in the future, it is ignored)