Currently the default base class for a JSP is hardcoded into JspC. The base class can be overridden individually for each JSP, but there is no way to override the default (i.e. if you have your own standard custom base class). This patch adds:
1) a -jspservletbase XXX option to JspC commandling 2) a getJspServletBase() method onto the Options interface 3) an implementation of getJspServletBase() on JspC and EmbededServletOptions (doesn't Embedded have 2 d's?) that defaults to the original return value (Constants.JSP_SERVLET_BASE) 4) modification to JspParseEventListener to retrieve the JspServletBase from the Options in the constructor Mike
diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/EmbededServletOptions.java jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/EmbededServletOptions.java --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/EmbededServletOptions.java Mon Nov 12 21:02:50 2001 +++ +jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/EmbededServletOptions.java + Mon Feb 4 16:26:12 2002 @@ -133,6 +133,11 @@ */ public String jspCompilerPath = null; + /** + * The base class of the compiled JSP servlet. + */ + public String jspServletBase = null; + /** * Cache for the TLD locations */ @@ -209,6 +214,13 @@ return jspCompilerPath; } + /** + * Returns the base class of the compiled JSP servlet. + */ + public String getJspServletBase() { + return (jspServletBase == null) ? Constants.JSP_SERVLET_BASE : jspServletBase; + } + public TldLocationsCache getTldLocationsCache() { return tldLocationsCache; } @@ -318,6 +330,8 @@ } this.javaEncoding = config.getInitParameter("javaEncoding"); + + this.jspServletBase = config.getInitParameter("jspServletBase"); // Setup the global Tag Libraries location cache for this // web-application. diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/JspC.java jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/JspC.java --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/JspC.java Mon Nov 12 21:02:50 2001 +++ jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/JspC.java Mon +Feb 4 16:24:51 2002 @@ -106,6 +106,7 @@ public static final String SWITCH_WEBAPP_XML = "-webxml"; public static final String SWITCH_MAPPED = "-mapped"; public static final String SWITCH_DIE = "-die"; + public static final String SWITCH_JSP_SERVLET_BASE = "-jspservletbase"; public static final int NO_WEBXML = 0; public static final int INC_WEBXML = 10; @@ -129,6 +130,8 @@ //String classPath; + String jspServletBase; + String targetPackage; String targetClassName; @@ -215,6 +218,10 @@ return System.getProperty("java.class.path"); } + public String getJspServletBase() { + return (jspServletBase == null) ? Constants.JSP_SERVLET_BASE : +jspServletBase; + } + int argPos; // value set by beutifully obsfucscated java boolean fullstop = false; @@ -311,6 +318,8 @@ } } else if (tok.equals(SWITCH_MAPPED)) { mappedFile = true; + } else if (tok.equals(SWITCH_JSP_SERVLET_BASE)) { + jspServletBase = nextArg(); } else if (tok.startsWith(SWITCH_DIE)) { try { dieLevel = Integer.parseInt( diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/Options.java jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/Options.java --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/Options.java Mon Nov 12 21:02:50 2001 +++ jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/Options.java Mon +Feb 4 16:19:38 2002 @@ -142,4 +142,9 @@ * page servlet. */ public String getJavaEncoding(); + + /** + * Returns the base class for compiled JSP's. + */ + public String getJspServletBase(); } diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java Mon Nov 12 21:02:50 2001 +++ +jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java + Mon Feb 4 16:31:13 2002 @@ -103,7 +103,7 @@ JspCompilationContext ctxt; ParserController parserCtl; - String jspServletBase = Constants.JSP_SERVLET_BASE; + String jspServletBase; String serviceMethodName = Constants.SERVICE_METHOD_NAME; String servletContentType = Constants.SERVLET_CONTENT_TYPE; @@ -179,6 +179,8 @@ this.parserCtl = parserCtl; this.beanInfo = new BeanRepository(ctxt.getClassLoader()); this.libraries = new TagLibraries(ctxt.getClassLoader()); + + this.jspServletBase = ctxt.getOptions().getJspServletBase(); // FIXME: Is this good enough? (I'm just taking the easy way out - akv) if (ctxt.getOptions().getLargeFile()) Only in jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/compiler: JspParseEventListener.java.orig diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/resources/messages.properties jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/resources/messages.properties --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/resources/messages.properties Mon Nov 12 21:02:50 2001 +++ +jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/resources/messages.properties + Mon Feb 4 16:33:44 2002 @@ -173,6 +173,7 @@ \ -mapped Generate separate write() calls for each HTML line in the JSP\n\ \ -die[#] Generate an error return code (#) on fatal errors.\n\ \ If the number is absent or unparsable it defaults to 1.\n\ +\ -jspservletbase Sets the base class for compiled JSP's.\n\ \ -uribase <dir> The uri directory compilations shoule be relative to\n\ \ (Default is "/")\n\ \ -uriroot <dir> The root directory that uri files should be resolved\n\ diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/resources/messages_es.properties jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/resources/messages_es.properties --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/resources/messages_es.properties Mon Nov 12 21:02:50 2001 +++ +jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/resources/messages_es.properties + Mon Feb 4 16:33:58 2002 @@ -153,6 +153,7 @@ \ -mapped Genera llamadas separadas a write() para cada linea de HTML linea en el JSP\n\ \ -die[#] Generate an error return code (#) on fatal errors.\n\ \ If the number is absent or unparsable it defaults to 1.\n\ +\ -jspservletbase Sets the base class for compiled JSP's.\n\ \ -uribase <dir> The uri directorio compilations shoule be relative to\n\ \ (Default is "/")\n\ \ -uriroot <dir> The root directorio that uri files should be resolved\n\ diff -u -r -x *.class jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/resources/messages_ja.properties jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/resources/messages_ja.properties --- jakarta-tomcat-4.0.1-src-orig/jasper/src/share/org/apache/jasper/resources/messages_ja.properties Mon Nov 12 21:02:50 2001 +++ +jakarta-tomcat-4.0.1-src/jasper/src/share/org/apache/jasper/resources/messages_ja.properties + Mon Feb 4 16:34:08 2002 @@ -169,6 +169,7 @@ \ -mapped JSP\u306e\u5404HTML\u884c\u3054\u3068\u306bwrite()\u30b3\u30fc\u30eb\u3092\u751f\u6210\u3059\u308b\n\ \ -die[#] \u81f4\u547d\u7684\u30a8\u30e9\u30fc\u306b\u30a8\u30e9\u30fc\u30ea\u30bf\u30fc\u30f3\u30b3\u30fc\u30c9#\u3092\u751f\u6210\u3059\u308b\n\ \ \u6570\u5024\u304c\u6307\u5b9a\u3055\u308c\u306a\u3044\u304b\u3001\u89e3\u6790\u3067\u304d\u306a\u3044\u5834\u5408\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306f1\u3067\u3042\u308b\n\ +\ -jspservletbase Sets the base class for compiled JSP's.\n\ \ -uribase <dir> \u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u76f8\u5bfe\u7684\u306b\u304a\u3053\u306a\u308f\u308c\u308buri\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\n\ \ (\u30c7\u30d5\u30a9\u30eb\u30c8\u306f"/")\n\ \ -uriroot <dir> uri\u30d5\u30a1\u30a4\u30eb\u304c\u76f8\u5bfe\u7684\u306b\u89e3\u6790\u3055\u308c\u308b\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea,\n\
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>