You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/07/15 00:15:51 UTC

svn commit: r964222 - in /tomcat/trunk: 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

Author: markt
Date: Wed Jul 14 22:15:50 2010
New Revision: 964222

URL: http://svn.apache.org/viewvc?rev=964222&view=rev
Log:
Remove the ExpiresActive option. Just comment it out if you don't want to use it.

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

Modified: tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java?rev=964222&r1=964221&r2=964222&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java Wed Jul 14 22:15:50 2010
@@ -1059,8 +1059,6 @@ public class ExpiresFilter extends Filte
 
     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 Filte
     }
 
     /**
-     * @see #isActive()
-     */
-    private boolean active = true;
-
-    /**
      * Default Expires configuration.
      */
     private ExpiresConfiguration defaultExpiresConfiguration;
@@ -1231,7 +1224,7 @@ public class ExpiresFilter extends Filte
                             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 Filte
                     // 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 Filte
                 } 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 Filte
     }
 
     /**
-     * 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 Filte
         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 Filte
 
     @Override
     public String toString() {
-        return getClass().getSimpleName() + "[active=" + this.active +
-                ", excludedResponseStatusCode=[" +
+        return getClass().getSimpleName() + "[excludedResponseStatusCode=[" +
                 intsToCommaDelimitedString(this.excludedResponseStatusCodes) +
                 "], default=" + this.defaultExpiresConfiguration + ", byType=" +
                 this.expiresConfigurationByContentType + "]";

Modified: tomcat/trunk/java/org/apache/catalina/filters/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/LocalStrings.properties?rev=964222&r1=964221&r2=964222&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/LocalStrings.properties Wed Jul 14 22:15:50 2010
@@ -24,7 +24,6 @@ expiresFilter.setExpirationDate=Request 
 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}

Modified: tomcat/trunk/test/org/apache/catalina/filters/TestExpiresFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/filters/TestExpiresFilter.java?rev=964222&r1=964221&r2=964222&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/filters/TestExpiresFilter.java (original)
+++ tomcat/trunk/test/org/apache/catalina/filters/TestExpiresFilter.java Wed Jul 14 22:15:50 2010
@@ -77,8 +77,6 @@ public class TestExpiresFilter extends T
 
         tomcat.start();
         try {
-            Assert.assertEquals(false, expiresFilter.isActive());
-
             // VERIFY EXCLUDED RESPONSE STATUS CODES
             {
                 int[] excludedResponseStatusCodes = expiresFilter.getExcludedResponseStatusCodesAsInts();

Modified: tomcat/trunk/webapps/docs/config/filter.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/filter.xml?rev=964222&r1=964221&r2=964222&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/filter.xml (original)
+++ tomcat/trunk/webapps/docs/config/filter.xml Wed Jul 14 22:15:50 2010
@@ -366,47 +366,6 @@ The expiry time can be fine-tuned by add
 
     <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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org