remm 2003/11/13 13:03:14 Modified: catalina/src/share/org/apache/catalina/core mbeans-descriptors.xml StandardContext.java StandardDefaultContext.java Log: - Add fields to control the resources, as well as set them globally using DefaultContext. - Add relevant JMX flags. Revision Changes Path 1.23 +46 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Index: mbeans-descriptors.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- mbeans-descriptors.xml 13 Sep 2003 17:12:45 -0000 1.22 +++ mbeans-descriptors.xml 13 Nov 2003 21:03:14 -0000 1.23 @@ -7,6 +7,29 @@ group="Default-Context" type="org.apache.catalina.core.StandardDefaultContext"> + <attribute name="allowLinking" + description="Allow symlinking to outside the webapp root directory, if the webapp is an exploded directory" + is="true" + type="boolean"/> + + <attribute name="cacheMaxSize" + description="Maximum cache size in KB" + type="int"/> + + <attribute name="cacheTTL" + description="Time interval in ms between cache refeshes" + type="int"/> + + <attribute name="cachingAllowed" + description="Should we cache static resources for this webapp" + is="true" + type="boolean"/> + + <attribute name="caseSensitive" + description="Should case sensitivity checks be performed" + is="true" + type="boolean"/> + <attribute name="cookies" description="Should we attempt to use cookies for session id communication?" type="boolean"/> @@ -94,6 +117,29 @@ group="Context" type="org.apache.catalina.core.StandardContext"> + <attribute name="allowLinking" + description="Allow symlinking to outside the webapp root directory, if the webapp is an exploded directory" + is="true" + type="boolean"/> + + <attribute name="cacheMaxSize" + description="Maximum cache size in KB" + type="int"/> + + <attribute name="cacheTTL" + description="Time interval in ms between cache refeshes" + type="int"/> + + <attribute name="cachingAllowed" + description="Should we cache static resources for this webapp" + is="true" + type="boolean"/> + + <attribute name="caseSensitive" + description="Should case sensitivity checks be performed" + is="true" + type="boolean"/> + <attribute name="children" description="Object names of all children" type="[Ljavax.management.ObjectName;"/> 1.100 +108 -13 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- StandardContext.java 13 Nov 2003 08:30:35 -0000 1.99 +++ StandardContext.java 13 Nov 2003 21:03:14 -0000 1.100 @@ -583,6 +583,31 @@ */ private boolean cachingAllowed = true; + + /** + * Case sensitivity. + */ + protected boolean caseSensitive = true; + + + /** + * Allow linking. + */ + protected boolean allowLinking = false; + + + /** + * Cache max size in KB. + */ + protected int cacheMaxSize = 10240; // 10 MB + + + /** + * Cache TTL in ms. + */ + protected int cacheTTL = 5000; + + private boolean lazy=true; /** @@ -607,6 +632,8 @@ public void setName( String name ) { super.setName( name ); } + + /** * Is caching allowed ? */ @@ -624,6 +651,70 @@ /** + * Set case sensitivity. + */ + public void setCaseSensitive(boolean caseSensitive) { + this.caseSensitive = caseSensitive; + } + + + /** + * Is case sensitive ? + */ + public boolean isCaseSensitive() { + return caseSensitive; + } + + + /** + * Set allow linking. + */ + public void setAllowLinking(boolean allowLinking) { + this.allowLinking = allowLinking; + } + + + /** + * Is linking allowed. + */ + public boolean isAllowLinking() { + return allowLinking; + } + + + /** + * Set cache TTL. + */ + public void setCacheTTL(int cacheTTL) { + this.cacheTTL = cacheTTL; + } + + + /** + * Get cache TTL. + */ + public int getCacheTTL() { + return cacheTTL; + } + + + /** + * Return the maximum size of the cache in KB. + */ + public int getCacheMaxSize() { + return cacheMaxSize; + } + + + /** + * Set the maximum size of the cache in KB. + */ + public void setCacheMaxSize(int cacheMaxSize) { + this.cacheMaxSize = cacheMaxSize; + } + + + /** * Return the "follow standard delegation model" flag used to configure * our ClassLoader. */ @@ -1504,9 +1595,13 @@ if (resources instanceof BaseDirContext) { ((BaseDirContext) resources).setCached(isCachingAllowed()); + ((BaseDirContext) resources).setCacheTTL(getCacheTTL()); + ((BaseDirContext) resources).setCacheMaxSize(getCacheMaxSize()); } if (resources instanceof FileDirContext) { filesystemBased = true; + ((FileDirContext) resources).setCaseSensitive(isCaseSensitive()); + ((FileDirContext) resources).setAllowLinking(isAllowLinking()); } this.webappResources = resources; @@ -3945,6 +4040,18 @@ } } + // Install DefaultContext configuration + if (!getOverride()) { + Container host = getParent(); + if (host instanceof StandardHost) { + ((StandardHost)host).installDefaultContext(this); + Container engine = host.getParent(); + if( engine instanceof StandardEngine ) { + ((StandardEngine)engine).installDefaultContext(this); + } + } + } + // Add missing components as necessary if (webappResources == null) { // (1) Required by Loader if (log.isDebugEnabled()) @@ -3963,18 +4070,6 @@ if (!resourcesStart()) { log.error( "Error in resourceStart()"); ok = false; - } - } - - // Install DefaultContext configuration - if (!getOverride()) { - Container host = getParent(); - if (host instanceof StandardHost) { - ((StandardHost)host).installDefaultContext(this); - Container engine = host.getParent(); - if( engine instanceof StandardEngine ) { - ((StandardEngine)engine).installDefaultContext(this); - } } } 1.9 +119 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java Index: StandardDefaultContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- StandardDefaultContext.java 24 Oct 2003 11:57:27 -0000 1.8 +++ StandardDefaultContext.java 13 Nov 2003 21:03:14 -0000 1.9 @@ -275,6 +275,36 @@ /** + * Case sensitivity. + */ + protected boolean caseSensitive = true; + + + /** + * Allow linking. + */ + protected boolean allowLinking = false; + + + /** + * Cache max size in KB. + */ + protected int cacheMaxSize = 10240; // 10 MB + + + /** + * Cache TTL in ms. + */ + protected int cacheTTL = 5000; + + + /** + * CachingAllowed. + */ + protected boolean cachingAllowed = true; + + + /** * The string manager for this package. */ protected static StringManager sm = @@ -291,6 +321,86 @@ /** + * Set case sensitivity. + */ + public void setCaseSensitive(boolean caseSensitive) { + this.caseSensitive = caseSensitive; + } + + + /** + * Is case sensitive ? + */ + public boolean isCaseSensitive() { + return caseSensitive; + } + + + /** + * Set allow linking. + */ + public void setAllowLinking(boolean allowLinking) { + this.allowLinking = allowLinking; + } + + + /** + * Is linking allowed. + */ + public boolean isAllowLinking() { + return allowLinking; + } + + + /** + * Set cache TTL. + */ + public void setCacheTTL(int cacheTTL) { + this.cacheTTL = cacheTTL; + } + + + /** + * Get cache TTL. + */ + public int getCacheTTL() { + return cacheTTL; + } + + + /** + * Return the maximum size of the cache in KB. + */ + public int getCacheMaxSize() { + return cacheMaxSize; + } + + + /** + * Set the maximum size of the cache in KB. + */ + public void setCacheMaxSize(int cacheMaxSize) { + this.cacheMaxSize = cacheMaxSize; + } + + + /** + * Set cachingAllowed. + */ + public void setCachingAllowed(boolean cachingAllowed) { + this.cachingAllowed = cachingAllowed; + } + + + /** + * Is cachingAllowed ? + */ + public boolean isCachingAllowed() { + return cachingAllowed; + } + + + /** * Returns true if the internal naming support is used. */ public boolean isUseNaming() { @@ -1412,6 +1522,11 @@ if (context instanceof StandardContext) { ((StandardContext)context).setUseNaming(isUseNaming()); ((StandardContext)context).setSwallowOutput(getSwallowOutput()); + ((StandardContext)context).setCachingAllowed(isCachingAllowed()); + ((StandardContext)context).setCacheTTL(getCacheTTL()); + ((StandardContext)context).setCacheMaxSize(getCacheMaxSize()); + ((StandardContext)context).setAllowLinking(isAllowLinking()); + ((StandardContext)context).setCaseSensitive(isCaseSensitive()); if (!contexts.containsKey(context)) { ((StandardContext) context).addLifecycleListener(this); } @@ -1455,7 +1570,6 @@ * @param context current web application context */ public void importDefaultContext(Context context) { - context.setCookies(getCookies()); context.setCrossContext(getCrossContext()); context.setReloadable(getReloadable());
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]