Class CacheFilter

java.lang.Object
org.eclipse.rdf4j.workbench.proxy.CacheFilter
All Implemented Interfaces:
javax.servlet.Filter

public class CacheFilter extends Object implements javax.servlet.Filter
Resource cache expiry filter for Tomcat 6, based on code authored by Saket Kumar.
Author:
Dale Visser
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_EXPIRY

      public static final long MAX_EXPIRY
      Maximum 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_EXPIRY
      Minimum 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 interface javax.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 interface javax.servlet.Filter
      Throws:
      javax.servlet.ServletException
      See Also:
    • destroy

      public void destroy()
      Make stored references available for garbage collection.
      Specified by:
      destroy in interface javax.servlet.Filter