cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_ja.properties
luehe 2002/06/26 09:50:38 Modified:jasper2/src/share/org/apache/jasper EmbededServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Generator.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_ja.properties Log: Added boolean context init parameter 'enablePooling', which determines whether tag handler pooling is turned on (true by default) Revision ChangesPath 1.8 +27 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java Index: EmbededServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- EmbededServletOptions.java20 Jun 2002 22:48:44 - 1.7 +++ EmbededServletOptions.java26 Jun 2002 16:50:37 - 1.8 @@ -100,7 +100,12 @@ * data being used literally in the generated servlet. */ public boolean largeFile = false; - + +/** + * Determines whether tag handler pooling is enabled. + */ +public boolean poolingEnabled = true; + /** * Do you want support for "mapped" files? This will generate * servlet that has a print statement per line of the JSP file. @@ -185,6 +190,10 @@ public boolean getLargeFile() { return largeFile; } + +public boolean isPoolingEnabled() { + return poolingEnabled; +} /** * Are we supporting HTML mapped servlets? @@ -274,7 +283,9 @@ * Create an EmbededServletOptions object using data available from * ServletConfig and ServletContext. */ -public EmbededServletOptions(ServletConfig config, ServletContext context) { +public EmbededServletOptions(ServletConfig config, + ServletContext context) { + Enumeration enum=config.getInitParameterNames(); while( enum.hasMoreElements() ) { String k=(String)enum.nextElement(); @@ -313,6 +324,17 @@ else if (mapFile.equalsIgnoreCase("false")) this.mappedFile = false; else Constants.message ("jsp.warning.mappedFile", Logger.WARNING); +} + + poolingEnabled = true; +String poolingEnabledParam + = config.getInitParameter("enablePooling"); +if (poolingEnabledParam != null + && !poolingEnabledParam.equalsIgnoreCase("true")) { +if (poolingEnabledParam.equalsIgnoreCase("false")) +this.poolingEnabled = false; +else Constants.message("jsp.warning.enablePooling", +Logger.WARNING); } String senderr = config.getInitParameter("sendErrToClient"); 1.12 +7 -3 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JspC.java 20 Jun 2002 22:49:54 - 1.11 +++ JspC.java 26 Jun 2002 16:50:38 - 1.12 @@ -205,6 +205,10 @@ return largeFile; } +public boolean isPoolingEnabled() { +return true; +} + /** * Are we supporting HTML mapped servlets? */ 1.6 +7 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java Index: Options.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Options.java 31 May 2002 05:13:13 - 1.5 +++ Options.java 26 Jun 2002 16:50:38 - 1.6 @@ -89,6 +89,10 @@ */ public boolean getLargeFile(); +/** + * Returns true if tag handler pooling is enabled, false otherwise. + */ +public boolean isPoolingEnabled(); /** * Are we supporting HTML mapped servlets? 1.34 +41 -22 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compi
cvs commit: jakarta-tomcat-4.0/catalina/src/conf web.xml
luehe 2002/06/26 09:56:00 Modified:catalina/src/conf web.xml Log: Added 'enablePooling' context init param to comment section Revision ChangesPath 1.38 +3 -0 jakarta-tomcat-4.0/catalina/src/conf/web.xml Index: web.xml === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/web.xml,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- web.xml 26 May 2002 00:02:42 - 1.37 +++ web.xml 26 Jun 2002 16:56:00 - 1.38 @@ -112,6 +112,9 @@ + + + -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/06/27 10:32:17 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Synchronize scripting variables at the appropriate places (where mandated by the spec). Revision ChangesPath 1.35 +58 -43 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- Generator.java26 Jun 2002 16:50:38 - 1.34 +++ Generator.java27 Jun 2002 17:32:17 - 1.35 @@ -1159,16 +1159,27 @@ } } + Class tagHandlerClass = handlerInfo.getTagHandlerClass(); + boolean implementsIterationTag = + IterationTag.class.isAssignableFrom(tagHandlerClass); + boolean implementsBodyTag = + BodyTag.class.isAssignableFrom(tagHandlerClass); + boolean implementsTryCatchFinally = + TryCatchFinally.class.isAssignableFrom(tagHandlerClass); + // Generate code for start tag, body, and end tag - generateCustomStart(n, handlerInfo, tagHandlerVar, tagEvalVar); + generateCustomStart(n, handlerInfo, tagHandlerVar, tagEvalVar, + implementsIterationTag, implementsBodyTag, + implementsTryCatchFinally); String tmpParent = parent; parent = tagHandlerVar; visitBody(n); parent = tmpParent; - generateCustomEnd(n, handlerInfo.getTagHandlerClass(), - tagHandlerVar, tagEvalVar); + generateCustomEnd(n, tagHandlerVar, tagEvalVar, + implementsIterationTag, implementsBodyTag, + implementsTryCatchFinally); if (n.isScriptless() && !n.hasScriptingVars()) { // Generate end of method @@ -1293,7 +1304,10 @@ private void generateCustomStart(Node.CustomTag n, TagHandlerInfo handlerInfo, String tagHandlerVar, - String tagEvalVar) + String tagEvalVar, + boolean implementsIterationTag, + boolean implementsBodyTag, + boolean implementsTryCatchFinally) throws JasperException { Class tagHandlerClass = handlerInfo.getTagHandlerClass(); @@ -1305,9 +1319,6 @@ out.printil("{"); out.pushIndent(); -boolean implementsTryCatchFinally = -TryCatchFinally.class.isAssignableFrom(tagHandlerClass); - // Declare scripting variables with NESTED scope declareNestedScriptingVariables(n); @@ -1348,11 +1359,11 @@ out.print(tagHandlerVar); out.println(".doStartTag();"); - boolean isBodyTag - = BodyTag.class.isAssignableFrom(tagHandlerClass); - - // Synchronize AT_BEGIN scripting variables - syncScriptingVariables(n, VariableInfo.AT_BEGIN); + // Synchronize AT_BEGIN and NESTED scripting variables + if (!implementsBodyTag) { + syncScriptingVariables(n, VariableInfo.AT_BEGIN); + syncScriptingVariables(n, VariableInfo.NESTED); + } if (n.getBody() != null) { out.printin("if ("); @@ -1360,7 +1371,7 @@ out.println(" != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {"); out.pushIndent(); - if (isBodyTag) { + if (implementsBodyTag) { out.printin("if ("); out.print(tagEvalVar); out.println(" != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {"); @@ -1374,48 +1385,51 @@ out.println(".setBodyContent(_bc);"); out.printin(tagHandlerVar); out.println(".doInitBody();"); + + // Synchronize AT_BEGIN and NESTED scripting variables + syncScriptingVariables(n, VariableInfo.AT_BEGIN); + syncScriptingVariables(n, VariableInfo.NESTED); out.popIndent(); out.printil("}"); } - if (IterationTag.class.isAssignableFrom(tagHandlerClass)) { + if (imp
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties
luehe 2002/07/08 10:28:58 Modified:jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties Log: Minor compliance fix and some resource bundle key fixes (Patch provided by Ryan Lubke) Revision ChangesPath 1.4 +12 -3 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JspDocumentParser.java20 Jun 2002 23:02:16 - 1.3 +++ JspDocumentParser.java8 Jul 2002 17:28:58 - 1.4 @@ -434,6 +434,15 @@ // get the uri String uri = attrs.getValue(i); + /* + * make sure that a relative path is prefixed with + * urn:jsptld:path + */ + if (uri.charAt(0) == '/') { + throw new JasperException( + err.getString("jsp.error.xml.taglib.uri.not_prefixed", + uri)); + } if (uri.startsWith(URN_JSPTLD)) { // uri value is of the form "urn:jsptld:path" uri = uri.substring(URN_JSPTLD.length()); 1.11 +12 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Validator.java20 Jun 2002 23:48:23 - 1.10 +++ Validator.java8 Jul 2002 17:28:58 - 1.11 @@ -138,14 +138,14 @@ if ("language".equals(attr)) { if (languageSeen) - err.jspError(n, "jsp.error.language.multiple"); + err.jspError(n, "jsp.error.page.multiple.language"); languageSeen = true; if (!"java".equalsIgnoreCase(value)) err.jspError(n, "jsp.error.language.nonjava"); pageInfo.setLanguage(value); } else if ("extends".equals(attr)) { if (extendsSeen) - err.jspError(n, "jsp.error.extends.multiple"); + err.jspError(n, "jsp.error.page.multiple.extends"); extendsSeen = true; pageInfo.setExtends(value); /* @@ -158,7 +158,7 @@ n.addImport(value); } else if ("contentType".equals(attr)) { if (contentTypeSeen) - err.jspError(n, "jsp.error.contentType.multiple"); + err.jspError(n, "jsp.error.page.multiple.contenttypes"); contentTypeSeen = true; pageInfo.setContentType(value); } else if ("session".equals(attr)) { @@ -173,7 +173,7 @@ err.jspError(n, "jsp.error.session.invalid"); } else if ("buffer".equals(attr)) { if (bufferSeen) - err.jspError(n, "jsp.error.buffer.multiple"); + err.jspError(n, "jsp.error.page.multiple.buffer"); bufferSeen = true; if ("none".equalsIgnoreCase(value)) @@ -192,7 +192,7 @@ } } else if ("autoFlush".equals(attr)) { if (autoFlushSeen) - err.jspError(n, "jsp.error.autoFlush.multiple"); + err.jspError(n, "jsp.error.page.multiple.autoflush"); autoFlushSeen = true; if ("true".equalsIgnoreCase(value)) pageInfo.setAutoFlush(true); @@ -202,7 +202,7 @@ err.jspError(n, "jsp.error.autoFlush.invalid"); } else if ("isthreadSafe".equals(attr)) { if (isThreadSafeSeen) - err.jspError(n, "jsp.error.isThreadSafe.multiple"); + err.jspError(n, "jsp.error.page.multiple.threadsafe"); isThreadSafeSeen = true; if
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Parser.java
luehe 2002/07/08 16:47:55 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java Log: Fixed Bug# 10126: NullPointerException when no uri defined in taglib directive Revision ChangesPath 1.7 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Parser.java 20 Jun 2002 20:12:26 - 1.6 +++ Parser.java 8 Jul 2002 23:47:55 - 1.7 @@ -348,11 +348,11 @@ Attributes attrs = parseAttributes(); String uri = attrs.getValue("uri"); String prefix = attrs.getValue("prefix"); - if (uri != null || prefix != null) { + if (uri != null && prefix != null) { // Errors to be checked in Validator String[] location = ctxt.getTldLocation(uri); TagLibraryInfo tl = new TagLibraryInfoImpl(ctxt, prefix, uri, -location, err); +location, err); taglibs.put(prefix, tl); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/16 13:40:11 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Convert expression to String (using String.valueOf(Object)), so they can be printed using Writer.write(String). Revision ChangesPath 1.37 +5 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- Generator.java16 Jul 2002 19:30:51 - 1.36 +++ Generator.java16 Jul 2002 20:40:11 - 1.37 @@ -810,7 +810,8 @@ public void visit(Node.Expression n) throws JasperException { n.setBeginJavaLine(out.getJavaLine()); - out.printil("out.write(" + new String(n.getText()) + ");"); + out.printil("out.write(String.valueOf(" + + new String(n.getText()) + "));"); n.setEndJavaLine(out.getJavaLine()); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/16 15:39:20 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Fixed infinite loop in fragment generation for . Revision ChangesPath 1.38 +7 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- Generator.java16 Jul 2002 20:40:11 - 1.37 +++ Generator.java16 Jul 2002 22:39:20 - 1.38 @@ -1689,10 +1689,7 @@ out.print(attributeValue(value, false, JspFragment.class, "null" )); } else { -// Parent node must be a CustomTag since -// isSimpleTagHandler is set to true. - generateJspFragment((Node.CustomTag)n.getParent(), -simpleTagHandlerVar); + generateJspFragment(n, simpleTagHandlerVar); } out.println(");"); } else { @@ -2377,7 +2374,7 @@ * Generates anonymous JspFragment inner class which is passed as an * argument to SimpleTag.setJspBody(). */ - private void generateJspFragment(Node parent, String tagHandlerVar) + private void generateJspFragment(Node n, String tagHandlerVar) throws JasperException { // XXX - A possible optimization here would be to check to see @@ -2387,10 +2384,10 @@ // body. The implementation of this fragment can come from // the org.apache.jasper.runtime package as a support class. int id = helperClassBuffer.getFragmentId(); -helperClassBuffer.openFragment( parent ); +helperClassBuffer.openFragment( n ); ServletWriter outSave = out; out = helperClassBuffer.getOut(); -visitBody( parent ); +visitBody( n ); out = outSave; helperClassBuffer.closeFragment(); // XXX - Need to change pageContext to jspContext if -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/16 17:35:31 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: escape \n when outputting params Revision ChangesPath 1.39 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- Generator.java16 Jul 2002 22:39:20 - 1.38 +++ Generator.java17 Jul 2002 00:35:30 - 1.39 @@ -1233,7 +1233,7 @@ escape( name ) + "\\\" value=\\\"\" + " + attributeValue( n.getValue(), false, String.class, "null" ) + " + \"\\\">\" );" ); -out.printil( "out.write(\"\n\");" ); +out.printil("out.write(\"\\n\");"); } else { // We want something of the form -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java Node.java Parser.java
luehe 2002/07/17 13:06:59 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java Node.java Parser.java Log: Do not declare tag handler pools for SimpleTag handlers. Revision ChangesPath 1.40 +43 -72 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- Generator.java17 Jul 2002 00:35:30 - 1.39 +++ Generator.java17 Jul 2002 20:06:58 - 1.40 @@ -196,15 +196,16 @@ * already contained in it. */ public void visit(Node.CustomTag n) throws JasperException { - - String name = createTagHandlerPoolName(n.getPrefix(), -n.getShortName(), -n.getAttributes()); - n.setTagHandlerPoolName(name); - if (!names.contains(name)) { - names.add(name); - } + if (!n.implementsSimpleTag()) { + String name = createTagHandlerPoolName(n.getPrefix(), +n.getShortName(), +n.getAttributes()); + n.setTagHandlerPoolName(name); + if (!names.contains(name)) { + names.add(name); + } + } visitBody(n); } @@ -1453,11 +1454,9 @@ TagHandlerInfo handlerInfo = (TagHandlerInfo) handlerInfosByShortName.get(n.getShortName()); if (handlerInfo == null) { - handlerInfo = new TagHandlerInfo( - n, - n.getTagInfo().getTagClassName(), - ctxt.getClassLoader(), - err); + handlerInfo = new TagHandlerInfo(n, + n.getTagHandlerClass(), + err); handlerInfosByShortName.put(n.getShortName(), handlerInfo); } @@ -1467,22 +1466,14 @@ String tagEvalVar = "_jspx_eval_" + baseVar; String tagHandlerVar = "_jspx_th_" + baseVar; - Class tagHandlerClass = handlerInfo.getTagHandlerClass(); - boolean implementsIterationTag = - IterationTag.class.isAssignableFrom(tagHandlerClass); - boolean implementsBodyTag = - BodyTag.class.isAssignableFrom(tagHandlerClass); - boolean implementsTryCatchFinally = - TryCatchFinally.class.isAssignableFrom(tagHandlerClass); - boolean implementsSimpleTag = - SimpleTag.class.isAssignableFrom(tagHandlerClass); + Class tagHandlerClass = n.getTagHandlerClass(); // If the tag contains no scripting element, generate its codes // to a method. ServletWriter outSave = null; MethodsBuffer methodsBufferSave = null; Node.ChildInfo ci = n.getChildInfo(); - if (implementsSimpleTag + if (n.implementsSimpleTag() || (ci.isScriptless() && !ci.hasScriptingVars())) { // The tag handler and its body code can reside in a separate // method if it is scriptless and does not have any scripting @@ -1532,17 +1523,14 @@ generateLocalVariables( out, n ); } - if (implementsSimpleTag) { - generateCustomDoTag(n, handlerInfo, tagHandlerVar, - implementsTryCatchFinally); + if (n.implementsSimpleTag()) { + generateCustomDoTag(n, handlerInfo, tagHandlerVar); } else { /* * Classic tag handler: Generate code for start element, body, * and end element */ - generateCustomStart(n, handlerInfo, tagHandlerVar, tagEvalVar, - implementsIterationTag, implementsBodyTag, - implementsTryCatchFinally); + generateCustomStart(n, handlerInfo, tagHandlerVar, tagEvalVar); // visit body String tmpParent = parent; @@ -1553,12 +1541,10 @@ parent = tmpParent; isSimpleTagHandler = tmpIsSimpleTagHandler; - generateCustomEnd(
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/17 14:13:38 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Fixed bug in JSP Fragment generation [PATCH by Mark Roth] Revision ChangesPath 1.41 +87 -38 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- Generator.java17 Jul 2002 20:06:58 - 1.40 +++ Generator.java17 Jul 2002 21:13:38 - 1.41 @@ -92,7 +92,7 @@ private ServletWriter out; private MethodsBuffer methodsBuffer; -private HelperClassBuffer helperClassBuffer; +private FragmentHelperClass fragmentHelperClass; private ErrorDispatcher err; private BeanRepository beanInfo; private JspCompilationContext ctxt; @@ -707,7 +707,7 @@ private ServletWriter out; private MethodsBuffer methodsBuffer; -private HelperClassBuffer helperClassBuffer; + private FragmentHelperClass fragmentHelperClass; private int methodNesting; /** @@ -715,11 +715,11 @@ */ public GenerateVisitor(ServletWriter out, MethodsBuffer methodsBuffer, -HelperClassBuffer helperClassBuffer ) +FragmentHelperClass fragmentHelperClass ) { this.out = out; this.methodsBuffer = methodsBuffer; -this.helperClassBuffer = helperClassBuffer; + this.fragmentHelperClass = fragmentHelperClass; methodNesting = 0; handlerInfos = new Hashtable(); tagVarNumbers = new Hashtable(); @@ -2362,18 +2362,19 @@ // generate a low-overhead JspFragment that just echoes its // body. The implementation of this fragment can come from // the org.apache.jasper.runtime package as a support class. -int id = helperClassBuffer.getFragmentId(); -helperClassBuffer.openFragment( n ); +FragmentHelperClass.Fragment fragment = +fragmentHelperClass.openFragment( n ); ServletWriter outSave = out; -out = helperClassBuffer.getOut(); + out = fragment.getMethodsBuffer().getOut(); visitBody( n ); out = outSave; -helperClassBuffer.closeFragment(); + fragmentHelperClass.closeFragment( fragment ); // XXX - Need to change pageContext to jspContext if // we're not in a place where pageContext is defined (e.g. // in a fragment or in a tag file. - out.print( "new " + helperClassBuffer.getClassName() + -"( " + id + ", pageContext, " + tagHandlerVar + ")" ); + out.print( "new " + fragmentHelperClass.getClassName() + +"( " + fragment.getId() + ", pageContext, " + +tagHandlerVar + ")" ); } /** @@ -2510,9 +2511,9 @@ out.print(methodsBuffer.toString()); // Append the helper class -if( helperClassBuffer.isUsed() ) { -helperClassBuffer.generatePostamble(); -out.print(helperClassBuffer.toString()); +if( fragmentHelperClass.isUsed() ) { +fragmentHelperClass.generatePostamble(); +out.printMultiLn(fragmentHelperClass.toString()); } // generate class definition for JspxState @@ -2533,7 +2534,7 @@ methodsBuffer = new MethodsBuffer(); err = compiler.getErrorDispatcher(); ctxt = compiler.getCompilationContext(); -helperClassBuffer = new HelperClassBuffer( + fragmentHelperClass = new FragmentHelperClass( ctxt.getServletClassName() + "Helper" ); pageInfo = compiler.getPageInfo(); beanInfo = pageInfo.getBeanRepository(); @@ -2557,9 +2558,9 @@ gen.compileTagHandlerPoolList(page); } gen.generatePreamble(page); -gen.helperClassBuffer.generatePreamble(); + gen.fragmentHelperClass.generatePreamble(); page.visit(gen.new GenerateVisitor(out, gen.methodsBuffer, -gen.helperClassBuffer)); +gen.fragmentHelperClass)); gen.generatePostamble(page); } @@ -2653,19 +2654,39 @@ } /** - * Keeps a separate buffer for helper classes. + * Keeps track of the generated Fragment Helper Class */ -private static class HelperClassBuffer -extends MethodsBuffer -{ +private static class Frag
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java Node.java
luehe 2002/07/18 14:17:27 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Node.java Log: Fixed Bug# 10670: Problem in JSP compilation Revision ChangesPath 1.42 +13 -54 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Generator.java17 Jul 2002 21:13:38 - 1.41 +++ Generator.java18 Jul 2002 21:17:27 - 1.42 @@ -1959,64 +1959,23 @@ } /* - * Declares any NESTED scripting variables of the given custom tag, - * if the given custom tag is not nested inside itself (i.e, has a - * nesting level of zero). If the custom tag does have a custom nesting - * level greater than 0, this method declares a scripting variable - * derived from the tag's "id" attribute (if present), only if its - * scope is NESTED and it does not match the "id" attribute of any of - * the enclosing tags of the same (custom) type. - * - * Additionally, a NESTED scripting variable is declared only if it - * has not already been declared in the same Java - * scope of the generated code, that is, if this custom tag's parent is - * different from the parent of the custom tag that may already have - * declared this variable. + * Declares any NESTED scripting variables of the given custom tag. */ private void declareNestedScriptingVariables(Node.CustomTag n) { - if (n.getCustomNestingLevel() > 0 && !n.hasUnnestedIdAttribute()) { - return; - } - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - if ((varInfos == null) && (tagVarInfos == null)) { + VariableInfo[] nestedVarInfos = n.getNestedVariableInfos(); + if ((nestedVarInfos == null) && (tagVarInfos == null)) { return; } - if (varInfos != null) { - if (n.getCustomNestingLevel() == 0) { - // Declare *any* scripting variables with NESTED scope - for (int i=0; i 0) { + nestedVarInfos = + (VariableInfo[]) vec.toArray(new VariableInfo[vec.size()]); + } } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java Node.java
luehe 2002/07/18 14:34:09 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Generator.java Node.java Log: Fixed Bug# 10670: Problem in JSP compilation Revision ChangesPath No revision No revision 1.35.2.1 +13 -54 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.35 retrieving revision 1.35.2.1 diff -u -r1.35 -r1.35.2.1 --- Generator.java27 Jun 2002 17:32:17 - 1.35 +++ Generator.java18 Jul 2002 21:34:08 - 1.35.2.1 @@ -1490,64 +1490,23 @@ } /* - * Declares any NESTED scripting variables of the given custom tag, - * if the given custom tag is not nested inside itself (i.e, has a - * nesting level of zero). If the custom tag does have a custom nesting - * level greater than 0, this method declares a scripting variable - * derived from the tag's "id" attribute (if present), only if its - * scope is NESTED and it does not match the "id" attribute of any of - * the enclosing tags of the same (custom) type. - * - * Additionally, a NESTED scripting variable is declared only if it - * has not already been declared in the same Java - * scope of the generated code, that is, if this custom tag's parent is - * different from the parent of the custom tag that may already have - * declared this variable. + * Declares any NESTED scripting variables of the given custom tag. */ private void declareNestedScriptingVariables(Node.CustomTag n) { - if (n.getCustomNestingLevel() > 0 && !n.hasUnnestedIdAttribute()) { - return; - } - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - if ((varInfos == null) && (tagVarInfos == null)) { + VariableInfo[] nestedVarInfos = n.getNestedVariableInfos(); + if ((nestedVarInfos == null) && (tagVarInfos == null)) { return; } - if (varInfos != null) { - if (n.getCustomNestingLevel() == 0) { - // Declare *any* scripting variables with NESTED scope - for (int i=0; i 0) { + nestedVarInfos = + (VariableInfo[]) vec.toArray(new VariableInfo[vec.size()]); + } } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties
luehe 2002/07/18 16:25:05 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch JspDocumentParser.java jasper2/src/share/org/apache/jasper/resources Tag: tomcat_4_branch messages.properties messages_es.properties Log: Undid patch for Bug 10291, which turned out to be not a bug Revision ChangesPath No revision No revision 1.4.2.1 +3 -12 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.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- JspDocumentParser.java8 Jul 2002 17:28:58 - 1.4 +++ JspDocumentParser.java18 Jul 2002 23:25:05 - 1.4.2.1 @@ -434,15 +434,6 @@ // get the uri String uri = attrs.getValue(i); - /* - * make sure that a relative path is prefixed with - * urn:jsptld:path - */ - if (uri.charAt(0) == '/') { - throw new JasperException( - err.getString("jsp.error.xml.taglib.uri.not_prefixed", - uri)); - } if (uri.startsWith(URN_JSPTLD)) { // uri value is of the form "urn:jsptld:path" uri = uri.substring(URN_JSPTLD.length()); No revision No revision 1.9.2.1 +1 -2 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.9 retrieving revision 1.9.2.1 diff -u -r1.9 -r1.9.2.1 --- messages.properties 8 Jul 2002 17:28:58 - 1.9 +++ messages.properties 18 Jul 2002 23:25:05 - 1.9.2.1 @@ -125,7 +125,6 @@ jsp.warning.unknown.element.in.TLD=Warning: Unknown element {0} in TLD jsp.warning.unknown.element.in.tag=Warning: Unknown element {0} in tag jsp.warning.unknown.element.in.attribute=Warning: Unknown element {0} in attribute -jsp.error.xml.taglib.uri.not_prefixed=The relative URI \"{0}\" must be prefixed by \"urn:jsptld:\" jsp.error.more.than.one.taglib=More than one taglib in the TLD: {0} jsp.warning.teiclass.is.null=Could not load TagExtraInfo class {0}: {1} jsp.warning.teiclass.is.nonnull=variable subelement defined in tld when TagExtraInfo class {0} is non-null 1.3.2.1 +1 -2 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.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- messages_es.properties8 Jul 2002 17:28:58 - 1.3 +++ messages_es.properties18 Jul 2002 23:25:05 - 1.3.2.1 @@ -106,7 +106,6 @@ jsp.warning.unknown.element.in.TLD=Aviso: Elemento {0} desconocido en el TLD jsp.warning.unknown.element.in.tag=Aviso: Elemento {0} desconocido en el tag jsp.warning.unknown.element.in.attribute=Aviso: Elemento {0} desconocido en el atributo -jsp.error.xml.taglib.uri.not_prefixed=El URI relativo {0} se debe prefijar por \"urn:jsptld:\" jsp.error.more.than.one.taglib=Mas de una libreria de tags en el TLD: {0} jsp.warning.teiclass.is.null=No se puedee cargar la clase TagExtraInfo llamada {0}: {1} jsp.error.parse.error.in.TLD=Error de analisis en el descriptor de libreria de tags: {0} -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java JspUtil.java PageDataImpl.java TagConstants.java TagLibraryInfoImpl.java
luehe 2002/07/22 16:02:55 Modified:jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java JspUtil.java PageDataImpl.java TagConstants.java TagLibraryInfoImpl.java Log: Added support for Tag File directives in Tag File Documents Revision ChangesPath 1.7 +34 -25 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- JspDocumentParser.java17 Jul 2002 20:06:58 - 1.6 +++ JspDocumentParser.java22 Jul 2002 23:02:55 - 1.7 @@ -183,21 +183,21 @@ Attributes attrsCopy = new AttributesImpl(attrs); Node node = null; - if (qName.equals(JSP_ROOT_TAG)) { + if (qName.equals(JSP_ROOT)) { node = new Node.JspRoot(attrsCopy, start, current); try { addCustomTagLibraries(attrsCopy); } catch (JasperException je) { throw new SAXException(je); } - } else if (qName.equals(JSP_PAGE_DIRECTIVE_TAG)) { + } else if (qName.equals(JSP_PAGE_DIRECTIVE)) { node = new Node.PageDirective(attrsCopy, start, current); String imports = attrs.getValue("import"); // There can only be one 'import' attribute per page directive if (imports != null) { ((Node.PageDirective) node).addImport(imports); } - } else if (qName.equals(JSP_INCLUDE_DIRECTIVE_TAG)) { + } else if (qName.equals(JSP_INCLUDE_DIRECTIVE)) { node = new Node.IncludeDirective(attrsCopy, start, current); String file = attrsCopy.getValue("file"); try { @@ -209,34 +209,42 @@ } catch (Exception e) { throw new SAXException(e); } - } else if (qName.equals(JSP_DECLARATION_TAG)) { + } else if (qName.equals(JSP_DECLARATION)) { node = new Node.Declaration(start, current); - } else if (qName.equals(JSP_SCRIPTLET_TAG)) { + } else if (qName.equals(JSP_SCRIPTLET)) { node = new Node.Scriptlet(start, current); - } else if (qName.equals(JSP_EXPRESSION_TAG)) { + } else if (qName.equals(JSP_EXPRESSION)) { node = new Node.Expression(start, current); - } else if (qName.equals(JSP_USE_BEAN_TAG)) { + } else if (qName.equals(JSP_USE_BEAN)) { node = new Node.UseBean(attrsCopy, start, current); - } else if (qName.equals(JSP_SET_PROPERTY_TAG)) { + } else if (qName.equals(JSP_SET_PROPERTY)) { node = new Node.SetProperty(attrsCopy, start, current); - } else if (qName.equals(JSP_GET_PROPERTY_TAG)) { + } else if (qName.equals(JSP_GET_PROPERTY)) { node = new Node.GetProperty(attrsCopy, start, current); - } else if (qName.equals(JSP_INCLUDE_TAG)) { + } else if (qName.equals(JSP_INCLUDE)) { node = new Node.IncludeAction(attrsCopy, start, current); - } else if (qName.equals(JSP_FORWARD_TAG)) { + } else if (qName.equals(JSP_FORWARD)) { node = new Node.ForwardAction(attrsCopy, start, current); - } else if (qName.equals(JSP_PARAM_TAG)) { + } else if (qName.equals(JSP_PARAM)) { node = new Node.ParamAction(attrsCopy, start, current); - } else if (qName.equals(JSP_PARAMS_TAG)) { + } else if (qName.equals(JSP_PARAMS)) { node = new Node.ParamsAction(start, current); - } else if (qName.equals(JSP_PLUGIN_TAG)) { + } else if (qName.equals(JSP_PLUGIN)) { node = new Node.PlugIn(attrsCopy, start, current); - } else if (qName.equals(JSP_TEXT_TAG)) { + } else if (qName.equals(JSP_TEXT)) { node = new Node.JspText(start, current); - } else if (qName.equals(JSP_BODY_TAG)) { + } else if (qName.equals(JSP_BODY)) { node = new Node.JspBody(attrsCopy, start, current); - } else if (qName.equals(JSP_ATTRIBUTE_TAG)) { + } else if (qName.equals(JSP_ATTRIBUTE)) { node = new Node.NamedAttribute(attrsCopy, start, current); + } else if (qName.equals(JSP_TAG_DIRECTIVE)) { + node = new Node.TagDirective(attrsCopy, start, current); + } else if (qName.equals(JSP_ATTRIBUTE_DIRECTIVE)) { + node = new Node.AttributeDirective(attrsCopy, start, current); + } else if (qName.equals(JSP_VARIABLE_DIRECTIVE)) { + node = new Node.VariableDirective(attrsCopy, start, current); + } else if (qName.equals(JSP_FRAGMENT_INPUT_DIRECTIVE)) { + node = new Node.FragmentInputDirec
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java ErrorDispatcher.java DefaultErrorHandler.java
luehe 2002/07/24 12:58:57 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java ErrorDispatcher.java DefaultErrorHandler.java Log: added error message for jsp.error.parse.xml.scripting.invalid.body error code + fixed NPE in ErrorDispatcher Revision ChangesPath 1.13 +2 -1 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.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- messages.properties 22 Jul 2002 20:35:27 - 1.12 +++ messages.properties 24 Jul 2002 19:58:57 - 1.13 @@ -231,6 +231,7 @@ jsp.error.no.more.content=End of content reached while more parsing required: tag nesting error? jsp.error.parse.xml=XML parsing error on file {0}: {1} jsp.error.parse.xml.line=XML parsing error on file {0}: (line {1}, col {2}): {3} +jsp.error.parse.xml.scripting.invalid.body=Body of {0} element must not contain any XML elements jsp.error.internal.tldinit=Exception initializing TldLocationsCache: {0} jsp.error.internal.filenotfound=Internal Error: File {0} not found jsp.error.internal.evaluator_not_found=Internal error: unable to load expression evaluator 1.8 +15 -7 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- JspDocumentParser.java22 Jul 2002 23:02:55 - 1.7 +++ JspDocumentParser.java24 Jul 2002 19:58:57 - 1.8 @@ -314,7 +314,7 @@ } if (current instanceof Node.ScriptingElement) { - checkScriptingBody(current.getBody()); + checkScriptingBody((Node.ScriptingElement) current); } if (current.getParent() != null) { @@ -495,18 +495,26 @@ * Ensures that the given body only contains nodes that are instances of * TemplateText. * - * This check is performed only for the body of a scripting (that is, a + * This check is performed only for the body of a scripting (that is: * declaration, scriptlet, or expression) element, after the end tag of a * scripting element has been reached. */ -private void checkScriptingBody(Node.Nodes body) throws SAXException { +private void checkScriptingBody(Node.ScriptingElement scriptingElem) + throws SAXException { + Node.Nodes body = scriptingElem.getBody(); if (body != null) { int size = body.size(); for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Node.java
luehe 2002/07/24 15:00:11 Modified:jasper2/src/share/org/apache/jasper/compiler Node.java Log: Added node types for and actions Revision ChangesPath 1.21 +41 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- Node.java 22 Jul 2002 20:35:27 - 1.20 +++ Node.java 24 Jul 2002 22:00:10 - 1.21 @@ -445,6 +445,34 @@ } /** + * Represents a tag file action + */ +public static class InvokeAction extends Node { + + public InvokeAction(Attributes attrs, Mark start, Node parent) { + super(attrs, start, parent); + } + + public void accept(Visitor v) throws JasperException { + v.visit(this); + } +} + +/** + * Represents a tag file action + */ +public static class DoBodyAction extends Node { + + public DoBodyAction(Attributes attrs, Mark start, Node parent) { + super(attrs, start, parent); + } + + public void accept(Visitor v) throws JasperException { + v.visit(this); + } +} + +/** * Represents a Jsp comment * Comments are kept for completeness. */ @@ -1592,6 +1620,16 @@ } public void visit(JspBody n) throws JasperException { +doVisit(n); +visitBody(n); +} + +public void visit(InvokeAction n) throws JasperException { +doVisit(n); +visitBody(n); +} + +public void visit(DoBodyAction n) throws JasperException { doVisit(n); visitBody(n); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspUtil.java
luehe 2002/07/24 18:04:44 Modified:jasper2/src/share/org/apache/jasper/compiler JspUtil.java Log: Removed JspUtil.replace(String name, char replace, char with) Revision ChangesPath 1.7 +3 -29 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java Index: JspUtil.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- JspUtil.java 22 Jul 2002 23:02:55 - 1.6 +++ JspUtil.java 25 Jul 2002 01:04:44 - 1.7 @@ -459,32 +459,6 @@ return buf.toString(); } -/** - * Replaces any occurrences of the character replace with the - * character with. - */ -public static String replace(String name, char replace, char with) { - StringBuffer buf = new StringBuffer(); - int begin = 0; - int end; - int last = name.length(); - - while (true) { - end = name.indexOf(replace, begin); - if (end < 0) { - end = last; - } - buf.append(name.substring(begin, end)); - if (end == last) { - break; - } - buf.append(with); - begin = end + 1; - } - - return buf.toString(); -} - public static class ValidAttribute { String name; boolean mandatory; -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/24 18:05:22 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: First shot at tag handler code generation for tag files Revision ChangesPath 1.44 +247 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- Generator.java19 Jul 2002 17:12:57 - 1.43 +++ Generator.java25 Jul 2002 01:05:22 - 1.44 @@ -865,7 +865,12 @@ // If any of the params have their values specified by // jsp:attribute, prepare those values first. -prepareParams( findJspBody( n ) ); + Node jspBody = findJspBody(n); + if (jspBody != null) { + prepareParams(jspBody); + } else { + prepareParams(n); + } out.printin("JspRuntimeLibrary.include(request, response, " + pageParam ); @@ -951,7 +956,12 @@ // If any of the params have their values specified by // jsp:attribute, prepare those values first. -prepareParams( findJspBody( n ) ); + Node jspBody = findJspBody(n); + if (jspBody != null) { + prepareParams(jspBody); + } else { + prepareParams(n); + } out.printin("pageContext.forward("); out.print( pageParam ); @@ -1684,6 +1694,87 @@ } } +public void visit(Node.InvokeAction n) throws JasperException { + + /** + * A visitor to handle in a + */ + class ParamVisitor extends Node.Visitor { + +public void visit(Node.ParamAction n) throws JasperException { + out.printin("params.put("); + out.print(n.getAttributeValue("name")); + out.print(", "); + out.print(attributeValue(n.getValue(), false, + String.class, "null")); + out.println(");"); + } + } + + // Assemble parameter map + out.printil("params = new java.util.HashMap();"); + if (n.getBody() != null) { + prepareParams(n); + n.getBody().visit(new ParamVisitor()); + } + + // Invoke fragment with parameter map + String getterMethodName + = getAccessorMethodName(n.getAttributeValue("fragment"), + true); + String varReader = n.getAttributeValue("varReader"); + if (varReader != null) { + out.printil("sout = new java.io.StringWriter();"); + out.printin(getterMethodName); + out.println("().invoke(sout, params);"); + } else { + out.printin(getterMethodName); + out.println("().invoke(null, params);"); + } + if (varReader != null) { + out.printin("jspContext.setAttribute(\""); + out.print(varReader); + out.print("\", new java.io.StringReader(sout.toString()));"); + // XXX evaluate scope + } + } + +public void visit(Node.DoBodyAction n) throws JasperException { + + /** + * A visitor to handle in a + */ + class ParamVisitor extends Node.Visitor { + +public void visit(Node.ParamAction n) throws JasperException { + out.printin("params.put("); + out.print(n.getAttributeValue("name")); + out.print(", "); + out.print(attributeValue(n.getValue(), false, + String.class, "null")); + out.println(");"); + } + } + + // Assemble parameter map + out.printil("params = new java.util.HashMap();"); + if (n.getBody() != null) { + prepareParams(n); + n.getBody().visit(new ParamVisitor()); + } + + // XXX Add scripting variables to parameter map + + // Invoke body with parameter map + String varReader = n.getAttributeValue("varReader"); + if (varReader != null) { + out.printil("sout =
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java Parser.java TagLibraryInfoImpl.java
luehe 2002/07/25 12:02:16 Modified:jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java Parser.java TagLibraryInfoImpl.java Log: Integrated TagFileProcessor into TagLibraryInfo constructor Revision ChangesPath 1.9 +5 -5 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JspDocumentParser.java24 Jul 2002 19:58:57 - 1.8 +++ JspDocumentParser.java25 Jul 2002 19:02:16 - 1.9 @@ -483,8 +483,8 @@ // get the location String[] location = ctxt.getTldLocation(uri); -tl = new TagLibraryInfoImpl(ctxt, prefix, uri, location, - err); +tl = new TagLibraryInfoImpl(ctxt, parserController, prefix, + uri, location, err); } taglibs.put(prefix, tl); } 1.12 +6 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Parser.java 22 Jul 2002 20:35:27 - 1.11 +++ Parser.java 25 Jul 2002 19:02:16 - 1.12 @@ -371,8 +371,9 @@ if (uri != null && prefix != null) { // Errors to be checked in Validator String[] location = ctxt.getTldLocation(uri); - TagLibraryInfo tl = new TagLibraryInfoImpl(ctxt, prefix, uri, -location, err); + TagLibraryInfo tl = new TagLibraryInfoImpl(ctxt, parserController, +prefix, uri, location, +err); taglibs.put(prefix, tl); } 1.5 +51 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java Index: TagLibraryInfoImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TagLibraryInfoImpl.java 22 Jul 2002 23:02:55 - 1.4 +++ TagLibraryInfoImpl.java 25 Jul 2002 19:02:16 - 1.5 @@ -81,13 +81,14 @@ * @author Kin-man Chung */ public class TagLibraryInfoImpl extends TagLibraryInfo { -static private final String TAGLIB_TLD = "META-INF/taglib.tld"; -static private final String WEB_XML = "/WEB-INF/web.xml"; -Hashtable jarEntries; +private static final String TAGLIB_TLD = "META-INF/taglib.tld"; +private static final String WEB_XML = "/WEB-INF/web.xml"; -JspCompilationContext ctxt; -ErrorDispatcher err; +private Hashtable jarEntries; +private JspCompilationContext ctxt; +private ErrorDispatcher err; +private ParserController parserController; private final void print(String name, String value, PrintWriter w) { if (value != null) { @@ -141,14 +142,19 @@ } -public TagLibraryInfoImpl(JspCompilationContext ctxt, String prefix, - String uriIn, String[] location, - ErrorDispatcher err) -throws JasperException { - +/** + * Constructor. + */ +public TagLibraryInfoImpl(JspCompilationContext ctxt, + ParserController pc, + String prefix, + String uriIn, + String[] location, + ErrorDispatcher err) throws JasperException { super(prefix, uriIn); this.ctxt = ctxt; + this.parserController = pc; this.err = err; ZipInputStream zin; InputStream in = null; @@ -275,6 +281,8 @@ this.tagLibraryValidator = createValidator(element); else if ("tag".equals(tname)) tagVector.addElement(createTagInfo(element)); +else if ("tag-file".equals(tname)) +tagVector.addElement(createTag
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java
luehe 2002/07/25 12:08:46 Modified:jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java Log: Removed java.lang.Exception from throws clause of TagFileProcessor.parseTagFile() Revision ChangesPath 1.2 +3 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TagFileProcessor.java 24 Jul 2002 22:38:43 - 1.1 +++ TagFileProcessor.java 25 Jul 2002 19:08:46 - 1.2 @@ -278,7 +278,7 @@ } public static TagInfo parseTagFile(ParserController pc, String tagfile) -throws FileNotFoundException, JasperException, Exception { +throws FileNotFoundException, JasperException { Node.Nodes page = pc.parse(tagfile); TagFileVisitor tagFileVisitor = new TagFileVisitor(pc.getCompiler()); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/07/25 15:28:46 Modified:jasper2/src/share/org/apache/jasper JspCompilationContext.java jasper2/src/share/org/apache/jasper/compiler Parser.java TagFileProcessor.java TagLibraryInfoImpl.java jasper2/src/share/org/apache/jasper/resources messages.properties Added: jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java Log: Added support for implicit tag libraries containing the tag handlers of tag files stored in a directory without a TLD file Revision ChangesPath 1.10 +12 -11 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java Index: JspCompilationContext.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JspCompilationContext.java24 Jul 2002 09:09:47 - 1.9 +++ JspCompilationContext.java25 Jul 2002 22:28:45 - 1.10 @@ -61,19 +61,16 @@ package org.apache.jasper; +import java.io.*; +import java.net.*; +import java.util.Set; +import javax.servlet.ServletContext; +import org.apache.jasper.compiler.JspRuntimeContext; import org.apache.jasper.compiler.JspReader; import org.apache.jasper.compiler.ServletWriter; -import java.io.IOException; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.MalformedURLException; import org.apache.jasper.compiler.Compiler; import org.apache.jasper.servlet.JspServletWrapper; import org.apache.jasper.servlet.JasperLoader; -import javax.servlet.ServletContext; -import org.apache.jasper.compiler.JspRuntimeContext; /** * A place holder for various things that are used through out the JSP @@ -233,6 +230,10 @@ public URL getResource(String res) throws MalformedURLException { return context.getResource(canonicalURI(res)); +} + +public Set getResourcePaths(String path) { +return context.getResourcePaths(canonicalURI(path)); } /** 1.13 +25 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Parser.java 25 Jul 2002 19:02:16 - 1.12 +++ Parser.java 25 Jul 2002 22:28:45 - 1.13 @@ -368,13 +368,28 @@ Attributes attrs = parseAttributes(); String uri = attrs.getValue("uri"); String prefix = attrs.getValue("prefix"); - if (uri != null && prefix != null) { - // Errors to be checked in Validator - String[] location = ctxt.getTldLocation(uri); - TagLibraryInfo tl = new TagLibraryInfoImpl(ctxt, parserController, -prefix, uri, location, -err); - taglibs.put(prefix, tl); + if (prefix != null) { + TagLibraryInfo tagLibInfo = null; + if (uri != null) { + // Errors to be checked in Validator + String[] location = ctxt.getTldLocation(uri); + tagLibInfo = new TagLibraryInfoImpl(ctxt, parserController, + prefix, uri, location, + err); + } else { + String tagdir = attrs.getValue("tagdir"); + if (tagdir != null) { + tagLibInfo = ImplicitTagLibraryInfo.getTabLibraryInfo( +ctxt, + parserController, + prefix, + tagdir, + err); + } + } + if (tagLibInfo != null) { + taglibs.put(prefix, tagLibInfo); + } } new Node.TaglibDirective(attrs, start, parent); 1.3 +12 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime TagHandlerPool.java
luehe 2002/07/26 16:21:39 Modified:jasper2/src/share/org/apache/jasper/runtime TagHandlerPool.java Log: Added Header, Revision, and Date CVS keywords Revision ChangesPath 1.2 +6 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/TagHandlerPool.java Index: TagHandlerPool.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/TagHandlerPool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TagHandlerPool.java 8 Jun 2002 00:16:45 - 1.1 +++ TagHandlerPool.java 26 Jul 2002 23:21:39 - 1.2 @@ -1,4 +1,10 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * + * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java
luehe 2002/07/26 16:21:00 Modified:jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java Log: Added Header, Revision, and Date CVS keywords Revision ChangesPath 1.3 +8 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java Index: ImplicitTagLibraryInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ImplicitTagLibraryInfo.java 26 Jul 2002 01:07:14 - 1.2 +++ ImplicitTagLibraryInfo.java 26 Jul 2002 23:21:00 - 1.3 @@ -1,4 +1,10 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * + * + * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights @@ -64,6 +70,8 @@ * Class responsible for generating an implicit tag library containing tag * handlers corresponding to the tag files in "/WEB-INF/tags/" or a * subdirectory of it. + * + * @author Jan Luehe */ public class ImplicitTagLibraryInfo extends TagLibraryInfo { -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/29 12:33:07 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Consider the tag directive attribute 'dynamic-attributes' in code generation for tag files Revision ChangesPath 1.47 +43 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- Generator.java26 Jul 2002 17:42:16 - 1.46 +++ Generator.java29 Jul 2002 19:33:07 - 1.47 @@ -2702,13 +2702,19 @@ // Generate class declaration out.printin("public class "); out.print(tagInfo.getTagName()); - out.print(" extends javax.servlet.jsp.tagext.SimpleTagSupport {"); + out.print(" extends javax.servlet.jsp.tagext.SimpleTagSupport"); + if (tagInfo.hasDynamicAttributes()) + out.print(" implements javax.servlet.jsp.tagext.DynamicAttributes"); + out.print(" {"); out.pushIndent(); // Class body begins here generateTagHandlerDeclarations(tagInfo); + if (tagInfo.hasDynamicAttributes()) + generateSetDynamicAttribute(); + out.printil("public int doTag() throws JspException {"); out.pushIndent(); // Declare parameter map for fragment/body invocation @@ -2747,11 +2753,13 @@ private void generateTagHandlerDeclarations(TagInfo tagInfo) throws JasperException { - TagAttributeInfo[] attrInfos; - TagFragmentAttributeInfo[] fragAttrInfos; + if (tagInfo.hasDynamicAttributes()) { + out.printil("HashMap dynamicAttrs = new java.util.HashMap();"); + } - attrInfos = tagInfo.getAttributes(); - fragAttrInfos = tagInfo.getFragmentAttributes(); + TagAttributeInfo[] attrInfos = tagInfo.getAttributes(); + TagFragmentAttributeInfo[] fragAttrInfos + = tagInfo.getFragmentAttributes(); // Declare "normal" attributes if (attrInfos != null) { @@ -2841,7 +2849,23 @@ } /* - * Creates a page-scoped variable for each tag attribute declared. + * Generates implementation of + * javax.servlet.jsp.tagext.DynamicAttributes.setDynamicAttribute() method, + * which saves each dynamic attribute that is passed in so that a scoped + * variable can later be created for it. + */ +public void generateSetDynamicAttribute() { +out.printil("public void setDynamicAttribute(String uri, String localName, Object value) throws AttributeNotSupportedException {"); + out.pushIndent(); + out.printil("dynamicAttrs.put(localName, value);"); + out.popIndent(); + out.printil("}"); +} + +/* + * Creates a page-scoped variable for each declared tag attribute. + * Also, if the tag accepts dynamic attributes, a page-scoped variable + * is made available for each dynamic attribute that was passed in. */ private void generatePageScopedVariables(TagInfo tagInfo) { @@ -2870,6 +2894,16 @@ out.print(toUpperCaseFirstChar(attrName)); out.println("());"); } + } + + // dynamic attributes + if (tagInfo.hasDynamicAttributes()) { + out.printil("for (Iterator i = dynamicAttrs.entrySet().iterator(); i.hasNext(); ) {"); + out.pushIndent(); + out.printil("Map.Entry e = (Map.Entry) i.next();"); + out.printil("this.jspContext.setAttribute(e.getKey(), e.getValue());"); + out.popIndent(); + out.printil("}"); } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/07/29 15:29:01 Modified:jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java Parser.java ParserController.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Reject tag-file related actions when parsing JSP document, and reject page directive when parsing tag file document. Revision ChangesPath 1.10 +51 -18 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JspDocumentParser.java25 Jul 2002 19:02:16 - 1.9 +++ JspDocumentParser.java29 Jul 2002 22:29:01 - 1.10 @@ -91,42 +91,34 @@ = "http://xml.org/sax/properties/lexical-handler";; private ParserController parserController; - -// XXX -private JspCompilationContext ctxt; - +private JspCompilationContext ctxt; // XML document source private InputSource inputSource; - -// XXX private String path; - // Node representing the XML element currently being parsed private Node current; - // Document locator private Locator locator; - -// XXX private Hashtable taglibs; - // Flag indicating whether we are inside DTD declarations private boolean inDTD; - private ErrorDispatcher err; +private boolean isTagFile; /* * Constructor */ public JspDocumentParser(ParserController pc, String path, - InputStreamReader reader) { + InputStreamReader reader, + boolean isTagFile) { this.parserController = pc; this.ctxt = pc.getJspCompilationContext(); this.taglibs = pc.getCompiler().getPageInfo().getTagLibraries(); this.err = pc.getCompiler().getErrorDispatcher(); this.path = path; this.inputSource = new InputSource(reader); + this.isTagFile = isTagFile; } /* @@ -137,8 +129,10 @@ public static Node.Nodes parse(ParserController pc, String path, InputStreamReader reader, -Node parent) throws JasperException { - JspDocumentParser handler = new JspDocumentParser(pc, path, reader); +Node parent, +boolean isTagFile) throws JasperException { + JspDocumentParser handler = new JspDocumentParser(pc, path, reader, + isTagFile); handler.current = parent; Node.Nodes pageNodes = null; @@ -191,6 +185,11 @@ throw new SAXException(je); } } else if (qName.equals(JSP_PAGE_DIRECTIVE)) { + if (isTagFile) { + throw new SAXParseException( + err.getString("jsp.error.action.istagfile", qName), + locator); + } node = new Node.PageDirective(attrsCopy, start, current); String imports = attrs.getValue("import"); // There can only be one 'import' attribute per page directive @@ -238,13 +237,47 @@ } else if (qName.equals(JSP_ATTRIBUTE)) { node = new Node.NamedAttribute(attrsCopy, start, current); } else if (qName.equals(JSP_TAG_DIRECTIVE)) { + if (!isTagFile) { + throw new SAXParseException( + err.getString("jsp.error.action.isnottagfile", qName), + locator); + } node = new Node.TagDirective(attrsCopy, start, current); } else if (qName.equals(JSP_ATTRIBUTE_DIRECTIVE)) { + if (!isTagFile) { + throw new SAXParseException( + err.getString("jsp.error.action.isnottagfile", qName), + locator); + } node = new Node.AttributeDirective(attrsCopy, start, current); } else if (qName.equals(JSP_VARIABLE_DIRECTIVE)) { + if (!isTagFile) { + throw new SAXParseException( + err.getString("jsp.error.action.isnottagfile", qName), + locator); + } node = new Node.VariableDirective(attrsCopy, start, current); } else if (qName.equals(JSP_FRAGMENT_INPUT_DIRECTIVE)) { + if (!isTagFile) { + throw new SAXParseException(
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/29 16:17:49 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Add AT_BEGIN and NESTED scripting vars to parameter map for body fragment invocation Revision ChangesPath 1.48 +80 -48 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Generator.java29 Jul 2002 19:33:07 - 1.47 +++ Generator.java29 Jul 2002 23:17:49 - 1.48 @@ -705,22 +705,23 @@ private String parent; private String simpleTagHandlerVar; private boolean isSimpleTagHandler; - private ServletWriter out; private MethodsBuffer methodsBuffer; private FragmentHelperClass fragmentHelperClass; private int methodNesting; + private TagInfo tagInfo; /** * Constructor. */ public GenerateVisitor(ServletWriter out, -MethodsBuffer methodsBuffer, -FragmentHelperClass fragmentHelperClass ) -{ +MethodsBuffer methodsBuffer, +FragmentHelperClass fragmentHelperClass, +TagInfo tagInfo) { this.out = out; this.methodsBuffer = methodsBuffer; this.fragmentHelperClass = fragmentHelperClass; + this.tagInfo = tagInfo; methodNesting = 0; handlerInfos = new Hashtable(); tagVarNumbers = new Hashtable(); @@ -1722,13 +1723,11 @@ String varReader = n.getAttributeValue("varReader"); if (varReader != null) { out.printil("sout = new java.io.StringWriter();"); - out.printin("get"); - out.print(toUpperCaseFirstChar(n.getAttributeValue("fragment"))); - out.println("().invoke(sout, params);"); + out.print(toGetterMethod(n.getAttributeValue("fragment"))); + out.println(".invoke(sout, params);"); } else { - out.printin("get"); - out.print(toUpperCaseFirstChar(n.getAttributeValue("fragment"))); - out.println("().invoke(null, params);"); + out.print(toGetterMethod(n.getAttributeValue("fragment"))); + out.println(".invoke(null, params);"); } // Store varReader in appropriate scope @@ -1769,7 +1768,31 @@ n.getBody().visit(new ParamVisitor()); } - // XXX Add scripting variables to parameter map + // Add AT_BEGIN and NESTED scripting variables to parameter map + TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); + if (tagVars != null) { + for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime ExpressionEvaluatorImpl.java ExpressionEvaluatorManager.java JspRuntimeLibrary.java
luehe 2002/07/30 15:41:37 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspUtil.java jasper2/src/share/org/apache/jasper/runtime ExpressionEvaluatorImpl.java ExpressionEvaluatorManager.java JspRuntimeLibrary.java Log: Made changes to comply with new signature of javax.servlet.jsp.el.ExpressionEvaluator.evaluate() Revision ChangesPath 1.49 +40 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- Generator.java29 Jul 2002 23:17:49 - 1.48 +++ Generator.java30 Jul 2002 22:41:37 - 1.49 @@ -410,6 +410,9 @@ // Static data for EL function maps: generateELFunctionMap(); +// Static data for EL function maps: + generatePrefixMap(); + // Class variable declarations /* @@ -652,6 +655,34 @@ } /* + * Generates prefix map section. + * The prefix map is a map with keys containing prefixes and values being + * the URI corresponding to that prefix in the taglib machinery. + */ +private void generatePrefixMap() throws JasperException { +Hashtable taglibs = pageInfo.getTagLibraries(); +Iterator iter = taglibs.keySet().iterator(); + +out.printil("private static java.util.HashMap _jspx_prefix_map = null;"); + iter = taglibs.keySet().iterator(); + out.println(); + out.printil("static {"); + out.pushIndent(); + out.printil("_jspx_prefix_map = new java.util.HashMap();"); + while (iter.hasNext()) { + String key = (String) iter.next(); + TagLibraryInfo tli = (TagLibraryInfo) taglibs.get(key); + out.printin("_jspx_prefix_map.put("); + out.print(quote(tli.getPrefixString())); + out.print(", "); + out.print(quote(tli.getURI())); + out.println(");"); +} + out.popIndent(); + out.printil("}"); +} + +/* * Generates the servlet constructor. */ private void generateServletConstructor(String servletClassName) { @@ -753,7 +784,8 @@ if (attr.isExpression() || attr.isELInterpreterInput()) { if (attr.isELInterpreterInput()) { v = JspUtil.interpreterCall( attr.getValue(), -expectedType, "_jspx_fnmap", defaultPrefix ); +expectedType, "_jspx_prefix_map", "_jspx_fnmap", + defaultPrefix ); } if (encode) { return "java.net.URLEncoder.encode(" + v + ")"; @@ -831,7 +863,7 @@ "out.write(" + JspUtil.interpreterCall( "${" + new String(n.getText()) + "}", String.class, - "_jspx_fnmap", "null" ) + "_jspx_prefix_map", "_jspx_fnmap", "null" ) + ");"); } else { out.printil("out.write(" + @@ -1042,7 +1074,7 @@ "pageContext.findAttribute(\"" + name + "\"), \"" + property + "\", " + quote(value.getValue()) + ", " -+ "pageContext, _jspx_fnmap);"); ++ "pageContext, _jspx_prefix_map, _jspx_fnmap);"); } else if( value.isNamedAttribute() ) { // If the value for setProperty was specified via // jsp:attribute, first generate code to evaluate @@ -2361,7 +2393,8 @@ } else if (attrs[i].isELInterpreterInput()) { // run attrValue through the expression interpreter attrValue = JspUtil.interpreterCall( attrValue, -c[0], "_jspx_fnmap", n.getPrefix() ); +c[0], "_jspx_prefix_map", "_jspx_fnmap", +n.getPrefix() ); } else { attrValue = convertString( c[0], attrValue, attrName, 1.8 +5 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/30 15:53:38 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: When making a dynamic attribute available as a page scoped variable, use _ (if is passed in) or just (otherwise) as the variable name. Revision ChangesPath 1.50 +10 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- Generator.java30 Jul 2002 22:41:37 - 1.49 +++ Generator.java30 Jul 2002 22:53:38 - 1.50 @@ -2910,7 +2910,14 @@ public void generateSetDynamicAttribute() { out.printil("public void setDynamicAttribute(String uri, String localName, Object value) throws AttributeNotSupportedException {"); out.pushIndent(); + out.printil("if (uri != null)"); + out.pushIndent(); + out.printil("dynamicAttrs.put(uri + \"_\" + localName, value);"); + out.popIndent(); + out.printil("else"); + out.pushIndent(); out.printil("dynamicAttrs.put(localName, value);"); + out.popIndent(); out.popIndent(); out.printil("}"); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_ja.properties
luehe 2002/07/31 09:04:39 Modified:jasper2/src/share/org/apache/jasper/compiler Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_ja.properties Log: Replaced call to TagExtraInfo.isValid() with the new TagExtraInfo.validate(), as required by JSP 2.0. Revision ChangesPath 1.15 +22 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Validator.java22 Jul 2002 20:35:27 - 1.14 +++ Validator.java31 Jul 2002 16:04:39 - 1.15 @@ -837,9 +837,25 @@ err.jspError(n, "jsp.error.missing.tagInfo", n.getName()); } - if (!tagInfo.isValid(n.getTagData())) { - err.jspError(n, "jsp.error.invalid.attributes"); - } + ValidationMessage[] errors = tagInfo.validate(n.getTagData()); +if (errors != null && errors.length != 0) { + StringBuffer errMsg = new StringBuffer(); +errMsg.append(""); +errMsg.append(err.getString("jsp.error.tei.invalid.attributes", + n.getName())); +errMsg.append(""); +for (int i=0; i"); + if (errors[i].getId() != null) { + errMsg.append(errors[i].getId()); + errMsg.append(": "); + } +errMsg.append(errors[i].getMessage()); +errMsg.append(""); +} + + err.jspError(n, errMsg.toString()); +} visitBody(n); } 1.19 +3 -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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- messages.properties 29 Jul 2002 22:29:01 - 1.18 +++ messages.properties 31 Jul 2002 16:04:39 - 1.19 @@ -160,7 +160,6 @@ jsp.error.unable.to_find_method=Unable to find setter method for attribute: {0} jsp.error.unable.to_convert_string=Unable to convert a String to {0} for attribute {1} jsp.error.unable.to_introspect=Unable to introspect on tag handler class: {0} because of {1} -jsp.error.invalid_attributes=Attributes are invalid according to TagInfo jsp.error.bad_tag=No such tag {0} in the tag library imported with prefix {1} jsp.error.bad_string_Character=Cannot extract a Character from a zero length array jsp.error.bad_string_char=Cannot extract a char from a zero length array @@ -225,7 +224,8 @@ jspc.error.emptyWebApp=-webapp requires a trailing file argument jsp.error.library.invalid=JSP page is invalid according to library {0}: {1} jsp.warning.tlvclass.is.null=Could not load TagLibraryValidator class {0}: {1} -jsp.error.taglibraryvalidator.invalidpage=Validation error messages from tag library {0} +jsp.error.tlv.invalid.page=Validation error messages from TagLibraryValidator for {0} +jsp.error.tei.invalid.attributes=Validation error messages from TagExtraInfo for {0} jsp.parser.sax.propertynotsupported=SAX property not supported: {0} jsp.parser.sax.propertynotrecognized=SAX property not recognized: {0} jsp.parser.sax.featurenotsupported=SAX feature not supported: {0} 1.4 +4 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- messages_es.properties8 Jul 2002 17:28:58 - 1.3 +++ messages_es.properties31 Jul 2002 16:04:39 - 1.4 @@ -133,7 +133,6 @@ jsp.error.unable.to_load_taghandler_class=No se puede cargar clase manejadora {0} del tag acausa de {1} jsp.error.unable.to_find_method=No se puede encontrar el metodo de escritura para el atributo: {0} jsp.error.unable.to_introspect=No se puede introspect on tag handler clase: {0} a causa de {1} -jsp.error.invalid_attributes=Los atributos no son validos de acuerdo con Tag
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java
luehe 2002/07/31 15:46:27 Modified:jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java Log: Supply name parameter to TagFileProcessor.parseTagFile() Revision ChangesPath 1.4 +8 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java Index: ImplicitTagLibraryInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ImplicitTagLibraryInfo.java 26 Jul 2002 23:21:00 - 1.3 +++ ImplicitTagLibraryInfo.java 31 Jul 2002 22:46:27 - 1.4 @@ -119,9 +119,11 @@ tldFile = path; break; } else if (path.endsWith(".tag")) { - tagVector.addElement(TagFileProcessor.parseTagFile(pc, -path, -this)); + tagVector.addElement( +TagFileProcessor.parseTagFile(pc, + shortname, + path, + this)); } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/31 16:04:47 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Added note that JSP 2.0 spec still needs to clarify what the variable name for a dynamic attribute looks like Revision ChangesPath 1.52 +5 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- Generator.java31 Jul 2002 21:42:27 - 1.51 +++ Generator.java31 Jul 2002 23:04:47 - 1.52 @@ -2907,6 +2907,8 @@ out.pushIndent(); out.printil("if (uri != null)"); out.pushIndent(); + // XXX Specification still needs to clarify what the variable name + // looks like. Assume _ for now. out.printil("dynamicAttrs.put(uri + \"_\" + localName, value);"); out.popIndent(); out.printil("else"); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java TagFileProcessor.java
luehe 2002/07/31 16:45:50 Modified:jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java TagFileProcessor.java Log: Modified implicit taglibrary generator to populate new "tagFiles" field in TagLibraryInfo Revision ChangesPath 1.5 +22 -14 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java Index: ImplicitTagLibraryInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ImplicitTagLibraryInfo.java 31 Jul 2002 22:46:27 - 1.4 +++ ImplicitTagLibraryInfo.java 31 Jul 2002 23:45:50 - 1.5 @@ -63,6 +63,7 @@ import java.util.*; import javax.servlet.jsp.tagext.TagLibraryInfo; import javax.servlet.jsp.tagext.TagInfo; +import javax.servlet.jsp.tagext.TagFileInfo; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.JasperException; @@ -101,7 +102,8 @@ err.jspError("jsp.error.invalid.tagdir", tagdir); } - // Determine the value of the element + // Determine the value of the subelement of the + // "imaginary" element if (tagdir.equals(WEB_INF_TAGS)) { shortname = TAGS_SHORTNAME; } else { @@ -111,24 +113,30 @@ Set dirList = ctxt.getResourcePaths(tagdir); if (dirList != null) { - Vector tagVector = new Vector(); + Vector vec = new Vector(); Iterator it = dirList.iterator(); while (it.hasNext()) { String path = (String) it.next(); - if (path.endsWith(".tld")) { + if (path.endsWith(TLD_SUFFIX)) { tldFile = path; break; - } else if (path.endsWith(".tag")) { - tagVector.addElement( -TagFileProcessor.parseTagFile(pc, - shortname, - path, - this)); + } else if (path.endsWith(TAG_FILE_SUFFIX)) { + // use the filename of the tag file, without the .tag + // extension, as the subelement of the "imaginary" + // element + String tagName = path.substring(path.lastIndexOf("/") + 1); + tagName = tagName.substring(0, + tagName.lastIndexOf(TAG_FILE_SUFFIX)); + TagInfo tagInfo = TagFileProcessor.parseTagFile(pc, + tagName, + path, + this); + vec.addElement(new TagFileInfo(tagName, path, tagInfo)); } } - tags = new TagInfo[tagVector.size()]; - tagVector.copyInto (this.tags); + this.tagFiles = new TagFileInfo[vec.size()]; + vec.copyInto(this.tagFiles); } } 1.6 +6 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TagFileProcessor.java 31 Jul 2002 21:42:27 - 1.5 +++ TagFileProcessor.java 31 Jul 2002 23:45:50 - 1.6 @@ -311,8 +311,9 @@ * handler that it represents is referenced. The tag file is not compiled * here. * @param pc the current ParserController used in this compilation - * @param tagile the path for the tagfile - * @param tagLibInfo the TaglibraryInfo object associated with this TagInfo + * @param name the tag name as specified in the TLD + * @param tagfile the path for the tagfile + * @param tagLibInfo the TagLibraryInfo object associated with this TagInfo * @return a TagInfo object assembled from the directives in the tag file. */ public static TagInfo parseTagFile(ParserController pc, @@ -321,7 +322,6 @@ TagLibraryInfo tagLibInfo) throws JasperException { - Node.Nodes page = null; try { page = pc.parse(tagfile); @@ -342,7 +342
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/31 17:32:29 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: fixed some compilation errors in generated tag handler file Revision ChangesPath 1.53 +16 -11 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- Generator.java31 Jul 2002 23:04:47 - 1.52 +++ Generator.java1 Aug 2002 00:32:29 - 1.53 @@ -1815,13 +1815,13 @@ out.print(name); out.print(", jspContext.getAttribute("); out.print(name); - out.println(");"); + out.println("));"); } else { String getter = toGetterMethod(tagVars[i].getNameFromAttribute()); out.print(getter); out.print(", jspContext.getAttribute("); out.print(getter); - out.println(");"); + out.println("));"); } } } @@ -2757,7 +2757,8 @@ out.print(" extends javax.servlet.jsp.tagext.SimpleTagSupport"); if (tagInfo.hasDynamicAttributes()) out.print(" implements javax.servlet.jsp.tagext.DynamicAttributes"); - out.print(" {"); + out.println(" {"); + out.println(); out.pushIndent(); // Class body begins here @@ -2767,14 +2768,14 @@ if (tagInfo.hasDynamicAttributes()) generateSetDynamicAttribute(); - out.printil("public int doTag() throws JspException {"); + out.printil("public int doTag() throws javax.servlet.jsp.JspException {"); out.pushIndent(); // Declare parameter map for fragment/body invocation - out.println("java.util.Map params = null;"); + out.printil("java.util.Map params = null;"); // Declare writer used for storing result of fragment/body invocation // if 'varReader' attribute is specified - out.println("java.io.Writer sout = null;"); + out.printil("java.io.Writer sout = null;"); out.printil("javax.servlet.jsp.JspWriter out = jspContext.getOut();"); out.printil("jspContext.pushPageScope();"); @@ -2820,6 +2821,7 @@ out.print(attrInfos[i].getName()); out.println(";"); } + out.println(); } // Declare fragment attributes @@ -2829,6 +2831,7 @@ out.print(fragAttrInfos[i].getName()); out.println(";"); } + out.println(); } // Define getter and setter methods for "normal" attributes @@ -2860,6 +2863,7 @@ out.println(";"); out.popIndent(); out.printil("}"); + out.println(); } } @@ -2892,6 +2896,7 @@ out.println(";"); out.popIndent(); out.printil("}"); + out.println(); } } } @@ -2931,7 +2936,7 @@ if (attrInfos != null) { for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/07/31 19:12:06 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: more compilation error fixes for generated tag handler files Revision ChangesPath 1.54 +25 -25 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- Generator.java1 Aug 2002 00:32:29 - 1.53 +++ Generator.java1 Aug 2002 02:12:05 - 1.54 @@ -1736,7 +1736,7 @@ public void visit(Node.ParamAction n) throws JasperException { out.printin("params.put("); - out.print(n.getAttributeValue("name")); + out.print(quote(n.getAttributeValue("name"))); out.print(", "); out.print(attributeValue(n.getValue(), false, String.class, "null")); @@ -1765,9 +1765,9 @@ // Store varReader in appropriate scope if (varReader != null) { String scopeName = n.getAttributeValue("scope"); - out.printin("jspContext.setAttribute(\""); - out.print(varReader); - out.print("\", new java.io.StringReader(sout.toString())"); + out.printin("getJspContext().setAttribute("); + out.print(quote(varReader)); + out.print(", new java.io.StringReader(sout.toString())"); if (scopeName != null) { out.print(", "); out.print(getScopeConstant(scopeName)); @@ -1785,7 +1785,7 @@ public void visit(Node.ParamAction n) throws JasperException { out.printin("params.put("); - out.print(n.getAttributeValue("name")); + out.print(quote(n.getAttributeValue("name"))); out.print(", "); out.print(attributeValue(n.getValue(), false, String.class, "null")); @@ -1812,14 +1812,14 @@ out.printin("params.put("); String name = tagVars[i].getNameGiven(); if (name != null) { - out.print(name); - out.print(", jspContext.getAttribute("); - out.print(name); + out.print(quote(name)); + out.print(", getJspContext().getAttribute("); + out.print(quote(name)); out.println("));"); } else { String getter = toGetterMethod(tagVars[i].getNameFromAttribute()); out.print(getter); - out.print(", jspContext.getAttribute("); + out.print(", getJspContext().getAttribute("); out.print(getter); out.println("));"); } @@ -1838,9 +1838,9 @@ // Store varReader in appropriate scope if (varReader != null) { String scopeName = n.getAttributeValue("scope"); - out.printin("jspContext.setAttribute(\""); - out.print(varReader); - out.print("\", new java.io.StringReader(sout.toString())"); + out.printin("getJspContext().setAttribute("); + out.print(quote(varReader)); + out.print(", new java.io.StringReader(sout.toString())"); if (scopeName != null) { out.print(", "); out.print(getScopeConstant(scopeName)); @@ -2777,8 +2777,8 @@ // if 'varReader' attribute is specified out.printil("java.io.Writer sout = null;"); - out.printil("javax.servlet.jsp.JspWriter out = jspContext.getOut();"); - out.printil("jspContext.pushPageScope();"); + out.printil("javax.servlet.jsp.JspWriter out = getJspContext().getOut();"); + out.printil("getJspContext().pushPageScope(null);"); generatePageScopedVariables(tagInfo); out.printil("try {"); out.pushIndent(); @@ -2788,7 +2788,7 @@ out.popIndent(); out.printil("} finally {"); out.pushIndent(); -out.printil("jspContext.popPageScope();"); +out.printil("getJspContext().popPageScope();"); out.popIndent(); out.printil("}"); out.println(); @@ -2936,9 +2936,9 @@ if (attrInfos != null) { for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java JspUtil.java
luehe 2002/08/01 11:47:28 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspUtil.java Log: more compilation error fixes for generated tag handler file Revision ChangesPath 1.55 +33 -27 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- Generator.java1 Aug 2002 02:12:05 - 1.54 +++ Generator.java1 Aug 2002 18:47:28 - 1.55 @@ -407,10 +407,8 @@ out.println(); } -// Static data for EL function maps: +// Static data for EL function and prefix maps: generateELFunctionMap(); - -// Static data for EL function maps: generatePrefixMap(); // Class variable declarations @@ -736,6 +734,7 @@ private String parent; private String simpleTagHandlerVar; private boolean isSimpleTagHandler; + private boolean isTagFile; private ServletWriter out; private MethodsBuffer methodsBuffer; private FragmentHelperClass fragmentHelperClass; @@ -745,10 +744,12 @@ /** * Constructor. */ - public GenerateVisitor(ServletWriter out, + public GenerateVisitor(boolean isTagFile, +ServletWriter out, MethodsBuffer methodsBuffer, FragmentHelperClass fragmentHelperClass, TagInfo tagInfo) { + this.isTagFile = isTagFile; this.out = out; this.methodsBuffer = methodsBuffer; this.fragmentHelperClass = fragmentHelperClass; @@ -783,9 +784,9 @@ if (attr.isExpression() || attr.isELInterpreterInput()) { if (attr.isELInterpreterInput()) { - v = JspUtil.interpreterCall( attr.getValue(), -expectedType, "_jspx_prefix_map", "_jspx_fnmap", - defaultPrefix ); + v = JspUtil.interpreterCall(this.isTagFile, + attr.getValue(), expectedType, "_jspx_prefix_map", + "_jspx_fnmap", defaultPrefix ); } if (encode) { return "java.net.URLEncoder.encode(" + v + ")"; @@ -861,9 +862,9 @@ if ( true /*isELEnabled*/ ) { out.printil( "out.write(" - + JspUtil.interpreterCall( - "${" + new String(n.getText()) + "}", String.class, - "_jspx_prefix_map", "_jspx_fnmap", "null" ) + + JspUtil.interpreterCall(this.isTagFile, +"${" + new String(n.getText()) + "}", String.class, + "_jspx_prefix_map", "_jspx_fnmap", "null" ) + ");"); } else { out.printil("out.write(" + @@ -2392,8 +2393,8 @@ // Do nothing } else if (attrs[i].isELInterpreterInput()) { // run attrValue through the expression interpreter -attrValue = JspUtil.interpreterCall( attrValue, -c[0], "_jspx_prefix_map", "_jspx_fnmap", +attrValue = JspUtil.interpreterCall(this.isTagFile, +attrValue, c[0], "_jspx_prefix_map", "_jspx_fnmap", n.getPrefix() ); } else { attrValue = convertString( @@ -2729,20 +2730,21 @@ if (gen.ctxt.isTagFile()) { TagInfo tagInfo = gen.ctxt.getTagInfo(); gen.generateTagHandlerPreamble(tagInfo); - page.visit(gen.new GenerateVisitor(out, gen.methodsBuffer, null, -tagInfo)); + page.visit(gen.new GenerateVisitor(gen.ctxt.isTagFile(), out, +gen.methodsBuffer, null, +tagInfo)); gen.generateTagHandlerPostamble(); - return; - } - - if (gen.ctxt.getOptions().isPoolingEnabled()) { - gen.compileTagHandlerPoolList(page); + } else { + if (gen.ctxt.getOptions().isPoolingEnabled()) { + gen.compileTagHandlerPoolList(page); + } +
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages_es.properties messages_ja.properties
luehe 2002/08/01 14:17:58 Modified:jasper2/src/share/org/apache/jasper/compiler PageDataImpl.java TagLibraryInfoImpl.java Validator.java jasper2/src/share/org/apache/jasper/resources messages_es.properties messages_ja.properties Log: Implemented taglib directive changes: - 'uri' attribute is no longer considered mandatory. - Use new 'tagdir' attribute if present. Revision ChangesPath 1.6 +9 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java Index: PageDataImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- PageDataImpl.java 22 Jul 2002 23:02:55 - 1.5 +++ PageDataImpl.java 1 Aug 2002 21:17:58 - 1.6 @@ -209,10 +209,14 @@ public void visit(Node.TaglibDirective n) throws JasperException { Attributes attrs = n.getAttributes(); if (attrs != null) { - String uri = attrs.getValue("uri"); + String location = attrs.getValue("uri"); + if (location == null) { + // JSP 2.0 CLARIFICATION NEEDED + location = attrs.getValue("tagdir"); + } String prefix = attrs.getValue("prefix"); rootAttrs.addAttribute("", "", "xmlns:" + prefix, "CDATA", -uri); +location); } } } 1.9 +3 -23 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java Index: TagLibraryInfoImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TagLibraryInfoImpl.java 31 Jul 2002 21:42:27 - 1.8 +++ TagLibraryInfoImpl.java 1 Aug 2002 21:17:58 - 1.9 @@ -467,7 +467,6 @@ } TagAttributeInfo createAttribute(TreeNode elem) { -//p("createAttribute\n" + elem); String name = null; boolean required = false, rtexprvalue = false, reqTime = false; String type = null; @@ -500,8 +499,6 @@ } } -// p("name=" + name + ", required=" + required + ", type=" + type + -// ", rtexprvalue=" + rtexprvalue); return new TagAttributeInfo(name, required, type, rtexprvalue); } @@ -642,7 +639,6 @@ Class tlvClass = ctxt.getClassLoader().loadClass(validatorClass); tlv = (TagLibraryValidator)tlvClass.newInstance(); - //p("got validator class: " + tlv); } catch (Exception ex) { Constants.message("jsp.warning.tlvclass.is.null", new Object[] { @@ -712,18 +708,6 @@ return new FunctionInfo(name, klass, signature); } -/* -static void copy(InputStream in, String fileName) -throws IOException, FileNotFoundException -{ -byte[] buf = new byte[1024]; - -FileOutputStream out = new FileOutputStream(fileName); -int nRead; -while ((nRead = in.read(buf, 0, buf.length)) != -1) -out.write(buf, 0, nRead); -} -*/ //* // Until javax.servlet.jsp.tagext.TagLibraryInfo is fixed @@ -753,8 +737,4 @@ } protected TagLibraryValidator tagLibraryValidator; - -private void p(String s) { - System.out.println("[TagLibraryInfoImpl] " + s); -} } 1.17 +12 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- Validator.java31 Jul 2002 21:42:27 - 1.16 +++ Validator.java1 Aug 2002 21:17:58 - 1.17 @@ -334,7 +334,8 @@ new JspUtil.ValidAttribute("file", true) }; private static final JspUtil.ValidAttribute[] taglibDirectiveAttrs = { - new JspUtil.ValidAttribut
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/08/01 14:19:09 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties Log: Implemented taglib directive changes: - 'uri' attribute is no longer considered mandatory. - Use new 'tagdir' attribute if present. Revision ChangesPath 1.21 +2 -1 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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- messages.properties 31 Jul 2002 21:42:27 - 1.20 +++ messages.properties 1 Aug 2002 21:19:09 - 1.21 @@ -245,6 +245,7 @@ tld.error.variableNotAllowed=It is an error for a tag that has one or more variable subelements to have a TagExtraInfo class that returns a non-null object. jsp.error.tldInWebDotXmlNotFound=Could not locate TLD {1} for URI {0} specified in web.xml jsp.error.taglibDirective.absUriCannotBeResolved=This absolute uri ({0}) cannot be resolved in either web.xml or the jar files deployed with this application +jsp.error.taglibDirective.missing.location=Neither 'uri' nor 'tagdir' attribute specified in taglib directive jsp.error.invalid.tagdir=Tag file directory {0} does not start with \"/WEB-INF/tags\" jsp.error.unterminated.user.tag=Unterminated user-defined tag: ending tag {0} not found or incorrectly nested #jspx.error.templateDataNotInJspCdata=Validation Error: Element <{0}> cannot have template data. Template data must be encapsulated within a <jsp:cdata> element. [JSP1.2 PFD section 5.1.9]\nTemplate data in error: {1} -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java
luehe 2002/08/01 15:26:50 Modified:jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java Log: Added 'dynamic-attributes' to list of valid tag directive attributes Revision ChangesPath 1.7 +4 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TagFileProcessor.java 31 Jul 2002 23:45:50 - 1.6 +++ TagFileProcessor.java 1 Aug 2002 22:26:50 - 1.7 @@ -106,8 +106,9 @@ private static final JspUtil.ValidAttribute[] tagDirectiveAttrs = { new JspUtil.ValidAttribute("name"), -new JspUtil.ValidAttribute("dispaly-name"), +new JspUtil.ValidAttribute("display-name"), new JspUtil.ValidAttribute("body-content"), +new JspUtil.ValidAttribute("dynamic-attributes"), new JspUtil.ValidAttribute("small-icon"), new JspUtil.ValidAttribute("large-icon"), new JspUtil.ValidAttribute("description"), -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/01 15:44:54 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: In generated doTag() method, catch IOException and rethrow as JspException Revision ChangesPath 1.56 +7 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- Generator.java1 Aug 2002 18:47:28 - 1.55 +++ Generator.java1 Aug 2002 22:44:54 - 1.56 @@ -2792,6 +2792,10 @@ private void generateTagHandlerPostamble() { out.popIndent(); +out.printil("} catch (java.io.IOException ioe) {"); + out.pushIndent(); + out.printil("throw new javax.servlet.jsp.JspException(ioe);"); + out.popIndent(); out.printil("} finally {"); out.pushIndent(); out.printil("getJspContext().popPageScope();"); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/01 18:31:08 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Added package declaration to generated tag handler file Revision ChangesPath 1.57 +11 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- Generator.java1 Aug 2002 22:44:54 - 1.56 +++ Generator.java2 Aug 2002 01:31:08 - 1.57 @@ -2753,6 +2753,14 @@ private void generateTagHandlerPreamble(TagInfo tagInfo) throws JasperException { + // Generate package declaration + String className = tagInfo.getTagClassName(); + String pkgName = className.substring(0, className.lastIndexOf(".")); + out.printin("package "); + out.print(pkgName); + out.println(";"); + out.println(); + // Generate class declaration out.printin("public class "); out.print(tagInfo.getTagName()); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/02 09:31:00 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: If tag handler implements SimpleTag, it must be scriptless, but it still may expose scripting variables, in which case its invocation must not be moved into a separate method. Revision ChangesPath 1.58 +5 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- Generator.java2 Aug 2002 01:31:08 - 1.57 +++ Generator.java2 Aug 2002 16:30:59 - 1.58 @@ -1518,8 +1518,7 @@ ServletWriter outSave = null; MethodsBuffer methodsBufferSave = null; Node.ChildInfo ci = n.getChildInfo(); - if (n.implementsSimpleTag() - || (ci.isScriptless() && !ci.hasScriptingVars())) { + if (ci.isScriptless() && !ci.hasScriptingVars()) { // The tag handler and its body code can reside in a separate // method if it is scriptless and does not have any scripting // variable defined. @@ -1589,8 +1588,7 @@ generateCustomEnd(n, tagHandlerVar, tagEvalVar); } - if (n.implementsSimpleTag() - || (ci.isScriptless() && !ci.hasScriptingVars())) { + if (ci.isScriptless() && !ci.hasScriptingVars()) { // Generate end of method if (methodNesting > 0) { out.printil("return false;"); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java TagFileProcessor.java Validator.java
luehe 2002/08/02 12:30:02 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java TagFileProcessor.java Validator.java Log: - Validate tag file directives only once (at the time when the TagFileProcessor creates a TagInfo from them), and not again when compiling the tag file - Fixed compilation error for tag handler generated from tag file supporting dynamic attributes Revision ChangesPath 1.59 +8 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- Generator.java2 Aug 2002 16:30:59 - 1.58 +++ Generator.java2 Aug 2002 19:30:02 - 1.59 @@ -2823,7 +2823,7 @@ throws JasperException { if (tagInfo.hasDynamicAttributes()) { - out.printil("HashMap dynamicAttrs = new java.util.HashMap();"); + out.printil("java.util.HashMap dynamicAttrs = new java.util.HashMap();"); } TagAttributeInfo[] attrInfos = tagInfo.getAttributes(); @@ -2924,7 +2924,7 @@ * variable can later be created for it. */ public void generateSetDynamicAttribute() { -out.printil("public void setDynamicAttribute(String uri, String localName, Object value) throws AttributeNotSupportedException {"); +out.printil("public void setDynamicAttribute(String uri, String localName, Object value) throws javax.servlet.jsp.tagext.AttributeNotSupportedException {"); out.pushIndent(); out.printil("if (uri != null)"); out.pushIndent(); @@ -2976,10 +2976,10 @@ // dynamic attributes if (tagInfo.hasDynamicAttributes()) { - out.printil("for (Iterator i = dynamicAttrs.entrySet().iterator(); i.hasNext(); ) {"); + out.printil("for (java.util.Iterator i = dynamicAttrs.entrySet().iterator(); i.hasNext(); ) {"); out.pushIndent(); - out.printil("Map.Entry e = (Map.Entry) i.next();"); - out.printil("getJspContext().setAttribute(e.getKey(), e.getValue());"); + out.printil("java.util.Map.Entry e = (java.util.Map.Entry) i.next();"); + out.printil("getJspContext().setAttribute((String) e.getKey(), e.getValue());"); out.popIndent(); out.printil("}"); } 1.8 +41 -42 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TagFileProcessor.java 1 Aug 2002 22:26:50 - 1.7 +++ TagFileProcessor.java 2 Aug 2002 19:30:02 - 1.8 @@ -86,6 +86,43 @@ */ static class TagFileVisitor extends Node.Visitor { +private static final JspUtil.ValidAttribute[] tagDirectiveAttrs = { +new JspUtil.ValidAttribute("name"), +new JspUtil.ValidAttribute("display-name"), +new JspUtil.ValidAttribute("body-content"), +new JspUtil.ValidAttribute("dynamic-attributes"), +new JspUtil.ValidAttribute("small-icon"), +new JspUtil.ValidAttribute("large-icon"), +new JspUtil.ValidAttribute("description"), +new JspUtil.ValidAttribute("example"), +new JspUtil.ValidAttribute("pageEncoding") }; + + private static final JspUtil.ValidAttribute[] attributeDirectiveAttrs = { + new JspUtil.ValidAttribute("name", true), + new JspUtil.ValidAttribute("required"), + new JspUtil.ValidAttribute("fragment"), + new JspUtil.ValidAttribute("rtexprvalue"), + new JspUtil.ValidAttribute("type"), + new JspUtil.ValidAttribute("description") + }; + + private static final JspUtil.ValidAttribute[] variableDirectiveAttrs = { + new JspUtil.ValidAttribute("name-given"), + new JspUtil.ValidAttribute("name-from"), + new JspUtil.ValidAttribute("variable-class"), + new JspUtil.ValidAttribute("scope"), + new JspUtil.ValidAttribute("declare"), + new JspUtil.ValidAttribute(&quo
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/02 14:13:34 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Fixed NPE in generateELFunctionMap() Revision ChangesPath 1.60 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- Generator.java2 Aug 2002 19:30:02 - 1.59 +++ Generator.java2 Aug 2002 21:13:33 - 1.60 @@ -525,7 +525,7 @@ while( iter.hasNext() ) { String key = (String)iter.next(); TagLibraryInfo tli = (TagLibraryInfo)taglibs.get( key ); -if( tli.getFunctions().length > 0 ) { +if( tli.getFunctions() != null && tli.getFunctions().length > 0 ) { fnPresent = true; break; } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java
luehe 2002/08/03 16:29:21 Modified:jasper2/src/share/org/apache/jasper JspCompilationContext.java jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java JspRuntimeContext.java TagFileProcessor.java jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java Log: Store tag file .java and .class files in standard location ("/tagfiles/org/apache/jsp/"), regardless of the original tag file path, and add this standard location to the compilation classpath for JSP pages Revision ChangesPath 1.14 +44 -32 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java Index: JspCompilationContext.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- JspCompilationContext.java1 Aug 2002 23:29:36 - 1.13 +++ JspCompilationContext.java3 Aug 2002 23:29:21 - 1.14 @@ -115,16 +115,20 @@ protected boolean reload = true; protected URLClassLoader jspLoader; -protected URL [] outUrls = new URL[1]; +protected URL[] outUrls = new URL[1]; protected Class servletClass; protected boolean isTagFile; protected TagInfo tagInfo; // jspURI _must_ be relative to the context -public JspCompilationContext(String jspUri, boolean isErrPage, Options options, - ServletContext context, JspServletWrapper jsw, +public JspCompilationContext(String jspUri, + boolean isErrPage, + Options options, + ServletContext context, + JspServletWrapper jsw, JspRuntimeContext rctxt) { + this.jspUri = canonicalURI(jspUri); this.isErrPage = isErrPage; this.options=options; @@ -146,9 +150,11 @@ this.rctxt=rctxt; } -public JspCompilationContext(String tagfile, TagInfo tagInfo, +public JspCompilationContext(String tagfile, + TagInfo tagInfo, Options options, - ServletContext context, JspServletWrapper jsw, + ServletContext context, + JspServletWrapper jsw, JspRuntimeContext rctxt) { this(tagfile, false, options, context, jsw, rctxt); @@ -200,8 +206,8 @@ return outputDir; } -public void setOutputDir( String s ) { -this.outputDir=s; +public void setOutputDir(String s) { +this.outputDir = s; } /** @@ -396,17 +402,23 @@ if (jspPath != null) { return jspPath; } -String dirName = getJspFile(); -int pos = dirName.lastIndexOf('/'); -if (pos > 0) { -dirName = dirName.substring(0, pos + 1); -} else { -dirName = ""; -} -jspPath = dirName + getServletClassName() + ".java"; -if (jspPath.startsWith("/")) { -jspPath = jspPath.substring(1); -} + + if (isTagFile) { + jspPath = "tagfiles/org/apache/jsp/" + tagInfo.getTagName() + ".java"; + } else { + String dirName = getJspFile(); + int pos = dirName.lastIndexOf('/'); + if (pos > 0) { + dirName = dirName.substring(0, pos + 1); + } else { + dirName = ""; + } + jspPath = dirName + getServletClassName() + ".java"; + if (jspPath.startsWith("/")) { + jspPath = jspPath.substring(1); + } + } + return jspPath; } @@ -508,7 +520,7 @@ public void compile() throws JasperException, FileNotFoundException { createCompiler(); -if (jspCompiler.isOutDated()) { + if (jspCompiler.isOutDated()) { try { jspCompiler.compile(); reload = true; @@ -518,7 +530,7 @@ throw new JasperException( Constants.getString("jsp.error.unable.compile"),ex); } -} + } } /** True if the servlet needs loading @@ -568,24 +580,24 @@ return servletClass; } -public void createOutdir() { +public void cre
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ScriptingVariabler.java Compiler.java Generator.java Node.java
luehe 2002/08/16 16:18:54 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java Node.java Added: jasper2/src/share/org/apache/jasper/compiler ScriptingVariabler.java Log: Added compilation step which determines, for every custom tag, the scripting variables that need to be declared. For example, if a custom action is nested, it must not redeclare the AT_BEGIN variables of its encapsulating action, etc. Scripting variables are now generated at the appropriate places, according to their scope. Revision ChangesPath 1.27 +6 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- Compiler.java 12 Aug 2002 21:58:48 - 1.26 +++ Compiler.java 16 Aug 2002 23:18:54 - 1.27 @@ -248,6 +248,9 @@ // this compilation unit. TagFileProcessor.loadTagFiles(this, pageNodes); + // Determine which custom tag needs to declare which scripting vars + ScriptingVariabler.set(pageNodes); + // generate servlet .java file Generator.generate(writer, this, pageNodes); writer.close(); 1.66 +107 -121 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- Generator.java12 Aug 2002 17:55:45 - 1.65 +++ Generator.java16 Aug 2002 23:18:54 - 1.66 @@ -247,73 +247,60 @@ return poolName; } } - + page.visit(new TagHandlerPoolVisitor(tagHandlerPoolNames)); } - -/* - * For every custom tag, declares its scripting variables with AT_BEGIN - * and AT_END scopes. - */ -private void declareAtBeginAtEndScriptingVariables(Node.Nodes page) + +private void declareTemporaryScriptingVars(Node.Nodes page) throws JasperException { - class ScriptingVariableDeclarationVisitor extends Node.Visitor { + class ScriptingVarVisitor extends Node.Visitor { - /* - * Vector keeping track of which scripting variables have already - * been declared - */ - private Vector scriptVars; + private Vector vars; - /* - * Constructor. - */ - public ScriptingVariableDeclarationVisitor() { - scriptVars = new Vector(); + ScriptingVarVisitor() { + vars = new Vector(); } public void visit(Node.CustomTag n) throws JasperException { - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - - if ((varInfos == null) && (tagVarInfos == null)) { - visitBody(n); - } - - if (varInfos != null) { - for (int i=0; i 0) { + TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); + VariableInfo[] varInfos = n.getVariableInfos(); + + if (varInfos != null) { + for (int i=0; i 0) { - nestedVarInfos = - (VariableInfo[]) vec.toArray(new VariableInfo[vec.size()]); - } } } 1.1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java Index: ScriptingVariabler.java === /* * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java,v 1.1 2002/08/16 23:18:54 luehe Exp $ * $Revision: 1.1 $ * $Date: 2002/08/16 23:18:54 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above c
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ScriptingVariabler.java Compiler.java Generator.java JspDocumentParser.java Node.java Parser.java
luehe 2002/08/16 17:14:24 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Generator.java JspDocumentParser.java Node.java Parser.java Added: jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch ScriptingVariabler.java Log: Added compilation step which determines, for every custom tag, the scripting variables that need to be declared. For example, if a custom action is nested, it must not redeclare the AT_BEGIN variables of its encapsulating action, etc. Scripting variables are now generated at the appropriate places, according to their scope. Revision ChangesPath No revision No revision 1.18.2.3 +6 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.2 retrieving revision 1.18.2.3 diff -u -r1.18.2.2 -r1.18.2.3 --- Compiler.java 20 Jul 2002 02:44:49 - 1.18.2.2 +++ Compiler.java 17 Aug 2002 00:14:23 - 1.18.2.3 @@ -237,6 +237,9 @@ // Collect page info Collector.collect(this, pageNodes); + // Determine which custom tag needs to declare which scripting vars + ScriptingVariabler.set(pageNodes); + // generate servlet .java file Generator.generate(writer, this, pageNodes); writer.close(); 1.35.2.3 +102 -126 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.35.2.2 retrieving revision 1.35.2.3 diff -u -r1.35.2.2 -r1.35.2.3 --- Generator.java8 Aug 2002 11:00:39 - 1.35.2.2 +++ Generator.java17 Aug 2002 00:14:23 - 1.35.2.3 @@ -235,70 +235,57 @@ page.visit(new TagHandlerPoolVisitor(tagHandlerPoolNames)); } - -/* - * For every custom tag, declares its scripting variables with AT_BEGIN - * and AT_END scopes. - */ -private void declareAtBeginAtEndScriptingVariables(Node.Nodes page) + +private void declareTemporaryScriptingVars(Node.Nodes page) throws JasperException { - class ScriptingVariableDeclarationVisitor extends Node.Visitor { + class ScriptingVarVisitor extends Node.Visitor { - /* - * Vector keeping track of which scripting variables have already - * been declared - */ - private Vector scriptVars; + private Vector vars; - /* - * Constructor. - */ - public ScriptingVariableDeclarationVisitor() { - scriptVars = new Vector(); + ScriptingVarVisitor() { + vars = new Vector(); } public void visit(Node.CustomTag n) throws JasperException { - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - - if ((varInfos == null) && (tagVarInfos == null)) { - visitBody(n); - } - - if (varInfos != null) { - for (int i=0; i 0) { + TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); + VariableInfo[] varInfos = n.getVariableInfos(); + + if (varInfos != null) { + for (int i=0; i 0)? "return true;": "return;"); out.popIndent(); - // Synchronize AT_BEGIN and AT_END scripting variables - syncScriptingVariables(n, VariableInfo.AT_BEGIN); - syncScriptingVariables(n, VariableInfo.AT_END); + // Synchronize AT_BEGIN scripting variables + syncScriptingVars(n, VariableInfo.AT_BEGIN); + + // Declare and synchronize AT_END scripting variables + declareScriptingVars(n, VariableInfo.AT_END); + syncScriptingVars(n, VariableInfo.AT_END); // TryCatchFinally if (implementsTryCatchFinally) { @@ -1482,44 +1475,35 @@ out.println("}"); } - restoreScriptingVariables(n); + restoreScriptingVars(n); out.popIndent(); out.printil("}"); n.setEndJavaLine(out.getJavaLine()); } - /* - * Declares any NESTED scripting variables of the given custom tag. - */ -
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Node.java
luehe 2002/08/16 17:15:28 Modified:jasper2/src/share/org/apache/jasper/compiler Node.java Log: removed redundant field Revision ChangesPath 1.26 +3 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Node.java 16 Aug 2002 23:18:54 - 1.25 +++ Node.java 17 Aug 2002 00:15:27 - 1.26 @@ -889,7 +889,6 @@ private TagFileInfo tagFileInfo; private Class tagHandlerClass; private VariableInfo[] varInfos; - private TagVariableInfo[] nestedTagVarInfos; private int customNestingLevel; private ChildInfo childInfo; private boolean implementsIterationTag; -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime ExpressionEvaluatorImpl.java ExpressionEvaluatorManager.java JspContextWrapper.java PageContextImpl.java
luehe 2002/08/19 09:54:17 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java JspUtil.java Node.java Parser.java ScriptingVariabler.java TagConstants.java TagFileProcessor.java TagLibraryInfoImpl.java Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_ja.properties jasper2/src/share/org/apache/jasper/runtime ExpressionEvaluatorImpl.java ExpressionEvaluatorManager.java JspContextWrapper.java PageContextImpl.java Log: Adpated jasper to modified JSP 2.0 APIs, including the removal of the fragment-input directive and and TLD elements, and addition of the subelement to and . Revision ChangesPath 1.67 +25 -71 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- Generator.java16 Aug 2002 23:18:54 - 1.66 +++ Generator.java19 Aug 2002 16:54:16 - 1.67 @@ -2337,16 +2337,15 @@ // Set parent if (!simpleTag) { if (parent != null) { - out.printin("if (!("); + out.printin("if ("); out.print(parent); - out.println(" instanceof javax.servlet.jsp.tagext.Tag))"); + out.println(" instanceof javax.servlet.jsp.tagext.SimpleTag)"); out.pushIndent(); out.printin(tagHandlerVar); out.print(".setParent("); out.print("new javax.servlet.jsp.tagext.TagAdapter("); + out.print("(javax.servlet.jsp.tagext.SimpleTag) "); out.print(parent); - out.print(", "); - out.print("null"); // XXX out.println("));"); out.popIndent(); out.printil("else"); @@ -2857,34 +2856,32 @@ } TagAttributeInfo[] attrInfos = tagInfo.getAttributes(); - TagFragmentAttributeInfo[] fragAttrInfos - = tagInfo.getFragmentAttributes(); - // Declare "normal" attributes + // Declare attributes if (attrInfos != null) { for (int i=0; i tag file action */ public static class InvokeAction extends Node { @@ -1097,37 +1070,20 @@ } /** - * Checks to see if the attribute or fragment attribute of the - * given name is of type JspFragment. + * Checks to see if the attribute of the given name is of type + * JspFragment. */ public boolean checkIfAttributeIsJspFragment( String name ) { boolean result = false; -// The attribute is of type JspFragment if it appears in -// the TagInfo Fragment Attributes list, or if it appears in the -// Attributes list and is of the right type. - -TagFragmentAttributeInfo[] fragmentAttributes = -tagInfo.getFragmentAttributes(); -for( int i = 0; i < fragmentAttributes.length; i++ ) { -if( fragmentAttributes[i].getName().equals( name ) ) { -result = true; -break; -} -} - -if( !result ) { -TagAttributeInfo[] attributes = tagInfo.getAttributes(); -for( int i = 0; i < attributes.length; i++ ) { -if( attributes[i].getName().equals( name ) && -"javax.servlet.jsp.tagext.JspFragment".equals( -attributes[i].getTypeName() ) ) -{ -result = true; -break; -} -} -} + TagAttributeInfo[] attributes = tagInfo.getAttributes(); + for (int i = 0; i < attributes.length; i++) { + if (attributes[i].getName().equals(name) && + attributes[i].isFragment()) { + result = true; + break; + } + } return result; } @@ -1556,10 +1512,6 @@ } publi
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java Validator.java
luehe 2002/08/19 11:44:42 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Validator.java Log: Added support for 'var' attribute to and Revision ChangesPath 1.68 +26 -14 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- Generator.java19 Aug 2002 16:54:16 - 1.67 +++ Generator.java19 Aug 2002 18:44:42 - 1.68 @@ -1741,8 +1741,9 @@ } // Invoke fragment with parameter map - String varReader = n.getAttributeValue("varReader"); - if (varReader != null) { + String varReaderAttr = n.getAttributeValue("varReader"); + String varAttr = n.getAttributeValue("var"); + if (varReaderAttr != null || varAttr != null) { out.printil("sout = new java.io.StringWriter();"); out.print(toGetterMethod(n.getAttributeValue("fragment"))); out.println(".invoke(sout, params);"); @@ -1752,11 +1753,16 @@ } // Store varReader in appropriate scope - if (varReader != null) { + if (varReaderAttr != null || varAttr != null) { String scopeName = n.getAttributeValue("scope"); out.printin("pageContext.setAttribute("); - out.print(quote(varReader)); - out.print(", new java.io.StringReader(sout.toString())"); + if (varReaderAttr != null) { + out.print(quote(varReaderAttr)); + out.print(", new java.io.StringReader(sout.toString())"); + } else { + out.print(quote(varAttr)); + out.print(", sout.toString()"); + } if (scopeName != null) { out.print(", "); out.print(getScopeConstant(scopeName)); @@ -1816,8 +1822,9 @@ } // Invoke body with parameter map - String varReader = n.getAttributeValue("varReader"); - if (varReader != null) { + String varReaderAttr = n.getAttributeValue("varReader"); + String varAttr = n.getAttributeValue("var"); + if (varReaderAttr != null || varAttr != null) { out.printil("sout = new java.io.StringWriter();"); out.printil("getJspBody().invoke(sout, params);"); } else { @@ -1825,11 +1832,16 @@ } // Store varReader in appropriate scope - if (varReader != null) { + if (varReaderAttr != null || varAttr != null) { String scopeName = n.getAttributeValue("scope"); out.printin("pageContext.setAttribute("); - out.print(quote(varReader)); - out.print(", new java.io.StringReader(sout.toString())"); + if (varReaderAttr != null) { + out.print(quote(varReaderAttr)); + out.print(", new java.io.StringReader(sout.toString())"); + } else { + out.print(quote(varAttr)); + out.print(", sout.toString()"); + } if (scopeName != null) { out.print(", "); out.print(getScopeConstant(scopeName)); @@ -2822,7 +2834,7 @@ out.printil("java.util.Map params = null;"); // Declare writer used for storing result of fragment/body invocation - // if 'varReader' attribute is specified + // if 'varReader' or 'var' attribute is specified out.printil("java.io.Writer sout = null;"); out.printil("javax.servlet.jsp.JspWriter out = pageContext.getOut();"); 1.22 +32 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Validator.java19 Aug 2002 16:54:16 - 1.21 +++ Validator.java19 Aug 2002 18:44:42 - 1.22 @@ -359,6 +359,17 @@ private static final JspUtil.ValidAttribute[] bodyAttrs = {
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ScriptingVariabler.java
luehe 2002/08/19 13:29:12 Modified:jasper2/src/share/org/apache/jasper/compiler ScriptingVariabler.java Log: Fixed bug which caused VariableInfos to be ignored when determining which scripting vars need to be declared Revision ChangesPath 1.3 +21 -21 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java Index: ScriptingVariabler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ScriptingVariabler.java 19 Aug 2002 16:54:16 - 1.2 +++ ScriptingVariabler.java 19 Aug 2002 20:29:12 - 1.3 @@ -130,19 +130,14 @@ else ownRange = parent.getNumCount(); - if (tagVarInfos != null) { - for (int i=0; i 0) { scriptVars.put(varName, ownRange); - vec.add(tagVarInfos[i]); + vec.add(varInfos[i]); } } else { // scope equals NESTED AND node implements BodyTag if (n.getCustomNestingLevel() == 0) { - vec.add(tagVarInfos[i]); + vec.add(varInfos[i]); } } } } else { - for (int i=0; i 0) { scriptVars.put(varName, ownRange); - vec.add(varInfos[i]); + vec.add(tagVarInfos[i]); } } else { // scope equals NESTED AND node implements BodyTag -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ScriptingVariabler.java
luehe 2002/08/19 14:16:47 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch ScriptingVariabler.java Log: Fixed bug which caused VariableInfos to be ignored when determining which scripting vars need to be declared Revision ChangesPath No revision No revision 1.1.2.2 +20 -20 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java Index: ScriptingVariabler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- ScriptingVariabler.java 17 Aug 2002 00:14:23 - 1.1.2.1 +++ ScriptingVariabler.java 19 Aug 2002 21:16:46 - 1.1.2.2 @@ -130,18 +130,14 @@ else ownRange = parent.getNumCount(); - if (tagVarInfos != null) { - for (int i=0; i 0) { scriptVars.put(varName, ownRange); - vec.add(tagVarInfos[i]); + vec.add(varInfos[i]); } } else { // scope equals NESTED AND node implements BodyTag if (n.getCustomNestingLevel() == 0) { - vec.add(tagVarInfos[i]); + vec.add(varInfos[i]); } } } } else { - for (int i=0; i 0) { scriptVars.put(varName, ownRange); - vec.add(varInfos[i]); + vec.add(tagVarInfos[i]); } } else { // scope equals NESTED AND node implements BodyTag -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java Parser.java ParserController.java TagFileProcessor.java
luehe 2002/08/19 16:06:01 Modified:jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java Parser.java ParserController.java TagFileProcessor.java Log: - When dealing with tag files underneath "/WEB-INF/tags/", *always* generate an implicit Tag Library Descriptor, regardless of whether a TLD file is present in the tag file directory - Removed 'name' attribute from tag directive. Revision ChangesPath 1.6 +4 -31 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java Index: ImplicitTagLibraryInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ImplicitTagLibraryInfo.java 31 Jul 2002 23:45:50 - 1.5 +++ ImplicitTagLibraryInfo.java 19 Aug 2002 23:06:01 - 1.6 @@ -77,14 +77,11 @@ public class ImplicitTagLibraryInfo extends TagLibraryInfo { private static final String WEB_INF_TAGS = "/WEB-INF/tags/"; -private static final String TLD_SUFFIX = ".tld"; private static final String TAG_FILE_SUFFIX = ".tag"; private static final String TAGS_SHORTNAME = "tags"; private static final String TLIB_VERSION = "1.0"; private static final String JSP_VERSION = "2.0"; -private String tldFile; - /** * Constructor. */ @@ -117,10 +114,7 @@ Iterator it = dirList.iterator(); while (it.hasNext()) { String path = (String) it.next(); - if (path.endsWith(TLD_SUFFIX)) { - tldFile = path; - break; - } else if (path.endsWith(TAG_FILE_SUFFIX)) { + if (path.endsWith(TAG_FILE_SUFFIX)) { // use the filename of the tag file, without the .tag // extension, as the subelement of the "imaginary" // element @@ -138,26 +132,5 @@ this.tagFiles = new TagFileInfo[vec.size()]; vec.copyInto(this.tagFiles); } -} - -public static TagLibraryInfo getTabLibraryInfo(JspCompilationContext ctxt, -ParserController pc, -String prefix, -String tagdir, -ErrorDispatcher err) - throws JasperException { - - TagLibraryInfo tagLibInfo = new ImplicitTagLibraryInfo(ctxt, pc, -prefix, tagdir, -err); - if (((ImplicitTagLibraryInfo) tagLibInfo).tldFile != null) { - // tagdir contains TLD file - String[] location = new String[2]; - location[0] = ((ImplicitTagLibraryInfo) tagLibInfo).tldFile; - tagLibInfo = new TagLibraryInfoImpl(ctxt, pc, prefix, tagdir, - location, err); - } - - return tagLibInfo; } } 1.21 +8 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- Parser.java 19 Aug 2002 16:54:16 - 1.20 +++ Parser.java 19 Aug 2002 23:06:01 - 1.21 @@ -376,12 +376,11 @@ } else { String tagdir = attrs.getValue("tagdir"); if (tagdir != null) { - tagLibInfo = ImplicitTagLibraryInfo.getTabLibraryInfo( -ctxt, - parserController, - prefix, - tagdir, - err); + tagLibInfo = new ImplicitTagLibraryInfo(ctxt, + parserController, + prefix, + tagdir, + err); } } if (tagLibInfo != null) { 1.10 +0 -10 jakarta-tomcat-jasper/
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime PageContextImpl.java
luehe 2002/08/19 16:25:42 Modified:jasper2/src/share/org/apache/jasper/runtime PageContextImpl.java Log: Implemented new PageContext method include(String relativeUrlPath, boolean flush) Revision ChangesPath 1.17 +14 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java Index: PageContextImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- PageContextImpl.java 19 Aug 2002 16:54:17 - 1.16 +++ PageContextImpl.java 19 Aug 2002 23:25:42 - 1.17 @@ -395,21 +395,23 @@ } public void include(String relativeUrlPath) -throws ServletException, IOException -{ + throws ServletException, IOException { + JspRuntimeLibrary.include((HttpServletRequest) request, (HttpServletResponse) response, - relativeUrlPath, out, true); -/* -String path = getAbsolutePathRelativeToContext(relativeUrlPath); -context.getRequestDispatcher(path).include( - request, new ServletResponseWrapperInclude(response, out)); -*/ + relativeUrlPath, + out, + true); } public void include(String relativeUrlPath, boolean flush) throws ServletException, IOException { - include(relativeUrlPath, false); // XXX + +JspRuntimeLibrary.include((HttpServletRequest) request, + (HttpServletResponse) response, + relativeUrlPath, + out, + flush); } public VariableResolver getVariableResolver() { -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/19 18:07:55 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Renamed non-standard 'sout' to '_jspx_sout' Revision ChangesPath 1.69 +12 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- Generator.java19 Aug 2002 18:44:42 - 1.68 +++ Generator.java20 Aug 2002 01:07:55 - 1.69 @@ -1744,9 +1744,9 @@ String varReaderAttr = n.getAttributeValue("varReader"); String varAttr = n.getAttributeValue("var"); if (varReaderAttr != null || varAttr != null) { - out.printil("sout = new java.io.StringWriter();"); + out.printil("_jspx_sout = new java.io.StringWriter();"); out.print(toGetterMethod(n.getAttributeValue("fragment"))); - out.println(".invoke(sout, params);"); + out.println(".invoke(_jspx_sout, params);"); } else { out.print(toGetterMethod(n.getAttributeValue("fragment"))); out.println(".invoke(null, params);"); @@ -1758,10 +1758,10 @@ out.printin("pageContext.setAttribute("); if (varReaderAttr != null) { out.print(quote(varReaderAttr)); - out.print(", new java.io.StringReader(sout.toString())"); + out.print(", new java.io.StringReader(_jspx_sout.toString())"); } else { out.print(quote(varAttr)); - out.print(", sout.toString()"); + out.print(", _jspx_sout.toString()"); } if (scopeName != null) { out.print(", "); @@ -1825,8 +1825,8 @@ String varReaderAttr = n.getAttributeValue("varReader"); String varAttr = n.getAttributeValue("var"); if (varReaderAttr != null || varAttr != null) { - out.printil("sout = new java.io.StringWriter();"); - out.printil("getJspBody().invoke(sout, params);"); + out.printil("_jspx_sout = new java.io.StringWriter();"); + out.printil("getJspBody().invoke(_jspx_sout, params);"); } else { out.printil("getJspBody().invoke(null, params);"); } @@ -1837,10 +1837,10 @@ out.printin("pageContext.setAttribute("); if (varReaderAttr != null) { out.print(quote(varReaderAttr)); - out.print(", new java.io.StringReader(sout.toString())"); + out.print(", new java.io.StringReader(_jspx_sout.toString())"); } else { out.print(quote(varAttr)); - out.print(", sout.toString()"); + out.print(", _jspx_sout.toString()"); } if (scopeName != null) { out.print(", "); @@ -2835,7 +2835,7 @@ // Declare writer used for storing result of fragment/body invocation // if 'varReader' or 'var' attribute is specified - out.printil("java.io.Writer sout = null;"); + out.printil("java.io.Writer _jspx_sout = null;"); out.printil("javax.servlet.jsp.JspWriter out = pageContext.getOut();"); generatePageScopedVariables(tagInfo); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/19 18:37:30 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Removed javax.servlet.jsp.tagext.AttributeNotSupportedException Revision ChangesPath 1.70 +4 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- Generator.java20 Aug 2002 01:07:55 - 1.69 +++ Generator.java20 Aug 2002 01:37:30 - 1.70 @@ -2433,8 +2433,6 @@ } if (attrs[i].isDynamic()) { - out.printil("try {"); - out.pushIndent(); out.printin(tagHandlerVar); out.print("."); out.print("setDynamicAttribute(\""); @@ -2444,13 +2442,6 @@ out.print("\", "); out.print(attrValue); out.println(");"); - out.popIndent(); - out.printin("}"); // catch - out.println(" catch (javax.servlet.jsp.tagext.AttributeNotSupportedException e) {"); - out.pushIndent(); - out.printil("throw new javax.servlet.jsp.JspException(e);"); - out.popIndent(); - out.printil("}"); // catch } else { out.printin(tagHandlerVar); out.print("."); @@ -2934,7 +2925,7 @@ * variable can later be created for it. */ public void generateSetDynamicAttribute() { -out.printil("public void setDynamicAttribute(String uri, String localName, Object value) throws javax.servlet.jsp.tagext.AttributeNotSupportedException {"); +out.printil("public void setDynamicAttribute(String uri, String localName, Object value) throws javax.servlet.jsp.JspException {"); out.pushIndent(); out.printil("if (uri != null)"); out.pushIndent(); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/08/19 18:42:38 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Renamed non-standard 'params' to '_jspx_params' Revision ChangesPath 1.71 +13 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- Generator.java20 Aug 2002 01:37:30 - 1.70 +++ Generator.java20 Aug 2002 01:42:38 - 1.71 @@ -1724,7 +1724,7 @@ class ParamVisitor extends Node.Visitor { public void visit(Node.ParamAction n) throws JasperException { - out.printin("params.put("); + out.printin("_jspx_params.put("); out.print(quote(n.getAttributeValue("name"))); out.print(", "); out.print(attributeValue(n.getValue(), false, @@ -1734,7 +1734,7 @@ } // Assemble parameter map - out.printil("params = new java.util.HashMap();"); + out.printil("_jspx_params = new java.util.HashMap();"); if (n.getBody() != null) { prepareParams(n); n.getBody().visit(new ParamVisitor()); @@ -1746,10 +1746,10 @@ if (varReaderAttr != null || varAttr != null) { out.printil("_jspx_sout = new java.io.StringWriter();"); out.print(toGetterMethod(n.getAttributeValue("fragment"))); - out.println(".invoke(_jspx_sout, params);"); + out.println(".invoke(_jspx_sout, _jspx_params);"); } else { out.print(toGetterMethod(n.getAttributeValue("fragment"))); - out.println(".invoke(null, params);"); + out.println(".invoke(null, _jspx_params);"); } // Store varReader in appropriate scope @@ -1779,7 +1779,7 @@ class ParamVisitor extends Node.Visitor { public void visit(Node.ParamAction n) throws JasperException { - out.printin("params.put("); + out.printin("_jspx_params.put("); out.print(quote(n.getAttributeValue("name"))); out.print(", "); out.print(attributeValue(n.getValue(), false, @@ -1789,7 +1789,7 @@ } // Assemble parameter map - out.printil("params = new java.util.HashMap();"); + out.printil("_jspx_params = new java.util.HashMap();"); if (n.getBody() != null) { prepareParams(n); n.getBody().visit(new ParamVisitor()); @@ -1804,7 +1804,7 @@ && scope != VariableInfo.NESTED) { continue; } - out.printin("params.put("); + out.printin("_jspx_params.put("); String name = tagVars[i].getNameGiven(); if (name != null) { out.print(quote(name)); @@ -1826,9 +1826,9 @@ String varAttr = n.getAttributeValue("var"); if (varReaderAttr != null || varAttr != null) { out.printil("_jspx_sout = new java.io.StringWriter();"); - out.printil("getJspBody().invoke(_jspx_sout, params);"); + out.printil("getJspBody().invoke(_jspx_sout, _jspx_params);"); } else { - out.printil("getJspBody().invoke(null, params);"); + out.printil("getJspBody().invoke(null, _jspx_params);"); } // Store varReader in appropriate scope @@ -2822,7 +2822,7 @@ out.pushIndent(); out.printil("PageContext pageContext = new JspContextWrapper(getJspContext());"); // Declare parameter map for fragment/body invocation - out.printil("java.util.Map params = null;"); + out.printil("java.util.Map _jspx_params = null;"); // Declare writer used for storing result of fragment/body invocation // if 'varReader' or 'var' attribute is specified -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java
luehe 2002/11/27 08:00:15 Modified:jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java Log: small javadoc improvement Revision ChangesPath 1.26 +8 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java Index: TagLibraryInfoImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- TagLibraryInfoImpl.java 14 Nov 2002 22:22:38 - 1.25 +++ TagLibraryInfoImpl.java 27 Nov 2002 16:00:14 - 1.26 @@ -407,6 +407,11 @@ * Parses the tag file directives of the given TagFile and turns them into * a TagInfo. * + * @param elem The element in the TLD + * @param uri The location of the TLD, in case the tag file is specified + * relative to it + * @param jarFile The JAR file, in case the tag file is packaged in a JAR + * * @return TagInfo correspoding to tag file directives */ private TagFileInfo createTagFileInfo(TreeNode elem, String uri, -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java
luehe 2002/11/27 08:00:42 Modified:jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java Log: small javadoc improvement Revision ChangesPath 1.20 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java Index: JspServletWrapper.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- JspServletWrapper.java28 Oct 2002 18:16:21 - 1.19 +++ JspServletWrapper.java27 Nov 2002 16:00:41 - 1.20 @@ -153,7 +153,7 @@ servletContext, this, rctxt, tagFileJars); - // Store tag file .java and .class files in standard location + // Store tag handler .java and .class files in standard location // (/tagfiles/org/apache/jsp/), regardless of the original tag file // path String standard = null; -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java ParserController.java
luehe 2002/11/27 08:42:26 Modified:jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java ParserController.java Log: Applied patch provided by Ryan Lubke to fix encoding issue: When processing a JSP document, pass the document's raw input stream to the SAX parser, that is, do not apply the autodetected encoding to it (the SAX parser will figure out the encoding itself). Revision ChangesPath 1.30 +7 -7 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.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- JspDocumentParser.java11 Nov 2002 19:26:28 - 1.29 +++ JspDocumentParser.java27 Nov 2002 16:42:26 - 1.30 @@ -119,7 +119,7 @@ */ public JspDocumentParser(ParserController pc, String path, - InputStreamReader reader, + InputStream inStream, boolean isTagFile, boolean directivesOnly) { this.parserController = pc; @@ -128,7 +128,7 @@ this.taglibs = this.pageInfo.getTagLibraries(); this.err = pc.getCompiler().getErrorDispatcher(); this.path = path; - this.inputSource = new InputSource(reader); + this.inputSource = new InputSource(inStream); this.isTagFile = isTagFile; this.directivesOnly = directivesOnly; this.isTop = true; @@ -141,13 +141,13 @@ */ public static Node.Nodes parse(ParserController pc, String path, -InputStreamReader reader, +InputStream inStream, Node parent, boolean isTagFile, boolean directivesOnly) throws JasperException { - JspDocumentParser handler = new JspDocumentParser(pc, path, reader, + JspDocumentParser handler = new JspDocumentParser(pc, path, inStream, isTagFile, directivesOnly); Node.Nodes pageNodes = null; 1.27 +43 -29 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java Index: ParserController.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- ParserController.java 7 Nov 2002 22:19:13 - 1.26 +++ ParserController.java 27 Nov 2002 16:42:26 - 1.27 @@ -180,46 +180,60 @@ throws FileNotFoundException, JasperException, IOException { Node.Nodes parsedPage = null; -InputStreamReader reader = null; String absFileName = resolveFileName(inFileName); JarFile jarFile = (JarFile) ctxt.getTagFileJars().get(inFileName); -try { -// Figure out what type of JSP document and encoding type we are - // dealing with -String encoding = figureOutJspDocument(absFileName, jarFile); + // Figure out what type of JSP document and encoding type we are + // dealing with + String encoding = figureOutJspDocument(absFileName, jarFile); - if (isTopFile) { - pageInfo.setIsXml(isXml); - isTopFile = false; - } else { - compiler.getPageInfo().addDependant(absFileName); - } + if (isTopFile) { + pageInfo.setIsXml(isXml); + isTopFile = false; + } else { + compiler.getPageInfo().addDependant(absFileName); + } -// dispatch to the proper parser -reader = JspUtil.getReader(absFileName, encoding, jarFile, ctxt, -err); -if (isXml) { -parsedPage = JspDocumentParser.parse(this, absFileName, - reader, parent, + // Dispatch to the proper parser + if (isXml) { + InputStream inStream = null; + try { + inStream = JspUtil.getInputStream(absFileName, jarFile, ctxt, + err); + parsedPage = JspDocumentParser.parse(this, absFileName, + inStream, p
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JasperLoader.java JspServletWrapper.java
luehe 2002/11/27 20:18:08 Modified:jasper2/src/share/org/apache/jasper Constants.java EmbededServletOptions.java JspCompilationContext.java jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java ImplicitTagLibraryInfo.java JspRuntimeContext.java JspUtil.java Node.java TagFileProcessor.java TagLibraryInfoImpl.java jasper2/src/share/org/apache/jasper/servlet JasperLoader.java JspServletWrapper.java Log: Avoid conflicts between tag files that are located in different directories and therefore are considered to belong to different implicit tag libraries. The path of a tag file is now reflected in the directory in which the corresponding tag handler is stored, and in the name of the package to which the tag handler is assigned. This change also avoids conflicts between tag files with the same name and path under /META-INF/tags/ and /WEB-INF/tags/, by adding "meta" or "web", respectively, to the directory and package names of the respective tag handlers. Revision ChangesPath 1.10 +1 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java Index: Constants.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Constants.java16 Nov 2002 04:20:09 - 1.9 +++ Constants.java28 Nov 2002 04:18:07 - 1.10 @@ -158,8 +158,7 @@ /** * The default package name for tag handlers generated from tag files */ -public static final String TAG_FILE_PACKAGE_NAME - = "org.apache.jsp.tagfile"; +public static final String TAG_FILE_PACKAGE_NAME = "org.apache.jsp.tag"; /** * Servlet context and request attributes that the JSP engine 1.13 +10 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java Index: EmbededServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- EmbededServletOptions.java16 Nov 2002 04:20:09 - 1.12 +++ EmbededServletOptions.java28 Nov 2002 04:18:07 - 1.13 @@ -435,12 +435,14 @@ if (classpath != null) this.classpath = classpath; + /* + * scratchdir + */ String dir = config.getInitParameter("scratchdir"); - -if (dir != null) +if (dir != null) { scratchDir = new File(dir); -else { -// First we try the Servlet 2.2 javax.servlet.context.tempdir property +} else { +// First try the Servlet 2.2 javax.servlet.context.tempdir property scratchDir = (File) context.getAttribute(Constants.TMP_DIR); if (scratchDir == null) { // Not running in a Servlet 2.2 container. @@ -449,8 +451,7 @@ if (dir != null) scratchDir = new File(dir); } -} - +} if (this.scratchDir == null) { Constants.message("jsp.error.no.scratch.dir", Logger.FATAL); return; 1.25 +68 -54 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java Index: JspCompilationContext.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- JspCompilationContext.java28 Oct 2002 18:16:19 - 1.24 +++ JspCompilationContext.java28 Nov 2002 04:18:07 - 1.25 @@ -91,7 +91,7 @@ private Hashtable tagFileJars; private boolean isPackagedTagFile; -private String servletClassName; +private String className; private String jspUri; private boolean isErrPage; private String servletPackageName; @@ -301,40 +301,45 @@ */ public String getServletClassName() { - if (isTagFile) { - return tagInfo.getTagName(); - } - -if (servletClassName != null) { -return servletClassName; +if (className != null) { +return className; } -int iSep = jspUri.lastIndexOf('/'
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/02 12:08:55 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties Log: Added error codes/messages for 15002 Revision ChangesPath 1.63 +3 -1 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.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- messages.properties 2 Dec 2002 11:21:00 - 1.62 +++ messages.properties 2 Dec 2002 20:08:55 - 1.63 @@ -336,3 +336,5 @@ jsp.error.xml.invalidHighSurrogate = High surrogate bits in UTF-8 sequence must not exceed 0x10 but found 0x{0}. jsp.error.multiple.jspoutput = Cannot have multiple occurrences of <jsp:output> jsp.error.attributes.not.allowed = {0} must not have any attributes +jsp.error.tagfile.badSuffix=Missing \".tag\" suffix in tag file path {0} +jsp.error.tagfile.illegalPath=Missing \"/WEB-INF/tags\" or \"/META-INF/tags\" in tag file path {0} -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspUtil.java
luehe 2002/12/02 12:09:28 Modified:jasper2/src/share/org/apache/jasper/compiler JspUtil.java Log: Added error codes/messages for 15002 Revision ChangesPath 1.25 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java Index: JspUtil.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- JspUtil.java 28 Nov 2002 04:18:08 - 1.24 +++ JspUtil.java 2 Dec 2002 20:09:28 - 1.25 @@ -770,7 +770,7 @@ if (index != -1) { path = path.substring(0, index); } else { - err.jspError("XXX", path); + err.jspError("jsp.error.tagfile.badSuffix", path); } index = path.indexOf(WEB_INF_TAGS); @@ -783,7 +783,7 @@ className = "org.apache.jsp.tag.meta."; begin = index + META_INF_TAGS.length(); } else { - err.jspError("jsp.error.tagfile.wrong.path", path); + err.jspError("jsp.error.tagfile.illegalPath", path); } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime PageContextImpl.java
luehe 2002/12/02 17:58:36 Modified:jasper2/src/share/org/apache/jasper/runtime PageContextImpl.java Log: Fixed Bugtraq 4787293: JspContext.popBody and Jsp/PageContext.pushBody don't update "out" attribute Revision ChangesPath 1.37 +12 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java Index: PageContextImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- PageContextImpl.java 27 Nov 2002 02:31:29 - 1.36 +++ PageContextImpl.java 3 Dec 2002 01:58:36 - 1.37 @@ -530,6 +530,10 @@ outs[depth].setWriter(writer); out = outs[depth]; + // Update the value of the "out" attribute in the page scope + // attribute namespace of this PageContext + setAttribute(OUT, out); + return outs[depth]; } @@ -540,6 +544,11 @@ } else { out = baseOut; } + + // Update the value of the "out" attribute in the page scope + // attribute namespace of this PageContext + setAttribute(OUT, out); + return out; } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime JspContextWrapper.java
luehe 2002/12/03 15:17:48 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java jasper2/src/share/org/apache/jasper/runtime JspContextWrapper.java Log: Performance improvement: Pass ArrayList (instead of Vector) of scripting variables to JSP Context Wrapper constructor: ArrayList is not synchronized. Revision ChangesPath 1.134 +12 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.133 retrieving revision 1.134 diff -u -r1.133 -r1.134 --- Generator.java28 Nov 2002 04:18:08 - 1.133 +++ Generator.java3 Dec 2002 23:17:48 - 1.134 @@ -3043,9 +3043,9 @@ out.pushIndent(); out.printil("super.setJspContext(ctx);"); TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); - out.printil("java.util.Vector _jspx_nested = null;"); - out.printil("java.util.Vector _jspx_at_begin = null;"); - out.printil("java.util.Vector _jspx_at_end = null;"); + out.printil("java.util.ArrayList _jspx_nested = null;"); + out.printil("java.util.ArrayList _jspx_at_begin = null;"); + out.printil("java.util.ArrayList _jspx_at_end = null;"); for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/12/03 15:49:46 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Do not call the setParent() method on SimpleTag handlers if the value being passed is null, since SimpleTag instances are not reused Revision ChangesPath 1.135 +11 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.134 retrieving revision 1.135 diff -u -r1.134 -r1.135 --- Generator.java3 Dec 2002 23:17:48 - 1.134 +++ Generator.java3 Dec 2002 23:49:46 - 1.135 @@ -2378,10 +2378,14 @@ out.println(");"); } } else { - out.printin(tagHandlerVar); - out.print(".setParent("); - out.print(parent); - out.println(");"); + // The setParent() method need not be called if the value being + // passed is null, since SimpleTag instances are not reused + if (parent != null) { + out.printin(tagHandlerVar); + out.print(".setParent("); + out.print(parent); + out.println(");"); + } } Node.JspAttribute[] attrs = n.getJspAttributes(); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java
luehe 2002/12/04 18:27:35 Modified:jasper2/src/share/org/apache/jasper JspCompilationContext.java jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java Log: Fix for 15002 ("Tag files in different directories not belonging to different tag libraries") on Windows. Revision ChangesPath 1.26 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java Index: JspCompilationContext.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- JspCompilationContext.java28 Nov 2002 04:18:07 - 1.25 +++ JspCompilationContext.java5 Dec 2002 02:27:35 - 1.26 @@ -447,7 +447,7 @@ if (isTagFile) { jspPath = "tags/" - + tagInfo.getTagClassName().replace('.', File.separatorChar) + + tagInfo.getTagClassName().replace('.', '/') + ".java"; } else { String dirName = getJspFile(); 1.22 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java Index: JspServletWrapper.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- JspServletWrapper.java28 Nov 2002 04:18:08 - 1.21 +++ JspServletWrapper.java5 Dec 2002 02:27:35 - 1.22 @@ -155,7 +155,7 @@ servletContext, this, rctxt, tagFileJars); ctxt.createOutdir("/tags/" - + tagInfo.getTagClassName().replace('.', File.separatorChar)); + + tagInfo.getTagClassName().replace('.', '/')); } public JspCompilationContext getJspEngineContext() { -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspUtil.java
luehe 2002/12/04 18:41:53 Modified:jasper2/src/share/org/apache/jasper/compiler JspUtil.java Log: Added javadocs Revision ChangesPath 1.26 +9 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java Index: JspUtil.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- JspUtil.java 2 Dec 2002 20:09:28 - 1.25 +++ JspUtil.java 5 Dec 2002 02:41:53 - 1.26 @@ -756,6 +756,12 @@ /** * Gets the fully-qualified class name of the tag handler corresponding to * the given tag file path. + * + * @param path Tag file path + * @param err Error dispatcher + * + * @return Fully-qualified class name of the tag handler corresponding to + * the given tag file path */ public static String getTagHandlerClassName(String path, ErrorDispatcher err) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/tagplugin TagPlugin.java TagPluginContext.java
luehe 2002/12/05 09:56:43 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java JspReader.java Node.java PageDataImpl.java Parser.java TagPluginManager.java jasper2/src/share/org/apache/jasper/compiler/tagplugin TagPlugin.java TagPluginContext.java Log: Store scriptlet text as String (instead of char[]), to avoid unnecessary conversions between String and char[]. Revision ChangesPath 1.137 +7 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.136 retrieving revision 1.137 diff -u -r1.136 -r1.137 --- Generator.java5 Dec 2002 02:39:03 - 1.136 +++ Generator.java5 Dec 2002 17:56:43 - 1.137 @@ -831,7 +831,7 @@ public void visit(Node.Scriptlet n) throws JasperException { n.setBeginJavaLine(out.getJavaLine()); - out.printMultiLn(new String(n.getText())); + out.printMultiLn(n.getText()); out.println(); n.setEndJavaLine(out.getJavaLine()); } @@ -1713,8 +1713,7 @@ public void visit(Node.TemplateText n) throws JasperException { - char[] chars = n.getText(); - int size = chars.length; + String text = n.getText(); n.setBeginJavaLine(out.getJavaLine()); @@ -1722,8 +1721,8 @@ StringBuffer sb = new StringBuffer("out.write(\""); int initLength = sb.length(); int count = CHUNKSIZE; - for (int i = 0 ; i < size ; i++) { - char ch = chars[i]; + for (int i = 0 ; i < text.length() ; i++) { + char ch = text.charAt(i); --count; switch(ch) { case '"': 1.31 +11 -13 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.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- JspDocumentParser.java27 Nov 2002 16:42:26 - 1.30 +++ JspDocumentParser.java5 Dec 2002 17:56:43 - 1.31 @@ -368,9 +368,9 @@ for (int i = offset; i < limit; i++) { int ch = buf[i]; if (lastCh == '$' && ch == '{') { - char[] bufCopy = ttext.toCharArray(); - if (bufCopy.length > 0) { - new Node.TemplateText(bufCopy, start, current); + if (ttext.size() > 0) { + new Node.TemplateText(ttext.toString(), start, + current); ttext = new CharArrayWriter(); } // following "${" to first unquoted "}" @@ -392,7 +392,8 @@ continue; } if (ch == '}') { - new Node.ELExpression(ttext.toCharArray(), start, current); + new Node.ELExpression(ttext.toString(), start, + current); ttext = new CharArrayWriter(); break; } @@ -417,9 +418,8 @@ if (lastCh == '$') { ttext.write('$'); } - char[] bufCopy = ttext.toCharArray(); - if (bufCopy.length > 0) { - new Node.TemplateText(bufCopy, start, current); + if (ttext.size() > 0) { + new Node.TemplateText(ttext.toString(), start, current); } } } @@ -482,9 +482,7 @@ if (!inDTD) { Mark start = new Mark(path, locator.getLineNumber(), locator.getColumnNumber()); - char[] bufCopy = new char[len]; - System.arraycopy(buf, offset, bufCopy, 0, len); - new Node.Comment(bufCopy, start, current); + new Node.Comment(new String(buf, offset, len), start, current); } } 1.12 +5 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java Index: JspReader.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/sr
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/tagplugins - New directory
luehe 2002/12/05 15:54:51 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/tagplugins - New directory -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/tagplugins/jstl - New directory
luehe 2002/12/05 15:55:15 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/tagplugins/jstl - New directory -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/tagplugins/jstl ForEach.java
luehe 2002/12/05 15:56:40 Modified:jasper2 build.xml jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java Node.java TagPluginManager.java Added: jasper2/src/share/org/apache/jasper/tagplugins/jstl ForEach.java Log: First cut at plugin implementation for JSTL's action. Revision ChangesPath 1.18 +1 -0 jakarta-tomcat-jasper/jasper2/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/build.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- build.xml 30 Aug 2002 18:04:50 - 1.17 +++ build.xml 5 Dec 2002 23:56:39 - 1.18 @@ -134,6 +134,7 @@ + 1.40 +1 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- Compiler.java 4 Dec 2002 00:48:42 - 1.39 +++ Compiler.java 5 Dec 2002 23:56:39 - 1.40 @@ -291,7 +291,7 @@ // Optimizations by Tag Plugins TagPluginManager tagPluginManager = options.getTagPluginManager(); - tagPluginManager.apply(pageNodes); + tagPluginManager.apply(pageNodes, errDispatcher); // generate servlet .java file Generator.generate(writer, this, pageNodes); 1.138 +6 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.137 retrieving revision 1.138 diff -u -r1.137 -r1.138 --- Generator.java5 Dec 2002 17:56:43 - 1.137 +++ Generator.java5 Dec 2002 23:56:39 - 1.138 @@ -1871,13 +1871,13 @@ } } - public void visit(Node.GenAttribute n) throws JasperException { + public void visit(Node.AttributeGenerator n) throws JasperException { Node.CustomTag tag = n.getTag(); Node.JspAttribute[] attrs = tag.getJspAttributes(); for (int i=0; ihttp://www.apache.org/)." *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software *Foundation" must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" *nor may "Apache" appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.jasper.tagplugins.jstl; import org.apache.jasper.compiler.tagplugin.*; public class ForEach implements TagPlugin { public void doTag(TagPluginContext ctxt) { String index = null; if (ctxt.isAttributeSpecified("begin")) { index = ctxt.getTemporaryVariableName(); ctxt.generateJavaSource("for (int " + index + " = "); ctxt.generateAttribute("begin"); ctxt.gener
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/06 11:11:53 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties Log: Added error message for jsp.error.plugin.wrongRootElement Revision ChangesPath 1.64 +2 -1 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.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- messages.properties 2 Dec 2002 20:08:55 - 1.63 +++ messages.properties 6 Dec 2002 19:11:53 - 1.64 @@ -338,3 +338,4 @@ jsp.error.attributes.not.allowed = {0} must not have any attributes jsp.error.tagfile.badSuffix=Missing \".tag\" suffix in tag file path {0} jsp.error.tagfile.illegalPath=Missing \"/WEB-INF/tags\" or \"/META-INF/tags\" in tag file path {0} +jsp.error.plugin.wrongRootElement=Name of root element in {0} different from {1} -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Parser.java
luehe 2002/12/09 13:51:57 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java Log: Standard syntax: - Added uri and local name to custom action attributes. - Enforce restriction that if a dynamic attribute has a prefix that doesn't map to a namespace (taglib), a translation error is caused. Revision ChangesPath 1.42 +26 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Parser.java 5 Dec 2002 17:56:43 - 1.41 +++ Parser.java 9 Dec 2002 21:51:56 - 1.42 @@ -199,11 +199,29 @@ * Note: JSP and XML spec does not allow while spaces around Eq. It is * added to be backward compatible with Tomcat, and with other xml parsers. */ -private boolean parseAttribute(AttributesImpl attrs) throws JasperException { - String name = parseName(); - if (name == null) +private boolean parseAttribute(AttributesImpl attrs) + throws JasperException { + + // Get the qualified name + String qName = parseName(); + if (qName == null) return false; + // Determine prefix and local name components + String localName = qName; + String uri = ""; + int index = qName.indexOf(':'); + if (index != -1) { + String prefix = qName.substring(0, index); + TagLibraryInfo tagLibInfo = (TagLibraryInfo) taglibs.get(prefix); + if (tagLibInfo == null) { + err.jspError(reader.mark(), + "jsp.error.attribute.invalidPrefix", prefix); + } + uri = tagLibInfo.getURI(); + localName = qName.substring(index+1); + } + reader.skipSpaces(); if (!reader.matches("=")) err.jspError(reader.mark(), "jsp.error.attribute.noequal"); @@ -218,8 +236,8 @@ watchString = "%>"; watchString = watchString + quote; - String attr = parseAttributeValue(watchString); - attrs.addAttribute("", name, name, "CDATA", attr); + String attrValue = parseAttributeValue(watchString); + attrs.addAttribute(uri, localName, qName, "CDATA", attrValue); return true; } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_fr.properties
luehe 2002/12/09 14:17:32 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_fr.properties Log: Fixed Bugzilla 15189: Error message provided when jsp:param element is not used properly is misleading Revision ChangesPath 1.43 +9 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- Parser.java 9 Dec 2002 21:51:56 - 1.42 +++ Parser.java 9 Dec 2002 22:17:32 - 1.43 @@ -1165,7 +1165,7 @@ *| 'plugin'StdActionContent *| 'element' StdActionContent */ -private void parseAction(Node parent) throws JasperException { +private void parseStandardAction(Node parent) throws JasperException { Mark start = reader.mark(); if (reader.matches("include")) { @@ -1196,8 +1196,10 @@ parsePlugin(parent); } else if (reader.matches("element")) { parseElement(parent); + } else if (reader.matches("param")) { + err.jspError(start, "jsp.error.param.invalidUse"); } else { - err.jspError(start, "jsp.error.badaction"); + err.jspError(start, "jsp.error.badStandardAction"); } } @@ -1447,7 +1449,7 @@ } else if (reader.matches("${")) { parseELExpression(parent); } else if (reader.matches("\" jsp.error.closeparams=param tag needs to be closed with /params jsp.error.plugin.notype=type not declared in jsp:plugin @@ -291,7 +292,7 @@ jsp.error.could.not.add.taglibraries=Could not add tag one or more libraries. jsp.error.duplicate.name.jspattribute=The attribute {0} specified in the standard or custom action also appears as the value of the name attribute in the enclosed jsp:attribute jsp.error.not.in.template={0} not allowed in a template text body. -jsp.error.badaction=The action is not a recognizable standard action. +jsp.error.badStandardAction=The action is not a recognizable standard action. jsp.error.tagdirective.badbodycontent=Invalid body-content ({0}) in tag directive jsp.error.page.config_pagedir_encoding_conflict=Page-encoding specified in jsp-property-group ({0}) is different from that specified in page directive ({1}) jsp.error.page.prolog_pagedir_encoding_conflict=Page-encoding specified in XML prolog ({0}) is different from that specified in page directive ({1}) @@ -339,3 +340,4 @@ jsp.error.tagfile.badSuffix=Missing \".tag\" suffix in tag file path {0} jsp.error.tagfile.illegalPath=Missing \"/WEB-INF/tags\" or \"/META-INF/tags\" in tag file path {0} jsp.error.plugin.wrongRootElement=Name of root element in {0} different from {1} +jsp.error.attribute.invalidPrefix=The attribute prefix {0} does not correspond to any imported tag library 1.7 +2 -2 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- messages_fr.properties2 Dec 2002 11:21:00 - 1.6 +++ messages_fr.properties9 Dec 2002 22:17:32 - 1.7 @@ -287,7 +287,7 @@ jsp.error.could.not.add.taglibraries=Impossible d''ajouter une ou plusieurs librairies de tag. jsp.error.duplicate.name.jspattribute=L''attribut {0} indiqué dans l''action standard ou spécifique (custom) apparait aussi comme valeur de l''attribut de nom dans le jsp:attribute inclus jsp.error.not.in.template={0} n''est pas autorisé dans le corps de texte de template. -jsp.error.badaction=L''action n''est pas reconnue comme une action standard. +jsp.error.badStandardAction=L''action n''est pas reconnue comme une action standard. jsp.error.tagdirective.badbodycontent=Contenu de corps (body-content) ({0}) invalide dans la directive tag jsp.error.page.config_pagedir_encoding_conflict=L''encode de page (Page-encoding) indiqué dans le jsp-property-group ({0}) est différent de celui indiqué dans la directive de page ({1}) jsp.error.page.prolog_pagedir_encoding_conflict= -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Validator.java
luehe 2002/12/09 14:26:10 Modified:jasper2/src/share/org/apache/jasper/compiler Validator.java Log: When verifying that a custom action does not have any invalid attributes, take the attributes' URI into account. Revision ChangesPath 1.56 +28 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- Validator.java8 Nov 2002 19:55:47 - 1.55 +++ Validator.java9 Dec 2002 22:26:10 - 1.56 @@ -361,6 +361,7 @@ private ErrorDispatcher err; private TagInfo tagInfo; private ClassLoader loader; + private Hashtable taglibs; // A FunctionMapper, used to validate EL expressions. private FunctionMapper functionMapper; @@ -442,6 +443,7 @@ */ ValidateVisitor(Compiler compiler) { this.pageInfo = compiler.getPageInfo(); + this.taglibs = pageInfo.getTagLibraries(); this.err = compiler.getErrorDispatcher(); this.tagInfo = compiler.getCompilationContext().getTagInfo(); this.loader = compiler.getCompilationContext().getClassLoader(); @@ -679,10 +681,32 @@ = new Node.JspAttribute[attrs.getLength() + namedAttributeNodes.size()]; Hashtable tagDataAttrs = new Hashtable(attrs.getLength()); + TagLibraryInfo tagLibInfo = + (TagLibraryInfo) taglibs.get(n.getPrefix()); + String uri = tagLibInfo.getURI(); for (int i=0; i, the action + * "test" and its attributes "a", "b", and "c" all belong + * to the namespace identified by the prefix "my". + * The above invocation would be equivalent to: + * + * An action attribute may have a prefix different from + * that of the action invocation only if the underlying + * tag handler supports dynamic attributes, in which case + * the attribute with the different prefix is considered a + * dynamic attribute. + */ + if (attrs.getLocalName(i).equals(tldAttrs[j].getName()) + && (attrs.getURI(i) == null + || attrs.getURI(i).length() == 0 + || attrs.getURI(i) == uri)) { if (tldAttrs[j].canBeRequestTime()) { Class expectedType = String.class; try { -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_fr.properties messages_ja.properties
luehe 2002/12/09 15:27:04 Modified:jasper2/src/share/org/apache/jasper/compiler Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_fr.properties messages_ja.properties Log: Fixed Bugtraq 4790760: A translation-time error is not generated if the 'name' attribute of jsp:param is an expression Revision ChangesPath 1.57 +12 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- Validator.java9 Dec 2002 22:26:10 - 1.56 +++ Validator.java9 Dec 2002 23:27:03 - 1.57 @@ -476,6 +476,13 @@ public void visit(Node.ParamAction n) throws JasperException { JspUtil.checkAttributes("Param action", n, paramActionAttrs, err); + // make sure the value of the 'name' attribute is not a + // request-time expression + if (isExpression(n, n.getAttributes().getValue("name"))) { + err.jspError(n, + "jsp.error.attribute.standard.non_rt_with_expr", + "name", "jsp:param"); + } n.setValue(getJspAttribute("value", null, null, n.getAttributeValue("value"), java.lang.String.class, null, @@ -739,7 +746,7 @@ // Make sure its value does not contain any. if (isExpression(n, attrs.getValue(i))) { err.jspError(n, - "jsp.error.attribute.non_rt_with_expr", + "jsp.error.attribute.custom.non_rt_with_expr", tldAttrs[j].getName()); } jspAttrs[i] @@ -976,7 +983,7 @@ * Checks to see if the given attribute value represents a runtime or * EL expression. */ - private boolean isExpression(Node.CustomTag n, String value) { + private boolean isExpression(Node n, String value) { if ((n.isXmlSyntax() && value.startsWith("%=")) || (!n.isXmlSyntax() && value.startsWith("<%=")) || (value.indexOf("${") != -1 && !pageInfo.isELIgnored())) 1.66 +3 -2 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.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- messages.properties 9 Dec 2002 22:17:32 - 1.65 +++ messages.properties 9 Dec 2002 23:27:03 - 1.66 @@ -297,7 +297,8 @@ jsp.error.page.config_pagedir_encoding_conflict=Page-encoding specified in jsp-property-group ({0}) is different from that specified in page directive ({1}) jsp.error.page.prolog_pagedir_encoding_conflict=Page-encoding specified in XML prolog ({0}) is different from that specified in page directive ({1}) jsp.error.page.prolog_config_encoding_conflict=Page-encoding specified in XML prolog ({0}) is different from that specified in jsp-property-group ({1}) -jsp.error.attribute.non_rt_with_expr=According to TLD, attribute {0} does not accept any expressions +jsp.error.attribute.custom.non_rt_with_expr=According to TLD, attribute {0} does not accept any expressions +jsp.error.attribute.standard.non_rt_with_expr=The {0} attribute of the {1} standard action does not accept any expressions jsp.error.scripting.variable.missing_name=Unable to determine scripting variable name from attribute {0} jasper.error.emptybodycontent.nonempty=According to TLD, tag {0} must be empty, but is not jsp.error.tagfile.var_name_given_equals_attr_name=In tag file {0}, the name-given attribute ({1}) of a variable directive equals the name attribute of an attribute directive 1.25 +2 -2 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/res
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/10 13:33:36 Modified:jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Fixed dynamic attribute bug for XML syntax. Revision ChangesPath 1.32 +7 -3 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.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- JspDocumentParser.java5 Dec 2002 17:56:43 - 1.31 +++ JspDocumentParser.java10 Dec 2002 21:33:35 - 1.32 @@ -169,6 +169,10 @@ // Use the default (non-validating) parser SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + // Preserve xmlns attributes + factory.setFeature("http://xml.org/sax/features/namespace-prefixes";, +true); // Configure the parser SAXParser saxParser = factory.newSAXParser(); 1.67 +2 -2 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.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- messages.properties 9 Dec 2002 23:27:03 - 1.66 +++ messages.properties 10 Dec 2002 21:33:36 - 1.67 @@ -289,7 +289,7 @@ jsp.error.unknown_attribute_type=Unknown attribute type ({1}) for attribute {0}. jsp.error.jspelement.missing.name=Mandatory attribute 'name' missing in jsp:element jsp.error.xmlns.redefinition.notimplemented=Internal error: Attempt to redefine xmlns:{0}. Redefinition of namespaces is not implemented. -jsp.error.could.not.add.taglibraries=Could not add tag one or more libraries. +jsp.error.could.not.add.taglibraries=Could not add one or more tag libraries. jsp.error.duplicate.name.jspattribute=The attribute {0} specified in the standard or custom action also appears as the value of the name attribute in the enclosed jsp:attribute jsp.error.not.in.template={0} not allowed in a template text body. jsp.error.badStandardAction=The action is not a recognizable standard action. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/12/11 11:40:46 Modified:jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Added support for named attributes that do not evaluate to String Revision ChangesPath 1.10 +12 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java Index: JspRuntimeLibrary.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JspRuntimeLibrary.java27 Nov 2002 02:54:46 - 1.9 +++ JspRuntimeLibrary.java11 Dec 2002 19:40:45 - 1.10 @@ -128,7 +128,15 @@ return null; } } - + +public static Character getCharacter(String s) throws JasperException { + if (s.length() > 0) { + return new Character(s.charAt(0)); + } else { + throw new JasperException(Constants.getString("jsp.error.bad_string_Character")); + } +} + // __begin convertMethod public static Object convert(String propertyName, String s, Class t, Class propertyEditorClass) throws JasperException 1.139 +54 -21 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.138 retrieving revision 1.139 diff -u -r1.138 -r1.139 --- Generator.java5 Dec 2002 23:56:39 - 1.138 +++ Generator.java11 Dec 2002 19:40:45 - 1.139 @@ -2419,7 +2419,7 @@ attrValue = convertString( c[0], attrValue, attrName, handlerInfo.getPropertyEditorClass(attrName), - false); + true); } } else if (attr.isELInterpreterInput()) { // run attrValue through the expression interpreter @@ -2429,7 +2429,7 @@ attrValue = convertString( c[0], attrValue, attrName, handlerInfo.getPropertyEditorClass(attrName), - true); + false); } return attrValue; } @@ -2519,11 +2519,12 @@ } private String convertString(Class c, String s, String attrName, - Class propEditorClass, boolean quote) + Class propEditorClass, + boolean isNamedAttribute) throws JasperException { String quoted = s; - if (quote) { + if (!isNamedAttribute) { quoted = quote(s); } @@ -2538,11 +2539,19 @@ } else if (c == boolean.class) { return Boolean.valueOf(s).toString(); } else if (c == Boolean.class) { - return "new Boolean(" + Boolean.valueOf(s).toString() + ")"; + if (isNamedAttribute) + return "new Boolean(" + s + ")"; + else + // Detect format error at translation time + return "new Boolean(" + Boolean.valueOf(s).toString() + ")"; } else if (c == byte.class) { return "((byte)" + Byte.valueOf(s).toString() + ")"; } else if (c == Byte.class) { - return "new Byte((byte)" + Byte.valueOf(s).toString() + ")"; + if (isNamedAttribute) + return "new Byte(" + s + ")"; + else + // Detect format error at translation time + return "new Byte((byte)" + Byte.valueOf(s).toString() + ")"; } else if (c == char.class) { // non-normative (normative method would fail to compile) if (s.length() > 0) { @@ -2554,35 +2563,59 @@ err.getString("jsp.error.bad_string_char")); } } else if (c == Character.class) { - // non-normative (normative method would fail to compile) - if (s.length() > 0) { - char ch = s.charAt(0); - // this trick avoids escaping issues - return "new Character((char) " + (int) ch + ")"; +
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ErrorDispatcher.java
luehe 2002/12/11 14:34:06 Modified:jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java jasper2/src/share/org/apache/jasper/compiler ErrorDispatcher.java Log: Leverage ErrorDispatcher in JspRuntimeLibrary Revision ChangesPath 1.11 +42 -47 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java Index: JspRuntimeLibrary.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JspRuntimeLibrary.java11 Dec 2002 19:40:45 - 1.10 +++ JspRuntimeLibrary.java11 Dec 2002 22:34:06 - 1.11 @@ -81,7 +81,7 @@ import javax.servlet.jsp.tagext.BodyContent; import org.apache.jasper.JasperException; -import org.apache.jasper.Constants; +import org.apache.jasper.compiler.ErrorDispatcher; // for JSTL expression interpreter import javax.servlet.jsp.PageContext; @@ -100,6 +100,12 @@ */ public class JspRuntimeLibrary { +private static ErrorDispatcher err; + +static { + err = new ErrorDispatcher(); +} + protected static class PrivilegedIntrospectHelper implements PrivilegedExceptionAction { @@ -130,15 +136,15 @@ } public static Character getCharacter(String s) throws JasperException { - if (s.length() > 0) { - return new Character(s.charAt(0)); - } else { - throw new JasperException(Constants.getString("jsp.error.bad_string_Character")); + if (s.length() == 0) { + err.jspError("jsp.error.bad_string_Character"); } + return new Character(s.charAt(0)); } // __begin convertMethod -public static Object convert(String propertyName, String s, Class t, Class propertyEditorClass) +public static Object convert(String propertyName, String s, Class t, + Class propertyEditorClass) throws JasperException { try { @@ -248,10 +254,8 @@ if ( method != null ) { if (type.isArray()) { if (request == null) { -throw new JasperException(Constants.getString( -"jsp.error.beans.setproperty.noindexset", -new Object[] {})); -}; +err.jspError("jsp.error.beans.setproperty.noindexset"); +} Class t = type.getComponentType(); String[] values = request.getParameterValues(param); //XXX Please check. @@ -275,14 +279,11 @@ } if (!ignoreMethodNF && (method == null)) { if (type == null) { -throw new JasperException(Constants.getString( -"jsp.error.beans.noproperty", -new Object[] {prop, bean.getClass().getName()})); +err.jspError("jsp.error.beans.noproperty", + prop, bean.getClass().getName()); } else { -throw new JasperException(Constants.getString( -"jsp.error.beans.nomethod.setproperty", -new Object[] {prop, type.getName(), - bean.getClass().getName()})); + err.jspError("jsp.error.beans.nomethod.setproperty", + prop, type.getName(), bean.getClass().getName()); } } } @@ -336,16 +337,19 @@ * the request and the property is indexed. */ public static void createTypedArray(String propertyName, - Object bean, Method method, String []values, Class t, + Object bean, + Method method, + String[] values, + Class t, Class propertyEditorClass) -throws JasperException { + throws JasperException { + try { if (propertyEditorClass != null) { Object[] tmpval = new Integer[values.length]; for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java Node.java Parser.java
luehe 2002/12/11 19:30:59 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java Node.java Parser.java Log: - Allow empty body, and treat it as "". - In a JSP document (XML syntax), preserve any leading and trailing white-space-only textual nodes in a whose 'trim' attribute is set to FALSE (these nodes are dropped otherwise). Revision ChangesPath 1.140 +30 -25 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.139 retrieving revision 1.140 diff -u -r1.139 -r1.140 --- Generator.java11 Dec 2002 19:40:45 - 1.139 +++ Generator.java12 Dec 2002 03:30:58 - 1.140 @@ -2687,8 +2687,8 @@ * @return The name of the temporary variable the result is stored in. */ public String generateNamedAttributeValue( Node.NamedAttribute n ) -throws JasperException -{ +throws JasperException { + String varName = n.getTemporaryVariableName(); // If the only body element for this named attribute node is @@ -2696,29 +2696,34 @@ // pushBody and popBody. Maybe we can further optimize // here by getting rid of the temporary variable, but in // reality it looks like javac does this for us. -boolean templateTextOptimization = false; Node.Nodes body = n.getBody(); -if( body.size() == 1 ) { -Node bodyElement = body.getNode( 0 ); -if( bodyElement instanceof Node.TemplateText ) { -templateTextOptimization = true; -out.printil( "String " + varName + " = " + -quote( new String( -((Node.TemplateText)bodyElement).getText() ) ) + ";" ); -} -} + if (body != null) { + boolean templateTextOptimization = false; + if( body.size() == 1 ) { + Node bodyElement = body.getNode( 0 ); + if( bodyElement instanceof Node.TemplateText ) { + templateTextOptimization = true; + out.printil("String " + varName + " = " + + quote(new String(((Node.TemplateText)bodyElement).getText())) + + ";"); + } + } -// XXX - Another possible optimization would be for -// lone EL expressions (no need to pushBody here either). + // XXX - Another possible optimization would be for + // lone EL expressions (no need to pushBody here either). -if( !templateTextOptimization ) { -out.printil( "out = pageContext.pushBody();" ); -visitBody( n ); -out.printil( "String " + varName + " = " + - "((javax.servlet.jsp.tagext.BodyContent)" + - "out).getString();" ); -out.printil( "out = pageContext.popBody();" ); -} + if( !templateTextOptimization ) { + out.printil( "out = pageContext.pushBody();" ); + visitBody( n ); + out.printil( "String " + varName + " = " + + "((javax.servlet.jsp.tagext.BodyContent)" + + "out).getString();" ); + out.printil( "out = pageContext.popBody();" ); + } + } else { + // Empty body must be treated as "" + out.printil("String " + varName + " = \"\";"); + } return varName; } 1.33 +38 -24 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.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- JspDocumentParser.java10 Dec 2002 21:33:35 - 1.32 +++ JspDocumentParser.java12 Dec 2002 03:30:58 - 1.33 @@ -349,12 +349,15 @@ int offset,
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/12 09:44:38 Modified:jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Removed support for tag file paths relative to TLD, until they are supported by the spec. Tag file paths must start with "/WEB-INF/tags" or "/META-INF/tags". Revision ChangesPath 1.28 +6 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java Index: TagLibraryInfoImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- TagLibraryInfoImpl.java 28 Nov 2002 04:18:08 - 1.27 +++ TagLibraryInfoImpl.java 12 Dec 2002 17:44:38 - 1.28 @@ -436,18 +436,11 @@ } } -path = path.replace('\\', '/'); - if (!path.startsWith("/")) { - // Tag file path is relative to uri of TLD file -path = uri.substring(0, uri.lastIndexOf("/") + 1) + path; - try { - path = new File(path).getCanonicalPath(); - } catch (IOException ioe) { - throw new JasperException(ioe); - } - } else if (path.startsWith("/META-INF/tags")) { + if (path.startsWith("/META-INF/tags")) { // Tag file packaged in JAR ctxt.getTagFileJars().put(path, jarFile); + } else if (!path.startsWith("/WEB-INF/tags")) { + err.jspError("jsp.error.tagfile.illegalPath", path); } TagInfo tagInfo = TagFileProcessor.parseTagFile(parserController, 1.68 +2 -2 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.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- messages.properties 10 Dec 2002 21:33:36 - 1.67 +++ messages.properties 12 Dec 2002 17:44:38 - 1.68 @@ -339,6 +339,6 @@ jsp.error.multiple.jspoutput = Cannot have multiple occurrences of <jsp:output> jsp.error.attributes.not.allowed = {0} must not have any attributes jsp.error.tagfile.badSuffix=Missing \".tag\" suffix in tag file path {0} -jsp.error.tagfile.illegalPath=Missing \"/WEB-INF/tags\" or \"/META-INF/tags\" in tag file path {0} +jsp.error.tagfile.illegalPath=Illegal tag file path: {0}, must start with \"/WEB-INF/tags\" or \"/META-INF/tags\" jsp.error.plugin.wrongRootElement=Name of root element in {0} different from {1} jsp.error.attribute.invalidPrefix=The attribute prefix {0} does not correspond to any imported tag library -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_fr.properties messages_ja.properties
luehe 2002/12/12 14:30:30 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties messages_es.properties messages_fr.properties messages_ja.properties Log: Added error message for jsp.error.plugin.badtype error code Revision ChangesPath 1.69 +2 -2 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.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- messages.properties 12 Dec 2002 17:44:38 - 1.68 +++ messages.properties 12 Dec 2002 22:30:30 - 1.69 @@ -107,8 +107,8 @@ jsp.error.closeindividualparam=param tag needs to be closed with \"/>\" jsp.error.closeparams=param tag needs to be closed with /params jsp.error.plugin.notype=type not declared in jsp:plugin +jsp.error.plugin.badtype=Illegal value for 'type' attribute in jsp:plugin: must be 'bean' or 'applet' jsp.error.plugin.nocode=code not declared in jsp:plugin -jsp.error.plugin.notclosed=jsp:plugin not closed jsp.error.ise_on_clear=Illegal to clear() when buffer size == 0 jsp.error.setproperty.beanNotFound=setProperty: Bean {0} not found jsp.error.getproperty.beanNotFound=getProperty: Bean {0} not found 1.26 +1 -2 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.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- messages_es.properties9 Dec 2002 23:27:03 - 1.25 +++ messages_es.properties12 Dec 2002 22:30:30 - 1.26 @@ -86,7 +86,6 @@ jsp.error.closeparams=el tag param necesita ser cerrado con /params jsp.error.plugin.notype=tipo no declarado en jsp:plugin jsp.error.plugin.nocode=codigo no declarado en jsp:plugin -jsp.error.plugin.notclosed=jsp:plugin no cerrado jsp.error.ise_on_clear=Es ilegal usar clear() cuando el tamaño del buffer es 0 jsp.error.setproperty.beanNotFound=setProperty: Bean {0} no encontrado jsp.error.getproperty.beanNotFound=getProperty: Bean {0} no encontrado 1.9 +1 -2 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- messages_fr.properties9 Dec 2002 23:27:03 - 1.8 +++ messages_fr.properties12 Dec 2002 22:30:30 - 1.9 @@ -107,7 +107,6 @@ jsp.error.closeparams=Le tag param tag doit être fermé avec /params jsp.error.plugin.notype=type non déclaré dans jsp:plugin jsp.error.plugin.nocode=code non déclaré dans jsp:plugin -jsp.error.plugin.notclosed=jsp:plugin non fermé jsp.error.ise_on_clear=Il est interdit d''utiliser clear() quand la taille de tampon== 0 jsp.error.setproperty.beanNotFound=setProperty: le Bean {0} est introuvable jsp.error.getproperty.beanNotFound=getProperty: le Bean {0} est introuvable 1.26 +1 -2 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.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- messages_ja.properties9 Dec 2002 23:27:03 - 1.25 +++ messages_ja.properties12 Dec 2002 22:30:30 - 1.26 @@ -98,7 +98,6 @@ jsp.error.closeparams=param\u30bf\u30b0\u306f/params\u3067\u9589\u3058\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093 jsp.error.plugin.notype=jsp:plugin\u3067type\u5c5e\u6027\u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093 jsp.error.plugin.nocode=jsp:plugin\u3067code\u5c5e\u6027\u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -jsp.error.plugin.notclosed=jsp:plugin\u304c\u9589\u3058\u3066\u3044\u307e\u305b\u3093 jsp.error.ise_on_clear=\u30d0\u30c3\u30d5\u30a1\u30b5\u30a4\u30ba\u304c0\u306e\u6642\u306bclear()\u3092\u5b9f\u884c\u3057\u3066\u3082\u7121\u52b9\u3067\u3059 jsp.error.setproperty.beanNotFound=setProperty: Bean {0} \u304c\u898b\u3064\u304b\u308a\u3
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/12 14:57:43 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Fixed 15338: jsp:params action used outside of the expected context yields misleading error message. Revision ChangesPath 1.45 +5 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- Parser.java 12 Dec 2002 03:30:58 - 1.44 +++ Parser.java 12 Dec 2002 22:57:43 - 1.45 @@ -1196,6 +1196,8 @@ parsePlugin(parent); } else if (reader.matches("element")) { parseElement(parent); + } else if (reader.matches("params")) { + err.jspError(start, "jsp.error.params.invalidUse"); } else if (reader.matches("param")) { err.jspError(start, "jsp.error.param.invalidUse"); } else { 1.70 +2 -1 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.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- messages.properties 12 Dec 2002 22:30:30 - 1.69 +++ messages.properties 12 Dec 2002 22:57:43 - 1.70 @@ -104,6 +104,7 @@ jsp.error.overflow=Error: JSP Buffer overflow jsp.error.paramexpected=Expected \"param\" tag with \"name\" and \"value\" attributes jsp.error.param.invalidUse=The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements +jsp.error.params.invalidUse=The jsp:params action must be a direct child of jsp:plugin jsp.error.closeindividualparam=param tag needs to be closed with \"/>\" jsp.error.closeparams=param tag needs to be closed with /params jsp.error.plugin.notype=type not declared in jsp:plugin -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
luehe 2002/12/12 15:31:52 Modified:jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java jasper2/src/share/org/apache/jasper/compiler Generator.java Log: Added support for named attributes whose associated attributes are of primitive type Revision ChangesPath 1.12 +10 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java Index: JspRuntimeLibrary.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JspRuntimeLibrary.java11 Dec 2002 22:34:06 - 1.11 +++ JspRuntimeLibrary.java12 Dec 2002 23:31:51 - 1.12 @@ -142,6 +142,13 @@ return new Character(s.charAt(0)); } +public static char getChar(String s) throws JasperException { + if (s.length() == 0) { + err.jspError("jsp.error.bad_string_Character"); + } + return s.charAt(0); +} + // __begin convertMethod public static Object convert(String propertyName, String s, Class t, Class propertyEditorClass) 1.141 +38 -16 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.140 retrieving revision 1.141 diff -u -r1.140 -r1.141 --- Generator.java12 Dec 2002 03:30:58 - 1.140 +++ Generator.java12 Dec 2002 23:31:51 - 1.141 @@ -2537,7 +2537,10 @@ } else if (c == String.class) { return quoted; } else if (c == boolean.class) { - return Boolean.valueOf(s).toString(); + if (isNamedAttribute) + return "Boolean.valueOf(" + s + ").booleanValue()"; + else + return Boolean.valueOf(s).toString(); } else if (c == Boolean.class) { if (isNamedAttribute) return "new Boolean(" + s + ")"; @@ -2553,14 +2556,18 @@ // Detect format error at translation time return "new Byte((byte)" + Byte.valueOf(s).toString() + ")"; } else if (c == char.class) { - // non-normative (normative method would fail to compile) - if (s.length() > 0) { - char ch = s.charAt(0); - // this trick avoids escaping issues - return "((char) " + (int) ch + ")"; + if (isNamedAttribute) { + return "org.apache.jasper.runtime.JspRuntimeLibrary.getChar(" + s + ")"; } else { - throw new NumberFormatException( -err.getString("jsp.error.bad_string_char")); + // non-normative (normative method would fail to compile) + if (s.length() > 0) { + char ch = s.charAt(0); + // this trick avoids escaping issues + return "((char) " + (int) ch + ")"; + } else { + throw new NumberFormatException( +err.getString("jsp.error.bad_string_char")); + } } } else if (c == Character.class) { if (isNamedAttribute) { @@ -2577,7 +2584,10 @@ } } } else if (c == double.class) { - return Double.valueOf(s).toString(); + if (isNamedAttribute) + return "Double.valueOf(" + s + ").doubleValue()"; + else + return Double.valueOf(s).toString(); } else if (c == Double.class) { if (isNamedAttribute) return "new Double(" + s + ")"; @@ -2585,7 +2595,10 @@ // Detect format error at translation time return "new Double(" + Double.valueOf(s).toString() + ")"; } else if (c == float.class) { - return Float.valueOf(s).toString() + "f"; + if (isNamedAttribute) + return "Float.valueOf(" + s + ").floatValue()"; + else + return Float.valueOf(s).toString() + "f"; } else if (c == Float.class) { if (
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Validator.java
luehe 2002/12/13 07:34:40 Modified:jasper2/src/share/org/apache/jasper/compiler Validator.java Log: Fixed 15354: Jasper doesn't cause a translation error if an EL or RT expression is provided to an attribute of jsp:plugin that doesn't accept dynamic attribute values. Revision ChangesPath 1.58 +46 -23 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- Validator.java9 Dec 2002 23:27:03 - 1.57 +++ Validator.java13 Dec 2002 15:34:39 - 1.58 @@ -478,11 +478,7 @@ paramActionAttrs, err); // make sure the value of the 'name' attribute is not a // request-time expression - if (isExpression(n, n.getAttributes().getValue("name"))) { - err.jspError(n, - "jsp.error.attribute.standard.non_rt_with_expr", - "name", "jsp:param"); - } + throwErrorIfExpression(n, "name", "jsp:param"); n.setValue(getJspAttribute("value", null, null, n.getAttributeValue("value"), java.lang.String.class, null, @@ -575,6 +571,18 @@ public void visit(Node.PlugIn n) throws JasperException { JspUtil.checkAttributes("Plugin", n, plugInAttrs, err); + throwErrorIfExpression(n, "type", "jsp:plugin"); + throwErrorIfExpression(n, "code", "jsp:plugin"); + throwErrorIfExpression(n, "codebase", "jsp:plugin"); + throwErrorIfExpression(n, "align", "jsp:plugin"); + throwErrorIfExpression(n, "archive", "jsp:plugin"); + throwErrorIfExpression(n, "hspace", "jsp:plugin"); + throwErrorIfExpression(n, "jreversion", "jsp:plugin"); + throwErrorIfExpression(n, "name", "jsp:plugin"); + throwErrorIfExpression(n, "vspace", "jsp:plugin"); + throwErrorIfExpression(n, "nspluginurl", "jsp:plugin"); + throwErrorIfExpression(n, "iepluginurl", "jsp:plugin"); + String type = n.getTextAttribute("type"); if (type == null) err.jspError(n, "jsp.error.plugin.notype"); @@ -891,6 +899,24 @@ n.getAttributeValue("omit-xml-declaration")); } + public void visit(Node.InvokeAction n) throws JasperException { + +JspUtil.checkAttributes("Invoke", n, invokeAttrs, err); + if (n.getAttributeValue("var") != null + && n.getAttributeValue("varReader") != null) { + err.jspError(n, "jsp.error.invoke.varAndVarReader"); + } + } + + public void visit(Node.DoBodyAction n) throws JasperException { + +JspUtil.checkAttributes("DoBody", n, doBodyAttrs, err); + if (n.getAttributeValue("var") != null + && n.getAttributeValue("varReader") != null) { + err.jspError(n, "jsp.error.doBody.varAndVarReader"); + } + } + /** * Preprocess attributes that can be expressions. Expression * delimiters are stripped. @@ -992,21 +1018,18 @@ return false; } - public void visit(Node.InvokeAction n) throws JasperException { - -JspUtil.checkAttributes("Invoke", n, invokeAttrs, err); - if (n.getAttributeValue("var") != null - && n.getAttributeValue("varReader") != null) { - err.jspError(n, "jsp.error.invoke.varAndVarReader"); - } - } - - public void visit(Node.DoBodyAction n) throws JasperException { - -JspUtil.checkAttributes("DoBody", n, doBodyAttrs, err); - if (n.getAttributeValue("var") != null - && n.getAttributeValue("varReader") != null) { - err.jspError(n, "jsp.error.doBody.varAndVarReader"); + /* + * Throws exception if the value of the attribute with the given + * name in the given node is given as an RT or EL expression, but the + * spec
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Parser.java
luehe 2002/12/13 07:44:39 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java Log: Fixed 15360: jsp:fallback action used outside of the expected context yields misleading error message. Revision ChangesPath 1.46 +5 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- Parser.java 12 Dec 2002 22:57:43 - 1.45 +++ Parser.java 13 Dec 2002 15:44:39 - 1.46 @@ -1196,6 +1196,8 @@ parsePlugin(parent); } else if (reader.matches("element")) { parseElement(parent); + } else if (reader.matches("fallback")) { + err.jspError(start, "jsp.error.fallback.invalidUse"); } else if (reader.matches("params")) { err.jspError(start, "jsp.error.params.invalidUse"); } else if (reader.matches("param")) { -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Validator.java
luehe 2002/12/13 07:55:34 Modified:jasper2/src/share/org/apache/jasper/compiler Validator.java Log: Fixed 15354 (Cont.): Jasper doesn't cause a translation error if an EL or RT expression is provided to an attribute of jsp:plugin that doesn't accept dynamic attribute values. Revision ChangesPath 1.59 +6 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- Validator.java13 Dec 2002 15:34:39 - 1.58 +++ Validator.java13 Dec 2002 15:55:34 - 1.59 @@ -1026,7 +1026,9 @@ private void throwErrorIfExpression(Node n, String attrName, String actionName) throws JasperException { - if (isExpression(n, n.getAttributes().getValue(attrName))) { + if (n.getAttributes() != null + && n.getAttributes().getValue(attrName) != null + && isExpression(n, n.getAttributes().getValue(attrName))) { err.jspError(n, "jsp.error.attribute.standard.non_rt_with_expr", attrName, actionName); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/13 08:27:43 Modified:jasper2/src/share/org/apache/jasper/compiler Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Fixed 15355: If a jsp:params element (nested within a jsp:plugin element) has no nested jsp:param elements, a translation error is not generated. Revision ChangesPath 1.60 +19 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- Validator.java13 Dec 2002 15:55:34 - 1.59 +++ Validator.java13 Dec 2002 16:27:43 - 1.60 @@ -486,6 +486,22 @@ visitBody(n); } + public void visit(Node.ParamsAction n) throws JasperException { + // Make sure we've got at least one nested jsp:param +Node.Nodes subElems = n.getBody(); +if (subElems == null) { + err.jspError(n, "jsp.error.params.emptyBody"); + } + for (int i=0; i\" jsp.error.closeparams=param tag needs to be closed with /params +jsp.error.params.emptyBody=jsp:params must contain at least one nested jsp:param +jsp.error.params.illegalChild=jsp:params must not have any nested elements other than jsp:param jsp.error.plugin.notype=type not declared in jsp:plugin jsp.error.plugin.badtype=Illegal value for 'type' attribute in jsp:plugin: must be 'bean' or 'applet' jsp.error.plugin.nocode=code not declared in jsp:plugin -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Node.java Validator.java
luehe 2002/12/13 10:06:08 Modified:jasper2/src/share/org/apache/jasper/compiler Node.java Validator.java Log: Implemented JSP 2.0 clarification for TagData.getAttribute() regarding named attributes: If a static value is specified for an attribute that accepts a request-time attribute expression then that static value is returned, even if the value is provided in the body of a action. The distinguished object REQUEST_TIME_VALUE is only returned if the value is specified as a request-time attribute expression or via the with a body that contains dynamic content (scriptlets, scripting expressions, EL expressions, standard actions, or custom actions). Returns null if the attribute is not set. Revision ChangesPath 1.48 +39 -31 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Node.java 12 Dec 2002 03:30:58 - 1.47 +++ Node.java 13 Dec 2002 18:06:08 - 1.48 @@ -145,16 +145,6 @@ * from the attribute of the node, or from a jsp:attrbute */ public String getTextAttribute(String name) { - class AttributeVisitor extends Visitor { - String attrValue = null; - public void visit(TemplateText txt) { - attrValue = new String(txt.getText()); - } - - public String getAttrValue() { - return attrValue; - } - } String attr = getAttributeValue(name); if (attr != null) { @@ -166,19 +156,7 @@ return null; } - // Get the attribute value from named attribute (jsp:attribute) - // Since this method is only for attributes that are not rtexpr, - // we can assume the body of the jsp:attribute is a template text - if (namedAttribute.getBody() != null) { - AttributeVisitor attributeVisitor = new AttributeVisitor(); - try { - namedAttribute.getBody().visit(attributeVisitor); - } catch (JasperException e) { - } - attr = attributeVisitor.getAttrValue(); - } - - return attr; + return namedAttribute.getText(); } /** @@ -922,7 +900,7 @@ */ public static class ChildInfo { private boolean scriptless; // true if the tag and its body - // contians no scripting elements. + // contain no scripting elements. private boolean hasUseBean; private boolean hasIncludeAction; private boolean hasSetProperty; @@ -1368,6 +1346,36 @@ public String getTemporaryVariableName() { return temporaryVariableName; } + + public String getText() { + + class AttributeVisitor extends Visitor { + String attrValue = null; + public void visit(TemplateText txt) { + attrValue = new String(txt.getText()); + } + + public String getAttrValue() { + return attrValue; + } + } + + // Get the attribute value from this named attribute + // (). + // Since this method is only for attributes that are not rtexpr, + // we can assume the body of the jsp:attribute is a template text + String text = null; + if (getBody() != null) { + AttributeVisitor attributeVisitor = new AttributeVisitor(); + try { + getBody().visit(attributeVisitor); + } catch (JasperException e) { + } + text = attributeVisitor.getAttrValue(); + } + + return text; + } } /** @@ -1557,14 +1565,14 @@ * @return true if the value represents an expression that should * be fed to the expression interpreter * @return false for string literals or rtexprvalues that should - * not be interpreter or reevaluated + * not be interpreted or reevaluated */ public boolean isELInterpreterInput() { return el; } /** - * @return true if the value is a string literal know at translation + * @return true if the value is a string literal known at translation * time. */ public boolean isLiteral() { @@ -1654,8 +1662,8 @@ public static class Visitor { /** - * The method provides a place to put actions that are common to - * all nodes
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TldLocationsCache.java
luehe 2002/12/13 11:09:52 Modified:jasper2/src/share/org/apache/jasper/compiler TldLocationsCache.java Log: - Added support for implicit taglib map entries from TLDs in the filesystem. - Add implicit entry to taglib map only if its uri is not already present in the map Revision ChangesPath 1.10 +90 -51 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java Index: TldLocationsCache.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TldLocationsCache.java2 Dec 2002 22:26:23 - 1.9 +++ TldLocationsCache.java13 Dec 2002 19:09:52 - 1.10 @@ -107,6 +107,7 @@ * the TLD of this tag library. * * @author Pierre Delisle + * @author Jan Luehe */ public class TldLocationsCache { @@ -121,12 +122,11 @@ private static final String WEB_XML = "/WEB-INF/web.xml"; /** - * The mapping of the 'global' tag library URI to the location - * (resource path) of the TLD associated with that tag library. - * The location is returned as a String array: + * The mapping of the 'global' tag library URI to the location (resource + * path) of the TLD associated with that tag library. The location is + * returned as a String array: *[0] The location - *[1] If the location is a jar file, this is the location - *of the tld. + *[1] If the location is a jar file, this is the location of the tld. */ private Hashtable mappings; @@ -163,19 +163,21 @@ private void init() { if( initialized ) return; try { -processWebDotXml(ctxt); -processJars(ctxt); -initialized=true; +processWebDotXml(); +processJars(); + processTldsInFileSystem(); +initialized = true; } catch (JasperException ex) { Constants.message("jsp.error.internal.tldinit", new Object[] { ex.getMessage() }, Logger.ERROR); } } - -private void processWebDotXml(ServletContext ctxt) -throws JasperException -{ + +/* + * Populates taglib map described in web.xml. + */ +private void processWebDotXml() throws JasperException { // Acquire an input stream to the web application deployment descriptor InputStream is = ctxt.getResourceAsStream(WEB_XML); @@ -187,8 +189,7 @@ } // Parse the web application deployment descriptor -ParserUtils pu = new ParserUtils(); -TreeNode webtld = pu.parseXMLDocument(WEB_XML, is); +TreeNode webtld = new ParserUtils().parseXMLDocument(WEB_XML, is); // Allow taglib be an element of the root or jsp-config (JSP2.0) TreeNode jspConfig = webtld.findChild("jsp-config"); @@ -218,44 +219,38 @@ if (tagLoc.endsWith(".jar")) tagLoc2 = "META-INF/taglib.tld"; mappings.put(tagUri, new String[] {tagLoc, tagLoc2}); - } - } /** - * Process all the jar files contained in this web application + * Processes any JAR files contained in this web application's * WEB-INF/lib directory. */ -private void processJars(ServletContext ctxt) -throws JasperException -{ - +private void processJars() throws JasperException { Set libSet = ctxt.getResourcePaths("/WEB-INF/lib"); if (libSet != null) { Iterator it = libSet.iterator(); while (it.hasNext()) { String resourcePath = (String) it.next(); if (resourcePath.endsWith(".jar")) -tldConfigJar(ctxt, resourcePath); +processTldsInJar(resourcePath); } } - } /** - * Process a TLD in the JAR file at the specified resource path - * (if there is one). Will update the URI mappings for all - * the .tld files found in the META-INF directory tree, if - * a element is defined in the TLD. + * Parses any TLD files located in the META-INF directory (or any + * subdirectory of it) of the JAR file at the given resource path, and adds + * an implicit map entry to the taglib map for any TLD that has a + * element. * * @param resourcePath Context-relative resource path */ -private
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java Node.java Parser.java
luehe 2002/12/16 08:13:28 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java Node.java Parser.java Log: Fixed 15364: The jsp:body action doesn't work as expected when used with the jsp:fallback action. Revision ChangesPath 1.142 +5 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.141 retrieving revision 1.142 diff -u -r1.141 -r1.142 --- Generator.java12 Dec 2002 23:31:51 - 1.141 +++ Generator.java16 Dec 2002 16:13:28 - 1.142 @@ -1458,15 +1458,8 @@ * Fallback */ if (n.getBody() != null) { - n.getBody().visit(new Node.Visitor() { - public void visit(Node.FallBackAction n) { - n.setBeginJavaLine(out.getJavaLine()); - out.printil("out.write(" + - quote(new String(n.getText())) + ");"); - out.printil("out.write(\"\\n\");"); - n.setEndJavaLine(out.getJavaLine()); - } - }); + visitBody(n); + out.printil("out.write(\"\\n\");"); } out.printil("out.write(" + quote("") + ");"); 1.49 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- Node.java 13 Dec 2002 18:06:08 - 1.48 +++ Node.java 16 Dec 2002 16:13:28 - 1.49 @@ -682,8 +682,8 @@ */ public static class FallBackAction extends Node { - public FallBackAction(Mark start, String text, Node parent) { - super(text, start, parent); + public FallBackAction(Mark start, Node parent) { + super(start, parent); } public void accept(Visitor v) throws JasperException { 1.47 +7 -20 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- Parser.java 13 Dec 2002 15:44:39 - 1.46 +++ Parser.java 16 Dec 2002 16:13:28 - 1.47 @@ -1090,23 +1090,10 @@ *) */ private void parseFallBack(Node parent) throws JasperException { -if( reader.matches( "/>" ) ) { -// No elements, don't create node. -} -else if( reader.matches( ">" ) ) { -Mark bodyStart = reader.mark(); -Mark bodyEnd = reader.skipUntilETag("jsp:fallback"); -if (bodyEnd == null) { -err.jspError(start, "jsp.error.unterminated", -"<jsp:fallback"); -} -new Node.FallBackAction(start, reader.getText(bodyStart, bodyEnd), - parent); -} -else { -err.jspError( reader.mark(), "jsp.error.unterminated", -"<jsp:fallback" ); -} + Mark bodyStart = reader.mark(); + Node fallBackNode = new Node.FallBackAction(start, parent); + parseOptionalBody(fallBackNode, "jsp:fallback", + JAVAX_BODY_CONTENT_TEMPLATE_TEXT); } /* -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Parser.java Validator.java
luehe 2002/12/16 09:34:32 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java Validator.java Log: Fixed 15391: Jasper generates a translation error if the body of jsp:params is supplied though jsp:body Revision ChangesPath 1.48 +6 -16 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Parser.java 16 Dec 2002 16:13:28 - 1.47 +++ Parser.java 16 Dec 2002 17:34:32 - 1.48 @@ -1068,18 +1068,9 @@ *| ( '>' S? Param* '' ) */ private void parseJspParams(Node parent) throws JasperException { -if( reader.matches( "/>" ) ) { -// No elements, don't create node. -} -else if( reader.matches( ">" ) ) { -reader.skipSpaces(); -Node jspParamsNode = new Node.ParamsAction(start, parent); -parseBody(jspParamsNode, "jsp:params", JAVAX_BODY_CONTENT_PARAM ); -} -else { -err.jspError(reader.mark(), "jsp.error.unterminated", -"<jsp:params" ); -} + Node jspParamsNode = new Node.ParamsAction(start, parent); + parseOptionalBody(jspParamsNode, "jsp:params", + JAVAX_BODY_CONTENT_PARAM ); } /* @@ -1090,7 +1081,6 @@ *) */ private void parseFallBack(Node parent) throws JasperException { - Mark bodyStart = reader.mark(); Node fallBackNode = new Node.FallBackAction(start, parent); parseOptionalBody(fallBackNode, "jsp:fallback", JAVAX_BODY_CONTENT_TEMPLATE_TEXT); 1.62 +3 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- Validator.java13 Dec 2002 18:06:08 - 1.61 +++ Validator.java16 Dec 2002 17:34:32 - 1.62 @@ -492,13 +492,6 @@ if (subElems == null) { err.jspError(n, "jsp.error.params.emptyBody"); } - for (int i=0; imailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java
luehe 2002/12/16 11:43:54 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java Log: Fixed 15404: No error condition raised if mandatory TLD elements and are not present in the TLD Revision ChangesPath 1.72 +2 -1 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.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- messages.properties 13 Dec 2002 16:27:43 - 1.71 +++ messages.properties 16 Dec 2002 19:43:53 - 1.72 @@ -280,6 +280,7 @@ jsp.error.tld.fn.invalid.signature.parenexpected=Invalid syntax for function signature in TLD. Parenthesis '(' expected. Tag Library: {0}, Function: {1}. jsp.error.dynamic.attributes.not.implemented=The {0} tag declares that it accepts dynamic attributes but does not implement the required interface jsp.error.nomatching.fragment=Cannot find an attribute directive (with name={0} and fragment=true) prior to the fragment directive. +jsp.error.tld.mandatory.element.missing=Mandatory TLD element missing: {0} jsp.error.attribute.noequal=equal symbol expected jsp.error.attribute.noquote=quote symbol expected jsp.error.attribute.unterminated=attribute for {0} is not properly terminated 1.29 +22 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java Index: TagLibraryInfoImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- TagLibraryInfoImpl.java 12 Dec 2002 17:44:38 - 1.28 +++ TagLibraryInfoImpl.java 16 Dec 2002 19:43:53 - 1.29 @@ -244,7 +244,9 @@ Vector tagVector = new Vector(); Vector tagFileVector = new Vector(); Hashtable functionTable = new Hashtable(); - + boolean tlibVersionSeen = false; + boolean jspVersionSeen = false; + // Create an iterator over the child elements of our element ParserUtils pu = new ParserUtils(); TreeNode tld = pu.parseXMLDocument(uri, in); @@ -256,13 +258,15 @@ TreeNode element = (TreeNode) list.next(); String tname = element.getName(); -if ("tlibversion".equals(tname) || // JSP 1.1 -"tlib-version".equals(tname)) // JSP 1.2 +if ("tlibversion".equals(tname)// JSP 1.1 + || "tlib-version".equals(tname)) { // JSP 1.2 this.tlibversion = element.getBody(); -else if ("jspversion".equals(tname) || - "jsp-version".equals(tname)) + tlibVersionSeen = true; +} else if ("jspversion".equals(tname) + || "jsp-version".equals(tname)) { this.jspversion = element.getBody(); -else if ("shortname".equals(tname) || + jspVersionSeen = true; +} else if ("shortname".equals(tname) || "short-name".equals(tname)) this.shortname = element.getBody(); else if ("uri".equals(tname)) @@ -301,6 +305,15 @@ } } + + if (!tlibVersionSeen) { + err.jspError("jsp.error.tld.mandatory.element.missing", + "tlib-version"); + } + if (!jspVersionSeen) { + err.jspError("jsp.error.tld.mandatory.element.missing", + "jsp-version"); + } this.tags = new TagInfo[tagVector.size()]; tagVector.copyInto (this.tags); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java
luehe 2002/12/16 12:39:17 Modified:jasper2/src/share/org/apache/jasper/resources messages.properties jasper2/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java Log: Fixed 15404: No error condition raised if mandatory TLD elements and are not present in the TLD Revision ChangesPath 1.73 +2 -2 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.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- messages.properties 16 Dec 2002 19:43:53 - 1.72 +++ messages.properties 16 Dec 2002 20:39:17 - 1.73 @@ -278,9 +278,9 @@ jsp.error.tld.fn.invalid.signature.classnotfound=Invalid syntax for function signature in TLD. Class not found: ${0}. Tag Library: {1}, Function: {2}. jsp.error.tld.fn.invalid.signature.commaexpected=Invalid syntax for function signature in TLD. Comma ',' expected. Tag Library: {0}, Function: {1}. jsp.error.tld.fn.invalid.signature.parenexpected=Invalid syntax for function signature in TLD. Parenthesis '(' expected. Tag Library: {0}, Function: {1}. +jsp.error.tld.mandatory.element.missing=Mandatory TLD element missing or empty: {0} jsp.error.dynamic.attributes.not.implemented=The {0} tag declares that it accepts dynamic attributes but does not implement the required interface jsp.error.nomatching.fragment=Cannot find an attribute directive (with name={0} and fragment=true) prior to the fragment directive. -jsp.error.tld.mandatory.element.missing=Mandatory TLD element missing: {0} jsp.error.attribute.noequal=equal symbol expected jsp.error.attribute.noquote=quote symbol expected jsp.error.attribute.unterminated=attribute for {0} is not properly terminated 1.30 +5 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java Index: TagLibraryInfoImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- TagLibraryInfoImpl.java 16 Dec 2002 19:43:53 - 1.29 +++ TagLibraryInfoImpl.java 16 Dec 2002 20:39:17 - 1.30 @@ -244,8 +244,6 @@ Vector tagVector = new Vector(); Vector tagFileVector = new Vector(); Hashtable functionTable = new Hashtable(); - boolean tlibVersionSeen = false; - boolean jspVersionSeen = false; // Create an iterator over the child elements of our element ParserUtils pu = new ParserUtils(); @@ -261,11 +259,9 @@ if ("tlibversion".equals(tname)// JSP 1.1 || "tlib-version".equals(tname)) { // JSP 1.2 this.tlibversion = element.getBody(); - tlibVersionSeen = true; } else if ("jspversion".equals(tname) || "jsp-version".equals(tname)) { this.jspversion = element.getBody(); - jspVersionSeen = true; } else if ("shortname".equals(tname) || "short-name".equals(tname)) this.shortname = element.getBody(); @@ -306,11 +302,11 @@ } - if (!tlibVersionSeen) { + if (tlibversion == null) { err.jspError("jsp.error.tld.mandatory.element.missing", "tlib-version"); } - if (!jspVersionSeen) { + if (jspversion == null) { err.jspError("jsp.error.tld.mandatory.element.missing", "jsp-version"); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TldLocationsCache.java
luehe 2002/12/16 13:23:25 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch TldLocationsCache.java Log: Fixed 14200: TLDs under WEB-INF are not scanned for URI mappings Revision ChangesPath No revision No revision 1.4.2.1 +101 -73 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java Index: TldLocationsCache.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- TldLocationsCache.java20 Jun 2002 23:00:43 - 1.4 +++ TldLocationsCache.java16 Dec 2002 21:23:25 - 1.4.2.1 @@ -107,6 +107,7 @@ * the TLD of this tag library. * * @author Pierre Delisle + * @author Jan Luehe */ public class TldLocationsCache { @@ -118,45 +119,56 @@ public static final int ROOT_REL_URI = 1; public static final int NOROOT_REL_URI = 2; -static private final String WEB_XML = "/WEB-INF/web.xml"; +private static final String WEB_XML = "/WEB-INF/web.xml"; /** - * The mapping of the 'global' tag library URI to the location - * (resource path) of the TLD associated with that tag library. - * The location is returned as a String array: + * The mapping of the 'global' tag library URI to the location (resource + * path) of the TLD associated with that tag library. The location is + * returned as a String array: *[0] The location - *[1] If the location is a jar file, this is the location - *of the tld. + *[1] If the location is a jar file, this is the location of the tld. */ -private Hashtable mappings = new Hashtable(); +private Hashtable mappings; -private Hashtable tlds = new Hashtable(); +private Hashtable tlds; + +private boolean initialized; +private ServletContext ctxt; -private boolean initialized=false; -ServletContext ctxt; //* // Constructor and Initilizations +/** + * Constructor. + * + * @param ctxt the servlet context of the web application in which Jasper + * is running + */ public TldLocationsCache(ServletContext ctxt) { -this.ctxt=ctxt; +this.ctxt = ctxt; +mappings = new Hashtable(); +tlds = new Hashtable(); +initialized = false; } private void init() { if( initialized ) return; try { -processWebDotXml(ctxt); -processJars(ctxt); -initialized=true; +processWebDotXml(); +processJars(); + processTldsInFileSystem(); +initialized = true; } catch (JasperException ex) { Constants.message("jsp.error.internal.tldinit", new Object[] { ex.getMessage() }, Logger.ERROR); } } - -private void processWebDotXml(ServletContext ctxt) -throws JasperException -{ + +/* + * Populates taglib map described in web.xml. + */ +private void processWebDotXml() throws JasperException { // Acquire an input stream to the web application deployment descriptor InputStream is = ctxt.getResourceAsStream(WEB_XML); @@ -168,11 +180,8 @@ } // Parse the web application deployment descriptor -ClassLoader cl = -// (ClassLoader) ctxt.getAttribute(Constants.SERVLET_CLASS_LOADER); -this.getClass().getClassLoader(); -ParserUtils pu = ParserUtils.createParserUtils(cl); -TreeNode webtld = pu.parseXMLDocument(WEB_XML, is); +TreeNode webtld = new ParserUtils().parseXMLDocument(WEB_XML, is); + Iterator taglibs = webtld.findChildren("taglib"); while (taglibs.hasNext()) { @@ -196,44 +205,38 @@ if (tagLoc.endsWith(".jar")) tagLoc2 = "META-INF/taglib.tld"; mappings.put(tagUri, new String[] {tagLoc, tagLoc2}); - } - } /** - * Process all the jar files contained in this web application + * Processes any JAR files contained in this web application's * WEB-INF/lib directory. */ -private void processJars(ServletContext ctxt) -throws JasperException -{ - +private void processJars() throws JasperException {
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/16 14:21:17 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Fixed 15410: if the jsp:attribute action is used out of the spec'd context, a misleading error message is generated. Revision ChangesPath 1.49 +5 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- Parser.java 16 Dec 2002 17:34:32 - 1.48 +++ Parser.java 16 Dec 2002 22:21:15 - 1.49 @@ -1173,6 +1173,8 @@ parsePlugin(parent); } else if (reader.matches("element")) { parseElement(parent); + } else if (reader.matches("attribute")) { + err.jspError(start, "jsp.error.attribute.invalidUse"); } else if (reader.matches("fallback")) { err.jspError(start, "jsp.error.fallback.invalidUse"); } else if (reader.matches("params")) { 1.74 +2 -1 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.73 retrieving revision 1.74 diff -u -r1.73 -r1.74 --- messages.properties 16 Dec 2002 20:39:17 - 1.73 +++ messages.properties 16 Dec 2002 22:21:16 - 1.74 @@ -106,6 +106,7 @@ jsp.error.param.invalidUse=The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements jsp.error.params.invalidUse=jsp:params must be a direct child of jsp:plugin jsp.error.fallback.invalidUse=jsp:fallback must be a direct child of jsp:plugin +jsp.error.attribute.invalidUse=jsp:attribute must be a sublement of a standard or custom action jsp.error.closeindividualparam=param tag needs to be closed with \"/>\" jsp.error.closeparams=param tag needs to be closed with /params jsp.error.params.emptyBody=jsp:params must contain at least one nested jsp:param -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Parser.java
luehe 2002/12/16 15:02:39 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java Log: updated productions of jsp:params and jsp:fallback so that they accept jsp:body Revision ChangesPath 1.50 +25 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- Parser.java 16 Dec 2002 22:21:15 - 1.49 +++ Parser.java 16 Dec 2002 23:02:39 - 1.50 @@ -1064,8 +1064,15 @@ } /* - * Params ::= '/>' - *| ( '>' S? Param* '' ) + * Params ::= `>' S? + * ( ( `' + *( ( S? Param+ S? `' ) + * | + *) + * ) + *| Param+ + * ) + * '' */ private void parseJspParams(Node parent) throws JasperException { Node jspParamsNode = new Node.ParamsAction(start, parent); @@ -1075,10 +1082,19 @@ /* * Fallback ::= '/>' - * | ( '>' - * ( Char* - ( Char* '' ) ) - * '' - *) + * | ( `>' S? `' + * ( ( S? + * ( Char* - ( Char* `' ) ) + * `' S? + * ) + * | + * ) + * `' + * ) + * | ( '>' + * ( Char* - ( Char* '' ) ) + * '' + * ) */ private void parseFallBack(Node parent) throws JasperException { Node fallBackNode = new Node.FallBackAction(start, parent); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
luehe 2002/12/18 09:37:50 Modified:jasper2/src/share/org/apache/jasper/compiler Parser.java Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: Fixed 15411: A translation error does not occur if jsp:attribute is used to provide an attribute value for an XML element that should be conisdered template text. Revision ChangesPath 1.51 +9 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- Parser.java 16 Dec 2002 23:02:39 - 1.50 +++ Parser.java 18 Dec 2002 17:37:50 - 1.51 @@ -1190,7 +1190,7 @@ } else if (reader.matches("element")) { parseElement(parent); } else if (reader.matches("attribute")) { - err.jspError(start, "jsp.error.attribute.invalidUse"); + err.jspError(start, "jsp.error.namedAttribute.invalidUse"); } else if (reader.matches("fallback")) { err.jspError(start, "jsp.error.fallback.invalidUse"); } else if (reader.matches("params")) { @@ -1317,12 +1317,13 @@ // Note except for the beginning of a page, the current char is '<'. // Quoting in template text is handled here. // JSP2.6 "A literal <% is quoted by <\%" + String templateText = null; if (reader.matches("<\\%")) { - String content = reader.nextContent(); - new Node.TemplateText("<%" + content, start, parent); - } else { - new Node.TemplateText(reader.nextContent(), start, parent); + templateText = "<%"; } + String content = reader.nextContent(); + templateText = (templateText == null) ? content : templateText+content; + new Node.TemplateText(templateText, start, parent); } /* 1.63 +9 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- Validator.java16 Dec 2002 17:34:32 - 1.62 +++ Validator.java18 Dec 2002 17:37:50 - 1.63 @@ -656,6 +656,12 @@ } } + public void visit(Node.UninterpretedTag n) throws JasperException { +if (n.getNamedAttributeNodes() != null) { + err.jspError(n, "jsp.error.namedAttribute.invalidUse"); +} +} + public void visit(Node.CustomTag n) throws JasperException { TagInfo tagInfo = n.getTagInfo(); if (tagInfo == null) { 1.75 +2 -2 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.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- messages.properties 16 Dec 2002 22:21:16 - 1.74 +++ messages.properties 18 Dec 2002 17:37:50 - 1.75 @@ -106,7 +106,7 @@ jsp.error.param.invalidUse=The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements jsp.error.params.invalidUse=jsp:params must be a direct child of jsp:plugin jsp.error.fallback.invalidUse=jsp:fallback must be a direct child of jsp:plugin -jsp.error.attribute.invalidUse=jsp:attribute must be a sublement of a standard or custom action +jsp.error.namedAttribute.invalidUse=jsp:attribute must be a sublement of a standard or custom action jsp.error.closeindividualparam=param tag needs to be closed with \"/>\" jsp.error.closeparams=param tag needs to be closed with /params jsp.error.params.emptyBody=jsp:params must contain at least one nested jsp:param -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java
luehe 2002/12/18 15:18:21 Modified:jasper2/src/share/org/apache/jasper JspCompilationContext.java jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java JspDocumentParser.java Parser.java ParserController.java TagFileProcessor.java TagLibraryInfoImpl.java jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java Log: If a tag file is packaged in a JAR, any of its include directives must be resolved against the JAR as opposed to the filesystem. Revision ChangesPath 1.28 +24 -11 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java Index: JspCompilationContext.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- JspCompilationContext.java8 Dec 2002 13:42:52 - 1.27 +++ JspCompilationContext.java18 Dec 2002 23:18:20 - 1.28 @@ -64,6 +64,7 @@ import java.io.*; import java.net.*; import java.util.*; +import java.util.jar.JarFile; import javax.servlet.ServletContext; import javax.servlet.jsp.tagext.TagInfo; import javax.servlet.jsp.tagext.TagData; @@ -122,6 +123,7 @@ private boolean isTagFile; private boolean protoTypeMode; private TagInfo tagInfo; +private JarFile tagFileJar; // jspURI _must_ be relative to the context public JspCompilationContext(String jspUri, @@ -162,13 +164,12 @@ ServletContext context, JspServletWrapper jsw, JspRuntimeContext rctxt, - Hashtable tagFileJars) { - + JarFile tagFileJar) { this(tagfile, false, options, context, jsw, rctxt); this.isTagFile = true; this.tagInfo = tagInfo; - this.tagFileJars = tagFileJars; - if (tagFileJars != null && tagFileJars.get(tagfile) != null) { + this.tagFileJar = tagFileJar; + if (tagFileJar != null) { isPackagedTagFile = true; } } @@ -284,13 +285,25 @@ } /** - * Returns the tag-file-to-JAR-file mapping for tag files packaged in JARs. + * Returns the tag-file-name-to-JAR-file map of this compilation unit, + * which maps tag file names to the JAR files in which the tag files are + * packaged. * - * The mapping uses the tag file name as the key, and the JAR file - * containing the tag file as the value. + * The map is populated when parsing the tag-file elements of the TLDs + * of any imported taglibs. */ public Hashtable getTagFileJars() { - return tagFileJars; + return this.tagFileJars; +} + +/** + * Returns the JAR file in which the tag file for which this + * JspCompilationContext was created is packaged, or null if this + * JspCompilationContext does not correspond to a tag file, or if the + * corresponding tag file is not packaged in a JAR. + */ +public JarFile getTagFileJar() { + return this.tagFileJar; } /* Common implementation */ 1.18 +7 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java Index: ImplicitTagLibraryInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ImplicitTagLibraryInfo.java 14 Dec 2002 14:16:07 - 1.17 +++ ImplicitTagLibraryInfo.java 18 Dec 2002 23:18:20 - 1.18 @@ -159,8 +159,10 @@ TagInfo tagInfo = null; try { - tagInfo = TagFileProcessor.parseTagFile(pc, shortName, path, - this); + tagInfo = TagFileProcessor.parseTagFileDirectives(pc, + shortName, + path, + this); } catch (JasperException je) { throw new RuntimeException(je.toString()); } 1.34 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java Index: JspDocumentPar
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java
luehe 2003/01/06 10:57:16 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java JspUtil.java Node.java Validator.java jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java Log: Implemented JSTL EL rules for coercing of empty string and null values Revision ChangesPath 1.144 +32 -90 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.143 retrieving revision 1.144 diff -u -r1.143 -r1.144 --- Generator.java16 Dec 2002 23:37:59 - 1.143 +++ Generator.java6 Jan 2003 18:57:14 - 1.144 @@ -2511,7 +2511,19 @@ } } - private String convertString(Class c, String s, String attrName, + /* + * @param c The target class to which to coerce the given string + * @param s The string value + * @param attrName The name of the attribute whose value is being + * supplied + * @param propEditorClass The property editor for the given attribute + * @param isNamedAttribute true if the given attribute is a named + * attribute (that is, specified using the jsp:attribute standard + * action), and false otherwise + */ + private String convertString(Class c, + String s, + String attrName, Class propEditorClass, boolean isNamedAttribute) throws JasperException { @@ -2530,107 +2542,37 @@ } else if (c == String.class) { return quoted; } else if (c == boolean.class) { - if (isNamedAttribute) - return "Boolean.valueOf(" + s + ").booleanValue()"; - else - return Boolean.valueOf(s).toString(); + return JspUtil.coerceToPrimitiveBoolean(s, isNamedAttribute); } else if (c == Boolean.class) { - if (isNamedAttribute) - return "new Boolean(" + s + ")"; - else - // Detect format error at translation time - return "new Boolean(" + Boolean.valueOf(s).toString() + ")"; + return JspUtil.coerceToBoolean(s, isNamedAttribute); } else if (c == byte.class) { - return "((byte)" + Byte.valueOf(s).toString() + ")"; + return JspUtil.coerceToPrimitiveByte(s, isNamedAttribute); } else if (c == Byte.class) { - if (isNamedAttribute) - return "new Byte(" + s + ")"; - else - // Detect format error at translation time - return "new Byte((byte)" + Byte.valueOf(s).toString() + ")"; + return JspUtil.coerceToByte(s, isNamedAttribute); } else if (c == char.class) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.getChar(" + s + ")"; - } else { - // non-normative (normative method would fail to compile) - if (s.length() > 0) { - char ch = s.charAt(0); - // this trick avoids escaping issues - return "((char) " + (int) ch + ")"; - } else { - throw new NumberFormatException( -err.getString("jsp.error.bad_string_char")); - } - } + return JspUtil.coerceToChar(s, isNamedAttribute); } else if (c == Character.class) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.getCharacter(" + s + ")"; - } else { - // non-normative (normative method would fail to compile) - if (s.length() > 0) { - char ch = s.charAt(0); - // this trick avoids escaping issues - return "new Character((char) " + (int) ch + ")"; - } else { - throw new NumberFormatException( - err.getString("jsp.error.bad_string_Character")); - } - } + return JspUtil.coerceToCharacter(s, isNamedAttribute); } else if (c =