Class NoCacheFilter
java.lang.Object
com.levigo.jadice.web.server.filter.NoCacheFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
@WebFilter(description="Disable caching for non-cacheable GWT resources",
displayName="jadice web toolkit GWT resource non-caching",
filterName="jwtNoCacheFilter",
urlPatterns="/*",
asyncSupported=true)
public class NoCacheFilter
extends Object
implements jakarta.servlet.Filter
This
Filter
adds the required HTTP Headers to the HttpServletResponse
to force
the browser not to cache the resource that was returned.
Caching will be turned for all *.nocache.* files, by (GWT) design. Additionally, this filter excludes index.* from caching.
This filter injects the following HTML headers into the response:
- Cache-Control: "no-cache, no-store, must-revalidate"
- Expires: -1
- Pragma: No-cache
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Checks whether this filter applies to the given path.void
destroy()
void
doFilter
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) void
init
(jakarta.servlet.FilterConfig filterConfig)
-
Constructor Details
-
NoCacheFilter
public NoCacheFilter() -
NoCacheFilter
-
-
Method Details
-
init
public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Filter
- Throws:
jakarta.servlet.ServletException
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilter
in interfacejakarta.servlet.Filter
- Throws:
IOException
jakarta.servlet.ServletException
-
appliesTo
Checks whether this filter applies to the given path.- Parameters:
path
- The path of the request- Returns:
true
if one of the patterns matches the given path and the headers shall be applied
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Filter
-