public static void addCacheHeaders ( HttpServletResponse response , String etag , Integer month ) { Assert . notNull ( etag , "ETag must not be null" ) ; long seconds ; if ( month != null ) { seconds = month * secondsInAMonth ; } else { seconds = 6L * secondsInAMonth ; } response . setDateHeader ( "Expires" , System . currentTimeMillis ( ) + seconds * 1000L ) ; response . setHeader ( "ETag" , etag ) ; response . setHeader ( "Cache-Control" , "public, max-age=" + seconds ) ; }
Adds Expires ETag and Cache - Control response headers .