kinman 2003/08/14 17:06:10 Modified: jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_fr.properties messages_ja.properties Log: - Spec has been changed to allow for include-prelude and include-coda in jsp-config. Revision Changes Path 1.65 +35 -17 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java Index: JspDocumentParser.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- JspDocumentParser.java 11 Aug 2003 21:11:07 -0000 1.64 +++ JspDocumentParser.java 15 Aug 2003 00:06:09 -0000 1.65 @@ -149,18 +149,6 @@ inStream, isTagFile, directivesOnly); - - // It's an error to have a prelude or a coda associated with - // a JSP document - if (!jspDocParser.pageInfo.getIncludePrelude().isEmpty()) { - String file = (String) jspDocParser.pageInfo.getIncludePrelude().get(0); - jspDocParser.err.jspError("jsp.error.prelude.xml", path, file); - } - if (!jspDocParser.pageInfo.getIncludeCoda().isEmpty()) { - String file = (String) jspDocParser.pageInfo.getIncludeCoda().get(0); - jspDocParser.err.jspError("jsp.error.coda.xml", path, file); - } - Node.Nodes pageNodes = null; try { @@ -171,8 +159,10 @@ dummyRoot.setJspConfigPageEncoding(jspConfigPageEnc); dummyRoot.setIsEncodingSpecifiedInProlog(isEncodingSpecifiedInProlog); jspDocParser.current = dummyRoot; - - if (parent != null) { + if (parent == null) { + jspDocParser.addInclude(dummyRoot, + jspDocParser.pageInfo.getIncludePrelude()); + } else { jspDocParser.isTop = false; } @@ -192,6 +182,11 @@ // Parse the input saxParser.parse(jspDocParser.inputSource, jspDocParser); + if (parent == null) { + jspDocParser.addInclude(dummyRoot, + jspDocParser.pageInfo.getIncludeCoda()); + } + // Create Node.Nodes from dummy root pageNodes = new Node.Nodes(dummyRoot); @@ -202,6 +197,29 @@ } return pageNodes; + } + + /* + * Processes the given list of included files. + * + * This is used to implement the include-prelude and include-coda + * subelements of the jsp-config element in web.xml + */ + private void addInclude(Node parent, List files) throws SAXException { + if (files != null) { + Iterator iter = files.iterator(); + while (iter.hasNext()) { + String file = (String) iter.next(); + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "file", "file", "CDATA", file); + + // Create a dummy Include directive node + Node includeDir = new Node.IncludeDirective(attrs, + null, // XXX + parent); + processIncludeDirective(file, includeDir); + } + } } /* 1.131 +1 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties Index: messages.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v retrieving revision 1.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- messages.properties 14 Aug 2003 21:16:52 -0000 1.130 +++ messages.properties 15 Aug 2003 00:06:09 -0000 1.131 @@ -388,8 +388,6 @@ jsp.error.variable.either.name=Either name-given or name-from-attribute attribute must be specified in a variable directive jsp.error.variable.both.name=Cannot specified both name-given or name-from-attribute attributes in a variable directive jsp.error.variable.alias=Both or none of the name-from-attribute and alias attributes can be specified in a variable directive -jsp.error.prelude.xml=The JSP document {0} has a prelude ({1}) associated with it -jsp.error.coda.xml=The JSP document {0} has a coda ({1}) associated with it jsp.error.attribute.null_name=Null attribute name jsp.error.jsptext.badcontent=\'<\', when appears in the body of <jsp:text>, must be encapsulated within a CDATA jsp.error.jsproot.version.invalid=Invalid version number: \"{0}\", must be \"1.2\" or \"2.0\" 1.44 +1 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties Index: messages_es.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- messages_es.properties 14 Aug 2003 21:16:52 -0000 1.43 +++ messages_es.properties 15 Aug 2003 00:06:10 -0000 1.44 @@ -252,8 +252,6 @@ jsp.error.variable.either.name= jsp.error.variable.both.name= jsp.error.variable.alias= -jsp.error.prelude.xml= -jsp.error.coda.xml= jsp.error.jsptext.badcontent= jsp.error.prefix.refined= jsp.error.jspoutput.conflict= 1.29 +1 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties Index: messages_fr.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- messages_fr.properties 14 Aug 2003 21:16:52 -0000 1.28 +++ messages_fr.properties 15 Aug 2003 00:06:10 -0000 1.29 @@ -289,8 +289,6 @@ jsp.error.variable.either.name= jsp.error.variable.both.name= jsp.error.variable.alias= -jsp.error.prelude.xml= -jsp.error.coda.xml= jsp.error.jsptext.badcontent= jsp.error.prefix.refined= jsp.error.jspoutput.conflict= 1.45 +1 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties Index: messages_ja.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- messages_ja.properties 14 Aug 2003 21:16:52 -0000 1.44 +++ messages_ja.properties 15 Aug 2003 00:06:10 -0000 1.45 @@ -344,8 +344,6 @@ jsp.error.variable.either.name=name-given\u307e\u305f\u306fname-from-attribute\u5c5e\u6027\u306e\u3069\u3061\u3089\u304b\u3092variable\u6307\u793a\u5b50\u306e\u4e2d\u3067\u6307\u5b9a\u3055\u308c\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093 jsp.error.variable.both.name=variable\u6307\u793a\u5b50\u4e2d\u3067name-given\u3068name-from-attribute\u5c5e\u6027\u306e\u4e21\u65b9\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093 jsp.error.variable.alias=name-from-attribute\u304a\u3088\u3073alias\u5c5e\u6027\u306e\u4e21\u65b9\u3092variable\u6307\u793a\u5b50\u4e2d\u306b\u6307\u5b9a\u3059\u308b\u3001\u307e\u305f\u306f\u3069\u3061\u3089\u3082\u6307\u5b9a\u3057\u306a\u3044\u3053\u3068\u304c\u3067\u304d\u307e\u3059 -jsp.error.prelude.xml=JSP\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 {0} \u306f\u305d\u308c\u306b\u95a2\u9023\u3057\u305f\u5c0e\u5165\u90e8 ({1}) \u3092\u6301\u3063\u3066\u3044\u307e\u3059 -jsp.error.coda.xml=JSP\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 {0} \u306f\u305d\u308c\u306b\u95a2\u9023\u3057\u305f\u7d42\u7d50\u90e8 ({1}) \u3092\u6301\u3063\u3066\u3044\u307e\u3059 jsp.error.prefix.refined= jsp.error.jspoutput.conflict= jsp.error.jspoutput.doctypenamesystem=
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]