costin 01/07/15 17:05:04
Modified: src/share/org/apache/tomcat/modules/config
ServerXmlReader.java
Log:
Extra check in trusted apps. Since the app is trusted, it has full access
to the internals - it could add new modules during a servlet init, but
we want this to happen sooner, as modules might use the earlier callbacks.
Revision Changes Path
1.11 +38 -1
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlReader.java
Index: ServerXmlReader.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlReader.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ServerXmlReader.java 2001/07/13 06:22:15 1.10
+++ ServerXmlReader.java 2001/07/16 00:05:04 1.11
@@ -120,6 +120,7 @@
BaseInterceptor module)
throws TomcatException
{
+ // checkHooks(cm, ctx, module);
if( this != module ) return;
setupHookFinder();
XmlMapper xh=new XmlMapper();
@@ -159,6 +160,42 @@
}
}
+ // -------------------- trusted apps --------------------
+
+ public void contextInit( Context ctx )
+ throws TomcatException
+ {
+ if( ! ctx.isTrusted() ) return;
+
+ // PathSetter is the first module in the chain, we shuld have
+ // a valid path by now
+ String dir=ctx.getAbsolutePath();
+
+ File f=new File(dir);
+ File modules=new File( f, "WEB-INF" + File.separator +
+ "interceptors.xml" );
+ if( modules.exists() ) {
+ ctx.log( "Loading modules from webapp " + modules );
+ } else {
+ if( debug > 0 )
+ ctx.log( "Can't find " + modules );
+ return;
+ }
+
+ XmlMapper xh=new XmlMapper();
+ xh.setClassLoader( ctx.getClassLoader());
+ xh.setDebug( debug );
+ xh.addRule( "ContextManager", xh.setProperties() );
+ setPropertiesRules( cm, xh );
+ setTagRules( xh );
+ addDefaultTags(cm, xh);
+ addTagRules( cm, xh );
+ setBackward( xh );
+
+ cm.setNote( "configFile", modules.getAbsolutePath());
+ loadConfigFile(xh,modules,cm);
+ }
+
// -------------------- Xml reading details --------------------
public static void loadConfigFile(XmlMapper xh, File f, ContextManager cm)
@@ -304,7 +341,7 @@
FileOutputStream pos=new FileOutputStream( f );
mods.save( pos, "Auto-generated cache file");
} catch(IOException ex ) {
- log("Error saving modules ", ex );
+ //log("Error saving modules ", ex );
}
}