yoavs 2004/11/18 06:38:17
Modified: webapps/docs Tag: TOMCAT_5_0 changelog.xml
jasper2/src/share/org/apache/jasper Tag: TOMCAT_5_0
JspC.java
jasper2/src/share/org/apache/jasper/resources Tag:
TOMCAT_5_0 messages.properties
messages_es.properties messages_fr.properties
messages_ja.properties
Log:
Bugzilla 32257: add configurable file name extensions to JspC. Also updated
JspC usage messages.
Revision Changes Path
No revision
No revision
1.70.2.73 +6 -0 jakarta-tomcat-catalina/webapps/docs/changelog.xml
Index: changelog.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
retrieving revision 1.70.2.72
retrieving revision 1.70.2.73
diff -u -r1.70.2.72 -r1.70.2.73
--- changelog.xml 17 Nov 2004 20:06:35 -0000 1.70.2.72
+++ changelog.xml 18 Nov 2004 14:38:14 -0000 1.70.2.73
@@ -81,6 +81,12 @@
<update>
Exposed compilerSourceVM and compilerTargetVM options to JspC.
(yoavs)
</update>
+ <update>
+ <bug>32257</bug>: Added ability to customize JSP file extensions in
JspC. (yoavs)
+ </update>
+ <update>
+ Updated JspC usage messages to include recently added configurable
parameters. (yoavs)
+ </update>
</changelog>
</subsection>
No revision
No revision
1.80.2.4 +46 -6
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
Index: JspC.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.80.2.3
retrieving revision 1.80.2.4
diff -u -r1.80.2.3 -r1.80.2.4
--- JspC.java 22 Oct 2004 16:51:23 -0000 1.80.2.3
+++ JspC.java 18 Nov 2004 14:38:16 -0000 1.80.2.4
@@ -32,6 +32,7 @@
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -80,6 +81,7 @@
* @author Danno Ferrin
* @author Pierre Delisle
* @author Costin Manolache
+ * @author Yoav Shapira
*/
public class JspC implements Options {
@@ -112,6 +114,8 @@
private static final String SWITCH_DIE = "-die";
private static final String SWITCH_POOLING = "-poolingEnabled";
private static final String SWITCH_ENCODING = "-javaEncoding";
+ private static final String SWITCH_ADD_EXTENSION = "-addExtension";
+
private static final String SHOW_SUCCESS ="-s";
private static final String LIST_ERRORS = "-l";
private static final int NO_WEBXML = 0;
@@ -150,7 +154,13 @@
private String compilerSourceVM = "1.3";
private boolean classDebugInfo = true;
- private Vector extensions;
+
+ /**
+ * The file extensions to be handled as JSP files.
+ * Default list is .jsp and .jspx.
+ */
+ private List extensions;
+
private Vector pages = new Vector();
private boolean errorOnUseBeanInvalidClassAttribute = true;
@@ -283,6 +293,8 @@
setCompilerSourceVM(nextArg());
} else if (tok.equals(SWITCH_TARGET)) {
setCompilerTargetVM(nextArg());
+ } else if (tok.equals(SWITCH_ADD_EXTENSION)) {
+ addExtension(nextArg());
} else {
if (tok.startsWith("-")) {
throw new JasperException("Unrecognized option: " + tok +
@@ -538,6 +550,32 @@
classPath=s;
}
+ /**
+ * Returns the list of file extensions
+ * that are treated as JSP files.
+ *
+ * @return The list of extensions
+ */
+ public List getExtensions() {
+ return extensions;
+ }
+
+ /**
+ * Adds the given file extension to the
+ * list of extensions handled as JSP files.
+ *
+ * @param extension The extension to add, e.g. "myjsp"
+ */
+ public void addExtension(final String extension) {
+ if(extension != null) {
+ if(extensions == null) {
+ extensions = new Vector();
+ }
+
+ extensions.add(extension);
+ }
+ }
+
/**
* Base dir for the webapp. Used to generate class names and resolve
* includes
@@ -852,11 +890,13 @@
public void scanFiles( File base ) throws JasperException {
Stack dirs = new Stack();
dirs.push(base);
- if (extensions == null) {
- extensions = new Vector();
- extensions.addElement("jsp");
- extensions.addElement("jspx");
+
+ // Make sure default extensions are always included
+ if ((getExtensions() == null) || (getExtensions().size() < 2)) {
+ addExtension("jsp");
+ addExtension("jspx");
}
+
while (!dirs.isEmpty()) {
String s = dirs.pop().toString();
File f = new File(s);
@@ -871,7 +911,7 @@
String path = f2.getPath();
String uri = path.substring(uriRoot.length());
ext = files[i].substring(files[i].lastIndexOf('.')
+1);
- if (extensions.contains(ext) ||
+ if (getExtensions().contains(ext) ||
jspConfig.isJspPage(uri)) {
pages.addElement(path);
}
No revision
No revision
1.146.2.1 +7 -3
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages.properties
Index: messages.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages.properties,v
retrieving revision 1.146
retrieving revision 1.146.2.1
diff -u -r1.146 -r1.146.2.1
--- messages.properties 25 May 2004 21:28:40 -0000 1.146
+++ messages.properties 18 Nov 2004 14:38:16 -0000 1.146.2.1
@@ -227,6 +227,10 @@
\ -classpath <path> Overrides java.class.path system property\n\
\ -xpoweredBy Add X-Powered-By response header\n\
\ -trimSpaces Trim spaces in template text between actions,
directives\n\
+\ -javaEncoding <enc> Set the encoding charset for Java classes (default
UTF-8)\n\
+\ -source <version> Set the -source argument to the compiler (default
1.4)\n\
+\ -target <version> Set the -target argument to the compiler (default
1.4)\n\
+\ -addExtension <ext> Add a file extension for JSP processing, e.g
"myjsp"\n\
jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
\n\
@@ -234,7 +238,7 @@
\ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"\n\
\ "http://java.sun.com/dtd/web-app_2_3.dtd">\n\
<!--\n\
-Automatically created by Tomcat JspC.\n\
+Automatically created by Apache Jakarta Tomcat JspC.\n\
-->\n\
<web-app>\n\
\n
@@ -243,7 +247,7 @@
\n
jspc.webinc.header=\n\
<!--\n\
-Automatically created by Tomcat JspC.\n\
+Automatically created by Apache Jakarta Tomcat JspC.\n\
Place this fragment in the web.xml before all icon, display-name,\n\
description, distributable, and context-param elements.\n\
-->\n
1.50.2.1 +8 -3
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages_es.properties,v
retrieving revision 1.50
retrieving revision 1.50.2.1
diff -u -r1.50 -r1.50.2.1
--- messages_es.properties 25 May 2004 21:28:40 -0000 1.50
+++ messages_es.properties 18 Nov 2004 14:38:16 -0000 1.50.2.1
@@ -227,6 +227,11 @@
\ -ieplugin <clsid> Java Plugin classid para Internet Explorer\n\
\ -classpath <path> Pasa por alto la propiedad de sistema
java.class.path\n\
\ -xpoweredBy A�ade cabecera de respuesta X-Powered-By\n\
+\ -trimSpaces Trim spaces in template text between actions,
directives\n\
+\ -javaEncoding <enc> Set the encoding charset for Java classes (default
UTF-8)\n\
+\ -source <version> Set the -source argument to the compiler (default
1.4)\n\
+\ -target <version> Set the -target argument to the compiler (default
1.4)\n\
+\ -addExtension <ext> Add a file extension for JSP processing, e.g
"myjsp"\n\
jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
\n\
@@ -234,7 +239,7 @@
\ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"\n\
\ "http://java.sun.com/dtd/web-app_2_3.dtd">\n\
<!--\n\
-Creado automaticamente mediante Tomcat JspC.\n\
+Creado automaticamente mediante Apache Jakarta Tomcat JspC.\n\
-->\n\
<web-app>\n\
\n
@@ -243,7 +248,7 @@
\n
jspc.webinc.header=\n\
<!--\n\
-Creado automaticamente mediante Tomcat JspC.\n\
+Creado automaticamente mediante Apache Jakarta Tomcat JspC.\n\
Coloque este fragmento en el fichero web.xml antes de \n\
todos los elementos: icon, display-name, description, \n\
distributable y context-param .\n\
1.33.2.1 +8 -3
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages_fr.properties
Index: messages_fr.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages_fr.properties,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -r1.33 -r1.33.2.1
--- messages_fr.properties 25 May 2004 21:28:40 -0000 1.33
+++ messages_fr.properties 18 Nov 2004 14:38:16 -0000 1.33.2.1
@@ -181,6 +181,11 @@
\ -webxml <file> Cr�ation d''un fichier web.xml complet pour l''option
-webapp.\n\
\ -ieplugin <clsid> Le classid du Plugin Java Plugin pour Internet
Explorer\n\
\ -sax2 <driverclassname> Le nom de classe du Driver SAX 2.0 �
utiliser\n\
+\ -trimSpaces Trim spaces in template text between actions,
directives\n\
+\ -javaEncoding <enc> Set the encoding charset for Java classes (default
UTF-8)\n\
+\ -source <version> Set the -source argument to the compiler (default
1.4)\n\
+\ -target <version> Set the -target argument to the compiler (default
1.4)\n\
+\ -addExtension <ext> Add a file extension for JSP processing, e.g
"myjsp"\n\
jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
\n\
@@ -188,7 +193,7 @@
\ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"\n\
\ "http://java.sun.com/dtd/web-app_2_3.dtd">\n\
<!--\n\
-Cr�er automatiquement par le JspC Tomcat.\n\
+Cr�er automatiquement par le JspC Apache Jakarta Tomcat.\n\
-->\n\
<web-app>\n\
\n
@@ -197,7 +202,7 @@
\n
jspc.webinc.header=\n\
<!--\n\
-Cr�er automatiquement par le JspC Tomcat.\n\
+Cr�er automatiquement par le JspC Apache Jakarta Tomcat.\n\
Placez ce fragment dans le fichier web.xml avant all icon, display-name,\n\
description, distributable, and context-param elements.\n\
-->\n
1.53.2.2 +8 -3
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/Attic/messages_ja.properties,v
retrieving revision 1.53.2.1
retrieving revision 1.53.2.2
diff -u -r1.53.2.1 -r1.53.2.2
--- messages_ja.properties 31 Aug 2004 13:35:32 -0000 1.53.2.1
+++ messages_ja.properties 18 Nov 2004 14:38:16 -0000 1.53.2.2
@@ -224,6 +224,11 @@
\ -classpath <path>
java.class.path\u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u4e0a\u66f8\u304d\n\
\ -xpoweredBy
X-Powered-By\u30ec\u30b9\u30dd\u30f3\u30b9\u30d8\u30c3\u30c0\u306e\u8ffd\u52a0\n\
\ -trimSpaces
\u30a2\u30af\u30b7\u30e7\u30f3\u3084\u6307\u793a\u5b50\u306e\u9593\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30c6\u30ad\u30b9\u30c8\u4e2d\u306e\u30b9\u30da\u30fc\u30b9\u3092\u524a\u9664\n\
+\ -trimSpaces Trim spaces in template text between actions,
directives\n\
+\ -javaEncoding <enc> Set the encoding charset for Java classes (default
UTF-8)\n\
+\ -source <version> Set the -source argument to the compiler (default
1.4)\n\
+\ -target <version> Set the -target argument to the compiler (default
1.4)\n\
+\ -addExtension <ext> Add a file extension for JSP processing, e.g
"myjsp"\n\
jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
\n\
@@ -231,7 +236,7 @@
\ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"\n\
\ "http://java.sun.com/dtd/web-app_2_3.dtd">\n\
<!--\n\
-Automatically created by Tomcat JspC.\n\
+Automatically created by Apache Jakarta Tomcat JspC.\n\
-->\n\
<web-app>\n\
\n
@@ -240,7 +245,7 @@
\n
jspc.webinc.header=\n\
<!--\n\
-Automatically created by Tomcat JspC.\n\
+Automatically created by Apache Jakarta Tomcat JspC.\n\
Place this fragment in the web.xml before all icon, display-name,\n\
description, distributable, and context-param elements.\n\
-->\n
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]