javaee-cache-filter
javaee-cache-filter copied to clipboard
ExpirationTime does not account for timezone
With this in web.xml
<init-param>
<param-name>expirationTime</param-name>
<param-value>14400</param-value>
</init-param>
When fetching a resource at 2014-10-16 14:39:40 in GMT +2 (with daylight savings active, +1 normally) This is in Sweden.
HTTP/1.1 200 OK
Cache-Control: public, max-age=14400
Date: Thu, 16 Oct 2014 12:39:40 GMT
Content-Length: 82718
Content-Type: text/css
Expires: Thu, 16 Oct 2014 16:39:40 GMT
Last-Modified: Thu, 16 Oct 2014 11:55:58 GMT
X-Powered-By: Servlet/2.5 JSP/2.1
In init of CacheFilter the time difference to GMT should be observed and accounted for.
seconds = Long.valueOf(filterConfig.getInitParameter(CacheConfigParameter.EXPIRATION_TIME.getName()));
This is off-course only interesting when using short cache times, if we cache it for 6 months the few hours means nothing obviously.