Class CacheControlFilter

java.lang.Object
com.logicaldoc.web.filter.CacheControlFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class CacheControlFilter extends Object implements jakarta.servlet.Filter
A filter that depending on the request compiles the Cache-Control header. The configuration is done via the setting cachecontrol in the format of match_pattern:value_of_cachecontrol.
More mappings can be used separated by ;
Eg.: cachecontrol = *.png:max-age=2592000; *.svg:max-age=2592000; *.css:max-age=2592000; *.js:max-age=600; *.jsp:max-age=2592000; *:max-age=2592000
Since:
8.9
Author:
Marco Meschieri - LogicalDOC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
     
    void
    init(jakarta.servlet.FilterConfig arg0)
     
    static void
    init(String cacheControlSpecs)
    Initializes the configuration

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CacheControlFilter

      public CacheControlFilter()
  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter
    • 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 interface jakarta.servlet.Filter
      Throws:
      IOException
      jakarta.servlet.ServletException
    • init

      public void init(jakarta.servlet.FilterConfig arg0) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Filter
      Throws:
      jakarta.servlet.ServletException
    • init

      public static void init(String cacheControlSpecs)
      Initializes the configuration
      Parameters:
      cacheControlSpecs - The full specification for the mappings. Eg.: *.png:max-age=2592000; *.svg:max-age=2592000; *.css:max-age=2592000; *.js:max-age=600; *.jsp:max-age=2592000; *:max-age=2592000