Remove the ExpiresActive option. Just comment it out if you don't want to use it.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 14 Jul 2010 22:15:50 +0000 (22:15 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 14 Jul 2010 22:15:50 +0000 (22:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@964222 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/filters/ExpiresFilter.java
java/org/apache/catalina/filters/LocalStrings.properties
test/org/apache/catalina/filters/TestExpiresFilter.java
webapps/docs/config/filter.xml

index c0d8c69..bf63918 100644 (file)
@@ -1059,8 +1059,6 @@ public class ExpiresFilter extends FilterBase {
 
     private static final Log log = LogFactory.getLog(ExpiresFilter.class);
 
-    private static final String PARAMETER_EXPIRES_ACTIVE = "ExpiresActive";
-
     private static final String PARAMETER_EXPIRES_BY_TYPE = "ExpiresByType";
 
     private static final String PARAMETER_EXPIRES_DEFAULT = "ExpiresDefault";
@@ -1197,11 +1195,6 @@ public class ExpiresFilter extends FilterBase {
     }
 
     /**
-     * @see #isActive()
-     */
-    private boolean active = true;
-
-    /**
      * Default Expires configuration.
      */
     private ExpiresConfiguration defaultExpiresConfiguration;
@@ -1231,7 +1224,7 @@ public class ExpiresFilter extends FilterBase {
                             httpRequest.getRequestURL()));
                 }
                 chain.doFilter(request, response);
