Package org.eclipse.rdf4j.workbench.proxy

## 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:
    Enable Caching in Tomcat 6

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `MAX_EXPIRY` | Maximum allowed expiry lifetime in seconds, set to one year according to the advice in RFC 2616.
    `static long` | `MIN_EXPIRY` | Minimum allowed expiry lifetime, zero, which corresponds to not caching at all.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CacheFilter()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### 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:
        RFC 2616: HTTP/1.1, Constant Field Values

    - #### MIN_EXPIRY

          public static final long MIN_EXPIRY

      Minimum allowed expiry lifetime, zero, which corresponds to not caching at all.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CacheFilter

          public CacheFilter()

  - ### Method Detail

    - #### 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:
        `MIN_EXPIRY`, `MAX_EXPIRY`

    - #### destroy

          public void destroy()

      Make stored references available for garbage collection.
      Specified by:
        `destroy` in interface `javax.servlet.Filter`