Class CacheFilter
java.lang.Object
org.eclipse.rdf4j.workbench.proxy.CacheFilter
- All Implemented Interfaces:
javax.servlet.Filter
Resource cache expiry filter for Tomcat 6, based on code authored by Saket Kumar.
- Author:
- Dale Visser
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Maximum allowed expiry lifetime in seconds, set to one year according to the advice in RFC 2616.static final long
Minimum allowed expiry lifetime, zero, which corresponds to not caching at all. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Make stored references available for garbage collection.void
doFilter
(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) Set a maximum expiry Cache-Control header applicable to the client and to intermediate caching servers.void
init
(javax.servlet.FilterConfig config) Parse the Cache-Control configuration parameter as a long integer, and set the filter expiry value, modulo the minimum and maximum expiry constraints.
-
Field Details
-
MAX_EXPIRY
public static final long MAX_EXPIRYMaximum allowed expiry lifetime in seconds, set to one year according to the advice in RFC 2616.- See Also:
-
MIN_EXPIRY
public static final long MIN_EXPIRYMinimum allowed expiry lifetime, zero, which corresponds to not caching at all.- See Also:
-
-
Constructor Details
-
CacheFilter
public CacheFilter()
-
-
Method Details
-
doFilter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException Set a maximum expiry Cache-Control header applicable to the client and to intermediate caching servers.- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
init
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException Parse the Cache-Control configuration parameter as a long integer, and set the filter expiry value, modulo the minimum and maximum expiry constraints. If the configuration parameter is not present, or not a valid long integer value, then no Cache-Control headers will be applied by the filter.- Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
- See Also:
-
destroy
public void destroy()Make stored references available for garbage collection.- Specified by:
destroy
in interfacejavax.servlet.Filter
-