You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/07/23 23:47:40 UTC
svn commit: r967277 [2/2] - in /tomcat/trunk/java/javax/servlet/jsp: ./ el/
tagext/
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTag.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTag.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTag.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTag.java Fri Jul 23 21:47:39 2010
@@ -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.
- *
- * <p>
- * 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.
- *
- * <p> 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.
- *
+ * The BodyTag interface extends IterationTag by defining additional methods
+ * that let a tag handler manipulate the content of evaluating its body.
* <p>
- * If EVAL_BODY_INCLUDE is returned, then evaluation happens
- * as in IterationTag.
- *
+ * 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.
+ * <p>
+ * 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.
+ * <p>
+ * If EVAL_BODY_INCLUDE is returned, then evaluation happens as in IterationTag.
+ * <p>
+ * 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.
+ * <p>
+ * The interface provides one new property with a setter method and one new
+ * action method.
+ * <p>
+ * <B>Properties</B>
+ * <p>
+ * 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.
+ * <p>
+ * <B>Methods</B>
+ * <p>
+ * 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.
+ * <p>
+ * <B>Lifecycle</B>
+ * <p>
+ * 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.
* <p>
- * 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.
- *
+ * <IMG src="doc-files/BodyTagProtocol.gif"
+ * alt="Lifecycle Details Transition Diagram for BodyTag"/>
* <p>
- * The interface provides one new property with a setter method and one
- * new action method.
- *
- * <p><B>Properties</B>
- * <p> 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.
- *
- * <p><B>Methods</B>
- * <p> 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.
- *
- * <p><B>Lifecycle</B>
- * <p> 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.
+ * <B>Empty and Non-Empty Action</B>
* <p>
- * <IMG src="doc-files/BodyTagProtocol.gif"
- * alt="Lifecycle Details Transition Diagram for BodyTag"/>
- *
- * <p><B>Empty and Non-Empty Action</B>
- * <p> If the TagLibraryDescriptor file indicates that the action must
- * 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.
- *
- * <p>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 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.
+ * <p>
+ * 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.
* <p>
* If SKIP_BODY is returned the body is not evaluated, and doEndTag() is
* invoked.
- *
* <p>
- * 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.
* <p>
* 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.
* <p>
- * 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.
* <p>
* 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.
* <p>
* 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;
-
}
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTagSupport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTagSupport.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTagSupport.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/BodyTagSupport.java Fri Jul 23 21:47:39 2010
@@ -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.
- *
* <p>
- * 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.
* <p>
- * 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 TagS
/**
* The current BodyContent for this BodyTag.
*/
- protected BodyContent bodyContent;
+ protected BodyContent bodyContent;
}
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/TagAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/TagAdapter.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/TagAdapter.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/TagAdapter.java Fri Jul 23 21:47:39 2010
@@ -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.
* <p>
- * 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.
- */
- public TagAdapter( SimpleTag adaptee ) {
- if( adaptee == null ) {
- // Cannot wrap a null adaptee.
- throw new IllegalArgumentException();
+ * 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();
}
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;
- }
-
- 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.
- *
+ 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;
+ }
+
+ /**
+ * 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");
}
}
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/TagLibraryInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/TagLibraryInfo.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/TagLibraryInfo.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/TagLibraryInfo.java Fri Jul 23 21:47:39 2010
@@ -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.TagFileI
/**
* 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
}
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/TagVariableInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/TagVariableInfo.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/TagVariableInfo.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/TagVariableInfo.java Fri Jul 23 21:47:39 2010
@@ -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>
- */
- 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;
+ *
+ * @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;
}
/**
* 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; // <name-given>
- private String nameFromAttribute; // <name-from-attribute>
- private String className; // <class>
- private boolean declare; // <declare>
- private int scope; // <scope>
+ private String nameGiven; // <name-given>
+ private String nameFromAttribute; // <name-from-attribute>
+ private String className; // <class>
+ private boolean declare; // <declare>
+ private int scope; // <scope>
}
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/ValidationMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/ValidationMessage.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/ValidationMessage.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/ValidationMessage.java Fri Jul 23 21:47:39 2010
@@ -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.
* <p>
- * 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.
* <p>
- * The actual prefix of the <code>id</code> attribute may or may not be
+ * The actual prefix of the <code>id</code> attribute may or may not be
* <code>jsp</code> but it will always map to the namespace
- * <code>http://java.sun.com/JSP/Page</code>. A TagLibraryValidator
+ * <code>http://java.sun.com/JSP/Page</code>. A TagLibraryValidator
* implementation must rely on the uri, not the prefix, of the <code>id</code>
* 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
Modified: tomcat/trunk/java/javax/servlet/jsp/tagext/VariableInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/tagext/VariableInfo.java?rev=967277&r1=967276&r2=967277&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/tagext/VariableInfo.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/tagext/VariableInfo.java Fri Jul 23 21:47:39 2010
@@ -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.
* <p>
- * 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.
* <p>
- * 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 <code>java.lang.Integer</code> 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
+ * <code>java.lang.Integer</code> must be used instead of primitives.
* <p>
- * 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.
* <p>
- * 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.
* <p>
- * 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.
- *
- * <p><B>Usage Comments</B>
+ * 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.
* <p>
- * 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.
- *
+ * <B>Usage Comments</B>
* <p>
- * 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.
- *
- * <p><B>Synchronization Protocol</B>
- *
+ * 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.
* <p>
- * 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.
+ * <p>
+ * <B>Synchronization Protocol</B>
+ * <p>
+ * 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:
* <p>
* <IMG src="doc-files/VariableInfo-1.gif"
- * alt="NESTED, AT_BEGIN and AT_END Variable Scopes"/>
- *
- *<p>
+ * alt="NESTED, AT_BEGIN and AT_END Variable Scopes"/>
+ * <p>
* The JSP 2.0 specification defines the interpretation of 3 values:
- *
* <ul>
- * <li> NESTED, if the scripting variable is available between
- * the start tag and the end tag of the action that defines it.
- * <li>
- * AT_BEGIN, if the scripting variable is available from the start tag
- * of the action that defines it until the end of the scope.
- * <li> AT_END, if the scripting variable is available after the end tag
- * of the action that defines it until the end of the scope.
+ * <li>NESTED, if the scripting variable is available between the start tag and
+ * the end tag of the action that defines it.
+ * <li>AT_BEGIN, if the scripting variable is available from the start tag of
+ * the action that defines it until the end of the scope.
+ * <li>AT_END, if the scripting variable is available after the end tag of the
+ * action that defines it until the end of the scope.
* </ul>
- *
- * 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. <b>Note:</b> the synchronization of the variable(s)
- * will occur <em>after</em> the respective method has been called.
- *
- * <blockquote>
- * <table cellpadding="2" cellspacing="2" border="0" width="55%"
- * bgcolor="#999999" summary="Variable Synchronization Points">
+ * 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.
+ * <b>Note:</b> the synchronization of the variable(s) will occur <em>after</em>
+ * the respective method has been called. <blockquote>
+ * <table cellpadding="2" cellspacing="2" border="0" width="55%" * bgcolor="#999999" summary="Variable Synchronization Points">
* <tbody>
- * <tr align="center">
- * <td valign="top" colspan="6" bgcolor="#999999"><u><b>Variable Synchronization
- * Points</b></u><br>
- * </td>
- * </tr>
- * <tr>
- * <th valign="top" bgcolor="#c0c0c0"> </th>
- * <th valign="top" bgcolor="#c0c0c0" align="center">doStartTag()</th>
- * <th valign="top" bgcolor="#c0c0c0" align="center">doInitBody()</th>
- * <th valign="top" bgcolor="#c0c0c0" align="center">doAfterBody()</th>
- * <th valign="top" bgcolor="#c0c0c0" align="center">doEndTag()</th>
- * <th valign="top" bgcolor="#c0c0c0" align="center">doTag()</th>
- * </tr>
- * <tr>
- * <td valign="top" bgcolor="#c0c0c0"><b>Tag<br>
- * </b></td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top" bgcolor="#c0c0c0"><b>IterationTag<br>
- * </b></td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top" bgcolor="#c0c0c0"><b>BodyTag<br>
- * </b></td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<sup>1</sup><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<sup>1</sup><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top" bgcolor="#c0c0c0"><b>SimpleTag<br>
- * </b></td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff"><br>
- * </td>
- * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
- * </td>
- * </tr>
+ * <tr align="center">
+ * <td valign="top" colspan="6" bgcolor="#999999"><u><b>Variable Synchronization
+ * Points</b></u><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <th valign="top" bgcolor="#c0c0c0"> </th>
+ * <th valign="top" bgcolor="#c0c0c0" align="center">doStartTag()</th>
+ * <th valign="top" bgcolor="#c0c0c0" align="center">doInitBody()</th>
+ * <th valign="top" bgcolor="#c0c0c0" align="center">doAfterBody()</th>
+ * <th valign="top" bgcolor="#c0c0c0" align="center">doEndTag()</th>
+ * <th valign="top" bgcolor="#c0c0c0" align="center">doTag()</th>
+ * </tr>
+ * <tr>
+ * <td valign="top" bgcolor="#c0c0c0"><b>Tag<br>
+ * </b></td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top" bgcolor="#c0c0c0"><b>IterationTag<br>
+ * </b></td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top" bgcolor="#c0c0c0"><b>BodyTag<br>
+ * </b></td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN,
+ * NESTED<sup>1</sup><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN,
+ * NESTED<sup>1</sup><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, NESTED<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top" bgcolor="#c0c0c0"><b>SimpleTag<br>
+ * </b></td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff"><br>
+ * </td>
+ * <td valign="top" align="center" bgcolor="#ffffff">AT_BEGIN, AT_END<br>
+ * </td>
+ * </tr>
* </tbody>
* </table>
- * <sup>1</sup> Called after <code>doStartTag()</code> if
- * <code>EVAL_BODY_INCLUDE</code> is returned, or after
- * <code>doInitBody()</code> otherwise.
- * </blockquote>
- *
- * <p><B>Variable Information in the TLD</B>
+ * <sup>1</sup> Called after <code>doStartTag()</code> if
+ * <code>EVAL_BODY_INCLUDE</code> is returned, or after
+ * <code>doInitBody()</code> otherwise. </blockquote>
+ * <p>
+ * <B>Variable Information in the TLD</B>
* <p>
* 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;
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org