tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r379499 [4/5] - in /tomcat/jasper/tc6.0.x/src: etc/ etc/dtd/ share/javax/servlet/ share/javax/servlet/jsp/ share/javax/servlet/jsp/el/ share/javax/servlet/jsp/tagext/ share/javax/servlet/jsp/tagext/doc-files/ share/org/apache/jasper/runtime/
Date Tue, 21 Feb 2006 15:46:40 GMT
Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/BodyTagSupport.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/BodyTagSupport.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/BodyTagSupport.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/BodyTagSupport.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,159 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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;
+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.
+ *
+ * <p>
+ * 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
+     * translator.
+     */
+
+    public BodyTagSupport() {
+	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
+     * @see BodyTag#doStartTag
+     */
+ 
+    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
+     * @see Tag#doEndTag
+     */
+
+    public int doEndTag() throws JspException {
+	return super.doEndTag();
+    }
+
+
+    // Actions related to body evaluation
+
+    /**
+     * Prepare for evaluation of the body: stash the bodyContent away.
+     *
+     * @param b the BodyContent
+     * @see #doAfterBody
+     * @see #doInitBody()
+     * @see BodyTag#setBodyContent
+     */
+
+    public void setBodyContent(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
+     * @see #setBodyContent
+     * @see #doAfterBody
+     * @see BodyTag#doInitBody
+     */
+
+    public void doInitBody() throws JspException {
+    }
+
+
+    /**
+     * 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
+     * @see #doInitBody
+     * @see BodyTag#doAfterBody
+     */
+
+    public int doAfterBody() throws JspException {
+ 	return SKIP_BODY;
+    }
+
+
+    /**
+     * Release state.
+     *
+     * @see Tag#release
+     */
+
+    public void release() {
+	bodyContent = null;
+
+	super.release();
+    }
+
+    /**
+     * Get current bodyContent.
+     *
+     * @return the body content.
+     */
+    
+    public BodyContent getBodyContent() {
+	return bodyContent;
+    }
+
+
+    /**
+     * Get surrounding out JspWriter.
+     *
+     * @return the enclosing JspWriter, from the bodyContent.
+     */
+
+    public JspWriter getPreviousOut() {
+	return bodyContent.getEnclosingWriter();
+    }
+
+    // protected fields
+
+    /**
+     * The current BodyContent for this BodyTag.
+     */
+    protected BodyContent   bodyContent;
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/DynamicAttributes.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/DynamicAttributes.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/DynamicAttributes.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/DynamicAttributes.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,51 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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;
+
+/**
+ * For a tag to declare that it accepts dynamic attributes, it must implement
+ * this interface.  The entry for the tag in the Tag Library Descriptor must 
+ * also be configured to indicate dynamic attributes are accepted.
+ * <br>
+ * For any attribute that is not declared in the Tag Library Descriptor for
+ * this tag, instead of getting an error at translation time, the 
+ * <code>setDynamicAttribute()</code> method is called, with the name and
+ * value of the attribute.  It is the responsibility of the tag to 
+ * remember the names and values of the dynamic attributes.
+ *
+ * @since 2.0
+ */
+public interface DynamicAttributes {
+    
+    /**
+     * Called when a tag declared to accept dynamic attributes is passed
+     * an attribute that is not declared in the Tag Library Descriptor.
+     * 
+     * @param uri the namespace of the attribute, or null if in the default
+     *     namespace.
+     * @param localName the name of the attribute being set.
+     * @param value the value of the attribute
+     * @throws JspException if the tag handler wishes to
+     *     signal that it does not accept the given attribute.  The 
+     *     container must not call doStartTag() or doTag() for this tag.
+     */
+    public void setDynamicAttribute(
+        String uri, String localName, Object value ) 
+        throws JspException;
+    
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/FunctionInfo.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/FunctionInfo.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/FunctionInfo.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/FunctionInfo.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,80 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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 for a function in a Tag Library.
+ * This class is instantiated from the Tag Library Descriptor file (TLD)
+ * and is available only at translation time.
+ * 
+ * @since 2.0
+ */
+public class FunctionInfo {
+
+    /**
+     * Constructor for FunctionInfo.
+     *
+     * @param name The name of the function
+     * @param klass The class of the function
+     * @param signature The signature of the function
+     */
+
+    public FunctionInfo(String name, String klass, String signature) {
+
+	this.name = name;
+        this.functionClass = klass;
+        this.functionSignature = signature;
+    }
+
+    /**
+     * The name of the function.
+     *
+     * @return The name of the function
+     */
+
+    public String getName() {
+	return name;
+    }
+
+    /**
+     * The class of the function.
+     *
+     * @return The class of the function
+     */
+
+    public String getFunctionClass() {
+        return functionClass;
+    }
+
+    /**
+     * The signature of the function.
+     *
+     * @return The signature of the function
+     */
+
+    public String getFunctionSignature() {
+        return functionSignature;
+    }
+
+    /*
+     * fields
+     */
+
+    private String name;
+    private String functionClass;
+    private String functionSignature;
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/IterationTag.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/IterationTag.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/IterationTag.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/IterationTag.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,119 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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 IterationTag interface extends Tag by defining one additional
+ * method that controls the reevaluation of its body.
+ *
+ * <p> A tag handler that implements IterationTag is treated as one that
+ * implements Tag regarding  the doStartTag() and doEndTag() methods.
+ * IterationTag provides a new method: <code>doAfterBody()</code>.
+ *
+ * <p> The doAfterBody() method is invoked after every body evaluation
+ * to control whether the body will be reevaluated or not.  If doAfterBody()
+ * returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated.
+ * If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped
+ * and doEndTag() will be evaluated instead.
+ *
+ * <p><B>Properties</B>
+ * There are no new properties in addition to those in Tag.
+ *
+ * <p><B>Methods</B>
+ * There is one new methods: doAfterBody().
+ *
+ * <p><B>Lifecycle</B>
+ *
+ * <p> Lifecycle details are described by the transition diagram
+ * below.  Exceptions that are thrown during the computation of
+ * doStartTag(), BODY and 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>
+ * <IMG src="doc-files/IterationTagProtocol.gif"
+ *      alt="Lifecycle Details Transition Diagram for IterationTag"/>
+ *
+ * <p><B>Empty and Non-Empty Action</B>
+ * <p> If the TagLibraryDescriptor file indicates that the action must
+ * always have an empty element body, by a &lt;body-content&gt; entry of 
+ * "empty", then the doStartTag() method must return SKIP_BODY.
+ *
+ * <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 on how it's declared in the TLD.
+ *
+ * <p>
+ * If SKIP_BODY is returned the body is not evaluated, and then doEndTag()
+ * is invoked.
+ *
+ * <p>
+ * If EVAL_BODY_INCLUDE is returned, and the custom action element is not
+ * empty, the body is evaluated and "passed through" to the current out, 
+ * then doAfterBody() is invoked and, after zero or more iterations, 
+ * doEndTag() is invoked.
+ */
+
+public interface IterationTag extends Tag {
+
+    /**
+     * Request the reevaluation of some body.
+     * Returned from doAfterBody.
+     *
+     * For compatibility with JSP 1.1, the value is carefully selected
+     * to be the same as the, now deprecated, BodyTag.EVAL_BODY_TAG,
+     * 
+     */
+ 
+    public final static int EVAL_BODY_AGAIN = 2;
+
+    /**
+     * Process body (re)evaluation.  This method is invoked by the
+     * JSP Page implementation object after every evaluation of
+     * the body into the BodyEvaluation object. The method is
+     * not invoked if there is no body evaluation.
+     *
+     * <p>
+     * If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the
+     * body will happen (followed by another invocation of doAfterBody).
+     * If doAfterBody returns SKIP_BODY, no more body evaluations will occur,
+     * and the doEndTag method will be invoked.
+     *
+     * <p>
+     * If this tag handler implements BodyTag and doAfterBody returns
+     * SKIP_BODY, the value of out will be restored using the popBody 
+     * method in pageContext prior to invoking doEndTag.
+     *
+     * <p>
+     * The method re-invocations may be lead to different actions because
+     * there might have been some changes to shared state, or because
+     * of external computation.
+     *
+     * <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 doAfterBody().
+     *
+     * @return whether additional evaluations of the body are desired
+     * @throws JspException if an error occurred while processing this tag
+     */
+
+    int doAfterBody() throws JspException;
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspFragment.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspFragment.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspFragment.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspFragment.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,82 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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.IOException;
+import java.io.Writer;
+import javax.servlet.jsp.*;
+
+/**
+ * Encapsulates a portion of JSP code in an object that 
+ * can be invoked as many times as needed.  JSP Fragments are defined 
+ * using JSP syntax as the body of a tag for an invocation to a SimpleTag 
+ * handler, or as the body of a &lt;jsp:attribute&gt; standard action
+ * specifying the value of an attribute that is declared as a fragment,
+ * or to be of type JspFragment in the TLD.
+ * <p>
+ * The definition of the JSP fragment must only contain template 
+ * text and JSP action elements.  In other words, it must not contain
+ * scriptlets or scriptlet expressions.  At translation time, the 
+ * container generates an implementation of the JspFragment abstract class
+ * capable of executing the defined fragment.
+ * <p>
+ * A tag handler can invoke the fragment zero or more times, or 
+ * pass it along to other tags, before returning.  To communicate values
+ * to/from a JSP fragment, tag handlers store/retrieve values in 
+ * the JspContext associated with the fragment.
+ * <p>
+ * Note that tag library developers and page authors should not generate
+ * JspFragment implementations manually.
+ * <p>
+ * <i>Implementation Note</i>: It is not necessary to generate a 
+ * separate class for each fragment.  One possible implementation is 
+ * to generate a single helper class for each page that implements 
+ * JspFragment. Upon construction, a discriminator can be passed to 
+ * select which fragment that instance will execute.
+ *
+ * @since 2.0
+ */
+public abstract class JspFragment {
+
+    /**
+     * Executes the fragment and directs all output to the given Writer,
+     * or the JspWriter returned by the getOut() method of the JspContext
+     * associated with the fragment if out is null.
+     *
+     * @param out The Writer to output the fragment to, or null if 
+     *     output should be sent to JspContext.getOut().
+     * @throws javax.servlet.jsp.JspException Thrown if an error occured
+     *     while invoking this fragment.
+     * @throws javax.servlet.jsp.SkipPageException Thrown if the page
+     *     that (either directly or indirectly) invoked the tag handler that
+     *     invoked this fragment is to cease evaluation.  The container
+     *     must throw this exception if a Classic Tag Handler returned
+     *     Tag.SKIP_PAGE or if a Simple Tag Handler threw SkipPageException.
+     * @throws java.io.IOException If there was an error writing to the 
+     *     stream.
+     */
+    public abstract void invoke( Writer out )
+        throws JspException, IOException;
+
+    /**
+     * Returns the JspContext that is bound to this JspFragment.
+     *
+     * @return The JspContext used by this fragment at invocation time.
+     */
+    public abstract JspContext getJspContext();
+
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspTag.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspTag.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspTag.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/JspTag.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,25 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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;
+
+/**
+ * Serves as a base class for Tag and SimpleTag.  
+ * This is mostly for organizational and type-safety purposes.
+ *
+ * @since 2.0
+ */
+public interface JspTag {
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/PageData.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/PageData.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/PageData.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/PageData.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,48 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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.InputStream;
+
+/**
+ * Translation-time information on a JSP page.  The information
+ * corresponds to the XML view of the JSP page.
+ *
+ * <p>
+ * Objects of this type are generated by the JSP translator, e.g.
+ * when being pased to a TagLibraryValidator instance.
+ */
+
+abstract public class PageData {
+
+    /**
+     * Sole constructor. (For invocation by subclass constructors, 
+     * typically implicit.)
+     */
+    public PageData() {
+    }
+    
+    /**
+     * Returns an input stream on the XML view of a JSP page.
+     * The stream is encoded in UTF-8.  Recall tht the XML view of a 
+     * JSP page has the include directives expanded.
+     * 
+     * @return An input stream on the document.
+     */
+   abstract public InputStream getInputStream();
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTag.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTag.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTag.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTag.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,139 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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.JspContext;
+
+/**
+ * Interface for defining Simple Tag Handlers.
+ * 
+ * <p>Simple Tag Handlers differ from Classic Tag Handlers in that instead 
+ * of supporting <code>doStartTag()</code> and <code>doEndTag()</code>, 
+ * the <code>SimpleTag</code> interface provides a simple 
+ * <code>doTag()</code> method, which is called once and only once for any 
+ * given tag invocation.  All tag logic, iteration, body evaluations, etc. 
+ * are to be performed in this single method.  Thus, simple tag handlers 
+ * have the equivalent power of <code>BodyTag</code>, but with a much 
+ * simpler lifecycle and interface.</p>
+ *
+ * <p>To support body content, the <code>setJspBody()</code> 
+ * method is provided.  The container invokes the <code>setJspBody()</code> 
+ * method with a <code>JspFragment</code> object encapsulating the body of 
+ * the tag.  The tag handler implementation can call 
+ * <code>invoke()</code> on that fragment to evaluate the body as
+ * many times as it needs.</p>
+ *
+ * <p>A SimpleTag handler must have a public no-args constructor.  Most
+ * SimpleTag handlers should extend SimpleTagSupport.</p>
+ * 
+ * <p><b>Lifecycle</b></p>
+ *
+ * <p>The following is a non-normative, brief overview of the 
+ * SimpleTag lifecycle.  Refer to the JSP Specification for details.</p>
+ *
+ * <ol>
+ *   <li>A new tag handler instance is created each time by the container 
+ *       by calling the provided zero-args constructor.  Unlike classic
+ *       tag handlers, simple tag handlers are never cached and reused by
+ *       the JSP container.</li>
+ *   <li>The <code>setJspContext()</code> and <code>setParent()</code> 
+ *       methods are called by the container.  The <code>setParent()</code>
+ *       method is only called if the element is nested within another tag 
+ *       invocation.</li>
+ *   <li>The setters for each attribute defined for this tag are called
+ *       by the container.</li>
+ *   <li>If a body exists, the <code>setJspBody()</code> method is called 
+ *       by the container to set the body of this tag, as a 
+ *       <code>JspFragment</code>.  If the action element is empty in
+ *       the page, this method is not called at all.</li>
+ *   <li>The <code>doTag()</code> method is called by the container.  All
+ *       tag logic, iteration, body evaluations, etc. occur in this 
+ *       method.</li>
+ *   <li>The <code>doTag()</code> method returns and all variables are
+ *       synchronized.</li>
+ * </ol>
+ * 
+ * @see SimpleTagSupport
+ * @since 2.0
+ */
+public interface SimpleTag extends JspTag {
+    
+    /** 
+     * Called by the container to invoke this tag.
+     * The implementation of this method is provided by the tag library
+     * developer, and handles all tag processing, body iteration, etc.
+     *
+     * <p>
+     * The JSP container will resynchronize any AT_BEGIN and AT_END
+     * variables (defined by the associated tag file, TagExtraInfo, or TLD)
+     * after the invocation of doTag().
+     * 
+     * @throws javax.servlet.jsp.JspException If an error occurred 
+     *     while processing this tag.
+     * @throws javax.servlet.jsp.SkipPageException If the page that
+     *     (either directly or indirectly) invoked this tag is to
+     *     cease evaluation.  A Simple Tag Handler generated from a 
+     *     tag file must throw this exception if an invoked Classic 
+     *     Tag Handler returned SKIP_PAGE or if an invoked Simple
+     *     Tag Handler threw SkipPageException or if an invoked Jsp Fragment
+     *     threw a SkipPageException.
+     * @throws java.io.IOException If there was an error writing to the
+     *     output stream.
+     */ 
+    public void doTag() 
+        throws javax.servlet.jsp.JspException, java.io.IOException;
+    
+    /**
+     * Sets the parent of this tag, for collaboration purposes.
+     * <p>
+     * The container invokes this method only if this tag invocation is 
+     * nested within another tag invocation.
+     *
+     * @param parent the tag that encloses this tag
+     */
+    public void setParent( JspTag parent );
+    
+    /**
+     * Returns the parent of this tag, for collaboration purposes.
+     *
+     * @return the parent of this tag
+     */ 
+    public JspTag getParent();
+    
+    /**
+     * Called by the container to provide this tag handler with
+     * the <code>JspContext</code> for this invocation.
+     * An implementation should save this value.
+     * 
+     * @param pc the page context for this invocation
+     * @see Tag#setPageContext
+     */
+    public void setJspContext( JspContext pc );
+                
+    /** 
+     * Provides the body of this tag as a JspFragment object, able to be 
+     * invoked zero or more times by the tag handler. 
+     * <p>
+     * This method is invoked by the JSP page implementation 
+     * object prior to <code>doTag()</code>.  If the action element is
+     * empty in the page, this method is not called at all.
+     * 
+     * @param jspBody The fragment encapsulating the body of this tag.
+     */ 
+    public void setJspBody( JspFragment jspBody );
+
+    
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,212 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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.JspContext;
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+
+/**
+ * A base class for defining tag handlers implementing SimpleTag.
+ * <p>
+ * The SimpleTagSupport class is a utility class intended to be used
+ * as the base class for new simple tag handlers.  The SimpleTagSupport
+ * class implements the SimpleTag interface and adds additional
+ * convenience methods including getter methods for the properties in
+ * SimpleTag.
+ *
+ * @since 2.0
+ */
+public class SimpleTagSupport 
+    implements SimpleTag
+{
+    /** Reference to the enclosing tag. */
+    private JspTag parentTag;
+    
+    /** The JSP context for the upcoming tag invocation. */
+    private JspContext jspContext;
+    
+    /** The body of the tag. */
+    private JspFragment jspBody;
+    
+    /**
+     * Sole constructor. (For invocation by subclass constructors, 
+     * typically implicit.)
+     */
+    public SimpleTagSupport() {
+    }
+    
+    /** 
+     * Default processing of the tag does nothing.
+     *
+     * @throws JspException Subclasses can throw JspException to indicate
+     *     an error occurred while processing this tag.
+     * @throws javax.servlet.jsp.SkipPageException If the page that
+     *     (either directly or indirectly) invoked this tag is to
+     *     cease evaluation.  A Simple Tag Handler generated from a 
+     *     tag file must throw this exception if an invoked Classic 
+     *     Tag Handler returned SKIP_PAGE or if an invoked Simple
+     *     Tag Handler threw SkipPageException or if an invoked Jsp Fragment
+     *     threw a SkipPageException.
+     * @throws IOException Subclasses can throw IOException if there was
+     *     an error writing to the output stream
+     * @see SimpleTag#doTag()
+     */ 
+    public void doTag() 
+        throws JspException, IOException
+    {
+    }
+    
+    /**
+     * Sets the parent of this tag, for collaboration purposes.
+     * <p>
+     * The container invokes this method only if this tag invocation is
+     * nested within another tag invocation.
+     *
+     * @param parent the tag that encloses this tag
+     */
+    public void setParent( JspTag parent ) {
+        this.parentTag = parent;
+    }
+    
+    /**
+     * Returns the parent of this tag, for collaboration purposes.
+     *
+     * @return the parent of this tag
+     */ 
+    public JspTag getParent() {
+        return this.parentTag;
+    }
+    
+    /**
+     * Stores the provided JSP context in the private jspContext field.
+     * Subclasses can access the <code>JspContext</code> via 
+     * <code>getJspContext()</code>.
+     * 
+     * @param pc the page context for this invocation
+     * @see SimpleTag#setJspContext
+     */
+    public void setJspContext( JspContext pc ) {
+        this.jspContext = pc;
+    }
+    
+    /**
+     * Returns the page context passed in by the container via 
+     * setJspContext.
+     *
+     * @return the page context for this invocation
+     */
+    protected JspContext getJspContext() {
+        return this.jspContext;
+    }
+                
+    /** 
+     * Stores the provided JspFragment.
+     *
+     * @param jspBody The fragment encapsulating the body of this tag.
+     *     If the action element is empty in the page, this method is 
+     *     not called at all.
+     * @see SimpleTag#setJspBody
+     */ 
+    public void setJspBody( JspFragment jspBody ) {
+        this.jspBody = jspBody;
+    }
+    
+    /**
+     * Returns the body passed in by the container via setJspBody.
+     *
+     * @return the fragment encapsulating the body of this tag, or
+     *    null if the action element is empty in the page.
+     */
+    protected JspFragment getJspBody() {
+        return this.jspBody;
+    }
+
+    /**
+     * Find the instance of a given class type that is closest to a given
+     * instance.
+     * This method uses the getParent method from the Tag and/or SimpleTag
+     * interfaces.  This method is used for coordination among 
+     * cooperating tags.
+     *
+     * <p> For every instance of TagAdapter
+     * encountered while traversing the ancestors, the tag handler returned by
+     * <tt>TagAdapter.getAdaptee()</tt> - instead of the TagAdpater itself -
+     * is compared to <tt>klass</tt>. If the tag handler matches, it - and
+     * not its TagAdapter - is returned.
+     *
+     * <p>
+     * The current version of the specification only provides one formal
+     * way of indicating the observable type of a tag handler: its
+     * tag handler implementation class, described in the tag-class
+     * subelement of the tag element.  This is extended in an
+     * informal manner by allowing the tag library author to
+     * indicate in the description subelement an observable type.
+     * The type should be a subtype of the tag handler implementation
+     * class or void.
+     * This addititional constraint can be exploited by a
+     * specialized container that knows about that specific tag library,
+     * as in the case of the JSP standard tag library.
+     *
+     * <p>
+     * When a tag library author provides information on the
+     * observable type of a tag handler, client programmatic code
+     * should adhere to that constraint.  Specifically, the Class
+     * passed to findAncestorWithClass should be a subtype of the
+     * observable type.
+     * 
+     *
+     * @param from The instance from where to start looking.
+     * @param klass The subclass of JspTag or interface to be matched
+     * @return the nearest ancestor that implements the interface
+     * or is an instance of the class specified
+     */
+    public static final JspTag findAncestorWithClass(
+	JspTag from, Class klass) 
+    {
+	boolean isInterface = false;
+
+	if (from == null || klass == null
+	        || (!JspTag.class.isAssignableFrom(klass)
+		    && !(isInterface = klass.isInterface()))) {
+	    return null;
+	}
+
+	for (;;) {
+	    JspTag parent = null;
+	    if( from instanceof SimpleTag ) {
+		parent = ((SimpleTag)from).getParent();
+	    }
+	    else if( from instanceof Tag ) {
+		parent = ((Tag)from).getParent();
+	    }
+	    if (parent == null) {
+		return null;
+	    }
+
+	    if (parent instanceof TagAdapter) {
+		parent = ((TagAdapter) parent).getAdaptee();
+	    }
+
+	    if ((isInterface && klass.isInstance(parent))
+		    || klass.isAssignableFrom(parent.getClass())) {
+		return parent;
+	    }
+
+	    from = parent;
+	}
+    }    
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/Tag.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/Tag.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/Tag.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/Tag.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,262 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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 interface of a classic tag handler that does not want to manipulate 
+ * its body.  The Tag interface defines the basic protocol between a Tag 
+ * handler and JSP page implementation class.  It defines the life cycle 
+ * and the methods to be invoked at start and end tag.
+ *
+ * <p><B>Properties</B></p>
+ *
+ * <p>The Tag interface specifies the setter and getter methods for the core
+ * pageContext and parent properties.</p>
+ *
+ * <p>The JSP page implementation object invokes setPageContext and
+ * setParent, in that order, before invoking doStartTag() or doEndTag().</p>
+ *
+ * <p><B>Methods</B></p>
+ *
+ * <p>There are two main actions: doStartTag and doEndTag.  Once all
+ * appropriate properties have been initialized, the doStartTag and
+ * doEndTag methods can be invoked on the tag handler.  Between these
+ * invocations, the tag handler is assumed to hold a state that must
+ * be preserved.  After the doEndTag invocation, the tag handler is
+ * available for further invocations (and it is expected to have
+ * retained its properties).</p>
+ *
+ * <p><B>Lifecycle</B></p>
+ *
+ * <p>Lifecycle details are described by the transition diagram below,
+ * with the following comments:
+ * <ul>
+ * <li> [1] This transition is intended to be for releasing long-term data.
+ * no guarantees are assumed on whether any properties have been retained
+ * or not.
+ * <li> [2] This transition happens if and only if the tag ends normally
+ * without raising an exception
+ * <li> [3] Some setters may be called again before a tag handler is 
+ * reused.  For instance, <code>setParent()</code> is called if it's 
+ * reused within the same page but at a different level, 
+ * <code>setPageContext()</code> is called if it's used in another page, 
+ * and attribute setters are called if the values differ or are expressed 
+ * as request-time attribute values.
+ * <li> Check the TryCatchFinally interface for additional details related
+ * to exception handling and resource management.
+ * </ul></p>
+ *
+ * <IMG src="doc-files/TagProtocol.gif"
+ *      alt="Lifecycle Details Transition Diagram for Tag"/>
+ * 
+ * <p>Once all invocations on the tag handler
+ * are completed, the release method is invoked on it.  Once a release
+ * method is invoked <em>all</em> properties, including parent and
+ * pageContext, are assumed to have been reset to an unspecified value.
+ * The page compiler guarantees that release() will be invoked on the Tag
+ * handler before the handler is released to the GC.</p>
+ *
+ * <p><B>Empty and Non-Empty Action</B></p>
+ * <p>If the TagLibraryDescriptor file indicates that the action must
+ * always have an empty action, by an &lt;body-content&gt; entry of "empty",
+ * then the doStartTag() method must return SKIP_BODY.</p>
+ *
+ * <p>Otherwise, the doStartTag() method may return SKIP_BODY or
+ * EVAL_BODY_INCLUDE.</p>
+ *
+ * <p>If SKIP_BODY is returned the body, if present, is not evaluated.</p>
+ * 
+ * <p>If EVAL_BODY_INCLUDE is returned, the body is evaluated and
+ * "passed through" to the current out.</p>
+*/
+
+public interface Tag extends JspTag {
+
+    /**
+     * Skip body evaluation.
+     * Valid return value for doStartTag and doAfterBody.
+     */
+ 
+    public final static int SKIP_BODY = 0;
+ 
+    /**
+     * Evaluate body into existing out stream.
+     * Valid return value for doStartTag.
+     */
+ 
+    public final static int EVAL_BODY_INCLUDE = 1;
+
+    /**
+     * Skip the rest of the page.
+     * Valid return value for doEndTag.
+     */
+
+    public final static int SKIP_PAGE = 5;
+
+    /**
+     * Continue evaluating the page.
+     * Valid return value for doEndTag().
+     */
+
+    public final static int EVAL_PAGE = 6;
+
+    // Setters for Tag handler data
+
+
+    /**
+     * Set the current page context.
+     * This method is invoked by the JSP page implementation object
+     * prior to doStartTag().
+     * <p>
+     * This value is *not* reset by doEndTag() and must be explicitly reset
+     * by a page implementation if it changes between calls to doStartTag().
+     *
+     * @param pc The page context for this tag handler.
+     */
+
+    void setPageContext(PageContext pc);
+
+
+    /**
+     * Set the parent (closest enclosing tag handler) of this tag handler.
+     * Invoked by the JSP page implementation object prior to doStartTag().
+     * <p>
+     * This value is *not* reset by doEndTag() and must be explicitly reset
+     * by a page implementation.
+     *
+     * @param t The parent tag, or null.
+     */
+
+
+    void setParent(Tag t);
+
+
+    /**
+     * Get the parent (closest enclosing tag handler) for this tag handler.
+     *
+     * <p>
+     * The getParent() method can be used to navigate the nested tag
+     * handler structure at runtime for cooperation among custom actions;
+     * for example, the findAncestorWithClass() method in TagSupport
+     * provides a convenient way of doing this.
+     *
+     * <p>
+     * The current version of the specification only provides one formal
+     * way of indicating the observable type of a tag handler: its
+     * tag handler implementation class, described in the tag-class
+     * subelement of the tag element.  This is extended in an
+     * informal manner by allowing the tag library author to
+     * indicate in the description subelement an observable type.
+     * The type should be a subtype of the tag handler implementation
+     * class or void.
+     * This addititional constraint can be exploited by a
+     * specialized container that knows about that specific tag library,
+     * as in the case of the JSP standard tag library.
+     *
+     * @return the current parent, or null if none.
+     * @see TagSupport#findAncestorWithClass
+     */
+
+    Tag getParent();
+
+
+    // Actions for basic start/end processing.
+
+
+    /**
+     * Process the start tag for this instance.
+     * This method is invoked by the JSP page implementation object.
+     *
+     * <p>
+     * The doStartTag method assumes that the properties pageContext and
+     * parent have been set. It also assumes that any properties exposed as
+     * attributes have been set too.  When this method is invoked, the body
+     * has not yet been evaluated.
+     *
+     * <p>
+     * This method returns Tag.EVAL_BODY_INCLUDE or
+     * BodyTag.EVAL_BODY_BUFFERED to indicate
+     * that the body of the action should be evaluated or SKIP_BODY to
+     * indicate otherwise.
+     *
+     * <p>
+     * When a Tag returns EVAL_BODY_INCLUDE the result of evaluating
+     * the body (if any) is included into the current "out" JspWriter as it
+     * happens and then doEndTag() is invoked.
+     *
+     * <p>
+     * BodyTag.EVAL_BODY_BUFFERED is only valid  if the tag handler
+     * implements BodyTag.
+     *
+     * <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 doStartTag(), except for a tag handler
+     * implementing BodyTag whose doStartTag() method returns
+     * BodyTag.EVAL_BODY_BUFFERED.
+     *
+     * @return EVAL_BODY_INCLUDE if the tag wants to process body, SKIP_BODY 
+     *     if it does not want to process it.
+     * @throws JspException if an error occurred while processing this tag
+     * @see BodyTag
+     */
+ 
+    int doStartTag() throws JspException;
+ 
+
+    /**
+     * Process the end tag for this instance.
+     * This method is invoked by the JSP page implementation object
+     * on all Tag handlers.
+     *
+     * <p>
+     * This method will be called after returning from doStartTag. The
+     * body of the action may or may not have been evaluated, depending on
+     * the return value of doStartTag.
+     *
+     * <p>
+     * If this method returns EVAL_PAGE, the rest of the page continues
+     * to be evaluated.  If this method returns SKIP_PAGE, the rest of
+     * the page is not evaluated, the request is completed, and 
+     * the doEndTag() methods of enclosing tags are not invoked.  If this
+     * request was forwarded or included from another page (or Servlet),
+     * only the current page evaluation is stopped.
+     *
+     * <p>
+     * The JSP container will resynchronize the values of any AT_BEGIN and
+     * AT_END variables (defined by the associated TagExtraInfo or TLD)
+     * after the invocation of doEndTag().
+     *
+     * @return indication of whether to continue evaluating the JSP page.
+     * @throws JspException if an error occurred while processing this tag
+     */
+
+    int doEndTag() throws JspException;
+
+    /**
+     * Called on a Tag handler to release state.
+     * The page compiler guarantees that JSP page implementation
+     * objects will invoke this method on all tag handlers,
+     * but there may be multiple invocations on doStartTag and doEndTag in between.
+     */
+
+    void release();
+
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAdapter.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAdapter.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAdapter.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAdapter.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,158 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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.
+ * <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.
+ *
+ * @since 2.0
+ */
+public class TagAdapter 
+    implements Tag
+{
+    /** The simple tag that's being adapted. */
+    private SimpleTag simpleTagAdaptee;
+
+    /** The parent, of this tag, converted (if necessary) to be of type Tag. */
+    private Tag parent;
+
+    // Flag indicating whether we have already determined the parent
+    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();
+        }
+        this.simpleTagAdaptee = adaptee;
+    }
+    
+    /**
+     * 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" );
+    }
+
+
+    /**
+     * Must not be called.  The parent of this tag is always 
+     * getAdaptee().getParent().
+     *
+     * @param parentTag ignored.
+     * @throws UnsupportedOperationException Must not be called.
+     */
+    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().  
+     *
+     * This will either be the enclosing Tag (if getAdaptee().getParent()
+     * 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.
+     *
+     * @return the tag that is being adapted
+     */
+    public JspTag getAdaptee() {
+        return this.simpleTagAdaptee;
+    }
+
+    /**
+     * Must not be called.
+     *
+     * @return always throws UnsupportedOperationException
+     * @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" );
+    }
+ 
+    /**
+     * Must not be called.
+     *
+     * @return always throws UnsupportedOperationException
+     * @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" );
+    }
+
+    /**
+     * Must not be called.
+     *
+     * @throws UnsupportedOperationException Must not be called
+     */
+    public void release() {
+        throw new UnsupportedOperationException( 
+            "Illegal to invoke release() on TagAdapter wrapper" );
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAttributeInfo.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAttributeInfo.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAttributeInfo.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagAttributeInfo.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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 attributes of a Tag, available at translation time. This
+ * class is instantiated from the Tag Library Descriptor file (TLD).
+ * 
+ * <p>
+ * Only the information needed to generate code is included here. Other
+ * information like SCHEMA for validation belongs elsewhere.
+ */
+
+public class TagAttributeInfo {
+    /**
+     * "id" is wired in to be ID. There is no real benefit in having it be
+     * something else IDREFs are not handled any differently.
+     */
+
+    public static final String ID = "id";
+
+    /**
+     * Constructor for TagAttributeInfo. This class is to be instantiated only
+     * from the TagLibrary code under request from some JSP code that is parsing
+     * a TLD (Tag Library Descriptor).
+     * 
+     * @param name
+     *            The name of the attribute.
+     * @param required
+     *            If this attribute is required in tag instances.
+     * @param type
+     *            The name of the type of the attribute.
+     * @param reqTime
+     *            Whether this attribute holds a request-time Attribute.
+     */
+
+    public TagAttributeInfo(String name, boolean required, String type,
+            boolean reqTime) {
+        this.name = name;
+        this.required = required;
+        this.type = type;
+        this.reqTime = reqTime;
+    }
+
+    /**
+     * JSP 2.0 Constructor for TagAttributeInfo. This class is to be
+     * instantiated only from the TagLibrary code under request from some JSP
+     * code that is parsing a TLD (Tag Library Descriptor).
+     * 
+     * @param name
+     *            The name of the attribute.
+     * @param required
+     *            If this attribute is required in tag instances.
+     * @param type
+     *            The name of the type of the attribute.
+     * @param reqTime
+     *            Whether this attribute holds a request-time Attribute.
+     * @param fragment
+     *            Whether this attribute is of type JspFragment
+     * 
+     * @since 2.0
+     */
+
+    public TagAttributeInfo(String name, boolean required, String type,
+            boolean reqTime, boolean fragment) {
+        this(name, required, type, reqTime);
+        this.fragment = fragment;
+    }
+
+    /**
+     * @since JSP 2.1
+     */
+    public TagAttributeInfo(String name, boolean required, String type,
+            boolean reqTime, boolean fragment, String description,
+            boolean deferredValue, boolean deferredMethod,
+            String expectedTypeName, String methodSignature) {
+        this(name, required, type, reqTime, fragment);
+        this.description = description;
+        this.deferredValue = deferredValue;
+        this.deferredMethod = deferredMethod;
+        this.expectedTypeName = expectedTypeName;
+        this.methodSignature = methodSignature;
+    }
+
+    /**
+     * The name of this attribute.
+     * 
+     * @return the name of the attribute
+     */
+
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * The type (as a String) of this attribute.
+     * 
+     * @return the type of the attribute
+     */
+
+    public String getTypeName() {
+        return type;
+    }
+
+    /**
+     * Whether this attribute can hold a request-time value.
+     * 
+     * @return if the attribute can hold a request-time value.
+     */
+
+    public boolean canBeRequestTime() {
+        return reqTime;
+    }
+
+    /**
+     * Whether this attribute is required.
+     * 
+     * @return if the attribute is required.
+     */
+    public boolean isRequired() {
+        return required;
+    }
+
+    /**
+     * Convenience static method that goes through an array of TagAttributeInfo
+     * objects and looks for "id".
+     * 
+     * @param a
+     *            An array of TagAttributeInfo
+     * @return The TagAttributeInfo reference with name "id"
+     */
+    public static TagAttributeInfo getIdAttribute(TagAttributeInfo a[]) {
+        for (int i = 0; i < a.length; i++) {
+            if (a[i].getName().equals(ID)) {
+                return a[i];
+            }
+        }
+        return null; // no such attribute
+    }
+
+    /**
+     * Whether this attribute is of type JspFragment.
+     * 
+     * @return if the attribute is of type JspFragment
+     * 
+     * @since 2.0
+     */
+    public boolean isFragment() {
+        return fragment;
+    }
+
+    /**
+     * Returns a String representation of this TagAttributeInfo, suitable for
+     * debugging purposes.
+     * 
+     * @return a String representation of this TagAttributeInfo
+     */
+    public String toString() {
+        StringBuffer b = new StringBuffer();
+        b.append("name = " + name + " ");
+        b.append("type = " + type + " ");
+        b.append("reqTime = " + reqTime + " ");
+        b.append("required = " + required + " ");
+        b.append("fragment = " + fragment + " ");
+        return b.toString();
+    }
+
+    /*
+     * private fields
+     */
+    private String name;
+
+    private String type;
+
+    private boolean reqTime;
+
+    private boolean required;
+
+    /*
+     * private fields for JSP 2.0
+     */
+    private boolean fragment;
+
+    /*
+     * private fields for JSP 2.1
+     */
+    private String description;
+
+    private boolean deferredValue;
+
+    private boolean deferredMethod;
+
+    private String expectedTypeName;
+
+    private String methodSignature;
+
+    public boolean isDeferredMethod() {
+        return deferredMethod;
+    }
+
+    public boolean isDeferredValue() {
+        return deferredValue;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getExpectedTypeName() {
+        return expectedTypeName;
+    }
+
+    public String getMethodSignature() {
+        return methodSignature;
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagData.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagData.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagData.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagData.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,153 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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.util.Hashtable;
+
+/**
+ * The (translation-time only) attribute/value information for a tag instance.
+ *
+ * <p>
+ * TagData is only used as an argument to the isValid, validate, and 
+ * getVariableInfo methods of TagExtraInfo, which are invoked at 
+ * translation time.
+ */
+
+public class TagData implements Cloneable {
+
+    /**
+     * Distinguished value for an attribute to indicate its value
+     * is a request-time expression (which is not yet available because
+     * TagData instances are used at translation-time).
+     */
+
+    public static final Object REQUEST_TIME_VALUE = new Object();
+
+
+    /**
+     * Constructor for TagData.
+     *
+     * <p>
+     * A typical constructor may be
+     * <pre>
+     * static final Object[][] att = {{"connection", "conn0"}, {"id", "query0"}};
+     * static final TagData td = new TagData(att);
+     * </pre>
+     *
+     * All values must be Strings except for those holding the
+     * distinguished object REQUEST_TIME_VALUE.
+
+     * @param atts the static attribute and values.  May be null.
+     */
+    public TagData(Object[] atts[]) {
+	if (atts == null) {
+	    attributes = new Hashtable();
+	} else {
+	    attributes = new Hashtable(atts.length);
+	}
+
+	if (atts != null) {
+	    for (int i = 0; i < atts.length; i++) {
+		attributes.put(atts[i][0], atts[i][1]);
+	    }
+	}
+    }
+
+    /**
+     * Constructor for a TagData.
+     *
+     * If you already have the attributes in a hashtable, use this
+     * constructor. 
+     *
+     * @param attrs A hashtable to get the values from.
+     */
+    public TagData(Hashtable attrs) {
+        this.attributes = attrs;
+    }
+
+    /**
+     * The value of the tag's id attribute.
+     *
+     * @return the value of the tag's id attribute, or null if no such
+     *     attribute was specified.
+     */
+
+    public String getId() {
+	return getAttributeString(TagAttributeInfo.ID);
+    }
+
+    /**
+     * The value of the attribute.
+     * If a static value is specified for an attribute that accepts a
+     * request-time attribute expression then that static value is returned,
+     * even if the value is provided in the body of a <jsp:attribute> action.
+     * The distinguished object REQUEST_TIME_VALUE is only returned if
+     * the value is specified as a request-time attribute expression
+     * or via the &lt;jsp:attribute&gt; action with a body that contains
+     * dynamic content (scriptlets, scripting expressions, EL expressions, 
+     * standard actions, or custom actions).  Returns null if the attribute 
+     * is not set. 
+     *
+     * @param attName the name of the attribute
+     * @return the attribute's value
+     */
+
+    public Object getAttribute(String attName) {
+	return attributes.get(attName);
+    }
+
+    /**
+     * Set the value of an attribute.
+     *
+     * @param attName the name of the attribute
+     * @param value the value.
+     */
+    public void setAttribute(String attName,
+			     Object value) {
+	attributes.put(attName, value);
+    }
+
+    /**
+     * Get the value for a given attribute.
+     *
+     * @param attName the name of the attribute
+     * @return the attribute value string
+     * @throws ClassCastException if attribute value is not a String
+     */
+
+    public String getAttributeString(String attName) {
+	Object o = attributes.get(attName);
+	if (o == null) {
+	    return null;
+	} else {
+	    return (String) o;
+	}	
+    }
+
+    /**
+     * Enumerates the attributes.
+     *
+     *@return An enumeration of the attributes in a TagData
+     */
+    public java.util.Enumeration getAttributes() {
+        return attributes.keys();
+    };
+
+    // private data
+
+    private Hashtable attributes;	// the tagname/value map
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagExtraInfo.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagExtraInfo.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagExtraInfo.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagExtraInfo.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,143 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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;
+
+/**
+ * Optional class provided by the tag library author to describe additional
+ * translation-time information not described in the TLD.
+ * The TagExtraInfo class is mentioned in the Tag Library Descriptor file (TLD).
+ *
+ * <p>
+ * This class can be used:
+ * <ul>
+ * <li> to indicate that the tag defines scripting variables
+ * <li> to perform translation-time validation of the tag attributes.
+ * </ul>
+ *
+ * <p>
+ * It is the responsibility of the JSP translator that the initial value
+ * to be returned by calls to getTagInfo() corresponds to a TagInfo
+ * object for the tag being translated. If an explicit call to
+ * setTagInfo() is done, then the object passed will be returned in
+ * subsequent calls to getTagInfo().
+ * 
+ * <p>
+ * The only way to affect the value returned by getTagInfo()
+ * is through a setTagInfo() call, and thus, TagExtraInfo.setTagInfo() is
+ * to be called by the JSP translator, with a TagInfo object that
+ * corresponds to the tag being translated. The call should happen before
+ * any invocation on validate() and before any invocation on
+ * getVariableInfo().
+ *
+ * <p>
+ * <tt>NOTE:</tt> It is a (translation time) error for a tag definition
+ * in a TLD with one or more variable subelements to have an associated
+ * TagExtraInfo implementation that returns a VariableInfo array with
+ * one or more elements from a call to getVariableInfo().
+ */
+
+public abstract class TagExtraInfo {
+
+    /**
+     * Sole constructor. (For invocation by subclass constructors, 
+     * typically implicit.)
+     */
+    public TagExtraInfo() {
+    }
+    
+    /**
+     * information on scripting variables defined by the tag associated with
+     * this TagExtraInfo instance.
+     * Request-time attributes are indicated as such in the TagData parameter.
+     *
+     * @param data The TagData instance.
+     * @return An array of VariableInfo data, or null or a zero length array
+     *         if no scripting variables are to be defined.
+     */
+    public VariableInfo[] getVariableInfo(TagData data) {
+	return ZERO_VARIABLE_INFO;
+    }
+
+    /**
+     * Translation-time validation of the attributes. 
+     * Request-time attributes are indicated as such in the TagData parameter.
+     * Note that the preferred way to do validation is with the validate()
+     * method, since it can return more detailed information.
+     *
+     * @param data The TagData instance.
+     * @return Whether this tag instance is valid.
+     * @see TagExtraInfo#validate
+     */
+
+    public boolean isValid(TagData data) {
+	return true;
+    }
+
+    /**
+     * Translation-time validation of the attributes.
+     * Request-time attributes are indicated as such in the TagData parameter.
+     * Because of the higher quality validation messages possible, 
+     * this is the preferred way to do validation (although isValid() 
+     * still works).  
+     * 
+     * <p>JSP 2.0 and higher containers call validate() instead of isValid().
+     * The default implementation of this method is to call isValid().  If 
+     * isValid() returns false, a generic ValidationMessage[] is returned
+     * indicating isValid() returned false.</p>
+     *
+     * @param data The TagData instance.
+     * @return A null object, or zero length array if no errors, an 
+     *     array of ValidationMessages otherwise.
+     * @since 2.0
+     */
+    public ValidationMessage[] validate( TagData data ) {
+	ValidationMessage[] result = null;
+
+	if( !isValid( data ) ) {
+	    result = new ValidationMessage[] {
+		new ValidationMessage( data.getId(), "isValid() == false" ) };
+	}
+
+	return result;
+    }
+
+    /**
+     * Set the TagInfo for this class.
+     *
+     * @param tagInfo The TagInfo this instance is extending
+     */
+    public final void setTagInfo(TagInfo tagInfo) {
+	this.tagInfo = tagInfo;
+    }
+
+    /**
+     * Get the TagInfo for this class.
+     *
+     * @return the taginfo instance this instance is extending
+     */
+    public final TagInfo getTagInfo() {
+	return tagInfo;
+    }
+    
+    // private data
+    private TagInfo tagInfo;
+
+    // zero length VariableInfo array
+    private static final VariableInfo[] ZERO_VARIABLE_INFO = { };
+}
+

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagFileInfo.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagFileInfo.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagFileInfo.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagFileInfo.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,85 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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;
+
+/**
+ * Tag information for a tag file in a Tag Library;
+ * This class is instantiated from the Tag Library Descriptor file (TLD)
+ * and is available only at translation time.
+ *
+ * @since 2.0
+ */
+public class TagFileInfo {
+
+    /**
+     * Constructor for TagFileInfo from data in the JSP 2.0 format for TLD.
+     * This class is to be instantiated only from the TagLibrary code
+     * under request from some JSP code that is parsing a
+     * TLD (Tag Library Descriptor).
+     *
+     * Note that, since TagLibibraryInfo reflects both TLD information
+     * and taglib directive information, a TagFileInfo instance is
+     * dependent on a taglib directive.  This is probably a
+     * design error, which may be fixed in the future.
+     *
+     * @param name The unique action name of this tag
+     * @param path Where to find the .tag file implementing this 
+     *     action, relative to the location of the TLD file.
+     * @param tagInfo The detailed information about this tag, as parsed
+     *     from the directives in the tag file.
+     */
+    public TagFileInfo( String name, String path, TagInfo tagInfo ) {
+        this.name = name;
+        this.path = path;
+        this.tagInfo = tagInfo;
+    }
+
+    /**
+     * The unique action name of this tag.
+     *
+     * @return The (short) name of the tag.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Where to find the .tag file implementing this action.
+     *
+     * @return The path of the tag file, relative to the TLD, or "." if 
+     *     the tag file was defined in an implicit tag file.
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * Returns information about this tag, parsed from the directives 
+     * in the tag file.
+     *
+     * @return a TagInfo object containing information about this tag
+     */
+    public TagInfo getTagInfo() {
+        return tagInfo;
+    }
+
+    // private fields for 2.0 info
+    private String name;
+    private String path;
+    private TagInfo tagInfo;
+}

Added: tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagInfo.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagInfo.java?rev=379499&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagInfo.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/javax/servlet/jsp/tagext/TagInfo.java Tue Feb 21 07:46:36 2006
@@ -0,0 +1,446 @@
+/*
+* Copyright 2004 The Apache Software Foundation
+*
+* Licensed 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;
+
+/**
+ * Tag 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.
+ *
+ * 
+*/
+
+public class TagInfo {
+
+    /**
+     * Static constant for getBodyContent() when it is JSP.
+     */
+
+    public static final String BODY_CONTENT_JSP = "JSP";
+
+    /**
+     * Static constant for getBodyContent() when it is Tag dependent.
+     */
+
+    public static final String BODY_CONTENT_TAG_DEPENDENT = "TAGDEPENDENT";
+
+
+    /**
+     * Static constant for getBodyContent() when it is empty.
+     */
+
+    public static final String BODY_CONTENT_EMPTY = "EMPTY";
+    
+    /**
+     * Static constant for getBodyContent() when it is scriptless.
+     * 
+     * @since 2.0
+     */ 
+    public static final String BODY_CONTENT_SCRIPTLESS = "SCRIPTLESS";
+
+    /**
+     * Constructor for TagInfo from data in the JSP 1.1 format for TLD.
+     * This class is to be instantiated only from the TagLibrary code
+     * under request from some JSP code that is parsing a
+     * TLD (Tag Library Descriptor).
+     *
+     * Note that, since TagLibibraryInfo reflects both TLD information
+     * and taglib directive information, a TagInfo instance is
+     * dependent on a taglib directive.  This is probably a
+     * design error, which may be fixed in the future.
+     *
+     * @param tagName The name of this tag
+     * @param tagClassName The name of the tag handler class
+     * @param bodycontent Information on the body content of these tags
+     * @param infoString The (optional) string information for this tag
+     * @param taglib The instance of the tag library that contains us.
+     * @param tagExtraInfo The instance providing extra Tag info.  May be null
+     * @param attributeInfo An array of AttributeInfo data from descriptor.
+     * May be null;
+     *
+     */
+    public TagInfo(String tagName,
+	    String tagClassName,
+	    String bodycontent,
+	    String infoString,
+	    TagLibraryInfo taglib,
+	    TagExtraInfo tagExtraInfo,
+	    TagAttributeInfo[] attributeInfo) {
+	this.tagName       = tagName;
+	this.tagClassName  = tagClassName;
+	this.bodyContent   = bodycontent;
+	this.infoString    = infoString;
+	this.tagLibrary    = taglib;
+	this.tagExtraInfo  = tagExtraInfo;
+	this.attributeInfo = attributeInfo;
+
+	if (tagExtraInfo != null)
+            tagExtraInfo.setTagInfo(this);
+    }
+			 
+    /**
+     * Constructor for TagInfo from data in the JSP 1.2 format for TLD.
+     * This class is to be instantiated only from the TagLibrary code
+     * under request from some JSP code that is parsing a
+     * TLD (Tag Library Descriptor).
+     *
+     * Note that, since TagLibibraryInfo reflects both TLD information
+     * and taglib directive information, a TagInfo instance is
+     * dependent on a taglib directive.  This is probably a
+     * design error, which may be fixed in the future.
+     *
+     * @param tagName The name of this tag
+     * @param tagClassName The name of the tag handler class
+     * @param bodycontent Information on the body content of these tags
+     * @param infoString The (optional) string information for this tag
+     * @param taglib The instance of the tag library that contains us.
+     * @param tagExtraInfo The instance providing extra Tag info.  May be null
+     * @param attributeInfo An array of AttributeInfo data from descriptor.
+     * May be null;
+     * @param displayName A short name to be displayed by tools
+     * @param smallIcon Path to a small icon to be displayed by tools
+     * @param largeIcon Path to a large icon to be displayed by tools
+     * @param tvi An array of a TagVariableInfo (or null)
+     */
+    public TagInfo(String tagName,
+	    String tagClassName,
+	    String bodycontent,
+	    String infoString,
+	    TagLibraryInfo taglib,
+	    TagExtraInfo tagExtraInfo,
+	    TagAttributeInfo[] attributeInfo,
+	    String displayName,
+	    String smallIcon,
+	    String largeIcon,
+	    TagVariableInfo[] tvi) {
+	this.tagName       = tagName;
+	this.tagClassName  = tagClassName;
+	this.bodyContent   = bodycontent;
+	this.infoString    = infoString;
+	this.tagLibrary    = taglib;
+	this.tagExtraInfo  = tagExtraInfo;
+	this.attributeInfo = attributeInfo;
+	this.displayName = displayName;
+	this.smallIcon = smallIcon;
+	this.largeIcon = largeIcon;
+	this.tagVariableInfo = tvi;
+
+	if (tagExtraInfo != null)
+            tagExtraInfo.setTagInfo(this);
+    }
+			 
+    /**
+     * Constructor for TagInfo from data in the JSP 2.0 format for TLD.
+     * This class is to be instantiated only from the TagLibrary code
+     * under request from some JSP code that is parsing a
+     * TLD (Tag Library Descriptor).
+     *
+     * Note that, since TagLibibraryInfo reflects both TLD information
+     * and taglib directive information, a TagInfo instance is
+     * dependent on a taglib directive.  This is probably a
+     * design error, which may be fixed in the future.
+     *
+     * @param tagName The name of this tag
+     * @param tagClassName The name of the tag handler class
+     * @param bodycontent Information on the body content of these tags
+     * @param infoString The (optional) string information for this tag
+     * @param taglib The instance of the tag library that contains us.
+     * @param tagExtraInfo The instance providing extra Tag info.  May be null
+     * @param attributeInfo An array of AttributeInfo data from descriptor.
+     * May be null;
+     * @param displayName A short name to be displayed by tools
+     * @param smallIcon Path to a small icon to be displayed by tools
+     * @param largeIcon Path to a large icon to be displayed by tools
+     * @param tvi An array of a TagVariableInfo (or null)
+     * @param dynamicAttributes True if supports dynamic attributes
+     *
+     * @since 2.0
+     */
+    public TagInfo(String tagName,
+            String tagClassName,
+            String bodycontent,
+            String infoString,
+            TagLibraryInfo taglib,
+            TagExtraInfo tagExtraInfo,
+            TagAttributeInfo[] attributeInfo,
+            String displayName,
+            String smallIcon,
+            String largeIcon,
+            TagVariableInfo[] tvi,
+            boolean dynamicAttributes) {
+        this.tagName       = tagName;
+        this.tagClassName  = tagClassName;
+        this.bodyContent   = bodycontent;
+        this.infoString    = infoString;
+        this.tagLibrary    = taglib;
+        this.tagExtraInfo  = tagExtraInfo;
+        this.attributeInfo = attributeInfo;
+        this.displayName = displayName;
+        this.smallIcon = smallIcon;
+        this.largeIcon = largeIcon;
+        this.tagVariableInfo = tvi;
+        this.dynamicAttributes = dynamicAttributes;
+
+        if (tagExtraInfo != null)
+            tagExtraInfo.setTagInfo(this);
+    }
+
+    /**
+     * The name of the Tag.
+     *
+     * @return The (short) name of the tag.
+     */
+
+    public String getTagName() {
+	return tagName;
+    }
+
+    /**
+     * Attribute information (in the TLD) on this tag.
+     * The return is an array describing the attributes of this tag, as
+     * indicated in the TLD.
+     *
+     * @return The array of TagAttributeInfo for this tag, or a
+     *         zero-length array if the tag has no attributes.
+     */
+
+   public TagAttributeInfo[] getAttributes() {
+       return attributeInfo;
+   }
+
+    /**
+     * Information on the scripting objects created by this tag at runtime.
+     * This is a convenience method on the associated TagExtraInfo class.
+     *
+     * @param data TagData describing this action.
+     * @return if a TagExtraInfo object is associated with this TagInfo, the
+     *     result of getTagExtraInfo().getVariableInfo( data ), otherwise
+     *     null.
+     */
+   public VariableInfo[] getVariableInfo(TagData data) {
+       VariableInfo[] result = null;
+       TagExtraInfo tei = getTagExtraInfo();
+       if (tei != null) {
+	   result = tei.getVariableInfo( data );
+       }
+       return result;
+   }
+
+    /**
+     * Translation-time validation of the attributes. 
+     * This is a convenience method on the associated TagExtraInfo class.
+     *
+     * @param data The translation-time TagData instance.
+     * @return Whether the data is valid.
+     */
+    public boolean isValid(TagData data) {
+        TagExtraInfo tei = getTagExtraInfo();
+        if (tei == null) {
+	    return true;
+        }
+        return tei.isValid(data);
+    }
+
+    /**
+     * Translation-time validation of the attributes.
+     * This is a convenience method on the associated TagExtraInfo class.
+     *
+     * @param data The translation-time TagData instance.
+     * @return A null object, or zero length array if no errors, an
+     *     array of ValidationMessages otherwise.
+     * @since 2.0
+     */
+    public ValidationMessage[] validate( TagData data ) {
+	TagExtraInfo tei = getTagExtraInfo();
+	if( tei == null ) {
+	    return null;
+	}
+	return tei.validate( data );
+    }
+
+    /**
+     * Set the instance for extra tag information.
+     * 
+     * @param tei the TagExtraInfo instance
+     */
+    public void setTagExtraInfo(TagExtraInfo tei) {
+	tagExtraInfo = tei;
+    }
+
+
+    /**
+     * The instance (if any) for extra tag information.
+     * 
+     * @return The TagExtraInfo instance, if any.
+     */
+    public TagExtraInfo getTagExtraInfo() {
+	return tagExtraInfo;
+    }
+
+
+    /**
+     * Name of the class that provides the handler for this tag.
+     *
+     * @return The name of the tag handler class.
+     */
+    
+    public String getTagClassName() {
+	return tagClassName;
+    }
+
+
+    /**
+     * The bodycontent information for this tag.
+     * If the bodycontent is not defined for this
+     * tag, the default of JSP will be returned.
+     *
+     * @return the body content string.
+     */
+
+    public String getBodyContent() {
+	return bodyContent;
+    }
+
+
+    /**
+     * The information string for the tag.
+     *
+     * @return the info string, or null if 
+     *         not defined
+     */
+
+    public String getInfoString() {
+	return infoString;
+    }
+
+
+    /**
+     * Set the TagLibraryInfo property.
+     *
+     * Note that a TagLibraryInfo element is dependent
+     * not just on the TLD information but also on the
+     * specific taglib instance used.  This means that
+     * a fair amount of work needs to be done to construct
+     * and initialize TagLib objects.
+     *
+     * If used carefully, this setter can be used to avoid having to
+     * create new TagInfo elements for each taglib directive.
+     *
+     * @param tl the TagLibraryInfo to assign
+     */
+
+    public void setTagLibrary(TagLibraryInfo tl) {
+	tagLibrary = tl;
+    }
+
+    /**
+     * The instance of TabLibraryInfo we belong to.
+     *
+     * @return the tag library instance we belong to
+     */
+
+    public TagLibraryInfo getTagLibrary() {
+	return tagLibrary;
+    }
+
+
+    // ============== JSP 2.0 TLD Information ========
+
+
+    /**
+     * Get the displayName.
+     *
+     * @return A short name to be displayed by tools,
+     *         or null if not defined
+     */
+
+    public String getDisplayName() {
+	return displayName;
+    }
+
+    /**
+     * Get the path to the small icon.
+     *
+     * @return Path to a small icon to be displayed by tools,
+     *         or null if not defined
+     */
+
+    public String getSmallIcon() {
+	return smallIcon;
+    }
+
+    /**
+     * Get the path to the large icon.
+     *
+     * @return Path to a large icon to be displayed by tools,
+     *         or null if not defined
+     */
+
+    public String getLargeIcon() {
+	return largeIcon;
+    }
+
+    /**
+     * Get TagVariableInfo objects associated with this TagInfo.
+     *
+     * @return Array of TagVariableInfo objects corresponding to
+     *         variables declared by this tag, or a zero length
+     *         array if no variables have been declared
+     */
+
+    public TagVariableInfo[] getTagVariableInfos() {
+	return tagVariableInfo;
+    }
+
+
+    // ============== JSP 2.0 TLD Information ========
+
+    /**
+     * Get dynamicAttributes associated with this TagInfo.
+     *
+     * @return True if tag handler supports dynamic attributes
+     * @since 2.0
+     */
+    public boolean hasDynamicAttributes() {
+        return dynamicAttributes;
+    }
+
+    /*
+     * private fields for 1.1 info
+     */
+    private String             tagName; // the name of the tag
+    private String             tagClassName;
+    private String             bodyContent;
+    private String             infoString;
+    private TagLibraryInfo     tagLibrary;
+    private TagExtraInfo       tagExtraInfo; // instance of TagExtraInfo
+    private TagAttributeInfo[] attributeInfo;
+
+    /*
+     * private fields for 1.2 info
+     */
+    private String             displayName;
+    private String             smallIcon;
+    private String             largeIcon;
+    private TagVariableInfo[]  tagVariableInfo;
+
+    /*
+     * Additional private fields for 2.0 info
+     */
+    private boolean dynamicAttributes;
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message