You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/03/17 21:51:27 UTC

DO NOT REPLY [Bug 18079] New: - Documentation error: configuration of resource caching (BaseDirContext).

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18079>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18079

Documentation error: configuration of resource caching (BaseDirContext).

           Summary: Documentation error: configuration of resource caching
                    (BaseDirContext).
           Product: Tomcat 4
           Version: 4.1.18
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: gawix@yahoo.com


According to online documentation, to de-activate caching of resources, we must
use the "cached" attribute of <Resources> element (nested in a <Context> element).  

<Context path="/mypath" docBase="/usr/local/mylocation">

  <Resources className="org.apache.naming.resources.FileDirContext"             
             cached="false"/>

</Context>

This is incorrect.  The org.apache.catalina.core.StandardContext will set the
caching value on the DirContext to the same value specified in the undocumented
"cachingAllowed" attribute of <Context> (which default to true):

(from org/apache/catalina/core/StandardContext.java)

 public synchronized void setResources(DirContext resources) {

        if (started) {
            throw new IllegalStateException
                (sm.getString("standardContext.resources.started"));
        }

        DirContext oldResources = this.webappResources;
        if (oldResources == resources)
            return;

        if (resources instanceof BaseDirContext) {
            ((BaseDirContext) resources).setCached(isCachingAllowed());
        }
        if (resources instanceof FileDirContext) {
            filesystemBased = true;
        }
        this.webappResources = resources;

        // The proxied resources will be refreshed on start
        this.resources = null;

        support.firePropertyChange("resources", oldResources,
                                   this.webappResources);

    }

Because of that, the "cached" attribute of the <Resources> element is useless. 
The only way to de-activate caching is to disable it at the context level:

<Context path="/mypath" docBase="/usr/local/mylocation"
         cachingAllowed="false"/>

I think the correct behaviour would be to logical-AND the "cachingAllowed"
property of the Context and the "cached" property of the DirContext.

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