You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2003/03/31 19:52:27 UTC
cvs commit: jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext BodyTag.java IterationTag.java SimpleTagSupport.java Tag.java TagInfo.java VariableInfo.java
kinman 2003/03/31 09:52:27
Modified: jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag
RepeatSimpleTag.java
jsr152/src/share/javax/servlet/jsp JspWriter.java
jsr152/src/share/javax/servlet/jsp/el
ExpressionEvaluator.java
jsr152/src/share/javax/servlet/jsp/tagext BodyTag.java
IterationTag.java SimpleTagSupport.java Tag.java
TagInfo.java VariableInfo.java
Log:
- Patch by Mark Roth
Here are the latest round of JSP 2.0 API updates. Some changes will
need to be made to jakarta-commons-sandbox/el before applying this patch.
I also made a couple of changes to the JSP 2.0 examples in accordance
with these changes.
jsr152/src/share/dtd/jsp_2_0.xsd:
jsr154/src/share/dtd/jsp_2_0.xsd:
- Expanded on description for taglibType complex type.
jsr152/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java:
- Change getJspBody() to be protected
- Change getJspContext() to be protected
- Change the jspBody field to be private
- Change the jspContext field to be private.
jsr152/src/share/javax/servlet/jsp/el/ExpressionEvaluator.java:
- Changed so that Strings of the form "abc${1+1}def${1+1}ghi" cannot
be parsed or evaluated. Only one expression can be parsed
evaluated at a time, and no static text can appear.
jsr152/src/share/javax/servlet/jsp/JspWriter.java:
- Changed javadocs for print() methods to indicate that the
resulting text is written to the writer, and not converted to
the platform's default character encoding first, which would
make no sense.
jsr152/src/share/javax/servlet/jsp/tagext/TagInfo.java
- getTagName() - Clarified that name is always returned (cannot
be null)
jsr152/src/share/javax/servlet/jsp/tagext/Tag.java
- Accessibility fix. Added img alt tag.
jsr152/src/share/javax/servlet/jsp/tagext/BodyTag.java
- Accessibility fix. Added img alt tag.
jsr152/src/share/javax/servlet/jsp/tagext/IterationTag.java
- Accessibility fix. Added img alt tag.
jsr152/src/share/javax/servlet/jsp/tagext/VariableInfo.java
- Accessibility fix. Added img alt tag and table summary tag.
jsr152/src/share/javax/servlet/jsp/el/ExpressionEvaluator.java
- evaluate() - Removed defaultPrefix param and allow FunctionMapper
to mutate after call.
- parseExpression() - Removed defaultPrefix param and allow
FunctionMapper to mutate after call.
Revision Changes Path
1.3 +1 -1 jakarta-servletapi-5/jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java
Index: RepeatSimpleTag.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RepeatSimpleTag.java 28 Oct 2002 17:45:43 -0000 1.2
+++ RepeatSimpleTag.java 31 Mar 2003 17:52:26 -0000 1.3
@@ -19,7 +19,7 @@
public void doTag() throws JspException, IOException {
for (int i=0; i<num; i++) {
- jspContext.setAttribute("count", String.valueOf( i + 1 ) );
+ getJspContext().setAttribute("count", String.valueOf( i + 1 ) );
getJspBody().invoke(null);
}
}
1.4 +27 -36 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/JspWriter.java
Index: JspWriter.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/JspWriter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JspWriter.java 29 Oct 2002 01:18:11 -0000 1.3
+++ JspWriter.java 31 Mar 2003 17:52:26 -0000 1.4
@@ -165,10 +165,9 @@
/**
* Print a boolean value. The string produced by <code>{@link
- * java.lang.String#valueOf(boolean)}</code> is translated into bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * java.lang.String#valueOf(boolean)}</code> is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param b The <code>boolean</code> to be printed
* @throws java.io.IOException If an error occured while writing
@@ -177,10 +176,9 @@
abstract public void print(boolean b) throws IOException;
/**
- * Print a character. The character is translated into one or more bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * Print a character. The character is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param c The <code>char</code> to be printed
* @throws java.io.IOException If an error occured while writing
@@ -190,10 +188,9 @@
/**
* Print an integer. The string produced by <code>{@link
- * java.lang.String#valueOf(int)}</code> is translated into bytes according
- * to the platform's default character encoding, and these bytes are
- * written in exactly the manner of the <code>{@link #write(int)}</code>
- * method.
+ * java.lang.String#valueOf(int)}</code> is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param i The <code>int</code> to be printed
* @see java.lang.Integer#toString(int)
@@ -204,10 +201,9 @@
/**
* Print a long integer. The string produced by <code>{@link
- * java.lang.String#valueOf(long)}</code> is translated into bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
- * method.
+ * java.lang.String#valueOf(long)}</code> is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param l The <code>long</code> to be printed
* @see java.lang.Long#toString(long)
@@ -218,10 +214,9 @@
/**
* Print a floating-point number. The string produced by <code>{@link
- * java.lang.String#valueOf(float)}</code> is translated into bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
- * method.
+ * java.lang.String#valueOf(float)}</code> is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param f The <code>float</code> to be printed
* @see java.lang.Float#toString(float)
@@ -232,10 +227,9 @@
/**
* Print a double-precision floating-point number. The string produced by
- * <code>{@link java.lang.String#valueOf(double)}</code> is translated into
- * bytes according to the platform's default character encoding, and these
- * bytes are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * <code>{@link java.lang.String#valueOf(double)}</code> is written to
+ * the JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param d The <code>double</code> to be printed
* @see java.lang.Double#toString(double)
@@ -245,10 +239,9 @@
abstract public void print(double d) throws IOException;
/**
- * Print an array of characters. The characters are converted into bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
- * method.
+ * Print an array of characters. The characters are written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param s The array of chars to be printed
*
@@ -261,9 +254,8 @@
/**
* Print a string. If the argument is <code>null</code> then the string
* <code>"null"</code> is printed. Otherwise, the string's characters are
- * converted into bytes according to the platform's default character
- * encoding, and these bytes are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * written to the JspWriter's buffer or, if no buffer is used, directly
+ * to the underlying writer.
*
* @param s The <code>String</code> to be printed
* @throws java.io.IOException If an error occured while writing
@@ -273,10 +265,9 @@
/**
* Print an object. The string produced by the <code>{@link
- * java.lang.String#valueOf(Object)}</code> method is translated into bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
- * method.
+ * java.lang.String#valueOf(Object)}</code> method is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the
+ * underlying writer.
*
* @param obj The <code>Object</code> to be printed
* @see java.lang.Object#toString()
@@ -411,7 +402,7 @@
* method will not throw an IOException if the buffer has already been
* flushed. It merely clears the current content of the buffer and
* returns.
- *
+ *
* @throws IOException If an I/O error occurs
*/
1.9 +28 -34 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/el/ExpressionEvaluator.java
Index: ExpressionEvaluator.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/el/ExpressionEvaluator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ExpressionEvaluator.java 4 Mar 2003 00:17:05 -0000 1.8
+++ ExpressionEvaluator.java 31 Mar 2003 17:52:26 -0000 1.9
@@ -67,21 +67,26 @@
* <p>An instance of the ExpressionEvaluator can be obtained via the
* JspContext / PageContext</p>
*
- * <p>The parseExpression() and evaluate() methods must be thread-safe. That is,
- * multiple threads may call these methods on the same ExpressionEvaluator
- * object simultaneously. Implementations should synchronize access if
- * they depend on transient state. Implementations should not, however,
- * assume that only one object of each ExpressionEvaluator type will be
- * instantiated; global caching should therefore be static.</p>
+ * <p>The parseExpression() and evaluate() methods must be thread-safe.
+ * That is, multiple threads may call these methods on the same
+ * ExpressionEvaluator object simultaneously. Implementations should
+ * synchronize access if they depend on transient state. Implementations
+ * should not, however, assume that only one object of each
+ * ExpressionEvaluator type will be instantiated; global caching should
+ * therefore be static.</p>
+ *
+ * <p>Only a single EL expression, starting with '${' and ending with
+ * '}', can be parsed or evaluated at a time. EL expressions
+ * cannot be mixed with static text. For example, attempting to
+ * parse or evaluate "<code>abc${1+1}def${1+1}ghi</code>" or even
+ * "<code>${1+1}${1+1}</code>" will cause an <code>ELException</code> to
+ * be thrown.</p>
+ *
+ * <p>The following are examples of syntactically legal EL expressions:
*
- * <p>For JSP EL expressions, an expression string without '${' and '}'
- * tokens is considered to be a static string. One or more occurrences
- * of '${' and '}' can be used in the expression string to delimit
- * dynamic expressions. Examples:
* <ul>
- * <li><code>${lastName}</code></li>
+ * <li><code>${person.lastName}</code></li>
* <li><code>${8 * 8}</code></li>
- * <li><code>Version ${major}.${minor}</code></li>
* <li><code>${my:reverse('hello')}</code></li>
* </ul>
* </p>
@@ -99,23 +104,21 @@
* @param expectedType The expected type of the result of the evaluation
* @param fMapper A FunctionMapper to resolve functions found in
* the expression. It can be null, in which case no functions
- * are supported for this invocation. The FunctionMapper will be
- * invoked one or more times between parsing the expression and
- * evaluating it, and must return a consistent value each time
- * it is invoked.
- * @param defaultPrefix The default prefix to use when a function is
- * encountered with no prefix, or "" if the default is no prefix.
- * If the value null is provided, an ELException will be thrown if
- * a function call is encountered with no prefix. This is useful
- * for situations where a function must have a prefix.
+ * are supported for this invocation. The ExpressionEvaluator
+ * must not hold on to the FunctionMapper reference after
+ * returning from <code>parseExpression()</code>. The
+ * <code>Expression</code> object returned must invoke the same
+ * functions regardless of whether the mappings in the
+ * provided <code>FunctionMapper</code> instance change between
+ * calling <code>ExpressionEvaluator.parseExpression()</code>
+ * and <code>Expression.evaluate()</code>.
* @return The Expression object encapsulating the arguments.
*
* @exception ELException Thrown if parsing errors were found.
*/
public abstract Expression parseExpression( String expression,
Class expectedType,
- FunctionMapper fMapper,
- String defaultPrefix )
+ FunctionMapper fMapper )
throws ELException;
@@ -131,15 +134,7 @@
* runtime to resolve the name of implicit objects into Objects.
* @param fMapper A FunctionMapper to resolve functions found in
* the expression. It can be null, in which case no functions
- * are supported for this invocation. The FunctionMapper will be
- * invoked one or more times between parsing the expression and
- * evaluating it, and must return a consistent value each time
- * it is invoked.
- * @param defaultPrefix The default prefix to use when a function is
- * encountered with no prefix, or "" if the default is no prefix.
- * If the value null is provided, an ELException will be thrown if
- * a function call is encountered with no prefix. This is useful
- * for situations where a function must have a prefix.
+ * are supported for this invocation.
* @return The result of the expression evaluation.
*
* @exception ELException Thrown if the expression evaluation failed.
@@ -147,8 +142,7 @@
public abstract Object evaluate( String expression,
Class expectedType,
VariableResolver vResolver,
- FunctionMapper fMapper,
- String defaultPrefix )
+ FunctionMapper fMapper )
throws ELException;
}
1.7 +2 -1 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/BodyTag.java
Index: BodyTag.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/BodyTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BodyTag.java 29 Jan 2003 21:42:13 -0000 1.6
+++ BodyTag.java 31 Mar 2003 17:52:26 -0000 1.7
@@ -113,7 +113,8 @@
* tag handler implements the TryCatchFinally interface; see that
* interface for details.
* <p>
- * <IMG src="doc-files/BodyTagProtocol.gif"/>
+ * <IMG src="doc-files/BodyTagProtocol.gif"
+ * alt="Lifecycle Details Transition Diagram for BodyTag"/>
*
* <p><B>Empty and Non-Empty Action</B>
* <p> If the TagLibraryDescriptor file indicates that the action must
1.6 +2 -1 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/IterationTag.java
Index: IterationTag.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/IterationTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IterationTag.java 29 Jan 2003 21:42:13 -0000 1.5
+++ IterationTag.java 31 Mar 2003 17:52:26 -0000 1.6
@@ -86,7 +86,8 @@
* details.
*
* <p>
- * <IMG src="doc-files/IterationTagProtocol.gif"/>
+ * <IMG src="doc-files/IterationTagProtocol.gif"
+ * alt="Lifecycle Details Transition Diagram for IterationTag"/>
*
* <p><B>Empty and Non-Empty Action</B>
* <p> If the TagLibraryDescriptor file indicates that the action must
1.6 +4 -4 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java
Index: SimpleTagSupport.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SimpleTagSupport.java 29 Jan 2003 21:42:13 -0000 1.5
+++ SimpleTagSupport.java 31 Mar 2003 17:52:26 -0000 1.6
@@ -76,10 +76,10 @@
private JspTag parentTag;
/** The JSP context for the upcoming tag invocation. */
- protected JspContext jspContext;
+ private JspContext jspContext;
/** The body of the tag. */
- protected JspFragment jspBody;
+ private JspFragment jspBody;
/**
* Sole constructor. (For invocation by subclass constructors,
@@ -144,7 +144,7 @@
*
* @return the page context for this invocation
*/
- public JspContext getJspContext() {
+ protected JspContext getJspContext() {
return this.jspContext;
}
@@ -165,7 +165,7 @@
* @return the fragment encapsulating the body of this tag, or
* null if this tag has a body content type of empty.
*/
- public JspFragment getJspBody() {
+ protected JspFragment getJspBody() {
return this.jspBody;
}
1.6 +2 -1 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/Tag.java
Index: Tag.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/Tag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Tag.java 18 Dec 2002 18:35:37 -0000 1.5
+++ Tag.java 31 Mar 2003 17:52:26 -0000 1.6
@@ -102,7 +102,8 @@
* to exception handling and resource management.
* </ul></p>
*
- * <IMG src="doc-files/TagProtocol.gif"/>
+ * <IMG src="doc-files/TagProtocol.gif"
+ * alt="Lifecycle Details Transition Diagram for Tag"/>
*
* <p>Once all invocations on the tag handler
* are completed, the release method is invoked on it. Once a release
1.6 +1 -2 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/TagInfo.java
Index: TagInfo.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/TagInfo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TagInfo.java 10 Jan 2003 18:17:02 -0000 1.5
+++ TagInfo.java 31 Mar 2003 17:52:26 -0000 1.6
@@ -241,8 +241,7 @@
/**
* The name of the Tag.
*
- * @return The (short) name of the tag, or null
- * if not defined.
+ * @return The (short) name of the tag.
*/
public String getTagName() {
1.8 +3 -2 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/VariableInfo.java
Index: VariableInfo.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/VariableInfo.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- VariableInfo.java 10 Jan 2003 18:17:02 -0000 1.7
+++ VariableInfo.java 31 Mar 2003 17:52:26 -0000 1.8
@@ -119,7 +119,8 @@
* a picture:
*
* <p>
- * <IMG src="doc-files/VariableInfo-1.gif"/>
+ * <IMG src="doc-files/VariableInfo-1.gif"
+ * alt="NESTED, AT_BEGIN and AT_END Variable Scopes"/>
*
*<p>
* The JSP 2.0 specification defines the interpretation of 3 values:
@@ -141,7 +142,7 @@
*
* <blockquote>
* <table cellpadding="2" cellspacing="2" border="0" width="55%"
- * bgcolor="#999999">
+ * bgcolor="#999999" summary="Variable Synchronization Points">
* <tbody>
* <tr align="center">
* <td valign="top" colspan="6" bgcolor="#999999"><u><b>Variable Synchronization
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org