protected void setResponseHeaders ( HttpServletResponse resp ) { // Force resource caching as best as possible resp . setHeader ( CACHE_CONTROL_HEADER , CACHE_CONTROL_VALUE ) ; resp . setHeader ( LAST_MODIFIED_HEADER , LAST_MODIFIED_VALUE ) ; resp . setHeader ( ETAG_HEADER , ETAG_VALUE ) ; Calendar cal = Calendar . getInstance ( ) ; cal . roll ( Calendar . YEAR , 10 ) ; resp . setDateHeader ( EXPIRES_HEADER , cal . getTimeInMillis ( ) ) ; }
Adds aggressive caching headers to the response in order to prevent browsers requesting the same file twice .