views:

59

answers:

1

Is there a right of the box cache-control response header filter that will enable me to set those cache headers on my static resources without me having to build my own Filter? It seems like such a common task. Is there a Spring filter ? I am currently using Tomcat 6.0 and using Spring's ShallowEtagHeaderFilter to set etag to my resources but I need to also add the cache-control headers.

+1  A: 

Use DelegatingFilterProxy, pointing to your own impl of WebContentGenerator to handle the cache headers. The WebContentGenerator is dependency-injected into the DelegatingFilterProxy using Spring. Your impl will also implement Filter and call the appropriate cache-setting methods of WebContentGenerator from doFilter.

Paul Grime