From d18d8b1f9c934a80024af36dfc0ab0dcd7e2de40 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 14 Jul 2010 22:15:50 +0000 Subject: [PATCH] Remove the ExpiresActive option. Just comment it out if you don't want to use it. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@964222 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/catalina/filters/ExpiresFilter.java | 33 ++--------------- .../catalina/filters/LocalStrings.properties | 1 - .../apache/catalina/filters/TestExpiresFilter.java | 2 -- webapps/docs/config/filter.xml | 41 ---------------------- 4 files changed, 2 insertions(+), 75 deletions(-) diff --git a/java/org/apache/catalina/filters/ExpiresFilter.java b/java/org/apache/catalina/filters/ExpiresFilter.java index c0d8c6972..bf63918fd 100644 --- a/java/org/apache/catalina/filters/ExpiresFilter.java +++ b/java/org/apache/catalina/filters/ExpiresFilter.java @@ -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 false, the filter is - * pass-through. Default is true. - */ - public boolean isActive() { - return active; - } - - /** * *

* protected 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 + "]"; diff --git a/java/org/apache/catalina/filters/LocalStrings.properties b/java/org/apache/catalina/filters/LocalStrings.properties index 012ea39b8..213dbb873 100644 --- a/java/org/apache/catalina/filters/LocalStrings.properties +++ b/java/org/apache/catalina/filters/LocalStrings.properties @@ -24,7 +24,6 @@ expiresFilter.setExpirationDate=Request "{0}" with response status "{1}" content expiresFilter.startingPointNotFound=Starting point (access|now|modification|a|m) not found in directive "{0}" expiresFilter.startingPointInvalid=Invalid starting point (access|now|modification|a|m) "{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} diff --git a/test/org/apache/catalina/filters/TestExpiresFilter.java b/test/org/apache/catalina/filters/TestExpiresFilter.java index 37938c79c..1e8daba97 100644 --- a/test/org/apache/catalina/filters/TestExpiresFilter.java +++ b/test/org/apache/catalina/filters/TestExpiresFilter.java @@ -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(); diff --git a/webapps/docs/config/filter.xml b/webapps/docs/config/filter.xml index c0e8dc915..b00a2fc2e 100644 --- a/webapps/docs/config/filter.xml +++ b/webapps/docs/config/filter.xml @@ -366,47 +366,6 @@ The expiry time can be fine-tuned by adding several ' - -

- This directive enables or disables the generation of the Expires and - Cache-Control headers by this ExpiresFilter. If set to - Off, the headers will not be generated for any HTTP response. If set - to On or true, the headers will be added to served HTTP - responses according to the criteria defined by the - ExpiresByType <content-type> and ExpiresDefault - directives. Note that this directive does not guarantee that an - Expires or Cache-Control header will be generated. If the - criteria aren't met, no header will be sent, and the effect will be as - though this directive wasn't even specified. -

-

- Default value is true. -

- -

- Sample: enable filter -

- - -<init-param> - <!-- supports case insensitive 'On' or 'true' --> - <param-name>ExpiresActive</param-name> - <param-value>On</param-value> -</init-param> - -

- Sample: disable filter -

- - -<init-param> - <!-- supports anything different from case insensitive 'On' and 'true' --> - <param-name>ExpiresActive</param-name> - <param-value>Off</param-value> -</init-param> - - -

This directive defines the http response status codes for which the -- 2.11.0