Class CacheControlFilter

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

public class CacheControlFilter extends Object implements javax.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(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
     
    static void
    init(String cacheControlSpecs)
    Initializes the configuration
    void
    init(javax.servlet.FilterConfig arg0)
     

    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 javax.servlet.Filter
    • doFilter

      public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
      Specified by:
      doFilter in interface javax.servlet.Filter
      Throws:
      IOException
      javax.servlet.ServletException
    • init

      public void init(javax.servlet.FilterConfig arg0) throws javax.servlet.ServletException
      Specified by:
      init in interface javax.servlet.Filter
      Throws:
      javax.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