Class TileCacheFilter
java.lang.Object
com.levigo.jadice.web.server.filter.TileCacheFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
@WebFilter(description="Enable caching for jadice web toolkit tiles",
displayName="jadice web toolkit tile caching",
filterName="jwtTileCacheFilter",
urlPatterns="/*",
asyncSupported=true)
public class TileCacheFilter
extends Object
implements jakarta.servlet.Filter
This
Filter
adds the required HTTP Headers to the to the HttpServletResponse
of
the tiles to force the browser to cache the image resource that was returned and to configure the
duration how long the cache entry is valid.
The maximum age is configured to 30 minutes.
This filter injects the following HTML headers into the response:
- Cache-Control: private, max-age=60 * 30
- Expires: 60 * 30 * 1000
- Pragma will be deleted, if existing
-
Field Summary
-
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)
-
Field Details
-
PATTERN
-
-
Constructor Details
-
TileCacheFilter
public TileCacheFilter() -
TileCacheFilter
-
-
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
-