Class ExpiresFilter

  • All Implemented Interfaces:
    JcmsConstants, JaliosConstants, javax.servlet.Filter

    public class ExpiresFilter
    extends JcmsServletFilter
    implements javax.servlet.Filter, JcmsConstants
    Add HTTP Expires header to matching resources.
      <filter>
        <filter-name>ExpiresFilter</filter-name>
        <filter-class>com.jalios.jcms.servlet.ExpiresFilter</filter-class>
        <init-param>
          <description>The regular expression that will be used to match resource (default is ".*\.(jpg|png|gif|ico)$").</description>
          <param-name>pattern</param-name>
          <param-value>.*\.(jpg|png|gif|ico)$</param-value>
        </init-param>
        <init-param>
          <description>The expires duration to set when resource match, in milliseconds (default is 10 years).</description>
          <param-name>expires</param-name>
          <param-value>315360000000</param-value>
        </init-param>
      </filter>
     
    Since:
    jcms-6.1.2
    • Constructor Detail

      • ExpiresFilter

        public ExpiresFilter()
    • Method Detail

      • init

        public void init​(javax.servlet.FilterConfig config)
        Specified by:
        init in interface javax.servlet.Filter
      • doFilter

        public void doFilter​(javax.servlet.ServletRequest req,
                             javax.servlet.ServletResponse res,
                             javax.servlet.FilterChain chain)
                      throws java.io.IOException,
                             javax.servlet.ServletException
        Specified by:
        doFilter in interface javax.servlet.Filter
        Throws:
        java.io.IOException
        javax.servlet.ServletException
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Filter