-            } else if (active) {
+            } else {
                 XHttpServletResponse xResponse = new XHttpServletResponse(
                         httpRequest, httpResponse);
                 chain.doFilter(request, xResponse);
@@ -1240,12 +1233,6 @@ public class ExpiresFilter extends FilterBase {
                     // onBeforeWriteResponseBody()
                     onBeforeWriteResponseBody(httpRequest, xResponse);
                 }
-            } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("expiresFilter.filterNotActive",
-                            httpRequest.getRequestURL()));
-                }
-                chain.doFilter(request, response);
             }
         } else {
             chain.doFilter(request, response);
@@ -1411,9 +1398,6 @@ public class ExpiresFilter extends FilterBase {
                 } else if (name.equalsIgnoreCase(PARAMETER_EXPIRES_DEFAULT)) {
                     ExpiresConfiguration expiresConfiguration = parseExpiresConfiguration(value);
                     this.defaultExpiresConfiguration = expiresConfiguration;
-                } else if (name.equalsIgnoreCase(PARAMETER_EXPIRES_ACTIVE)) {
-                    this.active = "On".equalsIgnoreCase(value) ||
-                            Boolean.valueOf(value).booleanValue();
                 } else if (name.equalsIgnoreCase(PARAMETER_EXPIRES_EXCLUDED_RESPONSE_STATUS_CODES)) {
                     this.excludedResponseStatusCodes = commaDelimitedListToIntArray(value);
                 } else {
@@ -1433,14 +1417,6 @@ public class ExpiresFilter extends FilterBase {
     }
 
     /**
-     * Indicates that the filter is active. If <code>false</code>, the filter is
-     * pass-through. Default is <code>true</code>.
-     */
-    public boolean isActive() {
-        return active;
-    }
-
-    /**
      * 
      * <p>
      * <code>protected</code> for extension.
@@ -1651,10 +1627,6 @@ public class ExpiresFilter extends FilterBase {
         return new ExpiresConfiguration(startingPoint, durations);
     }
 
-    public void setActive(boolean active) {
-        this.active = active;
-    }
-
     public void setDefaultExpiresConfiguration(
             ExpiresConfiguration defaultExpiresConfiguration) {
         this.defaultExpiresConfiguration = defaultExpiresConfiguration;
@@ -1671,8 +1643,7 @@ public class ExpiresFilter extends FilterBase {
 
     @Override
     public String toString() {
-        return getClass().getSimpleName() + "[active=" + this.active +
-                ", excludedResponseStatusCode=[" +
+        return getClass().getSimpleName() + "[excludedResponseStatusCode=[" +
                 intsToCommaDelimitedString(this.excludedResponseStatusCodes) +
                 "], default=" + this.defaultExpiresConfiguration + ", byType=" +
                 this.expiresConfigurationByContentType + "]";
index 012ea39..213dbb8 100644 (file)
@@ -24,7 +24,6 @@ expiresFilter.setExpirationDate=Request "{0}" with response status "{1}" content
 expiresFilter.startingPointNotFound=Starting point (access|now|modification|a<seconds>|m<seconds>) not found in directive "{0}"
 expiresFilter.startingPointInvalid=Invalid starting point (access|now|modification|a<seconds>|m<seconds>) "{0}" in directive "{1}"
 expiresFilter.responseAlreadyCommited=Request "{0}", can not apply ExpiresFilter on already committed response.
-expiresFilter.filterNotActive=Request "{0}", ExpiresFilter is NOT active
 expiresFilter.noExpirationConfiguredForContentType=No Expires configuration found for content-type "{0}"
 expiresFilter.useMatchingConfiguration=Use {0} matching "{1}" for content-type "{2}" returns {3}
 expiresFilter.useDefaultConfiguration=Use default {0} for content-type "{1}" returns {2}
index 37938c7..1e8daba 100644 (file)
@@ -77,8 +77,6 @@ public class TestExpiresFilter extends TomcatBaseTest {
 
         tomcat.start();
         try {
-            Assert.assertEquals(false, expiresFilter.isActive());
-
             // VERIFY EXCLUDED RESPONSE STATUS CODES
             {
                 int[] excludedResponseStatusCodes = expiresFilter.getExcludedResponseStatusCodesAsInts();
index c0e8dc9..b00a2fc 100644 (file)
@@ -366,47 +366,6 @@ The expiry time can be fine-tuned by adding several &#x27;
 
     <attributes>
 
-      <attribute name="ExpiresActive" required="false">
-        <p>
-        This directive enables or disables the generation of the <tt>Expires</tt> and
-        <tt>Cache-Control</tt> headers by this <tt>ExpiresFilter</tt>. If set to
-        <tt>Off</tt>, the headers will not be generated for any HTTP response. If set
-        to <tt>On</tt> or <tt>true</tt>, the headers will be added to served HTTP
-        responses according to the criteria defined by the
-        <tt>ExpiresByType &lt;content-type&gt;</tt> and <tt>ExpiresDefault</tt>
-        directives. Note that this directive does not guarantee that an
-        <tt>Expires</tt> or <tt>Cache-Control</tt> header will be generated. If the
-        criteria aren&#x27;t met, no header will be sent, and the effect will be as
-        though this directive wasn&#x27;t even specified.
-        </p>
-        <p>
-        Default value is <tt>true</tt>.
-        </p>
-        
-        <p>
-        <i>Sample: enable filter</i>
-        </p>
-    
-        <source>
-&lt;init-param&gt;
- &lt;!-- supports case insensitive &#x27;On&#x27; or &#x27;true&#x27; --&gt;
- &lt;param-name&gt;ExpiresActive&lt;/param-name&gt;
- &lt;param-value&gt;On&lt;/param-value&gt;
-&lt;/init-param&gt;
-         </source>
-         <p>
-         <i>Sample: disable filter</i>
-         </p>
-    
-         <source>
-&lt;init-param&gt;
- &lt;!-- supports anything different from case insensitive &#x27;On&#x27; and &#x27;true&#x27; --&gt;
- &lt;param-name&gt;ExpiresActive&lt;/param-name&gt;
- &lt;param-value&gt;Off&lt;/param-value&gt;
-&lt;/init-param&gt;
-         </source>
-      </attribute>
-
       <attribute name="ExpiresExcludedResponseStatusCodes" required="false">
          <p>
          This directive defines the http response status codes for which the