Author: kkolinko Date: Tue Dec 9 00:54:37 2014 New Revision: 1643964 URL: http://svn.apache.org/r1643964 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57331 Allow ExpiresFilter to use "year" as synonym for "years" in its configuration. Update documentation to mention both "<unit>" and "<unit>s" duration unit names. Fix minor formatting issue (Many lines in XML text were wrongly wrapped. because quote character was replaced by  and that broke wrapping algorithm.)
Merged r1643963 from tomcat/trunk. Modified: tomcat/tc8.0.x/trunk/ (props changed) tomcat/tc8.0.x/trunk/java/org/apache/catalina/filters/ExpiresFilter.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml tomcat/tc8.0.x/trunk/webapps/docs/config/filter.xml Propchange: tomcat/tc8.0.x/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Dec 9 00:54:37 2014 @@ -1 +1 @@ -/tomcat/trunk:1636524,1637156,1637176,1637188,1637331,1637684,1637695,1638720-1638725,1639653,1640010,1640084,1640088,1640275,1640322,1640347,1640361,1640365,1640403,1640410,1640652,1640655-1640658,1640688,1640700-1640883,1640903,1640976,1640978,1641000,1641026,1641038-1641039,1641051-1641052,1641058,1641064,1641300,1641369,1641374,1641380,1641486,1641634,1641656-1641692,1641704,1641707-1641718,1641720-1641722,1641735,1641981,1642554,1642564,1642595,1642606,1642668,1642679,1642697,1642699,1643002,1643045,1643054-1643055,1643066,1643121,1643206,1643209-1643210,1643216,1643249,1643270,1643283,1643309-1643310,1643323,1643365-1643366,1643370-1643371,1643465,1643474,1643570,1643634,1643649,1643651,1643654,1643675,1643731,1643733-1643734,1643761,1643766,1643814,1643937 +/tomcat/trunk:1636524,1637156,1637176,1637188,1637331,1637684,1637695,1638720-1638725,1639653,1640010,1640084,1640088,1640275,1640322,1640347,1640361,1640365,1640403,1640410,1640652,1640655-1640658,1640688,1640700-1640883,1640903,1640976,1640978,1641000,1641026,1641038-1641039,1641051-1641052,1641058,1641064,1641300,1641369,1641374,1641380,1641486,1641634,1641656-1641692,1641704,1641707-1641718,1641720-1641722,1641735,1641981,1642554,1642564,1642595,1642606,1642668,1642679,1642697,1642699,1643002,1643045,1643054-1643055,1643066,1643121,1643206,1643209-1643210,1643216,1643249,1643270,1643283,1643309-1643310,1643323,1643365-1643366,1643370-1643371,1643465,1643474,1643570,1643634,1643649,1643651,1643654,1643675,1643731,1643733-1643734,1643761,1643766,1643814,1643937,1643963 Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/filters/ExpiresFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/filters/ExpiresFilter.java?rev=1643964&r1=1643963&r2=1643964&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/catalina/filters/ExpiresFilter.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/filters/ExpiresFilter.java Tue Dec 9 00:54:37 2014 @@ -1558,7 +1558,8 @@ public class ExpiresFilter extends Filte Integer.valueOf(amount), line)); } DurationUnit durationUnit; - if ("years".equalsIgnoreCase(currentToken)) { + if ("year".equalsIgnoreCase(currentToken) || + "years".equalsIgnoreCase(currentToken)) { durationUnit = DurationUnit.YEAR; } else if ("month".equalsIgnoreCase(currentToken) || "months".equalsIgnoreCase(currentToken)) { Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1643964&r1=1643963&r2=1643964&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Tue Dec 9 00:54:37 2014 @@ -142,6 +142,10 @@ Make <code>o.a.catalina.webresources.StandardRoot</code> easier for extending. (violetagg) </update> + <fix> + <bug>57331</bug>: Allow ExpiresFilter to use "year" as synonym for + "years" in its configuration. (kkolinko) + </fix> </changelog> </subsection> <subsection name="Coyote"> Modified: tomcat/tc8.0.x/trunk/webapps/docs/config/filter.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/config/filter.xml?rev=1643964&r1=1643963&r2=1643964&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/config/filter.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/config/filter.xml Tue Dec 9 00:54:37 2014 @@ -325,7 +325,7 @@ </p> <p> - These HTTP headers are an instruction to the client about the document's + These HTTP headers are an instruction to the client about the document's validity and persistence. If cached, the document may be fetched from the cache rather than from the source until this time has passed. After that, the cache copy is considered "expired" and invalid, and a new copy must @@ -380,24 +380,24 @@ <source><![CDATA[<init-param> <param-name>ExpiresDefault</param-name> - <param-value><base> [plus] {<num> <type>}*</param-value> + <param-value><base> [plus] {<num> <type>}*</param-value> </init-param> <init-param> <param-name>ExpiresByType type</param-name> - <param-value><base> [plus] {<num> <type>}*</param-value> + <param-value><base> [plus] {<num> <type>}*</param-value> </init-param> <init-param> <param-name>ExpiresByType type;encoding</param-name> - <param-value><base> [plus] {<num> <type>}*</param-value> + <param-value><base> [plus] {<num> <type>}*</param-value> </init-param>]]></source> <p> where <code><base></code> is one of: </p> <ul> <li><code>access</code></li> - <li><code>now</code> (equivalent to '<code>access</code>')</li> + <li><code>now</code> (equivalent to '<code>access</code>')</li> <li><code>modification</code></li> </ul> @@ -407,13 +407,13 @@ <code><type></code> is one of: </p> <ul> - <li><code>years</code></li> - <li><code>months</code></li> - <li><code>weeks</code></li> - <li><code>days</code></li> - <li><code>hours</code></li> - <li><code>minutes</code></li> - <li><code>seconds</code></li> + <li><code>year</code>, <code>years</code></li> + <li><code>month</code>, <code>months</code></li> + <li><code>week</code>, <code>weeks</code></li> + <li><code>day</code>, <code>days</code></li> + <li><code>hour</code>, <code>hours</code></li> + <li><code>minute</code>, <code>minutes</code></li> + <li><code>second</code>, <code>seconds</code></li> </ul> <p> For example, any of the following directives can be used to make documents @@ -435,18 +435,18 @@ <param-value>access plus 30 days</param-value> </init-param>]]></source> <p> -The expiry time can be fine-tuned by adding several ' -<code><num> <type></code>' clauses: +The expiry time can be fine-tuned by adding several +'<code><num> <type></code>' clauses: </p> <source><![CDATA[<init-param> <param-name>ExpiresByType text/html</param-name> - <param-value>access plus 1 month 15 days 2 hours</param-value> + <param-value>access plus 1 month 15 days 2 hours</param-value> </init-param> <init-param> <param-name>ExpiresByType image/gif</param-name> - <param-value>modification plus 5 hours 3 minutes</param-value> + <param-value>modification plus 5 hours 3 minutes</param-value> </init-param>]]></source> <p> Note that if you use a modification date based setting, the <code>Expires</code> @@ -485,14 +485,13 @@ The expiry time can be fine-tuned by add <ol> <li><code>ExpiresByType</code> matching the exact content-type returned by <code>HttpServletResponse.getContentType()</code> possibly including the charset - (e.g. '<code>text/xml;charset=UTF-8</code>'),</li> + (e.g. '<code>text/xml;charset=UTF-8</code>'),</li> <li><code>ExpiresByType</code> matching the content-type without the charset if - <code>HttpServletResponse.getContentType()</code> contains a charset (e.g. ' - <code>text/xml;charset=UTF-8</code>' -> '<code>text/xml</code>'),</li> + <code>HttpServletResponse.getContentType()</code> contains a charset (e.g. + '<code>text/xml;charset=UTF-8</code>' -> '<code>text/xml</code>'),</li> <li><code>ExpiresByType</code> matching the major type (e.g. substring before - '<code>/</code>') of <code>HttpServletResponse.getContentType()</code> - (e.g. '<code>text/xml;charset=UTF-8</code>' -> '<code>text</code> - '),</li> + '<code>/</code>') of <code>HttpServletResponse.getContentType()</code> + (e.g. '<code>text/xml;charset=UTF-8</code>' -> '<code>text</code>'),</li> <li><code>ExpiresDefault</code></li> </ol> @@ -542,10 +541,10 @@ The expiry time can be fine-tuned by add </p> <p> The base time is either the last modification time of the file, or the time - of the client's access to the document. Which should be used is + of the client's access to the document. Which should be used is specified by the <code><code></code> field; <code>M</code> means that the - file's last modification time should be used as the base time, and - <code>A</code> means the client's access time should be used. The duration + file's last modification time should be used as the base time, and + <code>A</code> means the client's access time should be used. The duration is expressed in seconds. <code>A2592000</code> stands for <code>access plus 30 days</code> in alternate syntax. </p> @@ -553,10 +552,10 @@ The expiry time can be fine-tuned by add The difference in effect is subtle. If <code>M</code> (<code>modification</code> in alternate syntax) is used, all current copies of the document in all caches will expire at the same time, which can be good for something like a weekly - notice that's always found at the same URL. If <code>A</code> ( + notice that's always found at the same URL. If <code>A</code> ( <code>access</code> or <code>now</code> in alternate syntax) is used, the date of expiration is different for each client; this can be good for image files - that don't change very often, particularly for a set of related + that don't change very often, particularly for a set of related documents that all refer to the same images (<i>i.e.</i>, the images will be accessed repeatedly within a relatively short timespan). </p> @@ -977,17 +976,17 @@ FINE: Request "/docs/config/manager.html <td> 140.211.11.130 </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> <td> 140.211.11.130, 192.168.0.10 </td> <td> null </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> <td> null </td> <td> null </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-proto'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-proto'<code>]</code> </td> <td> https </td> <td> https </td> </tr> @@ -1052,12 +1051,12 @@ FINE: Request "/docs/config/manager.html <td> 140.211.11.130 </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> <td> 140.211.11.130, proxy1, proxy2 </td> <td> null </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> <td> null </td> <td> proxy1, proxy2 </td> </tr> @@ -1106,12 +1105,12 @@ FINE: Request "/docs/config/manager.html <td> 140.211.11.130 </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> <td> 140.211.11.130, proxy1, proxy2, 192.168.0.10 </td> <td> null </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> <td> null </td> <td> proxy1, proxy2 </td> </tr> @@ -1163,12 +1162,12 @@ FINE: Request "/docs/config/manager.html <td> untrusted-proxy </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-for'<code>]</code> </td> <td> 140.211.11.130, untrusted-proxy, proxy1 </td> <td> 140.211.11.130 </td> </tr> <tr> - <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> + <td> request.header<code>[</code>'x-forwarded-by'<code>]</code> </td> <td> null </td> <td> proxy1 </td> </tr> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org