cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java
craigmcc02/04/22 12:04:01 Modified:catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java Log: When parsing server.xml and web.xml files, use an InputSource rather than an InputStream so that we can set a system identifier. Among other things, this allows developers to split up their input files with the use of external entities like this: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; [ !ENTITY webinc PUBLIC webinc webinc.xml ] web-app webinc; /web-app Tested this with web.xml files in both unpacked directories and a packaged WAR file, and it seems to work. NOTE: This patch doesn't address trying to parse tag library descriptors that have external entities included in them. The same approach would probably work, but will require a couple of API changes to some private methods in o.a.c.ContextConfig and the corresponding code in Jasper. Based on a patch provided by Attila Szegedi szegedia at freemail.hu for Bugzilla #8024. Revision ChangesPath 1.47 +18 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java Index: Catalina.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- Catalina.java 15 Apr 2002 09:34:06 - 1.46 +++ Catalina.java 22 Apr 2002 19:04:01 - 1.47 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v 1.46 2002/04/15 09:34:06 remm Exp $ - * $Revision: 1.46 $ - * $Date: 2002/04/15 09:34:06 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v 1.47 2002/04/22 19:04:01 craigmcc Exp $ + * $Revision: 1.47 $ + * $Date: 2002/04/22 19:04:01 $ * * * @@ -66,6 +66,7 @@ import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; @@ -82,6 +83,7 @@ import org.apache.commons.digester.Digester; import org.apache.commons.digester.Rule; import org.xml.sax.Attributes; +import org.xml.sax.InputSource; /** @@ -97,7 +99,7 @@ * /u * * @author Craig R. McClanahan - * @version $Revision: 1.46 $ $Date: 2002/04/15 09:34:06 $ + * @version $Revision: 1.47 $ $Date: 2002/04/22 19:04:01 $ */ public class Catalina { @@ -438,8 +440,13 @@ Digester digester = createStartDigester(); File file = configFile(); try { +InputSource is = +new InputSource(file:// + file.getAbsolutePath()); +FileInputStream fis = new FileInputStream(file); +is.setByteStream(fis); digester.push(this); -digester.parse(file); +digester.parse(is); +fis.close(); } catch (Exception e) { System.out.println(Catalina.start: + e); e.printStackTrace(System.out); @@ -548,8 +555,13 @@ Digester digester = createStopDigester(); File file = configFile(); try { +InputSource is = +new InputSource(file:// + file.getAbsolutePath()); +FileInputStream fis = new FileInputStream(file); +is.setByteStream(fis); digester.push(this); -digester.parse(file); +digester.parse(is); +fis.close(); } catch (Exception e) { System.out.println(Catalina.stop: + e); e.printStackTrace(System.out); 1.62 +23 -8 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java Index: ContextConfig.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- ContextConfig.java4 Apr 2002 20:30:34 - 1.61 +++ ContextConfig.java22 Apr 2002 19:04:01 - 1.62 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v 1.61 2002/04/04 20:30:34 craigmcc Exp $ - * $Revision: 1.61 $ - * $Date: 2002/04/04 20:30:34 $ + * $Header:
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java EngineConfig.java HostConfig.java
[EMAIL PROTECTED] wrote: craigmcc01/04/18 11:59:30 Modified:catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java EngineConfig.java HostConfig.java Log: Catalina: Restore the recognition of Logger, Realm, and Valve elements nested inside a Context. They were only being recognized inside a DefaultContext. {Context,Engine,Host}Config: Inherit the debugging detail level of the owning component to assist in debugging problems like this. PR: Bugzilla #1370 Submitted by: Larry Karnowski [EMAIL PROTECTED] Does this mean that one can now use a Context specific Realm, that lives in the same classloader as the rest of the context? -- - Torgeir
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java EngineConfig.java HostConfig.java
On Sat, 21 Apr 2001, Torgeir Veimo wrote: [EMAIL PROTECTED] wrote: craigmcc01/04/18 11:59:30 Modified:catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java EngineConfig.java HostConfig.java Log: Catalina: Restore the recognition of Logger, Realm, and Valve elements nested inside a Context. They were only being recognized inside a DefaultContext. {Context,Engine,Host}Config: Inherit the debugging detail level of the owning component to assist in debugging problems like this. PR: Bugzilla #1370 Submitted by: Larry Karnowski [EMAIL PROTECTED] Does this mean that one can now use a Context specific Realm, Yes, but ... that lives in the same classloader as the rest of the context? the Realm implementation class needs to live in "server/classes" or in a JAR file in "server/lib", because it has to be loaded by the Catalina class loader. Such classes are not visible to the web app class loader. -- - Torgeir Craig
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java EngineConfig.java HostConfig.java
craigmcc01/04/18 11:59:30 Modified:catalina/src/share/org/apache/catalina/startup Catalina.java ContextConfig.java EngineConfig.java HostConfig.java Log: Catalina: Restore the recognition of Logger, Realm, and Valve elements nested inside a Context. They were only being recognized inside a DefaultContext. {Context,Engine,Host}Config: Inherit the debugging detail level of the owning component to assist in debugging problems like this. PR: Bugzilla #1370 Submitted by: Larry Karnowski [EMAIL PROTECTED] Revision ChangesPath 1.20 +43 -37 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java Index: Catalina.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Catalina.java 2001/04/07 10:26:05 1.19 +++ Catalina.java 2001/04/18 18:59:22 1.20 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v 1.19 2001/04/07 10:26:05 kief Exp $ - * $Revision: 1.19 $ - * $Date: 2001/04/07 10:26:05 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v 1.20 2001/04/18 18:59:22 craigmcc Exp $ + * $Revision: 1.20 $ + * $Date: 2001/04/18 18:59:22 $ * * * @@ -97,7 +97,7 @@ * /u * * @author Craig R. McClanahan - * @version $Revision: 1.19 $ $Date: 2001/04/07 10:26:05 $ + * @version $Revision: 1.20 $ $Date: 2001/04/18 18:59:22 $ */ public class Catalina { @@ -454,7 +454,9 @@ "configClass")); mapper.addRule(prefix + "", mapper.addChild ("addChild", "org.apache.catalina.Container")); + createContextCommon(prefix, mapper); + } @@ -474,28 +476,9 @@ mapper.addRule(prefix + "", mapper.setProperties()); mapper.addRule(prefix + "", mapper.addChild ("addDefaultContext", "org.apache.catalina.core.DefaultContext")); -mapper.addRule(prefix + "/Logger", mapper.objectCreate - (null, "className")); -mapper.addRule(prefix + "/Logger", - mapper.setProperties()); -mapper.addRule(prefix + "/Logger", mapper.addChild - ("setLogger", "org.apache.catalina.Logger")); - -mapper.addRule(prefix + "/Realm", mapper.objectCreate - (null, "className")); -mapper.addRule(prefix + "/Realm", - mapper.setProperties()); -mapper.addRule(prefix + "/Realm", mapper.addChild - ("setRealm", "org.apache.catalina.Realm")); - -mapper.addRule(prefix + "/Valve", mapper.objectCreate - (null, "className")); -mapper.addRule(prefix + "/Valve", - mapper.setProperties()); -mapper.addRule(prefix + "/Valve", mapper.addChild - ("addValve", "org.apache.catalina.Valve")); createContextCommon(prefix, mapper); + } @@ -507,19 +490,6 @@ * @param mapper The mapper we are updating */ protected void createContextCommon(String prefix, XmlMapper mapper) { -mapper.addRule(prefix + "/ResourceParams", mapper.objectCreate - ("org.apache.catalina.deploy.ResourceParams")); -mapper.addRule(prefix + "/ResourceParams", - mapper.setProperties()); -mapper.addRule(prefix + "/ResourceParams", mapper.addChild - ("addResourceParams", -"org.apache.catalina.deploy.ResourceParams")); - mapper.addRule(prefix + "/ResourceParams/parameter", -mapper.methodSetter("addParameter", 2)); - mapper.addRule(prefix + "/ResourceParams/parameter/name", -mapper.methodParam(0)); - mapper.addRule(prefix + "/ResourceParams/parameter/value", -mapper.methodParam(1)); mapper.addRule(prefix + "/Ejb", mapper.objectCreate ("org.apache.catalina.deploy.ContextEjb")); @@ -557,6 +527,13 @@ mapper.addRule(prefix + "/Loader", mapper.addChild ("setLoader", "org.apache.catalina.Loader")); +mapper.addRule(prefix + "/Logger", mapper.objectCreate + (null, "className")); +mapper.addRule(prefix + "/Logger", + mapper.setProperties()); +mapper.addRule(prefix + "/Logger", mapper.addChild +