-
Notifications
You must be signed in to change notification settings - Fork 14
NoCacheFilter
Samuel Santos edited this page Jul 21, 2014
·
2 revisions
NoCacheFilter
is a Java Servlet filter that allows you to completely disable browser caching for requested resources.
Declare the filter in your web descriptor file web.xml
:
<filter>
<filter-name>noCache</filter-name>
<filter-class>com.samaxes.filter.NoCacheFilter</filter-class>
</filter>
Map the filter to serve your dynamic resources:
<!-- Using Servlet mapping -->
<filter-mapping>
<filter-name>noCache</filter-name>
<servlet-name>MyServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- Or URL mapping -->
<filter-mapping>
<filter-name>noCache</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>