You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2009/02/26 22:31:14 UTC
svn commit: r748317 -
/incubator/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
Author: sabob
Date: Thu Feb 26 21:31:13 2009
New Revision: 748317
URL: http://svn.apache.org/viewvc?rev=748317&view=rev
Log:
added javadoc explaining cachable-paths more clearly
Modified:
incubator/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java?rev=748317&r1=748316&r2=748317&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java Thu Feb 26 21:31:13 2009
@@ -52,7 +52,7 @@
* <li>Rule 4 - Gzip Components</li>
* </ul>
*
- * The Click Framework can also help you with the other rules:
+ * The Click Framework can also help you with the following rules:
* <ul>
* <li>Rule 5 - Put Stylesheets at the Top, by using $cssImports at the
* top of you page</li>
@@ -125,7 +125,7 @@
* <filter-class><span class="red">org.apache.click.extras.filter.PerformanceFilter</span></filter-class>
* <init-param>
* <param-name><font color="blue">cachable-paths</font></param-name>
- * <param-value><font color="red">/assets/*, *.css</font></param-value>
+ * <param-value><font color="red">/assets/*</font>, <font color="red">*.css</font></param-value>
* </init-param>
* </filter>
*
@@ -158,6 +158,30 @@
* <servlet-name><span class="green">ClickServlet</span></servlet-name>
* .. </pre>
*
+ * The <tt>init-param</tt> <span class="blue">"cachable-paths"</span>, allows
+ * you to specify paths for resources such as JavaScript, CSS and images to be
+ * <tt>cached</tt> by the browser. (Caching here means setting the
+ * "Expires" and "Cache-Control" headers). The <tt>param-value</tt> accepts a
+ * comma separated list of directories and files to match against.
+ * To differentiate between directory and file values the following convention
+ * is used:
+ * <ul>
+ * <li>To specify a directory, the value must <b>end</b> with the asterisk
+ * character (*). When a resource is requested, the filter will only cache
+ * the resource if the resource path starts with the specified value. For example
+ * if the specified value is <tt><param-value><span class="red">/assets/*</span></param-value></tt>,
+ * the resource <tt>"<span class="red">/assets/</span>library.js"</tt> will be
+ * cached while <tt>"/public/library.js"</tt> will not be.
+ * </li>
+ * <li>To specify a file, the value must <b>start</b> with the asterisk character
+ * (*). When a resource is requested, the filter will only cache the resource
+ * if the resource path ends with the specified value. For example if the specified
+ * value is <tt><param-value><span class="red">*.css</span></param-value></tt>,
+ * the resource <tt>"/public/table<span class="red">.css</span>"</tt> will be
+ * cached while <tt>"/public/table.js"</tt> will not be.
+ * </li>
+ * </ul>
+ *
* This filter will automatically set the configured click.xml charset as the
* requests character encoding.
*
@@ -444,7 +468,7 @@
excludeFiles.add(path.substring(1));
} else {
- String message = "cachable-path '" + path + "' ignored, "
+ String message = "exclude-path '" + path + "' ignored, "
+ "path must start or end with a wildcard character: *";
getConfigService().getLogService().warn(message);
}
@@ -529,7 +553,7 @@
}
/**
- * Return true if the response should be cached using the configure cache
+ * Return true if the response should be cached using the configured cache
* max-age.
*
* @param path the request path to test