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 2021/11/18 10:10:16 UTC

[tomcat] branch main updated: Add docs for using CacheStrategy

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 475dc42  Add docs for using CacheStrategy
475dc42 is described below

commit 475dc42f61ab2844dc0e06d79ad4dd42be955d95
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Nov 18 10:06:57 2021 +0000

    Add docs for using CacheStrategy
---
 webapps/docs/config/resources.xml | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/webapps/docs/config/resources.xml b/webapps/docs/config/resources.xml
index 81108d6..12e74cb 100644
--- a/webapps/docs/config/resources.xml
+++ b/webapps/docs/config/resources.xml
@@ -180,8 +180,8 @@
 
   <p>A web application&apos;s main resources are defined by the
   <strong>docBase</strong> defined for the <a href="context.html">Context</a>.
-  Additional resources may be made available to the web application by defining
-  one or more nested components.</p>
+  Additional configuration settings and/or resources may be made available to
+  the web application by defining one or more nested components.</p>
 
   <h3>PreResources</h3>
 
@@ -323,6 +323,23 @@
   <code>FileResourceSet</code> mapped to <code>/WEB-INF/lib</code>.
   </p>
 
+  <h3>Cache Strategy</h3>
+
+  <p>Additional control over the caching of static resources can be obtained by
+     configuring a custom cache strategy. To configure a custom cache straegy,
+     nest a &lt;CacheStrategy&gt; element inside the &lt;Resources&gt; element
+     with the following attributes:</p>
+
+  <attributes>
+  
+    <attribute name="className" required="true">
+      <p>Java class name of the implementation to use. This class must implement
+      the <code>org.apache.catalina.WebResourceRoot$CacheStrategy</code>
+      interface.</p>
+    </attribute>
+  
+  </attributes>
+
 </section>
 
 

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


Re: [tomcat] branch main updated: Add docs for using CacheStrategy

Posted by Mark Thomas <ma...@apache.org>.
On 19/11/2021 15:29, Christopher Schultz wrote:
> Mark,
> 
> On 11/18/21 05:10, markt@apache.org wrote:
>  > [snip]
>> +    <attribute name="className" required="true">
>> +      <p>Java class name of the implementation to use. This class 
>> must implement
>> +      the <code>org.apache.catalina.WebResourceRoot$CacheStrategy</code>
> 
> YUCK
> 
> Implement an interface defined as an inner class? If this is intended to 
> be an extension point for Tomcat, this is a Bad way to do it IMO. Sure, 
> there is prior art (e.g. Map$Entry) but ... eew.
> 
> Any reason not to promote CacheStrategy to a top-level class (interface)?

Yes. This is already part of Tomcat's public interface.

The time for this sort of feedback was 2 weeks ago when the commit that 
changed the code was made.

Mark

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


Re: [tomcat] branch main updated: Add docs for using CacheStrategy

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 11/18/21 05:10, markt@apache.org wrote:
 > [snip]
> +    <attribute name="className" required="true">
> +      <p>Java class name of the implementation to use. This class must implement
> +      the <code>org.apache.catalina.WebResourceRoot$CacheStrategy</code>

YUCK

Implement an interface defined as an inner class? If this is intended to 
be an extension point for Tomcat, this is a Bad way to do it IMO. Sure, 
there is prior art (e.g. Map$Entry) but ... eew.

Any reason not to promote CacheStrategy to a top-level class (interface)?

-chris

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


Re: [tomcat] branch main updated: Add docs for using CacheStrategy

Posted by Mark Thomas <ma...@apache.org>.
On 18/11/2021 10:19, Rainer Jung wrote:
> 
> Small typo in new docs:
> 
> Am 18.11.2021 um 11:10 schrieb markt@apache.org:
>> diff --git a/webapps/docs/config/resources.xml 
>> b/webapps/docs/config/resources.xml
>> index 81108d6..12e74cb 100644
>> --- a/webapps/docs/config/resources.xml
>> +++ b/webapps/docs/config/resources.xml
>> @@ -323,6 +323,23 @@
>>     <code>FileResourceSet</code> mapped to <code>/WEB-INF/lib</code>.
>>     </p>
>> +  <h3>Cache Strategy</h3>
>> +
>> +  <p>Additional control over the caching of static resources can be 
>> obtained by
>> +     configuring a custom cache strategy. To configure a custom cache 
>> straegy,
> s/straegy/strategy/

Drat. Thanks for spotting that. Fix on the way.

Mark

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


Re: [tomcat] branch main updated: Add docs for using CacheStrategy

Posted by Rainer Jung <ra...@kippdata.de>.
Small typo in new docs:

Am 18.11.2021 um 11:10 schrieb markt@apache.org:
> diff --git a/webapps/docs/config/resources.xml b/webapps/docs/config/resources.xml
> index 81108d6..12e74cb 100644
> --- a/webapps/docs/config/resources.xml
> +++ b/webapps/docs/config/resources.xml
> @@ -323,6 +323,23 @@
>     <code>FileResourceSet</code> mapped to <code>/WEB-INF/lib</code>.
>     </p>
>   
> +  <h3>Cache Strategy</h3>
> +
> +  <p>Additional control over the caching of static resources can be obtained by
> +     configuring a custom cache strategy. To configure a custom cache straegy,
s/straegy/strategy/

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