You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/11/24 22:44:56 UTC
cvs commit: jakarta-cactus gump.xml build.properties.sample build.xml
vmassol 2002/11/24 13:44:56
Modified: sample-servlet build.properties.sample build.xml
sample-servlet/conf/sample/build/share build-share.xml
documentation/docs/xdocs changes.xml todo.xml
sample-servlet/src/unit/j2ee13/org/apache/cactus/unit
TestAll.java
sample-servlet/conf/sample/build/j2ee13
build.properties.sample
. gump.xml build.properties.sample build.xml
Added: sample-servlet/src/unit/j2ee13/org/apache/cactus/unit
TestJspTagLifecycle.java
framework/src/java/j2ee13/org/apache/cactus/extension/jsp
JspTagLifecycle.java
Log:
Added new extension class to help unit test JSP Taglibs. See the <code>TestJspTagLifecycle</code> test class in the sample-servlet
application for help on using it. Code submitted by Christopher Lenz.
Revision Changes Path
1.25 +7 -1 jakarta-cactus/sample-servlet/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-cactus/sample-servlet/build.properties.sample,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- build.properties.sample 7 Sep 2002 17:09:53 -0000 1.24
+++ build.properties.sample 24 Nov 2002 21:44:55 -0000 1.25
@@ -45,6 +45,12 @@
# The location of the Httpunit jar
httpunit.jar = ${lib.repo}/httpunit/jars/httpunit-1.4.5.jar
+# The location of the JSTL jar
+jstl.jar = ${lib.repo}/jstl/jars/jstl-1.0.2.jar
+
+# The location of the JSTL jar
+standard.jar = ${lib.repo}/taglibs/jars/standard-1.0.2.jar
+
# -----------------------------------------------------------------------------
# Optional properties
# -----------------------------------------------------------------------------
1.14 +4 -0 jakarta-cactus/sample-servlet/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/sample-servlet/build.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- build.xml 5 Aug 2002 17:58:40 -0000 1.13
+++ build.xml 24 Nov 2002 21:44:55 -0000 1.14
@@ -202,6 +202,8 @@
<property name="commons.httpclient.jar" isfile="true"/>
<property name="junit.jar" isfile="true"/>
<property name="httpunit.jar" isfile="true"/>
+ <property name="jstl.jar" isfile="true"/>
+ <property name="standard.jar" isFile="true"/>
</checkProperty>
</target>
@@ -377,6 +379,8 @@
<arg value="-Dcommons.httpclient.jar=${commons.httpclient.jar}"/>
<arg value="-Daspectjrt.jar=${aspectjrt.jar}"/>
<arg value="-Dhttpunit.jar=${httpunit.jar}"/>
+ <arg value="-Djstl.jar=${jstl.jar}"/>
+ <arg value="-Dstandard.jar=${standard.jar}"/>
<arg value="-Dbase.dir=${target.sample.dir}"/>
<arg value="-Dbasedir=${basedir}"/>
1.10 +8 -0 jakarta-cactus/sample-servlet/conf/sample/build/share/build-share.xml
Index: build-share.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/sample-servlet/conf/sample/build/share/build-share.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- build-share.xml 23 Nov 2002 12:07:32 -0000 1.9
+++ build-share.xml 24 Nov 2002 21:44:55 -0000 1.10
@@ -97,6 +97,8 @@
<pathelement location="${httpunit.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${aspectjrt.jar}"/>
+ <pathelement location="${jstl.jar}"/>
+ <pathelement location="${standard.jar}"/>
<!-- Includes system classpath for jars that are in ANT_HOME/lib such
as aspectrt.jar, etc -->
@@ -126,6 +128,8 @@
<echo message="commons.httpclient.jar = ${commons.httpclient.jar}"/>
<echo message="httpunit.jar = ${httpunit.jar}"/>
<echo message="junit.jar = ${junit.jar}"/>
+ <echo message="jstl.jar = ${jstl.jar}"/>
+ <echo message="standard.jar = ${standard.jar}"/>
<echo message=""/>
<echo message="log4j.jar (optional) = ${log4j.jar}"/>
<echo message="clover.jar (optional) = ${clover.jar}"/>
@@ -155,6 +159,8 @@
<available file="${commons.httpclient.jar}"/>
<available file="${httpunit.jar}"/>
<available file="${junit.jar}"/>
+ <available file="${jstl.jar}"/>
+ <available file="${standard.jar}"/>
</and>
</condition>
@@ -408,6 +414,8 @@
<copy tofile="${target.lib.dir}/aspectjrt.jar" file="${aspectjrt.jar}"/>
<copy tofile="${target.lib.dir}/commons-logging.jar" file="${commons.logging.jar}"/>
<copy tofile="${target.lib.dir}/httpunit.jar" file="${httpunit.jar}"/>
+ <copy tofile="${target.lib.dir}/jstl.jar" file="${jstl.jar}"/>
+ <copy tofile="${target.lib.dir}/standard.jar" file="${standard.jar}"/>
<!-- Copy the log4j server configuration file in order to change its
name to log4j.properties (the default name for Log4j) -->
1.60 +5 -0 jakarta-cactus/documentation/docs/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- changes.xml 24 Nov 2002 14:46:09 -0000 1.59
+++ changes.xml 24 Nov 2002 21:44:55 -0000 1.60
@@ -48,6 +48,11 @@
</devs>
<release version="1.5" date="- in CVS">
+ <action dev="VMA" type="add" due-to="Christopher Lenz" due-to-email="cmlenz@gmx.de">
+ Added new extension class to help unit test JSP Taglibs. See the
+ <code>TestJspTagLifecycle</code> test class in the sample-servlet
+ application for help on using it.
+ </action>
<action dev="VMA" type="update">
Improved error handling when dealing with invalid Cookies.
</action>
1.32 +3 -0 jakarta-cactus/documentation/docs/xdocs/todo.xml
Index: todo.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/todo.xml,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- todo.xml 21 Oct 2002 10:21:28 -0000 1.31
+++ todo.xml 24 Nov 2002 21:44:55 -0000 1.32
@@ -48,6 +48,9 @@
executed on the server. Overall coverage is reported as 45% whereas
it is more thaqn 60% in reality ...
</action>
+ <action>
+ Add doc for new <code>JspTagLifecycle</code> class.
+ </action>
</category>
<category title="Build Process">
1.7 +5 -4 jakarta-cactus/sample-servlet/src/unit/j2ee13/org/apache/cactus/unit/TestAll.java
Index: TestAll.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/sample-servlet/src/unit/j2ee13/org/apache/cactus/unit/TestAll.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestAll.java 31 Aug 2002 18:19:21 -0000 1.6
+++ TestAll.java 24 Nov 2002 21:44:55 -0000 1.7
@@ -58,7 +58,7 @@
import junit.framework.TestSuite;
/**
- * Run all the Cactus unit tests related to Servlet API 2.3.
+ * Run all the Cactus unit tests related to J2EE API 1.3.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
@@ -93,7 +93,7 @@
public static Test suite()
{
TestSuite suite = new TestSuite(
- "Cactus unit tests for Servlet API 2.3");
+ "Cactus unit tests for J2EE 1.3");
// Note: This test need to run first. See the comments in the
// test class for more information on why
@@ -118,9 +118,10 @@
suite.addTest(
org.apache.cactus.unit.TestServletTestCase_HttpUnit.suite());
- // Test cases specific to Servlet API 2.3 only
+ // Test cases specific to J2EE 1.3 only
suite.addTest(
org.apache.cactus.unit.TestServletTestCaseSpecific.suite());
+ suite.addTest(org.apache.cactus.unit.TestJspTagLifecycle.suite());
// JspTestCase related tests
suite.addTest(org.apache.cactus.unit.TestJspTestCase.suite());
1.1 jakarta-cactus/sample-servlet/src/unit/j2ee13/org/apache/cactus/unit/TestJspTagLifecycle.java
Index: TestJspTagLifecycle.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Cactus", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.cactus.unit;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.BodyContent;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.extension.jsp.JspTagLifecycle;
import org.apache.cactus.JspTestCase;
import org.apache.cactus.WebResponse;
import org.apache.taglibs.standard.tag.common.core.ChooseTag;
import org.apache.taglibs.standard.tag.el.core.ForEachTag;
import org.apache.taglibs.standard.tag.el.core.IfTag;
import org.apache.taglibs.standard.tag.el.core.OutTag;
import org.apache.taglibs.standard.tag.el.core.SetTag;
import org.apache.taglibs.standard.tag.el.core.WhenTag;
/**
*
*
* @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
*/
public class TestJspTagLifecycle
extends JspTestCase {
// Constructors ------------------------------------------------------------
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestJspTagLifecycle(String theName) {
super(theName);
}
// Public Static Methods ---------------------------------------------------
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite()
{
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestJspTagLifecycle.class);
}
// Test Methods ------------------------------------------------------------
/**
*
* @throws JspException
* @throws IOException
*/
public void testOutTag()
throws JspException, IOException {
OutTag tag = new OutTag();
tag.setValue("TEST");
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke(new JspTagLifecycle.Interceptor() {
public void evalBody(int iteration, BodyContent body) {
assertEquals("TEST", body.getString());
}
});
}
/**
*
* @param theResponse
*/
public void endOutTag(WebResponse theResponse) {
String output = theResponse.getText();
assertEquals("TEST", output);
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testOutTagDefaultAttribute()
throws JspException, IOException {
OutTag tag = new OutTag();
tag.setValue(null);
tag.setDefault("Default Value");
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke();
}
/**
*
* @param theResponse
*/
public void endOutTagWithDefaultAttribute(WebResponse theResponse) {
String output = theResponse.getText();
assertEquals("Default Value", output);
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testOutTagDefaultBody()
throws JspException, IOException {
/*
OutTag tag = new OutTag();
tag.setValue(null);
new JspTagLifecycle(tag) {
protected void evalBody(int iteration, BodyContent body)
throws IOException {
body.print("Default Value");
}
}.invoke(pageContext, null);*/
}
/**
*
* @param theResponse
*/
public void endOutTagDefaultBody(WebResponse theResponse) {
/*
String output = theResponse.getText();
assertEquals("Default Value", output);*/
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testSetTag()
throws JspException, IOException {
SetTag tag = new SetTag();
tag.setVar("name");
tag.setValue("value");
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke();
assertEquals("value", pageContext.findAttribute("name"));
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testForEachTag()
throws JspException, IOException {
ForEachTag tag = new ForEachTag();
tag.setVar("item");
tag.setItems("uno,dos,tres");
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke(new JspTagLifecycle.Interceptor() {
public void evalBody(int iteration, BodyContent body) {
if (iteration == 0) {
assertEquals("uno", pageContext.findAttribute("item"));
} else if (iteration == 1) {
assertEquals("dos", pageContext.findAttribute("item"));
} else if (iteration == 2) {
assertEquals("tres", pageContext.findAttribute("item"));
} else {
fail("More iterations than expected!");
}
}
});
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testIfTagTrue()
throws JspException, IOException {
IfTag tag = new IfTag();
tag.setTest("true");
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke(new JspTagLifecycle.Interceptor() {
public void skipBody() {
fail("Body should have been evaluated!");
}
});
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testIfTagFalse()
throws JspException, IOException {
IfTag tag = new IfTag();
tag.setTest("false");
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke(new JspTagLifecycle.Interceptor() {
public void evalBody(int iteration, BodyContent body) {
fail("Body should have been skipped!");
}
});
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testWhenTag()
throws JspException, IOException
{
WhenTag tag = new WhenTag();
tag.setTest("true");
JspTagLifecycle lifecycle =
new JspTagLifecycle(pageContext, tag, new ChooseTag());
lifecycle.invoke(new JspTagLifecycle.Interceptor() {
public void skipBody() {
fail("Body should have been evaluated!");
}
});
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testWhenTagNoPermission()
throws JspException, IOException
{
ChooseTag parent = new ChooseTag();
parent.subtagSucceeded();
WhenTag tag = new WhenTag();
tag.setTest("true");
JspTagLifecycle lifecycle =
new JspTagLifecycle(pageContext, tag, parent);
lifecycle.invoke(new JspTagLifecycle.Interceptor() {
public void evalBody(int iteration, BodyContent body) {
fail("Body should have been skipped!");
}
});
}
/**
*
* @throws JspException
* @throws IOException
*/
public void testWhenTagWithoutChooseTag()
throws JspException, IOException {
WhenTag tag = new WhenTag();
tag.setTest("true");
try {
JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
lifecycle.invoke();
fail("Expected JSPTagException");
} catch (JspTagException je) {
// expected
}
}
}
1.19 +7 -1 jakarta-cactus/sample-servlet/conf/sample/build/j2ee13/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-cactus/sample-servlet/conf/sample/build/j2ee13/build.properties.sample,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- build.properties.sample 30 Sep 2002 21:38:36 -0000 1.18
+++ build.properties.sample 24 Nov 2002 21:44:56 -0000 1.19
@@ -44,6 +44,12 @@
# The location of the Httpunit jar
httpunit.jar = ../lib/httpunit-1.4.5.jar
+# The location of the JSTL jar
+jstl.jar = ../lib/jstl-1.0.2.jar
+
+# The location of the JSTL jar
+standard.jar = ../lib/standard-1.0.2.jar
+
# -----------------------------------------------------------------------------
# Optional properties
# -----------------------------------------------------------------------------
1.1 jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jsp/JspTagLifecycle.java
Index: JspTagLifecycle.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Cactus" and "Apache Software
* Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.cactus.extension.jsp;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.IterationTag;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TryCatchFinally;
/**
* Convenience class that supports the testing of JSP tag by managing the tag's
* lifecycle as required by the JSP specification.
*
* @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
*
* @version $Id: $
* @see org.apache.cactus.JspTestCase
*/
public class JspTagLifecycle
{
// Inner Classes -----------------------------------------------------------
/**
*
* @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
*/
public abstract static class Interceptor
{
/**
* Method called when the body of the tag would be evaluated. Can be
* used in specific test cases to perform assertions.
*
* @param theIteration The number of times the body has been evaluated
* @param theBody The body content, or <tt>null</tt> if the tag isn't a
* <tt>BodyTag</tt>
* @throws IOException If an error occurs when reading or writing the
* body content
*/
public void evalBody(int theIteration, BodyContent theBody)
throws IOException
{
// default implementation does nothing
}
/**
* Method called when the body of the tag would be skipped. Can be used
* in specific test cases to perform assertions.
*/
public void skipBody()
{
// default implementation does nothing
}
}
/**
* Used internally to avoid having to check for <tt>null</tt>.
*/
private static final Interceptor NOOP_INTERCEPTOR =
new Interceptor()
{
};
// Instance Variables ------------------------------------------------------
/**
* The JSP tag handler.
*/
private PageContext pageContext;
/**
* The JSP tag handler.
*/
private Tag tag;
/**
* The JSP tag handler.
*/
private Tag parent;
// Constructors ------------------------------------------------------------
/**
* Constructor.
*
* @param thePageContext The JSP page context
* @param theTag The JSP tag
*/
public JspTagLifecycle(PageContext thePageContext, Tag theTag)
{
this(thePageContext, theTag, null);
}
/**
* Constructor.
*
* @param thePageContext The JSP page context
* @param theTag The JSP tag
* @param theParent The parent tag, or <tt>null</tt>
*/
public JspTagLifecycle(PageContext thePageContext, Tag theTag,
Tag theParent)
{
this.pageContext = thePageContext;
this.tag = theTag;
this.parent = theParent;
}
// Public Methods ----------------------------------------------------------
/**
* Invokes the tag in the provided page context. The tag should have been
* populated with its properties before calling this method. The tag is not
* released after the tag's lifecycle is over.
*
* @throws JspException If the tag throws an exception
* @throws IOException If an error occurs when reading or writing the body
* content
*/
public void invoke() throws JspException, IOException
{
invoke(NOOP_INTERCEPTOR);
}
/**
* Invokes the tag in the provided page context. The tag should have been
* populated with its properties before calling this method. The tag is not
* released after the tag's lifecycle is over.
*
* @param theInterceptor The interceptor that will be notified about
* lifecycle events
* @throws JspException If the tag throws an exception
* @throws IOException If an error occurs when reading or writing the body
* content
*/
public void invoke(Interceptor theInterceptor)
throws JspException, IOException
{
if (theInterceptor == null)
{
throw new NullPointerException();
}
tag.setPageContext(pageContext);
tag.setParent(parent);
BodyContent body = null;
if (tag instanceof TryCatchFinally)
{
TryCatchFinally tryCatchFinally = (TryCatchFinally) tag;
try
{
body = invokeTag(theInterceptor);
}
catch (Throwable t1)
{
try
{
tryCatchFinally.doCatch(t1);
}
catch (Throwable t2)
{
throw new JspException(t2.getMessage());
}
}
finally
{
if (body != null)
{
pageContext.popBody();
body = null;
}
tryCatchFinally.doFinally();
}
}
else
{
try
{
body = invokeTag(theInterceptor);
}
finally
{
if (body != null)
{
pageContext.popBody();
body = null;
}
}
}
}
// Private Methods ---------------------------------------------------------
/**
* Internal method to invoke a tag without doing exception handling.
*
* @param theInterceptor The interceptor that will be notified about
* lifecycle events
* @throws JspException If the tag throws an exception
* @throws IOException If an error occurs when reading or writing the body
* content
* @return The body content, or <tt>null</tt> if the tag didn't request
* buffered body evaluation
*/
private BodyContent invokeTag(Interceptor theInterceptor)
throws JspException, IOException
{
BodyContent body = null;
int status = tag.doStartTag();
if (status != Tag.SKIP_BODY)
{
if (tag instanceof IterationTag)
{
IterationTag iterationTag = (IterationTag) tag;
if ((status == BodyTag.EVAL_BODY_BUFFERED)
&& (tag instanceof BodyTag))
{
BodyTag bodyTag = (BodyTag) tag;
body = pageContext.pushBody();
bodyTag.setBodyContent(body);
bodyTag.doInitBody();
}
int iteration = 0;
do
{
theInterceptor.evalBody(iteration, body);
status = iterationTag.doAfterBody();
iteration++;
} while (status == IterationTag.EVAL_BODY_AGAIN);
}
}
else
{
theInterceptor.skipBody();
}
status = tag.doEndTag();
return body;
}
}
1.22 +8 -0 jakarta-cactus/gump.xml
Index: gump.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/gump.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- gump.xml 29 Oct 2002 21:29:27 -0000 1.21
+++ gump.xml 24 Nov 2002 21:44:56 -0000 1.22
@@ -205,6 +205,8 @@
<depend property="httpunit.jar" project="httpunit"/>
<depend property="aspectjrt.jar" project="aspectj" id="aspectjrt"/>
<depend property="junit.jar" project="junit"/>
+ <depend property="jstl.jar" project="jakarta-taglibs" id="jstl"/>
+ <depend property="standard.jar" project="jakarta-taglibs" id="standard"/>
<depend property="cactus.framework.jar" project="jakarta-cactus-framework-13"/>
<depend property="cactus.ant.jar" project="jakarta-cactus-ant"/>
<property name="test.port" value="8082"/>
@@ -244,6 +246,8 @@
<depend property="httpunit.jar" project="httpunit"/>
<depend property="aspectjrt.jar" project="aspectj" id="aspectjrt"/>
<depend property="junit.jar" project="junit"/>
+ <depend property="jstl.jar" project="jakarta-taglibs" id="jstl"/>
+ <depend property="standard.jar" project="jakarta-taglibs" id="standard"/>
<property name="release.dir" value="release-12"/>
<property name="cvs.executable" value="cvs"/>
@@ -281,6 +285,8 @@
<depend property="httpunit.jar" project="httpunit"/>
<depend property="aspectjrt.jar" project="aspectj" id="aspectjrt"/>
<depend property="junit.jar" project="junit"/>
+ <depend property="jstl.jar" project="jakarta-taglibs" id="jstl"/>
+ <depend property="standard.jar" project="jakarta-taglibs" id="standard"/>
<property name="release.dir" value="release-13"/>
<property name="cvs.executable" value="cvs"/>
@@ -318,6 +324,8 @@
<depend property="httpunit.jar" project="httpunit"/>
<depend property="aspectjrt.jar" project="aspectj" id="aspectjrt"/>
<depend property="junit.jar" project="junit"/>
+ <depend property="jstl.jar" project="jakarta-taglibs" id="jstl"/>
+ <depend property="standard.jar" project="jakarta-taglibs" id="standard"/>
<property name="cvs.executable" value="cvs"/>
</ant>
1.28 +7 -1 jakarta-cactus/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-cactus/build.properties.sample,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- build.properties.sample 7 Sep 2002 17:09:53 -0000 1.27
+++ build.properties.sample 24 Nov 2002 21:44:56 -0000 1.28
@@ -49,6 +49,12 @@
# The location of the Junit jar
junit.jar = ${lib.repo}/junit/jars/junit-3.8.1.jar
+# The location of the JSTL jar
+jstl.jar = ${lib.repo}/jstl/jars/jstl-1.0.2.jar
+
+# The location of the JSTL jar
+standard.jar = ${lib.repo}/taglibs/jars/standard-1.0.2.jar
+
# CVS executable to use for documentation generation (used to automatically
# generate web site changelog).
cvs.executable = cvs
1.25 +6 -0 jakarta-cactus/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/build.xml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- build.xml 9 Sep 2002 20:26:59 -0000 1.24
+++ build.xml 24 Nov 2002 21:44:56 -0000 1.25
@@ -93,6 +93,8 @@
<echo message="junit.jar = ${junit.jar}"/>
<echo message="aspectjrt.jar = ${aspectjrt.jar}"/>
<echo message="log4j.jar = ${log4j.jar}"/>
+ <echo message="jstl.jar = ${jstl.jar}"/>
+ <echo message="standard.jar = ${standard.jar}"/>
<echo message=""/>
<echo message="j2ee.jar = ${j2ee.jar}"/>
<echo message="servlet.jar = ${servlet.jar}"/>
@@ -121,6 +123,8 @@
<available file="${httpunit.jar}"/>
<available file="${junit.jar}"/>
<available file="${aspectjrt.jar}"/>
+ <available file="${jstl.jar}"/>
+ <available file="${standard.jar}"/>
<isset property="cvs.executable"/>
</and>
</condition>
@@ -466,6 +470,8 @@
<copy todir="${target.lib.dir}" file="${junit.jar}"/>
<copy todir="${target.lib.dir}" file="${aspectjrt.jar}"/>
<copy todir="${target.lib.dir}" file="${servlet.jar}"/>
+ <copy todir="${target.lib.dir}" file="${jstl.jar}"/>
+ <copy todir="${target.lib.dir}" file="${standard.jar}"/>
<zip zipfile="${release.dir}/${cactus.release.name}.zip">
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>