From debcf62122b66d8825388a1edbfc8285655a40ca Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 23 Jul 2010 21:47:39 +0000 Subject: [PATCH] More tab police - javax.servlet.jsp git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@967277 13f79535-47bb-0310-9956-ffa450edef68 --- java/javax/servlet/jsp/ErrorData.java | 85 ++-- java/javax/servlet/jsp/JspApplicationContext.java | 128 ++--- java/javax/servlet/jsp/JspTagException.java | 112 ++--- java/javax/servlet/jsp/JspWriter.java | 517 +++++++++++---------- java/javax/servlet/jsp/SkipPageException.java | 87 ++-- java/javax/servlet/jsp/el/ExpressionEvaluator.java | 188 ++++---- .../servlet/jsp/el/ScopedAttributeELResolver.java | 338 +++++++------- java/javax/servlet/jsp/el/VariableResolver.java | 87 ++-- java/javax/servlet/jsp/tagext/BodyContent.java | 140 +++--- java/javax/servlet/jsp/tagext/BodyTag.java | 251 +++++----- java/javax/servlet/jsp/tagext/BodyTagSupport.java | 114 ++--- java/javax/servlet/jsp/tagext/TagAdapter.java | 183 ++++---- java/javax/servlet/jsp/tagext/TagLibraryInfo.java | 222 +++++---- java/javax/servlet/jsp/tagext/TagVariableInfo.java | 138 +++--- .../servlet/jsp/tagext/ValidationMessage.java | 93 ++-- java/javax/servlet/jsp/tagext/VariableInfo.java | 389 ++++++++-------- 16 files changed, 1483 insertions(+), 1589 deletions(-) diff --git a/java/javax/servlet/jsp/ErrorData.java b/java/javax/servlet/jsp/ErrorData.java index 78f41d1d0..8b0212104 100644 --- a/java/javax/servlet/jsp/ErrorData.java +++ b/java/javax/servlet/jsp/ErrorData.java @@ -1,32 +1,30 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp; /** - * Contains information about an error, for error pages. - * The information contained in this instance is meaningless if not used - * in the context of an error page. To indicate a JSP is an error page, - * the page author must set the isErrorPage attribute of the page directive - * to "true". - * + * Contains information about an error, for error pages. The information + * contained in this instance is meaningless if not used in the context of an + * error page. To indicate a JSP is an error page, the page author must set the + * isErrorPage attribute of the page directive to "true". + * * @see PageContext#getErrorData * @since 2.0 */ - public final class ErrorData { private Throwable throwable; @@ -36,54 +34,57 @@ public final class ErrorData { /** * Creates a new ErrorData object. - * - * @param throwable The Throwable that is the cause of the error - * @param statusCode The status code of the error - * @param uri The request URI - * @param servletName The name of the servlet invoked + * + * @param throwable + * The Throwable that is the cause of the error + * @param statusCode + * The status code of the error + * @param uri + * The request URI + * @param servletName + * The name of the servlet invoked */ - public ErrorData( Throwable throwable, int statusCode, String uri, - String servletName ) - { - this.throwable = throwable; - this.statusCode = statusCode; - this.uri = uri; - this.servletName = servletName; + public ErrorData(Throwable throwable, int statusCode, String uri, + String servletName) { + this.throwable = throwable; + this.statusCode = statusCode; + this.uri = uri; + this.servletName = servletName; } /** * Returns the Throwable that caused the error. - * + * * @return The Throwable that caused the error */ public Throwable getThrowable() { - return this.throwable; + return this.throwable; } /** * Returns the status code of the error. - * + * * @return The status code of the error */ public int getStatusCode() { - return this.statusCode; + return this.statusCode; } /** * Returns the request URI. - * + * * @return The request URI */ public String getRequestURI() { - return this.uri; + return this.uri; } /** * Returns the name of the servlet invoked. - * + * * @return The name of the servlet invoked */ public String getServletName() { - return this.servletName; + return this.servletName; } } diff --git a/java/javax/servlet/jsp/JspApplicationContext.java b/java/javax/servlet/jsp/JspApplicationContext.java index 5533f32f9..10817e0dd 100644 --- a/java/javax/servlet/jsp/JspApplicationContext.java +++ b/java/javax/servlet/jsp/JspApplicationContext.java @@ -1,19 +1,19 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp; import javax.el.ELContextListener; @@ -24,54 +24,60 @@ import javax.el.ExpressionFactory; *

* Stores application-scoped information for the JSP container. *

+ * * @since 2.1 */ public interface JspApplicationContext { - /** - *

- * Registers an ELContextListener that will notified whenever - * a new ELContext is created. - *

- *

- * At the very least, any ELContext instantiated will have reference - * to the JspContext under JspContext.class. - *

- * - * @param listener - */ - public void addELContextListener(ELContextListener listener); - - /** - *

- * Adds an ELResolver to the chain of EL variable and property management - * within JSP pages and Tag files. - *

- *

- * JSP has a default set of ELResolvers to chain for all EL evaluation: - *

- *

- * - * @param resolver an additional resolver - * @throws IllegalStateException if called after the application's ServletContextListeners have been initialized. - */ - public void addELResolver(ELResolver resolver) throws IllegalStateException; - - /** - *

- * Returns the JSP container's ExpressionFactory implementation for EL use. - *

- * - * @return an ExpressionFactory implementation - */ - public ExpressionFactory getExpressionFactory(); - + /** + *

+ * Registers an ELContextListener that will notified whenever a + * new ELContext is created. + *

+ *

+ * At the very least, any ELContext instantiated will have + * reference to the JspContext under + * JspContext.class. + *

+ * + * @param listener + */ + public void addELContextListener(ELContextListener listener); + + /** + *

+ * Adds an ELResolver to the chain of EL variable and property + * management within JSP pages and Tag files. + *

+ *

+ * JSP has a default set of ELResolvers to chain for all EL evaluation: + *

+ *

+ * + * @param resolver + * an additional resolver + * @throws IllegalStateException + * if called after the application's + * ServletContextListeners have been initialized. + */ + public void addELResolver(ELResolver resolver) throws IllegalStateException; + + /** + *

+ * Returns the JSP container's ExpressionFactory implementation + * for EL use. + *

+ * + * @return an ExpressionFactory implementation + */ + public ExpressionFactory getExpressionFactory(); + } diff --git a/java/javax/servlet/jsp/JspTagException.java b/java/javax/servlet/jsp/JspTagException.java index 5f37b3f65..d15e3c1d2 100644 --- a/java/javax/servlet/jsp/JspTagException.java +++ b/java/javax/servlet/jsp/JspTagException.java @@ -1,93 +1,83 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp; /** - * Exception to be used by a Tag Handler to indicate some unrecoverable - * error. + * Exception to be used by a Tag Handler to indicate some unrecoverable error. * This error is to be caught by the top level of the JSP page and will result * in an error page. */ - public class JspTagException extends JspException { + /** - * Constructs a new JspTagException with the specified message. - * The message can be written to the server log and/or displayed - * for the user. + * Constructs a new JspTagException with the specified message. The message + * can be written to the server log and/or displayed for the user. * - * @param msg a String specifying the text of - * the exception message + * @param msg + * a String specifying the text of the exception + * message */ public JspTagException(String msg) { - super( msg ); + super(msg); } /** * Constructs a new JspTagException with no message. */ public JspTagException() { - super(); + super(); } /** - * Constructs a new JspTagException when the JSP Tag - * needs to throw an exception and include a message - * about the "root cause" exception that interfered with its - * normal operation, including a description message. - * - * - * @param message a String containing - * the text of the exception message - * - * @param rootCause the Throwable exception - * that interfered with the JSP Tag's - * normal operation, making this JSP Tag - * exception necessary - * + * Constructs a new JspTagException when the JSP Tag needs to throw an + * exception and include a message about the "root cause" exception that + * interfered with its normal operation, including a description message. + * + * @param message + * a String containing the text of the exception + * message + * @param rootCause + * the Throwable exception that interfered with the + * JSP Tag's normal operation, making this JSP Tag exception + * necessary * @since 2.0 */ public JspTagException(String message, Throwable rootCause) { - super( message, rootCause ); + super(message, rootCause); } - /** - * Constructs a new JSP Tag exception when the JSP Tag - * needs to throw an exception and include a message - * about the "root cause" exception that interfered with its - * normal operation. The exception's message is based on the localized - * message of the underlying exception. - * - *

This method calls the getLocalizedMessage method - * on the Throwable exception to get a localized exception - * message. When subclassing JspTagException, - * this method can be overridden to create an exception message - * designed for a specific locale. - * - * @param rootCause the Throwable exception - * that interfered with the JSP Tag's - * normal operation, making the JSP Tag - * exception necessary - * + * Constructs a new JSP Tag exception when the JSP Tag needs to throw an + * exception and include a message about the "root cause" exception that + * interfered with its normal operation. The exception's message is based on + * the localized message of the underlying exception. + *

+ * This method calls the getLocalizedMessage method on the + * Throwable exception to get a localized exception message. + * When subclassing JspTagException, this method can be + * overridden to create an exception message designed for a specific locale. + * + * @param rootCause + * the Throwable exception that interfered with the + * JSP Tag's normal operation, making the JSP Tag exception + * necessary * @since 2.0 */ - public JspTagException(Throwable rootCause) { - super( rootCause ); + super(rootCause); } - } diff --git a/java/javax/servlet/jsp/JspWriter.java b/java/javax/servlet/jsp/JspWriter.java index c50558d65..2c1cc74fb 100644 --- a/java/javax/servlet/jsp/JspWriter.java +++ b/java/javax/servlet/jsp/JspWriter.java @@ -1,433 +1,446 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package javax.servlet.jsp; import java.io.IOException; /** *

- * The actions and template data in a JSP page is written using the - * JspWriter object that is referenced by the implicit variable out which - * is initialized automatically using methods in the PageContext object. + * The actions and template data in a JSP page is written using the JspWriter + * object that is referenced by the implicit variable out which is initialized + * automatically using methods in the PageContext object. *

* This abstract class emulates some of the functionality found in the - * java.io.BufferedWriter and java.io.PrintWriter classes, - * however it differs in that it throws java.io.IOException from the print - * methods while PrintWriter does not. - *

Buffering + * java.io.BufferedWriter and java.io.PrintWriter classes, however it differs in + * that it throws java.io.IOException from the print methods while PrintWriter + * does not. + *

+ * Buffering *

- * The initial JspWriter object is associated with the PrintWriter object - * of the ServletResponse in a way that depends on whether the page is or - * is not buffered. If the page is not buffered, output written to this - * JspWriter object will be written through to the PrintWriter directly, - * which will be created if necessary by invoking the getWriter() method - * on the response object. But if the page is buffered, the PrintWriter - * object will not be created until the buffer is flushed and - * operations like setContentType() are legal. Since this flexibility - * simplifies programming substantially, buffering is the default for JSP - * pages. + * The initial JspWriter object is associated with the PrintWriter object of the + * ServletResponse in a way that depends on whether the page is or is not + * buffered. If the page is not buffered, output written to this JspWriter + * object will be written through to the PrintWriter directly, which will be + * created if necessary by invoking the getWriter() method on the response + * object. But if the page is buffered, the PrintWriter object will not be + * created until the buffer is flushed and operations like setContentType() are + * legal. Since this flexibility simplifies programming substantially, buffering + * is the default for JSP pages. *

- * Buffering raises the issue of what to do when the buffer is - * exceeded. Two approaches can be taken: + * Buffering raises the issue of what to do when the buffer is exceeded. Two + * approaches can be taken: *

*

- * Both approaches are valid, and thus both are supported in the JSP - * technology. The behavior of a page is controlled by the autoFlush - * attribute, which defaults to true. In general, JSP pages that need to - * be sure that correct and complete data has been sent to their client - * may want to set autoFlush to false, with a typical case being that - * where the client is an application itself. On the other hand, JSP - * pages that send data that is meaningful even when partially - * constructed may want to set autoFlush to true; such as when the - * data is sent for immediate display through a browser. Each application + * Both approaches are valid, and thus both are supported in the JSP technology. + * The behavior of a page is controlled by the autoFlush attribute, which + * defaults to true. In general, JSP pages that need to be sure that correct and + * complete data has been sent to their client may want to set autoFlush to + * false, with a typical case being that where the client is an application + * itself. On the other hand, JSP pages that send data that is meaningful even + * when partially constructed may want to set autoFlush to true; such as when + * the data is sent for immediate display through a browser. Each application * will need to consider their specific needs. *

- * An alternative considered was to make the buffer size unbounded; but, - * this had the disadvantage that runaway computations would consume an - * unbounded amount of resources. + * An alternative considered was to make the buffer size unbounded; but, this + * had the disadvantage that runaway computations would consume an unbounded + * amount of resources. *

- * The "out" implicit variable of a JSP implementation class is of this type. - * If the page directive selects autoflush="true" then all the I/O operations - * on this class shall automatically flush the contents of the buffer if an + * The "out" implicit variable of a JSP implementation class is of this type. If + * the page directive selects autoflush="true" then all the I/O operations on + * this class shall automatically flush the contents of the buffer if an * overflow condition would result if the current operation were performed * without a flush. If autoflush="false" then all the I/O operations on this * class shall throw an IOException if performing the current operation would * result in a buffer overflow condition. - * + * * @see java.io.Writer * @see java.io.BufferedWriter * @see java.io.PrintWriter */ - abstract public class JspWriter extends java.io.Writer { /** * Constant indicating that the Writer is not buffering output. */ - - public static final int NO_BUFFER = 0; + public static final int NO_BUFFER = 0; /** * Constant indicating that the Writer is buffered and is using the * implementation default buffer size. */ - - public static final int DEFAULT_BUFFER = -1; + public static final int DEFAULT_BUFFER = -1; /** - * Constant indicating that the Writer is buffered and is unbounded; this - * is used in BodyContent. + * Constant indicating that the Writer is buffered and is unbounded; this is + * used in BodyContent. */ - - public static final int UNBOUNDED_BUFFER = -2; + public static final int UNBOUNDED_BUFFER = -2; /** * Protected constructor. - * - * @param bufferSize the size of the buffer to be used by the JspWriter - * @param autoFlush whether the JspWriter should be autoflushing + * + * @param bufferSize + * the size of the buffer to be used by the JspWriter + * @param autoFlush + * whether the JspWriter should be autoflushing */ - protected JspWriter(int bufferSize, boolean autoFlush) { - this.bufferSize = bufferSize; - this.autoFlush = autoFlush; + this.bufferSize = bufferSize; + this.autoFlush = autoFlush; } /** - * Write a line separator. The line separator string is defined by the + * Write a line separator. The line separator string is defined by the * system property line.separator, and is not necessarily a single * newline ('\n') character. - * - * @exception IOException If an I/O error occurs + * + * @exception IOException + * If an I/O error occurs */ - abstract public void newLine() throws IOException; /** - * Print a boolean value. The string produced by {@link - * java.lang.String#valueOf(boolean)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param b The boolean to be printed - * @throws java.io.IOException If an error occurred while writing + * Print a boolean value. The string produced by {@link + * java.lang.String#valueOf(boolean)} + * is written to the JspWriter's buffer or, if no buffer is used, directly + * to the underlying writer. + * + * @param b + * The boolean to be printed + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(boolean b) throws IOException; /** - * 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 char to be printed - * @throws java.io.IOException If an error occurred while writing + * 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 char to be printed + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(char c) throws IOException; /** - * Print an integer. The string produced by {@link - * java.lang.String#valueOf(int)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param i The int to be printed - * @see java.lang.Integer#toString(int) - * @throws java.io.IOException If an error occurred while writing + * Print an integer. The string produced by {@link + * java.lang.String#valueOf(int)} + * is written to the JspWriter's buffer or, if no buffer is used, directly + * to the underlying writer. + * + * @param i + * The int to be printed + * @see java.lang.Integer#toString(int) + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(int i) throws IOException; /** - * Print a long integer. The string produced by {@link - * java.lang.String#valueOf(long)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param l The long to be printed - * @see java.lang.Long#toString(long) - * @throws java.io.IOException If an error occurred while writing + * Print a long integer. The string produced by {@link + * java.lang.String#valueOf(long)} + * is written to the JspWriter's buffer or, if no buffer is used, directly + * to the underlying writer. + * + * @param l + * The long to be printed + * @see java.lang.Long#toString(long) + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(long l) throws IOException; /** - * Print a floating-point number. The string produced by {@link - * java.lang.String#valueOf(float)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param f The float to be printed - * @see java.lang.Float#toString(float) - * @throws java.io.IOException If an error occurred while writing + * Print a floating-point number. The string produced by {@link + * java.lang.String#valueOf(float)} + * is written to the JspWriter's buffer or, if no buffer is used, directly + * to the underlying writer. + * + * @param f + * The float to be printed + * @see java.lang.Float#toString(float) + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(float f) throws IOException; /** - * Print a double-precision floating-point number. The string produced by - * {@link java.lang.String#valueOf(double)} is written to - * the JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param d The double to be printed - * @see java.lang.Double#toString(double) - * @throws java.io.IOException If an error occurred while writing + * Print a double-precision floating-point number. The string produced by + * {@link java.lang.String#valueOf(double)} is written to the + * JspWriter's buffer or, if no buffer is used, directly to the underlying + * writer. + * + * @param d + * The double to be printed + * @see java.lang.Double#toString(double) + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(double d) throws IOException; /** - * 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 - * - * @throws NullPointerException If s is null - * @throws java.io.IOException If an error occurred while writing + * 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 + * @throws NullPointerException + * If s is null + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(char s[]) throws IOException; /** - * Print a string. If the argument is null then the string - * "null" is printed. Otherwise, the string's characters are - * written to the JspWriter's buffer or, if no buffer is used, directly - * to the underlying writer. - * - * @param s The String to be printed - * @throws java.io.IOException If an error occurred while writing + * Print a string. If the argument is null then the string + * "null" is printed. Otherwise, the string's characters are + * written to the JspWriter's buffer or, if no buffer is used, directly to + * the underlying writer. + * + * @param s + * The String to be printed + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(String s) throws IOException; /** - * Print an object. The string produced by the {@link - * java.lang.String#valueOf(Object)} method is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param obj The Object to be printed - * @see java.lang.Object#toString() - * @throws java.io.IOException If an error occurred while writing + * Print an object. The string produced by the {@link + * java.lang.String#valueOf(Object)} + * method is written to the JspWriter's buffer or, if no buffer is used, + * directly to the underlying writer. + * + * @param obj + * The Object to be printed + * @see java.lang.Object#toString() + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void print(Object obj) throws IOException; /** - * Terminate the current line by writing the line separator string. The - * line separator string is defined by the system property + * Terminate the current line by writing the line separator string. The line + * separator string is defined by the system property * line.separator, and is not necessarily a single newline * character ('\n'). - * @throws java.io.IOException If an error occurred while writing + * + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println() throws IOException; /** - * Print a boolean value and then terminate the line. This method behaves - * as though it invokes {@link #print(boolean)} and then + * Print a boolean value and then terminate the line. This method behaves as + * though it invokes {@link #print(boolean)} and then * {@link #println()}. - * - * @param x the boolean to write - * @throws java.io.IOException If an error occurred while writing + * + * @param x + * the boolean to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(boolean x) throws IOException; /** - * Print a character and then terminate the line. This method behaves as + * Print a character and then terminate the line. This method behaves as * though it invokes {@link #print(char)} and then {@link - * #println()}. - * - * @param x the char to write - * @throws java.io.IOException If an error occurred while writing + * #println()} + * . + * + * @param x + * the char to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(char x) throws IOException; /** - * Print an integer and then terminate the line. This method behaves as + * Print an integer and then terminate the line. This method behaves as * though it invokes {@link #print(int)} and then {@link - * #println()}. - * - * @param x the int to write - * @throws java.io.IOException If an error occurred while writing + * #println()} + * . + * + * @param x + * the int to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(int x) throws IOException; /** - * Print a long integer and then terminate the line. This method behaves - * as though it invokes {@link #print(long)} and then + * Print a long integer and then terminate the line. This method behaves as + * though it invokes {@link #print(long)} and then * {@link #println()}. - * - * @param x the long to write - * @throws java.io.IOException If an error occurred while writing + * + * @param x + * the long to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(long x) throws IOException; /** - * Print a floating-point number and then terminate the line. This method + * Print a floating-point number and then terminate the line. This method * behaves as though it invokes {@link #print(float)} and then * {@link #println()}. - * - * @param x the float to write - * @throws java.io.IOException If an error occurred while writing + * + * @param x + * the float to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(float x) throws IOException; /** * Print a double-precision floating-point number and then terminate the - * line. This method behaves as though it invokes {@link - * #print(double)} and then {@link #println()}. - * - * @param x the double to write - * @throws java.io.IOException If an error occurred while writing + * line. This method behaves as though it invokes {@link + * #print(double)} and + * then {@link #println()}. + * + * @param x + * the double to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(double x) throws IOException; /** - * Print an array of characters and then terminate the line. This method + * Print an array of characters and then terminate the line. This method * behaves as though it invokes print(char[]) and then * println(). - * - * @param x the char[] to write - * @throws java.io.IOException If an error occurred while writing + * + * @param x + * the char[] to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(char x[]) throws IOException; /** - * Print a String and then terminate the line. This method behaves as - * though it invokes {@link #print(String)} and then + * Print a String and then terminate the line. This method behaves as though + * it invokes {@link #print(String)} and then * {@link #println()}. - * - * @param x the String to write - * @throws java.io.IOException If an error occurred while writing + * + * @param x + * the String to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(String x) throws IOException; /** - * Print an Object and then terminate the line. This method behaves as + * Print an Object and then terminate the line. This method behaves as * though it invokes {@link #print(Object)} and then * {@link #println()}. - * - * @param x the Object to write - * @throws java.io.IOException If an error occurred while writing + * + * @param x + * the Object to write + * @throws java.io.IOException + * If an error occurred while writing */ - abstract public void println(Object x) throws IOException; - /** - * Clear the contents of the buffer. If the buffer has been already - * been flushed then the clear operation shall throw an IOException - * to signal the fact that some data has already been irrevocably - * written to the client response stream. - * - * @throws IOException If an I/O error occurs + * Clear the contents of the buffer. If the buffer has been already been + * flushed then the clear operation shall throw an IOException to signal the + * fact that some data has already been irrevocably written to the client + * response stream. + * + * @throws IOException + * If an I/O error occurs */ - abstract public void clear() throws IOException; /** - * Clears the current contents of the buffer. Unlike clear(), this - * 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 + * Clears the current contents of the buffer. Unlike clear(), this 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 */ - abstract public void clearBuffer() throws IOException; /** - * Flush the stream. If the stream has saved any characters from the - * various write() methods in a buffer, write them immediately to their - * intended destination. Then, if that destination is another character or - * byte stream, flush it. Thus one flush() invocation will flush all the - * buffers in a chain of Writers and OutputStreams. + * Flush the stream. If the stream has saved any characters from the various + * write() methods in a buffer, write them immediately to their intended + * destination. Then, if that destination is another character or byte + * stream, flush it. Thus one flush() invocation will flush all the buffers + * in a chain of Writers and OutputStreams. *

* The method may be invoked indirectly if the buffer size is exceeded. *

- * Once a stream has been closed, - * further write() or flush() invocations will cause an IOException to be - * thrown. - * - * @exception IOException If an I/O error occurs + * Once a stream has been closed, further write() or flush() invocations + * will cause an IOException to be thrown. + * + * @exception IOException + * If an I/O error occurs */ - @Override abstract public void flush() throws IOException; /** * Close the stream, flushing it first. *

- * This method needs not be invoked explicitly for the initial JspWriter - * as the code generated by the JSP container will automatically - * include a call to close(). + * This method needs not be invoked explicitly for the initial JspWriter as + * the code generated by the JSP container will automatically include a call + * to close(). *

* Closing a previously-closed stream, unlike flush(), has no effect. - * - * @exception IOException If an I/O error occurs + * + * @exception IOException + * If an I/O error occurs */ - @Override abstract public void close() throws IOException; /** * This method returns the size of the buffer used by the JspWriter. - * + * * @return the size of the buffer in bytes, or 0 is unbuffered. */ - - public int getBufferSize() { return bufferSize; } + public int getBufferSize() { + return bufferSize; + } /** * This method returns the number of unused bytes in the buffer. - * + * * @return the number of bytes unused in the buffer */ - abstract public int getRemaining(); /** * This method indicates whether the JspWriter is autoFlushing. - * - * @return if this JspWriter is auto flushing or throwing IOExceptions - * on buffer overflow conditions + * + * @return if this JspWriter is auto flushing or throwing IOExceptions on + * buffer overflow conditions */ - - public boolean isAutoFlush() { return autoFlush; } + public boolean isAutoFlush() { + return autoFlush; + } /* * fields @@ -436,8 +449,8 @@ abstract public class JspWriter extends java.io.Writer { /** * The size of the buffer used by the JspWriter. */ - protected int bufferSize; - + protected int bufferSize; + /** * Whether the JspWriter is autoflushing. */ diff --git a/java/javax/servlet/jsp/SkipPageException.java b/java/javax/servlet/jsp/SkipPageException.java index 8dfcc1366..1ed632dd9 100644 --- a/java/javax/servlet/jsp/SkipPageException.java +++ b/java/javax/servlet/jsp/SkipPageException.java @@ -1,76 +1,75 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp; /** - * Exception to indicate the calling page must cease evaluation. - * Thrown by a simple tag handler to indicate that the remainder of - * the page must not be evaluated. The result is propagated back to - * the page in the case where one tag invokes another (as can be - * the case with tag files). The effect is similar to that of a - * Classic Tag Handler returning Tag.SKIP_PAGE from doEndTag(). - * Jsp Fragments may also throw this exception. This exception + * Exception to indicate the calling page must cease evaluation. Thrown by a + * simple tag handler to indicate that the remainder of the page must not be + * evaluated. The result is propagated back to the page in the case where one + * tag invokes another (as can be the case with tag files). The effect is + * similar to that of a Classic Tag Handler returning Tag.SKIP_PAGE from + * doEndTag(). Jsp Fragments may also throw this exception. This exception * should not be thrown manually in a JSP page or tag file - the behavior is - * undefined. The exception is intended to be thrown inside - * SimpleTag handlers and in JSP fragments. + * undefined. The exception is intended to be thrown inside SimpleTag handlers + * and in JSP fragments. * * @see javax.servlet.jsp.tagext.SimpleTag#doTag * @see javax.servlet.jsp.tagext.JspFragment#invoke * @see javax.servlet.jsp.tagext.Tag#doEndTag * @since 2.0 */ -public class SkipPageException - extends JspException -{ +public class SkipPageException extends JspException { + /** * Creates a SkipPageException with no message. */ public SkipPageException() { super(); } - + /** * Creates a SkipPageException with the provided message. - * - * @param message the detail message + * + * @param message + * the detail message */ - public SkipPageException( String message ) { - super( message ); + public SkipPageException(String message) { + super(message); } /** * Creates a SkipPageException with the provided message and root cause. - * - * @param message the detail message - * @param rootCause the originating cause of this exception + * + * @param message + * the detail message + * @param rootCause + * the originating cause of this exception */ - public SkipPageException( String message, Throwable rootCause ) { - super( message, rootCause ); + public SkipPageException(String message, Throwable rootCause) { + super(message, rootCause); } /** * Creates a SkipPageException with the provided root cause. - * - * @param rootCause the originating cause of this exception + * + * @param rootCause + * the originating cause of this exception */ - public SkipPageException( Throwable rootCause ) { - super( rootCause ); + public SkipPageException(Throwable rootCause) { + super(rootCause); } - } - - diff --git a/java/javax/servlet/jsp/el/ExpressionEvaluator.java b/java/javax/servlet/jsp/el/ExpressionEvaluator.java index 332a9f537..6610fcb6b 100644 --- a/java/javax/servlet/jsp/el/ExpressionEvaluator.java +++ b/java/javax/servlet/jsp/el/ExpressionEvaluator.java @@ -1,111 +1,115 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.el; - /** - *

The abstract base class for an expression-language evaluator. - * Classes that implement an expression language expose their functionality - * via this abstract class.

- * - *

An instance of the ExpressionEvaluator can be obtained via the - * JspContext / PageContext

- * - *

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.

- * - *

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 "abc${1+1}def${1+1}ghi" or even - * "${1+1}${1+1}" will cause an ELException to - * be thrown.

- * - *

The following are examples of syntactically legal EL expressions: - * + *

+ * The abstract base class for an expression-language evaluator. Classes that + * implement an expression language expose their functionality via this abstract + * class. + *

+ *

+ * An instance of the ExpressionEvaluator can be obtained via the JspContext / + * PageContext + *

+ *

+ * 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. + *

+ *

+ * 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 " + * abc${1+1}def${1+1}ghi" or even "${1+1}${1+1}" will + * cause an ELException to be thrown. + *

+ *

+ * The following are examples of syntactically legal EL expressions: *

*

- * + * * @since 2.0 * @deprecated */ -@SuppressWarnings("dep-ann") // TCK signature test fails with annotation +@SuppressWarnings("dep-ann") +// TCK signature test fails with annotation public abstract class ExpressionEvaluator { /** - * Prepare an expression for later evaluation. This method should perform - * syntactic validation of the expression; if in doing so it detects - * errors, it should raise an ELParseException. - * - * @param expression The expression to be evaluated. - * @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 ExpressionEvaluator - * must not hold on to the FunctionMapper reference after - * returning from parseExpression(). The - * Expression object returned must invoke the same - * functions regardless of whether the mappings in the - * provided FunctionMapper instance change between - * calling ExpressionEvaluator.parseExpression() - * and Expression.evaluate(). + * Prepare an expression for later evaluation. This method should perform + * syntactic validation of the expression; if in doing so it detects errors, + * it should raise an ELParseException. + * + * @param expression + * The expression to be evaluated. + * @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 ExpressionEvaluator must not hold on to + * the FunctionMapper reference after returning from + * parseExpression(). The Expression + * object returned must invoke the same functions regardless of + * whether the mappings in the provided + * FunctionMapper instance change between calling + * ExpressionEvaluator.parseExpression() and + * Expression.evaluate(). * @return The Expression object encapsulating the arguments. - * - * @exception ELException Thrown if parsing errors were found. - */ - public abstract Expression parseExpression( String expression, - @SuppressWarnings("unchecked") // TCK signature fails with generics - Class expectedType, - FunctionMapper fMapper) - throws ELException; - + * @exception ELException + * Thrown if parsing errors were found. + */ + public abstract Expression parseExpression(String expression, + @SuppressWarnings("unchecked")// TCK signature fails with generics + Class expectedType, FunctionMapper fMapper) throws ELException; - /** - * Evaluates an expression. This method may perform some syntactic - * validation and, if so, it should raise an ELParseException error if - * it encounters syntactic errors. EL evaluation errors should cause - * an ELException to be raised. - * - * @param expression The expression to be evaluated. - * @param expectedType The expected type of the result of the evaluation - * @param vResolver A VariableResolver instance that can be used at - * 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. + /** + * Evaluates an expression. This method may perform some syntactic + * validation and, if so, it should raise an ELParseException error if it + * encounters syntactic errors. EL evaluation errors should cause an + * ELException to be raised. + * + * @param expression + * The expression to be evaluated. + * @param expectedType + * The expected type of the result of the evaluation + * @param vResolver + * A VariableResolver instance that can be used at 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. * @return The result of the expression evaluation. - * - * @exception ELException Thrown if the expression evaluation failed. + * @exception ELException + * Thrown if the expression evaluation failed. */ - public abstract Object evaluate( String expression, - @SuppressWarnings("unchecked") // TCK signature fails with generics - Class expectedType, - VariableResolver vResolver, - FunctionMapper fMapper) - throws ELException; + public abstract Object evaluate( + String expression, + @SuppressWarnings("unchecked")// TCK signature fails with generics + Class expectedType, VariableResolver vResolver, + FunctionMapper fMapper) throws ELException; } - diff --git a/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java b/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java index d2d38ecdc..de7fe39bf 100644 --- a/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java +++ b/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java @@ -1,20 +1,19 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.el; import java.beans.FeatureDescriptor; @@ -33,166 +32,167 @@ import javax.servlet.jsp.PageContext; public class ScopedAttributeELResolver extends ELResolver { - public ScopedAttributeELResolver() { - super(); - } + public ScopedAttributeELResolver() { + super(); + } - @Override + @Override public Object getValue(ELContext context, Object base, Object property) - throws NullPointerException, PropertyNotFoundException, ELException { - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - if (property != null) { - String key = property.toString(); - PageContext page = (PageContext) context - .getContext(JspContext.class); - return page.findAttribute(key); - } - } - - return null; - } - - @Override + throws NullPointerException, PropertyNotFoundException, ELException { + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + if (property != null) { + String key = property.toString(); + PageContext page = (PageContext) context + .getContext(JspContext.class); + return page.findAttribute(key); + } + } + + return null; + } + + @Override public Class getType(ELContext context, Object base, Object property) - throws NullPointerException, PropertyNotFoundException, ELException { - if (context == null) { - throw new NullPointerException(); - } + throws NullPointerException, PropertyNotFoundException, ELException { + if (context == null) { + throw new NullPointerException(); + } - if (base == null) { - context.setPropertyResolved(true); - return Object.class; - } + if (base == null) { + context.setPropertyResolved(true); + return Object.class; + } - return null; - } + return null; + } - @Override + @Override public void setValue(ELContext context, Object base, Object property, - Object value) throws NullPointerException, - PropertyNotFoundException, PropertyNotWritableException, - ELException { - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - if (property != null) { - String key = property.toString(); - PageContext page = (PageContext) context - .getContext(JspContext.class); - int scope = page.getAttributesScope(key); - if (scope != 0) { - page.setAttribute(key, value, scope); - } else { - page.setAttribute(key, value); - } - } - } - } - - @Override + Object value) throws NullPointerException, + PropertyNotFoundException, PropertyNotWritableException, + ELException { + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + if (property != null) { + String key = property.toString(); + PageContext page = (PageContext) context + .getContext(JspContext.class); + int scope = page.getAttributesScope(key); + if (scope != 0) { + page.setAttribute(key, value, scope); + } else { + page.setAttribute(key, value); + } + } + } + } + + @Override public boolean isReadOnly(ELContext context, Object base, Object property) - throws NullPointerException, PropertyNotFoundException, ELException { - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - } - - return false; - } - - @Override - public Iterator getFeatureDescriptors(ELContext context, Object base) { - - PageContext ctxt = (PageContext) context.getContext(JspContext.class); - List list = new ArrayList(); - Enumeration e; - Object value; - String name; - - e = ctxt.getAttributeNamesInScope(PageContext.PAGE_SCOPE); - while (e.hasMoreElements()) { - name = e.nextElement(); - value = ctxt.getAttribute(name, PageContext.PAGE_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setShortDescription("page scoped attribute"); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); - list.add(descriptor); - } - - e = ctxt.getAttributeNamesInScope(PageContext.REQUEST_SCOPE); - while (e.hasMoreElements()) { - name = e.nextElement(); - value = ctxt.getAttribute(name, PageContext.REQUEST_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setShortDescription("request scope attribute"); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); - list.add(descriptor); - } - - if (ctxt.getSession() != null) { - e = ctxt.getAttributeNamesInScope(PageContext.SESSION_SCOPE); - while (e.hasMoreElements()) { - name = e.nextElement(); - value = ctxt.getAttribute(name, PageContext.SESSION_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setShortDescription("session scoped attribute"); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); - list.add(descriptor); - } - } - - e = ctxt.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE); - while (e.hasMoreElements()) { - name = e.nextElement(); - value = ctxt.getAttribute(name, PageContext.APPLICATION_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setShortDescription("application scoped attribute"); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); - list.add(descriptor); - } - return list.iterator(); - } - - @Override + throws NullPointerException, PropertyNotFoundException, ELException { + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + } + + return false; + } + + @Override + public Iterator getFeatureDescriptors(ELContext context, + Object base) { + + PageContext ctxt = (PageContext) context.getContext(JspContext.class); + List list = new ArrayList(); + Enumeration e; + Object value; + String name; + + e = ctxt.getAttributeNamesInScope(PageContext.PAGE_SCOPE); + while (e.hasMoreElements()) { + name = e.nextElement(); + value = ctxt.getAttribute(name, PageContext.PAGE_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setShortDescription("page scoped attribute"); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); + list.add(descriptor); + } + + e = ctxt.getAttributeNamesInScope(PageContext.REQUEST_SCOPE); + while (e.hasMoreElements()) { + name = e.nextElement(); + value = ctxt.getAttribute(name, PageContext.REQUEST_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setShortDescription("request scope attribute"); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); + list.add(descriptor); + } + + if (ctxt.getSession() != null) { + e = ctxt.getAttributeNamesInScope(PageContext.SESSION_SCOPE); + while (e.hasMoreElements()) { + name = e.nextElement(); + value = ctxt.getAttribute(name, PageContext.SESSION_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setShortDescription("session scoped attribute"); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); + list.add(descriptor); + } + } + + e = ctxt.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE); + while (e.hasMoreElements()) { + name = e.nextElement(); + value = ctxt.getAttribute(name, PageContext.APPLICATION_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setShortDescription("application scoped attribute"); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); + list.add(descriptor); + } + return list.iterator(); + } + + @Override public Class getCommonPropertyType(ELContext context, Object base) { - if (base == null) { - return String.class; - } - return null; - } + if (base == null) { + return String.class; + } + return null; + } } diff --git a/java/javax/servlet/jsp/el/VariableResolver.java b/java/javax/servlet/jsp/el/VariableResolver.java index f42d23634..14f31d99c 100644 --- a/java/javax/servlet/jsp/el/VariableResolver.java +++ b/java/javax/servlet/jsp/el/VariableResolver.java @@ -1,52 +1,51 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.el; /** - *

This class is used to customize the way an ExpressionEvaluator resolves - * variable references at evaluation time. For example, instances of this class can - * implement their own variable lookup mechanisms, or introduce the - * notion of "implicit variables" which override any other variables. - * An instance of this class should be passed when evaluating - * an expression.

- * - *

An instance of this class includes the context against which resolution - * will happen

- * + *

+ * This class is used to customize the way an ExpressionEvaluator resolves + * variable references at evaluation time. For example, instances of this class + * can implement their own variable lookup mechanisms, or introduce the notion + * of "implicit variables" which override any other variables. An instance of + * this class should be passed when evaluating an expression. + *

+ *

+ * An instance of this class includes the context against which resolution will + * happen + *

+ * * @since 2.0 * @deprecated */ -@SuppressWarnings("dep-ann") // TCK signature test fails with annotation -public interface VariableResolver -{ - //------------------------------------- - /** - * Resolves the specified variable. - * Returns null if the variable is not found. - * - * @param pName the name of the variable to resolve - * @return the result of the variable resolution - * - * @throws ELException if a failure occurred while trying to resolve - * the given variable - **/ - public Object resolveVariable (String pName) - throws ELException; - - //------------------------------------- +@SuppressWarnings("dep-ann") +// TCK signature test fails with annotation +public interface VariableResolver { + + /** + * Resolves the specified variable. Returns null if the variable is not + * found. + * + * @param pName + * the name of the variable to resolve + * @return the result of the variable resolution + * @throws ELException + * if a failure occurred while trying to resolve the given + * variable + */ + public Object resolveVariable(String pName) throws ELException; } diff --git a/java/javax/servlet/jsp/tagext/BodyContent.java b/java/javax/servlet/jsp/tagext/BodyContent.java index 4b55e5ad4..0e7428df3 100644 --- a/java/javax/servlet/jsp/tagext/BodyContent.java +++ b/java/javax/servlet/jsp/tagext/BodyContent.java @@ -1,19 +1,19 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; import java.io.Reader; @@ -23,118 +23,102 @@ import javax.servlet.jsp.*; /** * An encapsulation of the evaluation of the body of an action so it is - * available to a tag handler. BodyContent is a subclass of JspWriter. - * + * available to a tag handler. BodyContent is a subclass of JspWriter. *

- * Note that the content of BodyContent is the result of evaluation, so - * it will not contain actions and the like, but the result of their - * invocation. - * + * Note that the content of BodyContent is the result of evaluation, so it will + * not contain actions and the like, but the result of their invocation. *

- * BodyContent has methods to convert its contents into - * a String, to read its contents, and to clear the contents. - * + * BodyContent has methods to convert its contents into a String, to read its + * contents, and to clear the contents. *

- * The buffer size of a BodyContent object is unbounded. A - * BodyContent object cannot be in autoFlush mode. It is not possible to - * invoke flush on a BodyContent object, as there is no backing stream. - * + * The buffer size of a BodyContent object is unbounded. A BodyContent object + * cannot be in autoFlush mode. It is not possible to invoke flush on a + * BodyContent object, as there is no backing stream. *

- * Instances of BodyContent are created by invoking the pushBody and - * popBody methods of the PageContext class. A BodyContent is enclosed - * within another JspWriter (maybe another BodyContent object) following - * the structure of their associated actions. - * + * Instances of BodyContent are created by invoking the pushBody and popBody + * methods of the PageContext class. A BodyContent is enclosed within another + * JspWriter (maybe another BodyContent object) following the structure of their + * associated actions. *

- * A BodyContent is made available to a BodyTag through a setBodyContent() - * call. The tag handler can use the object until after the call to - * doEndTag(). + * A BodyContent is made available to a BodyTag through a setBodyContent() call. + * The tag handler can use the object until after the call to doEndTag(). */ - public abstract class BodyContent extends JspWriter { - + /** - * Protected constructor. - * - * Unbounded buffer, no autoflushing. - * - * @param e the enclosing JspWriter + * Protected constructor. Unbounded buffer, no autoflushing. + * + * @param e + * the enclosing JspWriter */ - protected BodyContent(JspWriter e) { - super(UNBOUNDED_BUFFER , false); - this.enclosingWriter = e; + super(UNBOUNDED_BUFFER, false); + this.enclosingWriter = e; } /** * Redefined flush() so it is not legal. - * *

- * It is not valid to flush a BodyContent because there is no backing - * stream behind it. - * - * @throws IOException always thrown + * It is not valid to flush a BodyContent because there is no backing stream + * behind it. + * + * @throws IOException + * always thrown */ - @Override public void flush() throws IOException { - throw new IOException("Illegal to flush within a custom tag"); + throw new IOException("Illegal to flush within a custom tag"); } /** * Clear the body without throwing any exceptions. */ - public void clearBody() { - try { - this.clear(); - } catch (IOException ex) { - // TODO -- clean this one up. - throw new Error("internal error!;"); - } + try { + this.clear(); + } catch (IOException ex) { + // TODO -- clean this one up. + throw new Error("internal error!;"); + } } /** * Return the value of this BodyContent as a Reader. - * + * * @return the value of this BodyContent as a Reader */ public abstract Reader getReader(); - /** * Return the value of the BodyContent as a String. - * + * * @return the value of the BodyContent as a String */ public abstract String getString(); - /** - * Write the contents of this BodyContent into a Writer. - * Subclasses may optimize common invocation patterns. - * - * @param out The writer into which to place the contents of - * this body evaluation - * @throws IOException if an I/O error occurred while writing the - * contents of this BodyContent to the given Writer + * Write the contents of this BodyContent into a Writer. Subclasses may + * optimize common invocation patterns. + * + * @param out + * The writer into which to place the contents of this body + * evaluation + * @throws IOException + * if an I/O error occurred while writing the contents of this + * BodyContent to the given Writer */ - public abstract void writeOut(Writer out) throws IOException; - /** * Get the enclosing JspWriter. - * + * * @return the enclosing JspWriter passed at construction time */ - public JspWriter getEnclosingWriter() { - return enclosingWriter; + return enclosingWriter; } - // private fields private JspWriter enclosingWriter; - } +} diff --git a/java/javax/servlet/jsp/tagext/BodyTag.java b/java/javax/servlet/jsp/tagext/BodyTag.java index 297a0d2bc..847cc3ed4 100644 --- a/java/javax/servlet/jsp/tagext/BodyTag.java +++ b/java/javax/servlet/jsp/tagext/BodyTag.java @@ -1,186 +1,161 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; import javax.servlet.jsp.*; /** - * The BodyTag interface extends IterationTag by defining additional - * methods that let a tag handler manipulate the content of evaluating its body. - * + * The BodyTag interface extends IterationTag by defining additional methods + * that let a tag handler manipulate the content of evaluating its body. *

- * It is the responsibility of the tag handler to manipulate the body - * content. For example the tag handler may take the body content, - * convert it into a String using the bodyContent.getString - * method and then use it. Or the tag handler may take the body - * content and write it out into its enclosing JspWriter using - * the bodyContent.writeOut method. - * - *

A tag handler that implements BodyTag is treated as one that - * implements IterationTag, except that the doStartTag method can - * return SKIP_BODY, EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED. - * + * It is the responsibility of the tag handler to manipulate the body content. + * For example the tag handler may take the body content, convert it into a + * String using the bodyContent.getString method and then use it. Or the tag + * handler may take the body content and write it out into its enclosing + * JspWriter using the bodyContent.writeOut method. *

- * If EVAL_BODY_INCLUDE is returned, then evaluation happens - * as in IterationTag. - * + * A tag handler that implements BodyTag is treated as one that implements + * IterationTag, except that the doStartTag method can return SKIP_BODY, + * EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED. *

- * If EVAL_BODY_BUFFERED is returned, then a BodyContent object will be - * created (by code generated by the JSP compiler) to capture the body - * evaluation. - * The code generated by the JSP compiler obtains the BodyContent object by - * calling the pushBody method of the current pageContext, which - * additionally has the effect of saving the previous out value. - * The page compiler returns this object by calling the popBody - * method of the PageContext class; - * the call also restores the value of out. - * + * If EVAL_BODY_INCLUDE is returned, then evaluation happens as in IterationTag. *

- * The interface provides one new property with a setter method and one - * new action method. - * - *

Properties - *

There is a new property: bodyContent, to contain the BodyContent - * object, where the JSP Page implementation object will place the - * evaluation (and reevaluation, if appropriate) of the body. The setter - * method (setBodyContent) will only be invoked if doStartTag() returns - * EVAL_BODY_BUFFERED and the corresponding action element does not have - * an empty body. - * - *

Methods - *

In addition to the setter method for the bodyContent property, there - * is a new action method: doInitBody(), which is invoked right after - * setBodyContent() and before the body evaluation. This method is only - * invoked if doStartTag() returns EVAL_BODY_BUFFERED. - * - *

Lifecycle - *

Lifecycle details are described by the transition diagram below. - * Exceptions that are thrown during the computation of doStartTag(), - * setBodyContent(), doInitBody(), BODY, doAfterBody() interrupt the - * execution sequence and are propagated up the stack, unless the - * tag handler implements the TryCatchFinally interface; see that - * interface for details. + * If EVAL_BODY_BUFFERED is returned, then a BodyContent object will be created + * (by code generated by the JSP compiler) to capture the body evaluation. The + * code generated by the JSP compiler obtains the BodyContent object by calling + * the pushBody method of the current pageContext, which additionally has the + * effect of saving the previous out value. The page compiler returns this + * object by calling the popBody method of the PageContext class; the call also + * restores the value of out. + *

+ * The interface provides one new property with a setter method and one new + * action method. + *

+ * Properties + *

+ * There is a new property: bodyContent, to contain the BodyContent object, + * where the JSP Page implementation object will place the evaluation (and + * reevaluation, if appropriate) of the body. The setter method (setBodyContent) + * will only be invoked if doStartTag() returns EVAL_BODY_BUFFERED and the + * corresponding action element does not have an empty body. + *

+ * Methods + *

+ * In addition to the setter method for the bodyContent property, there is a new + * action method: doInitBody(), which is invoked right after setBodyContent() + * and before the body evaluation. This method is only invoked if doStartTag() + * returns EVAL_BODY_BUFFERED. + *

+ * Lifecycle + *

+ * Lifecycle details are described by the transition diagram below. Exceptions + * that are thrown during the computation of doStartTag(), setBodyContent(), + * doInitBody(), BODY, doAfterBody() interrupt the execution sequence and are + * propagated up the stack, unless the tag handler implements the + * TryCatchFinally interface; see that interface for details. *

* Lifecycle Details Transition Diagram for BodyTag - * - *

Empty and Non-Empty Action - *

If the TagLibraryDescriptor file indicates that the action must - * always have an empty element body, by an <body-content> entry - * of "empty", then the doStartTag() method must return SKIP_BODY. - * Otherwise, the doStartTag() method may return SKIP_BODY, - * EVAL_BODY_INCLUDE, or EVAL_BODY_BUFFERED. - * - *

Note that which methods are invoked after the doStartTag() depends on - * both the return value and on if the custom action element is empty - * or not in the JSP page, not how it's declared in the TLD. - * + * alt="Lifecycle Details Transition Diagram for BodyTag"/> + *

+ * Empty and Non-Empty Action + *

+ * If the TagLibraryDescriptor file indicates that the action must always have + * an empty element body, by an <body-content> entry of "empty", then the + * doStartTag() method must return SKIP_BODY. Otherwise, the doStartTag() method + * may return SKIP_BODY, EVAL_BODY_INCLUDE, or EVAL_BODY_BUFFERED. + *

+ * Note that which methods are invoked after the doStartTag() depends on both + * the return value and on if the custom action element is empty or not in the + * JSP page, not how it's declared in the TLD. *

* If SKIP_BODY is returned the body is not evaluated, and doEndTag() is * invoked. - * *

- * If EVAL_BODY_INCLUDE is returned, and the custom action element is not - * empty, setBodyContent() is not invoked, - * doInitBody() is not invoked, the body is evaluated and - * "passed through" to the current out, doAfterBody() is invoked - * and then, after zero or more iterations, doEndTag() is invoked. - * If the custom action element is empty, only doStart() and - * doEndTag() are invoked. - * + * If EVAL_BODY_INCLUDE is returned, and the custom action element is not empty, + * setBodyContent() is not invoked, doInitBody() is not invoked, the body is + * evaluated and "passed through" to the current out, doAfterBody() is invoked + * and then, after zero or more iterations, doEndTag() is invoked. If the custom + * action element is empty, only doStart() and doEndTag() are invoked. *

* If EVAL_BODY_BUFFERED is returned, and the custom action element is not - * empty, setBodyContent() is invoked, - * doInitBody() is invoked, the body is evaluated, doAfterBody() is - * invoked, and then, after zero or more iterations, doEndTag() is invoked. - * If the custom action element is empty, only doStart() and doEndTag() - * are invoked. + * empty, setBodyContent() is invoked, doInitBody() is invoked, the body is + * evaluated, doAfterBody() is invoked, and then, after zero or more iterations, + * doEndTag() is invoked. If the custom action element is empty, only doStart() + * and doEndTag() are invoked. */ - public interface BodyTag extends IterationTag { /** - * Deprecated constant that has the same value as EVAL_BODY_BUFFERED - * and EVAL_BODY_AGAIN. This name has been marked as deprecated - * to encourage the use of the two different terms, which are much - * more descriptive. - * - * @deprecated As of Java JSP API 1.2, use BodyTag.EVAL_BODY_BUFFERED - * or IterationTag.EVAL_BODY_AGAIN. + * Deprecated constant that has the same value as EVAL_BODY_BUFFERED and + * EVAL_BODY_AGAIN. This name has been marked as deprecated to encourage the + * use of the two different terms, which are much more descriptive. + * + * @deprecated As of Java JSP API 1.2, use BodyTag.EVAL_BODY_BUFFERED or + * IterationTag.EVAL_BODY_AGAIN. */ - @SuppressWarnings("dep-ann") // TCK signature test fails with annotation + @SuppressWarnings("dep-ann") + // TCK signature test fails with annotation public final static int EVAL_BODY_TAG = 2; /** - * Request the creation of new buffer, a BodyContent on which to - * evaluate the body of this tag. - * - * Returned from doStartTag when it implements BodyTag. - * This is an illegal return value for doStartTag when the class + * Request the creation of new buffer, a BodyContent on which to evaluate + * the body of this tag. Returned from doStartTag when it implements + * BodyTag. This is an illegal return value for doStartTag when the class * does not implement BodyTag. */ - public final static int EVAL_BODY_BUFFERED = 2; - /** - * Set the bodyContent property. - * This method is invoked by the JSP page implementation object at - * most once per action invocation. - * This method will be invoked before doInitBody. - * This method will not be invoked for empty tags or for non-empty - * tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. - * + * Set the bodyContent property. This method is invoked by the JSP page + * implementation object at most once per action invocation. This method + * will be invoked before doInitBody. This method will not be invoked for + * empty tags or for non-empty tags whose doStartTag() method returns + * SKIP_BODY or EVAL_BODY_INCLUDE. *

- * When setBodyContent is invoked, the value of the implicit object out - * has already been changed in the pageContext object. The BodyContent - * object passed will have not data on it but may have been reused - * (and cleared) from some previous invocation. - * + * When setBodyContent is invoked, the value of the implicit object out has + * already been changed in the pageContext object. The BodyContent object + * passed will have not data on it but may have been reused (and cleared) + * from some previous invocation. *

* The BodyContent object is available and with the appropriate content - * until after the invocation of the doEndTag method, at which case it - * may be reused. - * - * @param b the BodyContent + * until after the invocation of the doEndTag method, at which case it may + * be reused. + * + * @param b + * the BodyContent * @see #doInitBody * @see #doAfterBody */ - void setBodyContent(BodyContent b); - /** - * Prepare for evaluation of the body. - * This method is invoked by the JSP page implementation object - * after setBodyContent and before the first time - * the body is to be evaluated. - * This method will not be invoked for empty tags or for non-empty - * tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. - * + * Prepare for evaluation of the body. This method is invoked by the JSP + * page implementation object after setBodyContent and before the first time + * the body is to be evaluated. This method will not be invoked for empty + * tags or for non-empty tags whose doStartTag() method returns SKIP_BODY or + * EVAL_BODY_INCLUDE. *

* The JSP container will resynchronize the values of any AT_BEGIN and * NESTED variables (defined by the associated TagExtraInfo or TLD) after * the invocation of doInitBody(). - * - * @throws JspException if an error occurred while processing this tag + * + * @throws JspException + * if an error occurred while processing this tag * @see #doAfterBody */ - void doInitBody() throws JspException; - } diff --git a/java/javax/servlet/jsp/tagext/BodyTagSupport.java b/java/javax/servlet/jsp/tagext/BodyTagSupport.java index 2399b9b3f..5f694f431 100644 --- a/java/javax/servlet/jsp/tagext/BodyTagSupport.java +++ b/java/javax/servlet/jsp/tagext/BodyTagSupport.java @@ -1,19 +1,19 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; import javax.servlet.jsp.JspException; @@ -21,139 +21,123 @@ import javax.servlet.jsp.JspWriter; /** * A base class for defining tag handlers implementing BodyTag. - * *

- * The BodyTagSupport class implements the BodyTag interface and adds - * additional convenience methods including getter methods for the - * bodyContent property and methods to get at the previous out JspWriter. - * + * The BodyTagSupport class implements the BodyTag interface and adds additional + * convenience methods including getter methods for the bodyContent property and + * methods to get at the previous out JspWriter. *

- * Many tag handlers will extend BodyTagSupport and only redefine a - * few methods. + * Many tag handlers will extend BodyTagSupport and only redefine a few methods. */ - public class BodyTagSupport extends TagSupport implements BodyTag { /** - * Default constructor, all subclasses are required to only define - * a public constructor with the same signature, and to call the - * superclass constructor. - * - * This constructor is called by the code generated by the JSP + * Default constructor, all subclasses are required to only define a public + * constructor with the same signature, and to call the superclass + * constructor. This constructor is called by the code generated by the JSP * translator. */ - public BodyTagSupport() { - super(); + super(); } /** * Default processing of the start tag returning EVAL_BODY_BUFFERED. - * + * * @return EVAL_BODY_BUFFERED - * @throws JspException if an error occurred while processing this tag + * @throws JspException + * if an error occurred while processing this tag * @see BodyTag#doStartTag */ - @Override public int doStartTag() throws JspException { return EVAL_BODY_BUFFERED; } - /** * Default processing of the end tag returning EVAL_PAGE. - * + * * @return EVAL_PAGE - * @throws JspException if an error occurred while processing this tag + * @throws JspException + * if an error occurred while processing this tag * @see Tag#doEndTag */ - @Override public int doEndTag() throws JspException { - return super.doEndTag(); + return super.doEndTag(); } - // Actions related to body evaluation /** * Prepare for evaluation of the body: stash the bodyContent away. - * - * @param b the BodyContent + * + * @param b + * the BodyContent * @see #doAfterBody * @see #doInitBody() * @see BodyTag#setBodyContent */ - public void setBodyContent(BodyContent b) { - this.bodyContent = b; + this.bodyContent = b; } - /** * Prepare for evaluation of the body just before the first body evaluation: * no action. - * - * @throws JspException if an error occurred while processing this tag + * + * @throws JspException + * if an error occurred while processing this tag * @see #setBodyContent * @see #doAfterBody * @see BodyTag#doInitBody */ - public void doInitBody() throws JspException { // NOOP by default } - /** * After the body evaluation: do not reevaluate and continue with the page. * By default nothing is done with the bodyContent data (if any). - * + * * @return SKIP_BODY - * @throws JspException if an error occurred while processing this tag + * @throws JspException + * if an error occurred while processing this tag * @see #doInitBody * @see BodyTag#doAfterBody */ - @Override public int doAfterBody() throws JspException { - return SKIP_BODY; + return SKIP_BODY; } - /** * Release state. - * + * * @see Tag#release */ - @Override public void release() { - bodyContent = null; + bodyContent = null; - super.release(); + super.release(); } /** * Get current bodyContent. - * + * * @return the body content. */ - public BodyContent getBodyContent() { - return bodyContent; + return bodyContent; } - /** * Get surrounding out JspWriter. - * + * * @return the enclosing JspWriter, from the bodyContent. */ - public JspWriter getPreviousOut() { - return bodyContent.getEnclosingWriter(); + return bodyContent.getEnclosingWriter(); } // protected fields @@ -161,5 +145,5 @@ public class BodyTagSupport extends TagSupport implements BodyTag { /** * The current BodyContent for this BodyTag. */ - protected BodyContent bodyContent; + protected BodyContent bodyContent; } diff --git a/java/javax/servlet/jsp/tagext/TagAdapter.java b/java/javax/servlet/jsp/tagext/TagAdapter.java index 1b309a8a9..72b15a374 100644 --- a/java/javax/servlet/jsp/tagext/TagAdapter.java +++ b/java/javax/servlet/jsp/tagext/TagAdapter.java @@ -1,42 +1,37 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; import javax.servlet.jsp.*; - /** - * Wraps any SimpleTag and exposes it using a Tag interface. This is used - * to allow collaboration between classic Tag handlers and SimpleTag - * handlers. + * Wraps any SimpleTag and exposes it using a Tag interface. This is used to + * allow collaboration between classic Tag handlers and SimpleTag handlers. *

- * Because SimpleTag does not extend Tag, and because Tag.setParent() - * only accepts a Tag instance, a classic tag handler (one - * that implements Tag) cannot have a SimpleTag as its parent. To remedy - * this, a TagAdapter is created to wrap the SimpleTag parent, and the - * adapter is passed to setParent() instead. A classic Tag Handler can - * call getAdaptee() to retrieve the encapsulated SimpleTag instance. - * + * Because SimpleTag does not extend Tag, and because Tag.setParent() only + * accepts a Tag instance, a classic tag handler (one that implements Tag) + * cannot have a SimpleTag as its parent. To remedy this, a TagAdapter is + * created to wrap the SimpleTag parent, and the adapter is passed to + * setParent() instead. A classic Tag Handler can call getAdaptee() to retrieve + * the encapsulated SimpleTag instance. + * * @since 2.0 */ -public class TagAdapter - implements Tag -{ +public class TagAdapter implements Tag { /** The simple tag that's being adapted. */ private SimpleTag simpleTagAdaptee; @@ -47,76 +42,77 @@ public class TagAdapter private boolean parentDetermined; /** - * Creates a new TagAdapter that wraps the given SimpleTag and - * returns the parent tag when getParent() is called. - * - * @param adaptee The SimpleTag being adapted as a Tag. + * Creates a new TagAdapter that wraps the given SimpleTag and returns the + * parent tag when getParent() is called. + * + * @param adaptee + * The SimpleTag being adapted as a Tag. */ - public TagAdapter( SimpleTag adaptee ) { - if( adaptee == null ) { - // Cannot wrap a null adaptee. - throw new IllegalArgumentException(); + public TagAdapter(SimpleTag adaptee) { + if (adaptee == null) { + // Cannot wrap a null adaptee. + throw new IllegalArgumentException(); } this.simpleTagAdaptee = adaptee; } - + /** * Must not be called. - * - * @param pc ignored. - * @throws UnsupportedOperationException Must not be called + * + * @param pc + * ignored. + * @throws UnsupportedOperationException + * Must not be called */ public void setPageContext(PageContext pc) { - throw new UnsupportedOperationException( - "Illegal to invoke setPageContext() on TagAdapter wrapper" ); + throw new UnsupportedOperationException( + "Illegal to invoke setPageContext() on TagAdapter wrapper"); } - /** - * Must not be called. The parent of this tag is always + * Must not be called. The parent of this tag is always * getAdaptee().getParent(). - * - * @param parentTag ignored. - * @throws UnsupportedOperationException Must not be called. + * + * @param parentTag + * ignored. + * @throws UnsupportedOperationException + * Must not be called. */ - public void setParent( Tag parentTag ) { - throw new UnsupportedOperationException( - "Illegal to invoke setParent() on TagAdapter wrapper" ); + public void setParent(Tag parentTag) { + throw new UnsupportedOperationException( + "Illegal to invoke setParent() on TagAdapter wrapper"); } - /** - * Returns the parent of this tag, which is always - * getAdaptee().getParent(). - * + * Returns the parent of this tag, which is always getAdaptee().getParent(). * This will either be the enclosing Tag (if getAdaptee().getParent() - * implements Tag), or an adapter to the enclosing Tag (if + * implements Tag), or an adapter to the enclosing Tag (if * getAdaptee().getParent() does not implement Tag). - * + * * @return The parent of the tag being adapted. */ public Tag getParent() { - if (!parentDetermined) { - JspTag adapteeParent = simpleTagAdaptee.getParent(); - if (adapteeParent != null) { - if (adapteeParent instanceof Tag) { - this.parent = (Tag) adapteeParent; - } else { - // Must be SimpleTag - no other types defined. - this.parent = new TagAdapter((SimpleTag) adapteeParent); - } - } - parentDetermined = true; - } + if (!parentDetermined) { + JspTag adapteeParent = simpleTagAdaptee.getParent(); + if (adapteeParent != null) { + if (adapteeParent instanceof Tag) { + this.parent = (Tag) adapteeParent; + } else { + // Must be SimpleTag - no other types defined. + this.parent = new TagAdapter((SimpleTag) adapteeParent); + } + } + parentDetermined = true; + } - return this.parent; + return this.parent; } - + /** - * Gets the tag that is being adapted to the Tag interface. - * This should be an instance of SimpleTag in JSP 2.0, but room - * is left for other kinds of tags in future spec versions. - * + * Gets the tag that is being adapted to the Tag interface. This should be + * an instance of SimpleTag in JSP 2.0, but room is left for other kinds of + * tags in future spec versions. + * * @return the tag that is being adapted */ public JspTag getAdaptee() { @@ -125,35 +121,40 @@ public class TagAdapter /** * Must not be called. - * + * * @return always throws UnsupportedOperationException - * @throws UnsupportedOperationException Must not be called - * @throws JspException never thrown + * @throws UnsupportedOperationException + * Must not be called + * @throws JspException + * never thrown */ public int doStartTag() throws JspException { - throw new UnsupportedOperationException( - "Illegal to invoke doStartTag() on TagAdapter wrapper" ); + throw new UnsupportedOperationException( + "Illegal to invoke doStartTag() on TagAdapter wrapper"); } - + /** * Must not be called. - * + * * @return always throws UnsupportedOperationException - * @throws UnsupportedOperationException Must not be called - * @throws JspException never thrown + * @throws UnsupportedOperationException + * Must not be called + * @throws JspException + * never thrown */ public int doEndTag() throws JspException { - throw new UnsupportedOperationException( - "Illegal to invoke doEndTag() on TagAdapter wrapper" ); + throw new UnsupportedOperationException( + "Illegal to invoke doEndTag() on TagAdapter wrapper"); } /** * Must not be called. - * - * @throws UnsupportedOperationException Must not be called + * + * @throws UnsupportedOperationException + * Must not be called */ public void release() { - throw new UnsupportedOperationException( - "Illegal to invoke release() on TagAdapter wrapper" ); + throw new UnsupportedOperationException( + "Illegal to invoke release() on TagAdapter wrapper"); } } diff --git a/java/javax/servlet/jsp/tagext/TagLibraryInfo.java b/java/javax/servlet/jsp/tagext/TagLibraryInfo.java index 4d97c7fdb..c382b7634 100644 --- a/java/javax/servlet/jsp/tagext/TagLibraryInfo.java +++ b/java/javax/servlet/jsp/tagext/TagLibraryInfo.java @@ -1,20 +1,19 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; import javax.servlet.jsp.tagext.TagInfo; @@ -22,60 +21,53 @@ import javax.servlet.jsp.tagext.TagFileInfo; /** * Translation-time information associated with a taglib directive, and its - * underlying TLD file. - * - * Most of the information is directly from the TLD, except for - * the prefix and the uri values used in the taglib directive - * - * + * underlying TLD file. Most of the information is directly from the TLD, except + * for the prefix and the uri values used in the taglib directive */ - abstract public class TagLibraryInfo { /** - * Constructor. - * - * This will invoke the constructors for TagInfo, and TagAttributeInfo - * after parsing the TLD file. - * - * @param prefix the prefix actually used by the taglib directive - * @param uri the URI actually used by the taglib directive + * Constructor. This will invoke the constructors for TagInfo, and + * TagAttributeInfo after parsing the TLD file. + * + * @param prefix + * the prefix actually used by the taglib directive + * @param uri + * the URI actually used by the taglib directive */ protected TagLibraryInfo(String prefix, String uri) { - this.prefix = prefix; - this.uri = uri; + this.prefix = prefix; + this.uri = uri; } // ==== methods accessing taglib information ======= /** - * The value of the uri attribute from the taglib directive for - * this library. - * + * The value of the uri attribute from the taglib directive for this + * library. + * * @return the value of the uri attribute */ - public String getURI() { return uri; } /** * The prefix assigned to this taglib from the taglib directive - * + * * @return the prefix assigned to this taglib from the taglib directive */ - public String getPrefixString() { - return prefix; + return prefix; } // ==== methods using the TLD data ======= /** - * The preferred short name (prefix) as indicated in the TLD. - * This may be used by authoring tools as the preferred prefix - * to use when creating an taglib directive for this library. - * + * The preferred short name (prefix) as indicated in the TLD. This may be + * used by authoring tools as the preferred prefix to use when creating an + * taglib directive for this library. + * * @return the preferred short name for the library */ public String getShortName() { @@ -83,46 +75,41 @@ abstract public class TagLibraryInfo { } /** - * The "reliable" URN indicated in the TLD (the uri element). - * This may be used by authoring tools as a global identifier - * to use when creating a taglib directive for this library. - * + * The "reliable" URN indicated in the TLD (the uri element). This may be + * used by authoring tools as a global identifier to use when creating a + * taglib directive for this library. + * * @return a reliable URN to a TLD like this */ public String getReliableURN() { return urn; } - /** * Information (documentation) for this TLD. - * + * * @return the info string for this tag lib */ - public String getInfoString() { return info; } - /** * A string describing the required version of the JSP container. * * @return the (minimal) required version of the JSP container. * @see javax.servlet.jsp.JspEngineInfo */ - public String getRequiredVersion() { return jspversion; } - /** * An array describing the tags that are defined in this tag library. - * - * @return the TagInfo objects corresponding to the tags defined by this - * tag library, or a zero length array if this tag library - * defines no tags + * + * @return the TagInfo objects corresponding to the tags defined by this tag + * library, or a zero length array if this tag library defines no + * tags */ public TagInfo[] getTags() { return tags; @@ -130,26 +117,25 @@ abstract public class TagLibraryInfo { /** * An array describing the tag files that are defined in this tag library. - * - * @return the TagFileInfo objects corresponding to the tag files defined - * by this tag library, or a zero length array if this - * tag library defines no tags files + * + * @return the TagFileInfo objects corresponding to the tag files defined by + * this tag library, or a zero length array if this tag library + * defines no tags files * @since 2.0 */ public TagFileInfo[] getTagFiles() { return tagFiles; } - /** - * Get the TagInfo for a given tag name, looking through all the - * tags in this tag library. - * - * @param shortname The short name (no prefix) of the tag - * @return the TagInfo for the tag with the specified short name, or - * null if no such tag is found + * Get the TagInfo for a given tag name, looking through all the tags in + * this tag library. + * + * @param shortname + * The short name (no prefix) of the tag + * @return the TagInfo for the tag with the specified short name, or null if + * no such tag is found */ - public TagInfo getTag(String shortname) { TagInfo tags[] = getTags(); @@ -157,7 +143,7 @@ abstract public class TagLibraryInfo { return null; } - for (int i=0; i < tags.length; i++) { + for (int i = 0; i < tags.length; i++) { if (tags[i].getTagName().equals(shortname)) { return tags[i]; } @@ -166,12 +152,13 @@ abstract public class TagLibraryInfo { } /** - * Get the TagFileInfo for a given tag name, looking through all the - * tag files in this tag library. - * - * @param shortname The short name (no prefix) of the tag - * @return the TagFileInfo for the specified Tag file, or null - * if no Tag file is found + * Get the TagFileInfo for a given tag name, looking through all the tag + * files in this tag library. + * + * @param shortname + * The short name (no prefix) of the tag + * @return the TagFileInfo for the specified Tag file, or null if no Tag + * file is found * @since 2.0 */ public TagFileInfo getTagFile(String shortname) { @@ -181,7 +168,7 @@ abstract public class TagLibraryInfo { return null; } - for (int i=0; i < tagFiles.length; i++) { + for (int i = 0; i < tagFiles.length; i++) { if (tagFiles[i].getName().equals(shortname)) { return tagFiles[i]; } @@ -191,23 +178,23 @@ abstract public class TagLibraryInfo { /** * An array describing the functions that are defined in this tag library. - * - * @return the functions defined in this tag library, or a zero - * length array if the tag library defines no functions. + * + * @return the functions defined in this tag library, or a zero length array + * if the tag library defines no functions. * @since 2.0 */ public FunctionInfo[] getFunctions() { return functions; } - /** * Get the FunctionInfo for a given function name, looking through all the * functions in this tag library. - * - * @param name The name (no prefix) of the function - * @return the FunctionInfo for the function with the given name, or null - * if no such function exists + * + * @param name + * The name (no prefix) of the function + * @return the FunctionInfo for the function with the given name, or null if + * no such function exists * @since 2.0 */ public FunctionInfo getFunction(String name) { @@ -217,7 +204,7 @@ abstract public class TagLibraryInfo { return null; } - for (int i=0; i < functions.length; i++) { + for (int i = 0; i < functions.length; i++) { if (functions[i].getName().equals(name)) { return functions[i]; } @@ -225,79 +212,78 @@ abstract public class TagLibraryInfo { return null; } - /** - * Returns an array of TagLibraryInfo objects representing the entire set - * of tag libraries (including this TagLibraryInfo) imported by taglib - * directives in the translation unit that references this TagLibraryInfo. - * If a tag library is imported more than once and bound to different prefixes, - * only the TagLibraryInfo bound to the first prefix must be included - * in the returned array. - * - * @return Array of TagLibraryInfo objects representing the entire set - * of tag libraries (including this TagLibraryInfo) imported by taglib + * Returns an array of TagLibraryInfo objects representing the entire set of + * tag libraries (including this TagLibraryInfo) imported by taglib * directives in the translation unit that references this TagLibraryInfo. + * If a tag library is imported more than once and bound to different + * prefixes, only the TagLibraryInfo bound to the first prefix must be + * included in the returned array. + * + * @return Array of TagLibraryInfo objects representing the entire set of + * tag libraries (including this TagLibraryInfo) imported by taglib + * directives in the translation unit that references this + * TagLibraryInfo. * @since 2.1 */ public abstract javax.servlet.jsp.tagext.TagLibraryInfo[] getTagLibraryInfos(); - - + // Protected fields /** * The prefix assigned to this taglib from the taglib directive. */ - protected String prefix; - + protected String prefix; + /** - * The value of the uri attribute from the taglib directive for - * this library. + * The value of the uri attribute from the taglib directive for this + * library. */ - protected String uri; - + protected String uri; + /** * An array describing the tags that are defined in this tag library. */ - protected TagInfo[] tags; - + protected TagInfo[] tags; + /** * An array describing the tag files that are defined in this tag library. - * + * * @since 2.0 */ protected TagFileInfo[] tagFiles; - + /** * An array describing the functions that are defined in this tag library. - * + * * @since 2.0 */ protected FunctionInfo[] functions; // Tag Library Data - + /** * The version of the tag library. */ protected String tlibversion; // required - + /** * The version of the JSP specification this tag library is written to. */ - protected String jspversion; // required - + protected String jspversion; // required + /** * The preferred short name (prefix) as indicated in the TLD. */ - protected String shortname; // required - + protected String shortname; // required + /** * The "reliable" URN indicated in the TLD. */ - protected String urn; // required - + protected String urn; // required + /** * Information (documentation) for this TLD. */ - protected String info; // optional + protected String info; // optional } diff --git a/java/javax/servlet/jsp/tagext/TagVariableInfo.java b/java/javax/servlet/jsp/tagext/TagVariableInfo.java index 145a50db7..92470515f 100644 --- a/java/javax/servlet/jsp/tagext/TagVariableInfo.java +++ b/java/javax/servlet/jsp/tagext/TagVariableInfo.java @@ -1,121 +1,109 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - -package javax.servlet.jsp.tagext; - -/** - * Variable information for a tag in a Tag Library; - * This class is instantiated from the Tag Library Descriptor file (TLD) - * and is available only at translation time. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * This object should be immutable. + * http://www.apache.org/licenses/LICENSE-2.0 * - * This information is only available in JSP 1.2 format TLDs or above. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ +package javax.servlet.jsp.tagext; +/** + * Variable information for a tag in a Tag Library; This class is instantiated + * from the Tag Library Descriptor file (TLD) and is available only at + * translation time. This object should be immutable. This information is only + * available in JSP 1.2 format TLDs or above. + */ public class TagVariableInfo { /** * Constructor for TagVariableInfo. - * - * @param nameGiven value of <name-given> - * @param nameFromAttribute value of <name-from-attribute> - * @param className value of <variable-class> - * @param declare value of <declare> - * @param scope value of <scope> + * + * @param nameGiven + * value of <name-given> + * @param nameFromAttribute + * value of <name-from-attribute> + * @param className + * value of <variable-class> + * @param declare + * value of <declare> + * @param scope + * value of <scope> */ - public TagVariableInfo( - String nameGiven, - String nameFromAttribute, - String className, - boolean declare, - int scope) { - this.nameGiven = nameGiven; - this.nameFromAttribute = nameFromAttribute; - this.className = className; - this.declare = declare; - this.scope = scope; + public TagVariableInfo(String nameGiven, String nameFromAttribute, + String className, boolean declare, int scope) { + this.nameGiven = nameGiven; + this.nameFromAttribute = nameFromAttribute; + this.className = className; + this.declare = declare; + this.scope = scope; } /** * The body of the <name-given> element. - * + * * @return The variable name as a constant */ - public String getNameGiven() { - return nameGiven; + return nameGiven; } /** - * The body of the <name-from-attribute> element. - * This is the name of an attribute whose (translation-time) - * value will give the name of the variable. One of - * <name-given> or <name-from-attribute> is required. - * + * The body of the <name-from-attribute> element. This is the name of + * an attribute whose (translation-time) value will give the name of the + * variable. One of <name-given> or <name-from-attribute> is + * required. + * * @return The attribute whose value defines the variable name */ - public String getNameFromAttribute() { - return nameFromAttribute; + return nameFromAttribute; } /** - * The body of the <variable-class> element. - * - * @return The name of the class of the variable or - * 'java.lang.String' if not defined in the TLD. + * The body of the <variable-class> element. + * + * @return The name of the class of the variable or 'java.lang.String' if + * not defined in the TLD. */ - public String getClassName() { - return className; + return className; } /** * The body of the <declare> element. - * - * @return Whether the variable is to be declared or not. - * If not defined in the TLD, 'true' will be returned. + * + * @return Whether the variable is to be declared or not. If not defined in + * the TLD, 'true' will be returned. */ - public boolean getDeclare() { - return declare; + return declare; } /** * The body of the <scope> element. - * - * @return The scope to give the variable. NESTED - * scope will be returned if not defined in - * the TLD. + * + * @return The scope to give the variable. NESTED scope will be returned if + * not defined in the TLD. */ - public int getScope() { - return scope; + return scope; } - /* * private fields */ - private String nameGiven; // - private String nameFromAttribute; // - private String className; // - private boolean declare; // - private int scope; // + private String nameGiven; // + private String nameFromAttribute; // + private String className; // + private boolean declare; // + private int scope; // } diff --git a/java/javax/servlet/jsp/tagext/ValidationMessage.java b/java/javax/servlet/jsp/tagext/ValidationMessage.java index 90dd43a1b..4459ba338 100644 --- a/java/javax/servlet/jsp/tagext/ValidationMessage.java +++ b/java/javax/servlet/jsp/tagext/ValidationMessage.java @@ -1,83 +1,74 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; - /** * A validation message from either TagLibraryValidator or TagExtraInfo. *

- * As of JSP 2.0, a JSP container must support a jsp:id attribute - * to provide higher quality validation errors. - * The container will track the JSP pages - * as passed to the container, and will assign to each element - * a unique "id", which is passed as the value of the jsp:id - * attribute. Each XML element in the XML view available will - * be extended with this attribute. The TagLibraryValidator - * can then use the attribute in one or more ValidationMessage - * objects. The container then, in turn, can use these - * values to provide more precise information on the location - * of an error. - * + * As of JSP 2.0, a JSP container must support a jsp:id attribute to provide + * higher quality validation errors. The container will track the JSP pages as + * passed to the container, and will assign to each element a unique "id", which + * is passed as the value of the jsp:id attribute. Each XML element in the XML + * view available will be extended with this attribute. The TagLibraryValidator + * can then use the attribute in one or more ValidationMessage objects. The + * container then, in turn, can use these values to provide more precise + * information on the location of an error. *

- * The actual prefix of the id attribute may or may not be + * The actual prefix of the id attribute may or may not be * jsp but it will always map to the namespace - * http://java.sun.com/JSP/Page. A TagLibraryValidator + * http://java.sun.com/JSP/Page. A TagLibraryValidator * implementation must rely on the uri, not the prefix, of the id * attribute. */ - public class ValidationMessage { /** - * Create a ValidationMessage. The message String should be - * non-null. The value of id may be null, if the message - * is not specific to any XML element, or if no jsp:id - * attributes were passed on. If non-null, the value of - * id must be the value of a jsp:id attribute for the PageData + * Create a ValidationMessage. The message String should be non-null. The + * value of id may be null, if the message is not specific to any XML + * element, or if no jsp:id attributes were passed on. If non-null, the + * value of id must be the value of a jsp:id attribute for the PageData * passed into the validate() method. - * - * @param id Either null, or the value of a jsp:id attribute. - * @param message A localized validation message. + * + * @param id + * Either null, or the value of a jsp:id attribute. + * @param message + * A localized validation message. */ public ValidationMessage(String id, String message) { - this.id = id; - this.message = message; + this.id = id; + this.message = message; } - /** - * Get the jsp:id. - * Null means that there is no information available. - * + * Get the jsp:id. Null means that there is no information available. + * * @return The jsp:id information. */ public String getId() { - return id; + return id; } /** * Get the localized validation message. - * + * * @return A validation message */ - public String getMessage(){ - return message; + public String getMessage() { + return message; } // Private data diff --git a/java/javax/servlet/jsp/tagext/VariableInfo.java b/java/javax/servlet/jsp/tagext/VariableInfo.java index 24fd330f8..147643b7b 100644 --- a/java/javax/servlet/jsp/tagext/VariableInfo.java +++ b/java/javax/servlet/jsp/tagext/VariableInfo.java @@ -1,195 +1,171 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package javax.servlet.jsp.tagext; /** - * Information on the scripting variables that are created/modified by - * a tag (at run-time). This information is provided by TagExtraInfo - * classes and it is used by the translation phase of JSP. - * + * Information on the scripting variables that are created/modified by a tag (at + * run-time). This information is provided by TagExtraInfo classes and it is + * used by the translation phase of JSP. *

- * Scripting variables generated by a custom action have an associated - * scope of either AT_BEGIN, NESTED, or AT_END. - * + * Scripting variables generated by a custom action have an associated scope of + * either AT_BEGIN, NESTED, or AT_END. *

- * The class name (VariableInfo.getClassName) in the returned objects - * is used to determine the types of the scripting variables. - * Note that because scripting variables are assigned their values - * from scoped attributes which cannot be of primitive types, - * "boxed" types such as java.lang.Integer must - * be used instead of primitives. - * + * The class name (VariableInfo.getClassName) in the returned objects is used to + * determine the types of the scripting variables. Note that because scripting + * variables are assigned their values from scoped attributes which cannot be of + * primitive types, "boxed" types such as + * java.lang.Integer must be used instead of primitives. *

- * The class name may be a Fully Qualified Class Name, or a short - * class name. - * + * The class name may be a Fully Qualified Class Name, or a short class name. *

- * If a Fully Qualified Class Name is provided, it should refer to a - * class that should be in the CLASSPATH for the Web Application (see - * Servlet 2.4 specification - essentially it is WEB-INF/lib and - * WEB-INF/classes). Failure to be so will lead to a translation-time - * error. - * + * If a Fully Qualified Class Name is provided, it should refer to a class that + * should be in the CLASSPATH for the Web Application (see Servlet 2.4 + * specification - essentially it is WEB-INF/lib and WEB-INF/classes). Failure + * to be so will lead to a translation-time error. *

- * If a short class name is given in the VariableInfo objects, then - * the class name must be that of a public class in the context of the - * import directives of the page where the custom action appears. - * The class must also be in the CLASSPATH for the Web Application - * (see Servlet 2.4 specification - essentially it is WEB-INF/lib and - * WEB-INF/classes). Failure to be so will lead to a translation-time - * error. - * - *

Usage Comments + * If a short class name is given in the VariableInfo objects, then the class + * name must be that of a public class in the context of the import directives + * of the page where the custom action appears. The class must also be in the + * CLASSPATH for the Web Application (see Servlet 2.4 specification - + * essentially it is WEB-INF/lib and WEB-INF/classes). Failure to be so will + * lead to a translation-time error. *

- * Frequently a fully qualified class name will refer to a class that - * is known to the tag library and thus, delivered in the same JAR - * file as the tag handlers. In most other remaining cases it will - * refer to a class that is in the platform on which the JSP processor - * is built (like J2EE). Using fully qualified class names in this - * manner makes the usage relatively resistant to configuration - * errors. - * + * Usage Comments *

- * A short name is usually generated by the tag library based on some - * attributes passed through from the custom action user (the author), - * and it is thus less robust: for instance a missing import directive - * in the referring JSP page will lead to an invalid short name class - * and a translation error. - * - *

Synchronization Protocol - * + * Frequently a fully qualified class name will refer to a class that is known + * to the tag library and thus, delivered in the same JAR file as the tag + * handlers. In most other remaining cases it will refer to a class that is in + * the platform on which the JSP processor is built (like J2EE). Using fully + * qualified class names in this manner makes the usage relatively resistant to + * configuration errors. *

- * The result of the invocation on getVariableInfo is an array of - * VariableInfo objects. Each such object describes a scripting - * variable by providing its name, its type, whether the variable is - * new or not, and what its scope is. Scope is best described through - * a picture: - * + * A short name is usually generated by the tag library based on some attributes + * passed through from the custom action user (the author), and it is thus less + * robust: for instance a missing import directive in the referring JSP page + * will lead to an invalid short name class and a translation error. + *

+ * Synchronization Protocol + *

+ * The result of the invocation on getVariableInfo is an array of VariableInfo + * objects. Each such object describes a scripting variable by providing its + * name, its type, whether the variable is new or not, and what its scope is. + * Scope is best described through a picture: *

* NESTED, AT_BEGIN and AT_END Variable Scopes - * - *

+ * alt="NESTED, AT_BEGIN and AT_END Variable Scopes"/> + *

* The JSP 2.0 specification defines the interpretation of 3 values: - * *

    - *
  • NESTED, if the scripting variable is available between - * the start tag and the end tag of the action that defines it. - *
  • - * AT_BEGIN, if the scripting variable is available from the start tag - * of the action that defines it until the end of the scope. - *
  • AT_END, if the scripting variable is available after the end tag - * of the action that defines it until the end of the scope. + *
  • NESTED, if the scripting variable is available between the start tag and + * the end tag of the action that defines it. + *
  • AT_BEGIN, if the scripting variable is available from the start tag of + * the action that defines it until the end of the scope. + *
  • AT_END, if the scripting variable is available after the end tag of the + * action that defines it until the end of the scope. *
- * - * The scope value for a variable implies what methods may affect its - * value and thus where synchronization is needed as illustrated by - * the table below. Note: the synchronization of the variable(s) - * will occur after the respective method has been called. - * - *
- * + * The scope value for a variable implies what methods may affect its value and + * thus where synchronization is needed as illustrated by the table below. + * Note: the synchronization of the variable(s) will occur after + * the respective method has been called.
+ *
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * * *
Variable Synchronization - * Points
- *
 doStartTag()doInitBody()doAfterBody()doEndTag()doTag()
Tag
- *
AT_BEGIN, NESTED
- *

- *

- *
AT_BEGIN, AT_END
- *

- *
IterationTag
- *
AT_BEGIN, NESTED
- *

- *
AT_BEGIN, NESTED
- *
AT_BEGIN, AT_END
- *

- *
BodyTag
- *
AT_BEGIN, NESTED1
- *
AT_BEGIN, NESTED1
- *
AT_BEGIN, NESTED
- *
AT_BEGIN, AT_END
- *

- *
SimpleTag
- *

- *

- *

- *

- *
AT_BEGIN, AT_END
- *
Variable Synchronization + * Points
+ *
 doStartTag()doInitBody()doAfterBody()doEndTag()doTag()
Tag
+ *
AT_BEGIN, NESTED
+ *

+ *

+ *
AT_BEGIN, AT_END
+ *

+ *
IterationTag
+ *
AT_BEGIN, NESTED
+ *

+ *
AT_BEGIN, NESTED
+ *
AT_BEGIN, AT_END
+ *

+ *
BodyTag
+ *
AT_BEGIN, + * NESTED1
+ *
AT_BEGIN, + * NESTED1
+ *
AT_BEGIN, NESTED
+ *
AT_BEGIN, AT_END
+ *

+ *
SimpleTag
+ *

+ *

+ *

+ *

+ *
AT_BEGIN, AT_END
+ *
- * 1 Called after doStartTag() if - * EVAL_BODY_INCLUDE is returned, or after - * doInitBody() otherwise. - *
- * - *

Variable Information in the TLD + * 1 Called after doStartTag() if + * EVAL_BODY_INCLUDE is returned, or after + * doInitBody() otherwise. + *

+ * Variable Information in the TLD *

* Scripting variable information can also be encoded directly for most cases * into the Tag Library Descriptor using the <variable> subelement of the - * <tag> element. See the JSP specification. + * <tag> element. See the JSP specification. */ - public class VariableInfo { /** @@ -208,77 +184,74 @@ public class VariableInfo { */ public static final int AT_END = 2; - /** - * Constructor - * These objects can be created (at translation time) by the TagExtraInfo - * instances. - * - * @param varName The name of the scripting variable - * @param className The type of this variable - * @param declare If true, it is a new variable (in some languages this will - * require a declaration) - * @param scope Indication on the lexical scope of the variable + * Constructor These objects can be created (at translation time) by the + * TagExtraInfo instances. + * + * @param varName + * The name of the scripting variable + * @param className + * The type of this variable + * @param declare + * If true, it is a new variable (in some languages this will + * require a declaration) + * @param scope + * Indication on the lexical scope of the variable */ - - public VariableInfo(String varName, - String className, - boolean declare, - int scope) { - this.varName = varName; - this.className = className; - this.declare = declare; - this.scope = scope; + public VariableInfo(String varName, String className, boolean declare, + int scope) { + this.varName = varName; + this.className = className; + this.declare = declare; + this.scope = scope; } // Accessor methods - + /** * Returns the name of the scripting variable. - * + * * @return the name of the scripting variable */ - public String getVarName() { - return varName; + public String getVarName() { + return varName; } - + /** * Returns the type of this variable. - * + * * @return the type of this variable */ - public String getClassName() { - return className; + public String getClassName() { + return className; } - + /** - * Returns whether this is a new variable. - * If so, in some languages this will require a declaration. - * + * Returns whether this is a new variable. If so, in some languages this + * will require a declaration. + * * @return whether this is a new variable. */ - public boolean getDeclare() { - return declare; + public boolean getDeclare() { + return declare; } - + /** * Returns the lexical scope of the variable. * - * @return the lexical scope of the variable, either AT_BEGIN, AT_END, - * or NESTED. + * @return the lexical scope of the variable, either AT_BEGIN, AT_END, or + * NESTED. * @see #AT_BEGIN * @see #AT_END * @see #NESTED */ - public int getScope() { - return scope; + public int getScope() { + return scope; } - // == private data private String varName; private String className; private boolean declare; private int scope; } - -- 2.11.0