Initial revision
diff --git a/README b/README
new file mode 100644
index 0000000..d005775
--- /dev/null
+++ b/README
@@ -0,0 +1,74 @@
+JSP Standard Tag Library (JSTL)
+Release: Early Access 2 (EA2)
+
+Thanks for downloading the JSTL EA2 release. We hope you find the tags,
+documents, and examples here of interest. We're curious to hear your
+feedback on this release, which represents work in progress toward a
+standard JSP Tag Library. Please contact us at
+
+ mailto:jsr052-comments@sun.com
+
+with any comments you might have.
+
+Included in this distibution:
+
+ DOCUMENTATION ('doc/web' directory)
+
+ GettingStarted.html: A quick roadmap to help you get started
+ with this release.
+
+ Overview.html: An overview of JSTL's design philosophy and
+ current syntax.
+
+ Functional descriptions: Technical guides representing the
+ design considerations and functionality of JSTL's tag set.
+ Note that these are not formal specifications, just technical
+ overviews of functionality and intent.
+
+ EXAMPLES ('examples' directory)
+
+ The standard-examples application included with this distribution
+ demonstrates the current capabilities of JSTL, exploring idioms
+ and usage patterns when appropriate.
+
+ REFERENCE IMPLEMENTATION ('src' and 'conf' directories)
+
+ Every effort has been made to provide a functional, robust, and
+ speedy reference implementation (RI) for the current functionality
+ JSTL offers. For developers, the code is commented thoroughly
+ to help provide an understanding of design considerations and
+ salient implementation details.
+
+ Classes in the javax.servlet.jsp.jstl represent the current
+ draft of the JSTL API classes. Classes under org.apache.*
+ represent the reference implementation, expected to be released
+ through Jakarta Taglibs. The package structure for the RI is
+ organized as follows:
+
+ org.apache.taglibs.standard
+ .tag tag handlers and routines related to them
+ .common handlers and support routines common for RT/EL attributes
+ .core core library (common)
+ .fmt internationalization-capable formatting tags (common)
+ .xml XML manipulation library (common)
+ .el handlers specific to expression language (EL) evaluation
+ .core core library (EL)
+ .fmt internationalization-capable formatting tags (EL)
+ .xml XML manipulation library (EL)
+ .rt handlers specific to rtexprvalue (rt) evaluation
+ .core core library (rt)
+ .fmt internationalization-capable formatting tags (rt)
+ .xml XML manipulation library (rt)
+ .tei TagExtraInfo classes (common to both libraries)
+ .tlv TagLibraryValidator classes (and associated helpers)
+ .lang expression-language support and implementation
+ .dummy dummy ExpressionEvaluator
+ .support ExpressionEvaluator, ExpressionEvaluatorManager
+ .spel SPEL
+ .jpath JPath
+ .jxpath JXPath
+ .javascript ECMAScript (JavaScript/Rhino)
+
+Enjoy!
+
+ -- JSR-052 (JSTL) Expert Group
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..69e0b36
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,264 @@
+<project name="standard" default="main" basedir=".">
+
+ <!-- ******************** Adjustable Properties *********************** -->
+
+ <property file="../build.properties"/>
+ <property file="../common.properties"/>
+ <property name="js.jar" value="lib/js.jar"/>
+ <property name="jaxen-full.jar" value="lib/jaxen-full.jar"/>
+ <property name="saxpath.jar" value="lib/saxpath.jar"/>
+ <property name="crimson.jar" value="lib/crimson.jar"/>
+ <property name="xalan.jar" value="lib/xalan.jar"/>
+ <property name="classpath" value="${servlet23.jar}"/>
+ <property name="taglib.name" value="standard"/>
+
+ <!-- ****************** Project Standard Properties ******************* -->
+
+ <!-- *********************** Default Properties ********************** -->
+
+ <!-- ********************* Derived Properties ************************* -->
+
+ <!--
+
+ These property values are derived from the previously defined values,
+ and should not normally be overridden from the command line.
+
+ build.doc Target directory for documentation app
+ build.examples Target directory for examples app
+ build.library Target directory for tag library
+ dist.doc Destination WAR for documentation app
+ dist.examples Destination WAR for examples app
+ dist.library Destination JAR for tag library
+ dist.tld Destination TLD file for tag library
+
+ -->
+
+ <!--
+ <property name="dist-jr.tld" value="${dist.dir}/${taglib.name}/${taglib.name}-jr.tld"/>
+ <property name="dist-jx.tld" value="${dist.dir}/${taglib.name}/${taglib.name}-jx.tld"/>
+ <property name="dist-x.tld" value="${dist.dir}/${taglib.name}/${taglib.name}-x.tld"/>
+ <property name="dist-scriptfree.tld" value="${dist.dir}/${taglib.name}/${taglib.name}-scriptfree.tld"/>
+ -->
+ <property name="jxpath.jar" value="lib/commons-JXPath-0.1-dev.jar"/>
+
+ <!-- ********************** Destination Preparation ********************* -->
+
+ <target name="prepare">
+ <!-- Make sure required dependencies are available -->
+ <antcall target="checkRequiredFile">
+ <param name="file" value="${servlet23.jar}"/>
+ <param name="fail.message" value="A jar file containing the Servlet 2.3 and JSP1.2 classes is required to compile the standard taglib. please define the property servlet23.jar in your build.properties file and ensure that the file exists."/>
+ </antcall>
+ <antcall target="checkRequiredFile">
+ <param name="file" value="${jaxp.jar}"/>
+ <param name="fail.message" value="The standard taglib required the JAXP 1.1 jaxp.jar file, please define the property jaxp.jar in your build.properties file and ensure that the file exists."/>
+ </antcall>
+ <antcall target="checkRequiredFile">
+ <param name="file" value="${crimson.jar}"/>
+ <param name="fail.message" value="The standard taglib required the JAXP 1.1 crimson.jar file, please define the property crimson.jar in your build.properties file and ensure that the file exists."/>
+ </antcall>
+ <!--
+ <antcall target="checkOptionalFile">
+ <param name="file" value="${jxpath.jar}"/>
+ <param name="warn.message" value="The standard taglib requires that you provide the JXPath JAR if you desire support of the JXPath Expression Language. Since the property jxpath.jar in your build.properties file does not point to a valid file or is not defined, JXPath support will not be included in the compilation or the 'example' application."/>
+ </antcall>
+ -->
+
+ <!-- Set up build directories -->
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.doc}"/>
+ <mkdir dir="${build.doc}/WEB-INF"/>
+ <mkdir dir="${build.doc}/WEB-INF/classes"/>
+ <mkdir dir="${build.doc}/WEB-INF/lib"/>
+ <mkdir dir="${build.examples}"/>
+ <mkdir dir="${build.examples}/WEB-INF"/>
+ <mkdir dir="${build.examples}/WEB-INF/classes"/>
+ <mkdir dir="${build.examples}/WEB-INF/lib"/>
+ <mkdir dir="${build.library}"/>
+ <mkdir dir="${build.library}/META-INF"/>
+ <!-- Set up distribution directory -->
+ <mkdir dir="${dist.dir}"/>
+ <mkdir dir="${dist.dir}/${taglib.name}"/>
+ </target>
+
+
+ <!-- **************** Compile Tag Library Components ******************** -->
+
+ <!-- Compile the documentation application -->
+ <target name="documentation" depends="prepare">
+ <copy todir="${build.doc}/WEB-INF">
+ <fileset dir="${doc.src}/conf"/>
+ </copy>
+ <style in="${xml.src}/intro.xml"
+ destdir="${build.doc}"
+ out="${build.doc}/intro.html"
+ style="${taglibs.xsl}">
+ <param name="prefix" expression="../../"/>
+ </style>
+ <copy todir="${build.doc}">
+ <fileset dir="${doc.src}/web">
+ <include name="**/*.html"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- Compile the examples application -->
+ <target name="examples" depends="library-dist">
+ <copy todir="${build.examples}/WEB-INF">
+ <fileset dir="${examples.src}/conf"/>
+ </copy>
+ <copy todir="${build.examples}">
+ <fileset dir="${examples.src}/web"/>
+ </copy>
+ <!-- Copy implementation-detail jar files -->
+ <copy todir="${build.examples}/WEB-INF/lib">
+ <fileset dir="lib" includes="*.jar"/>
+ </copy>
+ <!-- Copy required external API jar files -->
+ <!--
+ <copy file="${jaxp.jar}"
+ tofile="${build.examples}/WEB-INF/lib/jaxp.jar"/>
+ <copy file="${crimson.jar}"
+ tofile="${build.examples}/WEB-INF/lib/crimson.jar"/>
+ -->
+ <!-- Copy the 'standard' TLD files -->
+ <copy todir="${build.examples}/WEB-INF">
+ <fileset dir="conf" includes="*.tld"/>
+ </copy>
+ <!--
+ <copy file="${dist-jx.tld}"
+ tofile="${build.examples}/WEB-INF/jx.tld"/>
+ <copy file="${dist-jr.tld}"
+ tofile="${build.examples}/WEB-INF/jr.tld"/>
+ <copy file="${dist-x.tld}"
+ tofile="${build.examples}/WEB-INF/x.tld"/>
+ <copy file="${dist-scriptfree.tld}"
+ tofile="${build.examples}/WEB-INF/scriptfree.tld"/>
+ -->
+ <!-- Copy the 'standard' jar files -->
+ <copy file="${dist.library}/jstl.jar"
+ tofile="${build.examples}/WEB-INF/lib/jstl.jar"/>
+ <javac srcdir="${examples.src}" destdir="${build.examples}/WEB-INF/classes"
+ classpath="${servlet23.jar}:${build.library}"/>
+ </target>
+
+ <!-- Compile the tag library itself -->
+ <target name="library" depends="prepare">
+ <copy todir="${build.library}/META-INF">
+ <fileset dir="conf" includes="*.tld"/>
+ </copy>
+ <!--
+ <copy file="${conf.src}/jx.tld"
+ tofile="${build.library}/META-INF/jx.tld"/>
+ <copy file="${conf.src}/jr.tld"
+ tofile="${build.library}/META-INF/jr.tld"/>
+ <copy file="${conf.src}/x.tld"
+ tofile="${build.library}/META-INF/x.tld"/>
+ -->
+ <copy todir="${build.library}">
+ <fileset dir="${library.src}">
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+<!--
+ - [ for optional JXPath (versus integrated JXPath) ... ] -
+ <javac srcdir="${library.src}" destdir="${build.library}"
+ classpath="${servlet23.jar}"
+ excludes="org/apache/taglibs/standard/lang/jxpath/**"
+ debug="on"/>
+ <available file="${jxpath.jar}" property="jxpath.available"/>
+ <antcall target="libraryJXPath"/>
+ </target>
+
+ <target name="libraryJXPath" if="jxpath.available">
+ <javac srcdir="${library.src}" destdir="${build.library}"
+ classpath="${servlet23.jar}"
+ includes="org/apache/taglibs/standard/lang/jxpath/**"
+ debug="on"/>
+ </target>
+-->
+
+ <javac srcdir="${library.src}" destdir="${build.library}"
+ classpath="${servlet23.jar}:${jxpath.jar}:${js.jar}:${jaxen-full.jar}:${saxpath.jar}:${crimson.jar}:${xalan.jar}"
+ debug="on"/>
+ </target>
+
+ <!-- Compile the library as well as the associated applications -->
+ <target name="main" depends="library,documentation,examples"/>
+
+
+ <!-- ******************* Create Distribution Files ********************** -->
+
+ <!-- Create the documentation application WAR file -->
+ <target name="documentation-dist" depends="documentation">
+ <jar jarfile="${dist.doc}" basedir="${build.doc}" excludes="intro.html"/>
+ <mkdir dir="${taglibs.doc}"/>
+ <copy todir="${taglibs.doc}">
+ <fileset dir="${build.doc}">
+ <exclude name="WEB-INF/**"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- Create the examples application WAR file -->
+ <target name="examples-dist" depends="examples">
+ <jar jarfile="${dist.examples}" basedir="${build.examples}"/>
+ </target>
+
+ <!-- Create the library distribution files -->
+ <target name="library-dist" depends="library">
+ <!-- Create the tag library jar -->
+ <jar jarfile="${dist.library}/jstl.jar"
+ basedir="${build.library}"/>
+ <!-- Create the 'standard' API jar -->
+ <jar jarfile="${dist.library}/jstl-api.jar"
+ basedir="${build.library}"
+ includes="javax/**"/>
+ <copy todir="${dist.dir}/${taglib.name}">
+ <fileset dir="conf" includes="*.tld"/>
+ </copy>
+ <!--
+ <copy file="${conf.src}/jx.tld" tofile="${dist-jx.tld}"/>
+ <copy file="${conf.src}/x.tld" tofile="${dist-x.tld}"/>
+ <copy file="${conf.src}/jr.tld" tofile="${dist-jr.tld}"/>
+ <copy file="${conf.src}/scriptfree.tld" tofile="${dist-scriptfree.tld}"/>
+ -->
+ </target>
+
+ <!-- Create the entire set of distribution files -->
+ <target name="dist" depends="library-dist,examples-dist,documentation-dist"/>
+
+
+
+ <!-- ************************ Utility Commands ************************** -->
+
+ <!-- Delete output directories and files so we can build from scratch -->
+ <target name="clean">
+ <delete dir="${build.dir}/${taglib.name}"/>
+ <delete dir="${dist.dir}/${taglib.name}"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Scripts used with antcall for checking for required classes or jars -->
+ <!-- Must provide "class" or "file" and "fail.message" parameters -->
+ <!-- =================================================================== -->
+ <target name="checkRequiredClass">
+ <available classname="${class}" property="requirement.satisfied"/>
+ <antcall target="checkRequired.fail"/>
+ </target>
+ <target name="checkRequiredFile">
+ <available file="${file}" property="requirement.satisfied"/>
+ <antcall target="checkRequired.fail"/>
+ </target>
+ <target name="checkOptionalFile">
+ <available file="${file}" property="requirement.satisfied"/>
+ <antcall target="checkRequired.warn"/>
+ </target>
+ <target name="checkRequired.fail" unless="requirement.satisfied">
+ <fail message="${fail.message}"/>
+ </target>
+ <target name="checkRequired.warn" unless="requirement.satisfied">
+ <echo message="WARNING: ${warn.message}"/>
+ </target>
+
+</project>
diff --git a/conf/c-rt.tld b/conf/c-rt.tld
new file mode 100644
index 0000000..4445452
--- /dev/null
+++ b/conf/c-rt.tld
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>c-rt</short-name>
+ <uri>http://java.sun.com/jstl/ea/core-rt</uri>
+ <display-name>JSTL core RT</display-name>
+ <description>JSTL 1.0 core library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+ </validator-class>
+ <description>
+ Provides core validation features for JSTL tags.
+ </description>
+ </validator>
+
+ <tag>
+ <name>choose</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ <when> and <otherwise>
+ </description>
+ </tag>
+
+ <tag>
+ <name>declare</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.DeclareTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.DeclareTEI</tei-class>
+ <body-content>empty</body-content>
+ <description>
+ Declares an scripting variable, initially defined by an
+ existing scoped attribute of the same name. The type of the
+ variable defaults to java.lang.Object but can be modified
+ by using the 'type' attribute.
+ </description>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>if</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag, which evalutes its body if the
+ supplied condition is true and optionally exposes a Boolean
+ scripting variable representing the evaluation of this condition
+ </description>
+ <attribute>
+ <name>test</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>import</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Retrieves an absolute or relative URL and exposes its contents
+ to either the page, a String in 'var', or a Reader in 'varReader'.
+ </description>
+ <attribute>
+ <name>url</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>varReader</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>context</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>charEncoding</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>forEach</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ The basic iteration tag, accepting many different
+ collection types and supporting subsetting and other
+ functionality
+ </description>
+ <attribute>
+ <name>items</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <!-- No label in EA2
+ <attribute>
+ <name>label</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ -->
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>status</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>forTokens</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Iterates over tokens, separated by the supplied delimeters
+ </description>
+ <attribute>
+ <name>items</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>delims</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <!-- No label in EA2
+ <attribute>
+ <name>label</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ -->
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>status</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>otherwise</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that follows <when> tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+ </description>
+ </tag>
+
+ <tag>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Adds a parameter to a containing 'import' tag's URL.
+ </description>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>encode</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>urlEncode</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.URLEncodeTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Encodes its 'value' attribute (or body) per x-www-form-urlencoded
+ rules.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>when</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that includes its body if its
+ condition evalutes to 'true'
+ </description>
+ <attribute>
+ <name>test</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>boolean</type>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/conf/c.tld b/conf/c.tld
new file mode 100644
index 0000000..b1ee816
--- /dev/null
+++ b/conf/c.tld
@@ -0,0 +1,378 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>c</short-name>
+ <uri>http://java.sun.com/jstl/ea/core</uri>
+ <display-name>JSTL core</display-name>
+ <description>JSTL 1.0 core library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+ </validator-class>
+ <init-param>
+ <param-name>expressionAttributes</param-name>
+ <param-value>
+ expr:value
+ expr:default
+ if:test
+ import:url
+ import:context
+ import:charEncoding
+ forEach:items
+ forEach:begin
+ forEach:end
+ forEach:step
+ forTokens:items
+ forTokens:begin
+ forTokens:end
+ forTokens:step
+ set:value
+ when:test
+ </param-value>
+ <description>
+ Whitespace-separated list of colon-separated token pairs
+ describing tag:attribute combinations that accept expressions.
+ The validator uses this information to determine which
+ attributes need their syntax validated.
+ </description>
+ </init-param>
+ <description>
+ Provides core validation features for JSTL tags.
+ </description>
+ </validator>
+
+ <!-- The validator also listens in order to recover a context parameter -->
+ <listener>
+ <listener-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLVHelper
+ </listener-class>
+ </listener>
+
+ <tag>
+ <name>choose</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ <when> and <otherwise>
+ </description>
+ </tag>
+
+ <tag>
+ <name>declare</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.DeclareTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.DeclareTEI</tei-class>
+ <body-content>empty</body-content>
+ <description>
+ Declares an scripting variable, initially defined by an
+ existing scoped attribute of the same name. The type of the
+ variable defaults to java.lang.Object but can be modified
+ by using the 'type' attribute.
+ </description>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>expr</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.ExprTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Like <%= ... >, but for expressions.
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>default</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>expressionLanguage</name>
+ <tag-class>
+ org.apache.taglibs.standard.tag.el.core.ExpressionLanguageTag
+ </tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Temporary tag that allows for runtime pluggability of expression-
+ language evaluators. This tag just supports experimentation with
+ expression languages and is not expected to remain in the
+ final release of JSTL 1.0.
+ </description>
+ <attribute>
+ <name>evaluator</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>if</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag, which evalutes its body if the
+ supplied condition is true and optionally exposes a Boolean
+ scripting variable representing the evaluation of this condition
+ </description>
+ <attribute>
+ <name>test</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>import</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.ImportTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Retrieves an absolute or relative URL and exposes its contents
+ to either the page, a String in 'var', or a Reader in 'varReader'.
+ </description>
+ <attribute>
+ <name>url</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>varReader</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>context</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>charEncoding</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>forEach</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.ForEachTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ The basic iteration tag, accepting many different
+ collection types and supporting subsetting and other
+ functionality
+ </description>
+ <attribute>
+ <name>items</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <!-- No label in EA2
+ <attribute>
+ <name>label</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ -->
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>status</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>forTokens</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.ForTokensTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Iterates over tokens, separated by the supplied delimeters
+ </description>
+ <attribute>
+ <name>items</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>delims</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <!-- No label in EA2
+ <attribute>
+ <name>label</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ -->
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>status</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>otherwise</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that follows <when> tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+ </description>
+ </tag>
+
+ <tag>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Adds a parameter to a containing 'import' tag's URL.
+ </description>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>encode</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>set</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.SetTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Sets the result of an expression evaluation in a 'scope'
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>urlEncode</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.URLEncodeTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Encodes its 'value' attribute (or body) per x-www-form-urlencoded
+ rules.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>when</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.core.WhenTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that includes its body if its
+ condition evalutes to 'true'
+ </description>
+ <attribute>
+ <name>test</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/conf/fmt-rt.tld b/conf/fmt-rt.tld
new file mode 100644
index 0000000..a51ba46
--- /dev/null
+++ b/conf/fmt-rt.tld
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>fmt-rt</short-name>
+ <uri>http://java.sun.com/jstl/ea/fmt-rt</uri>
+ <display-name>JSTL fmt RT</display-name>
+ <description>JSTL 1.0 i18n-capable formatting library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+ </validator-class>
+ <description>
+ Provides core validation features for JSTL tags.
+ </description>
+ </validator>
+
+ <tag>
+ <name>exception</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ExceptionTag</tag-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Prints the given exception in localized format
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>bundle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>stackTrace</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>locale</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.LocaleTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.LocaleTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Establishes the locale to use for resource bundles and formatting
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>variant</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>timeZone</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.TimeZoneTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Establishes the time zone in which to represent a <formatDate>
+ tag's time information
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>bundle</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.BundleTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Loads a resource bundle containing localized messages
+ </description>
+ <attribute>
+ <name>basename</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>prefix</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>message</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.MessageTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Maps key to localized message and performs parametric replacement
+ </description>
+ <attribute>
+ <name>key</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>bundle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>messageFormat</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageFormatTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.MessageFormatTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Performs parametric replacement on a given pattern string
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>messageArg</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageArgTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Supplies an argument for parametric replacement to a containing
+ <message> or <messageFormat> tag
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>formatNumber</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.FormatNumberTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Formats a numeric value as a number, currency, or percentage
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>parseNumber</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ParseNumberTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Parses the string representation of a number, currency, or percentage
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>formatDate</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.FormatDateTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Formats a date and/or time using the supplied styles and pattern
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>dateStyle</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>timeStyle</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>timeZone</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>parseDate</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ParseDateTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Parses the string representation of a date and/or time
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/conf/fmt.tld b/conf/fmt.tld
new file mode 100644
index 0000000..af0cd5f
--- /dev/null
+++ b/conf/fmt.tld
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>fmt</short-name>
+ <uri>http://java.sun.com/jstl/ea/fmt</uri>
+ <display-name>JSTL fmt</display-name>
+ <description>JSTL 1.0 i18n-capable formatting library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+ </validator-class>
+ <init-param>
+ <param-name>expressionAttributes</param-name>
+ <param-value>
+ exception:value
+ exception:bundle
+ exception:stackTrace
+ locale:value
+ locale:variant
+ timeZone:value
+ bundle:basename
+ bundle:prefix
+ message:key
+ message:bundle
+ messageFormat:value
+ messageArg:value
+ formatNumber:value
+ formatNumber:pattern
+ parseNumber:value
+ parseNumber:pattern
+ formatDate:value
+ formatDate:pattern
+ formatDate:timeZone
+ parseDate:value
+ parseDate:pattern
+ </param-value>
+ <description>
+ Whitespace-separated list of colon-separated token pairs
+ describing tag:attribute combinations that accept expressions.
+ The validator uses this information to determine which
+ attributes need their syntax validated.
+ </description>
+ </init-param>
+ <description>
+ Provides core validation features for JSTL tags.
+ </description>
+ </validator>
+
+ <!-- The validator also listens in order to recover a context parameter -->
+ <listener>
+ <listener-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLVHelper
+ </listener-class>
+ </listener>
+
+ <tag>
+ <name>exception</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.ExceptionTag</tag-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Prints the given exception in localized format
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>bundle</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>stackTrace</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>locale</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.LocaleTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.LocaleTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Establishes the locale to use for resource bundles and formatting
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>variant</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>timeZone</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.TimeZoneTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.TimeZoneTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Establishes the time zone in which to represent a <formatDate>
+ tag's time information
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>bundle</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.BundleTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.BundleTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Loads a resource bundle containing localized messages
+ </description>
+ <attribute>
+ <name>basename</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>prefix</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>message</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.MessageTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.MessageTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Maps key to localized message and performs parametric replacement
+ </description>
+ <attribute>
+ <name>key</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>bundle</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>messageFormat</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.MessageFormatTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.MessageFormatTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Performs parametric replacement on a given pattern string
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>messageArg</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.MessageArgTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Supplies an argument for parametric replacement to a containing
+ <message> or <messageFormat> tag
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>formatNumber</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.FormatNumberTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.FormatNumberTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Formats a numeric value as a number, currency, or percentage
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>parseNumber</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ParseNumberTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Parses the string representation of a number, currency, or percentage
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>formatDate</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.FormatDateTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.FormatDateTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Formats a date and/or time using the supplied styles and pattern
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>dateStyle</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>timeStyle</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>timeZone</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>parseDate</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.fmt.ParseDateTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.ParseDateTEI</tei-class>
+ <body-content>EMPTY</body-content>
+ <description>
+ Parses the string representation of a date and/or time
+ </description>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>type</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>pattern</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/conf/scriptfree.tld b/conf/scriptfree.tld
new file mode 100644
index 0000000..c3f3473
--- /dev/null
+++ b/conf/scriptfree.tld
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>scriptfree</short-name>
+ <uri>http://jakarta.apache.org/taglibs/jsptl/scriptfree</uri>
+ <description>
+ Validates JSP pages to prohibit use of scripting elements.
+ </description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.ScriptFreeTLV
+ </validator-class>
+ <init-param>
+ <param-name>allowDeclarations</param-name>
+ <param-value>false</param-value>
+ <description>
+ Controls whether or not declarations are considered valid.
+ </description>
+ </init-param>
+ <init-param>
+ <param-name>allowScriptlets</param-name>
+ <param-value>false</param-value>
+ <description>
+ Controls whether or not scriptlets are considered valid.
+ </description>
+ </init-param>
+ <init-param>
+ <param-name>allowExpressions</param-name>
+ <param-value>false</param-value>
+ <description>
+ Controls whether or not top-level expressions are considered valid.
+ </description>
+ </init-param>
+ <init-param>
+ <param-name>allowRTExpressions</param-name>
+ <param-value>true</param-value>
+ <description>
+ Controls whether or not expressions used to supply request-time
+ attribute values are considered valid.
+ </description>
+ </init-param>
+ <description>
+ Validates prohibitions against scripting elements.
+ </description>
+ </validator>
+
+ <!-- Every TLD needs at least one 'tag' element. We happily oblige. -->
+
+ <tag>
+ <name>noop</name>
+ <tag-class>javax.servlet.jsp.tagext.TagSupport</tag-class>
+ <body-content>empty</body-content>
+ <description>Does nothing.</description>
+ </tag>
+</taglib>
diff --git a/conf/x-rt.tld b/conf/x-rt.tld
new file mode 100644
index 0000000..4e88913
--- /dev/null
+++ b/conf/x-rt.tld
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>x-rt</short-name>
+ <uri>http://java.sun.com/jstl/ea/xml-rt</uri>
+ <display-name>JSTL XML RT</display-name>
+ <description>JSTL 1.0 XML library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlXmlTLV
+ </validator-class>
+ <description>
+ Provides validation features for JSTL XML tags.
+ </description>
+ </validator>
+
+ <tag>
+ <name>choose</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ <when> and <otherwise>
+ </description>
+ </tag>
+
+ <tag>
+ <name>expr</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.ExprTag</tag-class>
+ <body-content>empty</body-content>
+ <description>
+ Like <%= ... >, but for XPath expressions.
+ </description>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>if</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag, which evalutes its body if the
+ supplied condition is true and optionally exposes a Boolean
+ scripting variable representing the evaluation of this condition
+ </description>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>forEach</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ XML iteration tag.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>otherwise</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that follows <when> tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+ </description>
+ </tag>
+
+ <tag>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Adds a parameter to a containing 'transform' tag's Transformer
+ </description>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>parse</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Parses XML content from 'source' attribute or 'body'; exposes as 'var'.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>domVar</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>source</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>filter</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>set</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Sets the result of an XPath expression evaluation in a 'scope'
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>select</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <!--
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ -->
+ </tag>
+
+ <tag>
+ <name>transform</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.TransformTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Conducts a transformation given a source XML document
+ and an XSLT stylesheet (or Transformer object)
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>result</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>source</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>xslt</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>transformer</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>transformer</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformerTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Exposes a Transformer object
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>xslt</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>when</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.WhenTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that includes its body if its
+ condition evalutes to 'true'
+ </description>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/conf/x.tld b/conf/x.tld
new file mode 100644
index 0000000..b444d29
--- /dev/null
+++ b/conf/x.tld
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>x</short-name>
+ <uri>http://java.sun.com/jstl/ea/xml</uri>
+ <display-name>JSTL XML</display-name>
+ <description>JSTL 1.0 XML library</description>
+
+ <validator>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlXmlTLV
+ </validator-class>
+ <init-param>
+ <param-name>expressionAttributes</param-name>
+ <param-value>
+ parse:source
+ parse:filter
+ transform:source
+ transform:xslt
+ transform:transformer
+ transform:result
+ transformer:xslt
+ </param-value>
+ <description>
+ Whitespace-separated list of colon-separated token pairs
+ describing tag:attribute combinations that accept expressions.
+ The validator uses this information to determine which
+ attributes need their syntax validated.
+ </description>
+ </init-param>
+ <description>
+ Provides validation features for JSTL XML tags.
+ </description>
+ </validator>
+
+ <!-- The validator also listens in order to recover a context parameter -->
+ <listener>
+ <listener-class>
+ org.apache.taglibs.standard.tlv.JstlCoreTLVHelper
+ </listener-class>
+ </listener>
+
+ <tag>
+ <name>choose</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ <when> and <otherwise>
+ </description>
+ </tag>
+
+ <tag>
+ <name>expr</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.ExprTag</tag-class>
+ <body-content>empty</body-content>
+ <description>
+ Like <%= ... >, but for XPath expressions.
+ </description>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>if</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Simple conditional tag, which evalutes its body if the
+ supplied condition is true and optionally exposes a Boolean
+ scripting variable representing the evaluation of this condition
+ </description>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>forEach</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ XML iteration tag.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>otherwise</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that follows <when> tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+ </description>
+ </tag>
+
+ <tag>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.xml.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Adds a parameter to a containing 'transform' tag's Transformer
+ </description>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>parse</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.xml.ParseTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Parses XML content from 'source' attribute or 'body'; exposes as 'var'.
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>domVar</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>source</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>filter</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>set</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Sets the result of an XPath expression evaluation in a 'scope'
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>select</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <!--
+ <attribute>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ -->
+ </tag>
+
+ <tag>
+ <name>transform</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.xml.TransformTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.TransformTEI</tei-class>
+ <body-content>JSP</body-content>
+ <description>
+ Conducts a transformation given a source XML document
+ and an XSLT stylesheet (or Transformer object)
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>result</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>source</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>xslt</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>transformer</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>transformer</name>
+ <tag-class>org.apache.taglibs.standard.tag.el.xml.TransformerTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Exposes a Transformer object
+ </description>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>xslt</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>when</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.WhenTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>
+ Subtag of <choose> that includes its body if its
+ condition evalutes to 'true'
+ </description>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/doc/conf/web.xml b/doc/conf/web.xml
new file mode 100644
index 0000000..39236b3
--- /dev/null
+++ b/doc/conf/web.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
+
+<web-app>
+
+ <description>
+ Documentation for the 'standard' tag library (JSTL EA2)
+ </description>
+
+</web-app>
diff --git a/doc/web/Conditionals_FunctionalDescription_1_EA1.html b/doc/web/Conditionals_FunctionalDescription_1_EA1.html
new file mode 100644
index 0000000..96a2cb7
--- /dev/null
+++ b/doc/web/Conditionals_FunctionalDescription_1_EA1.html
@@ -0,0 +1,152 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>JSTL: Conditional Tags -- Functional Description</title>
+<style media="screen" type="text/css"><!--
+.fixme { color: red }
+--></style>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>
+
+ <hr width="100%" noshade>
+</h3>
+
+<h2> Conditional Tags — Functional Description</h2>
+
+<h2> <tt><if></tt><br>
+ <tt><choose> <when> <otherwise> </tt></h2>
+<hr WIDTH="100%" noshade>
+<h3>
+1. Introduction</h3>
+The set of JSTL conditional tags are designed to support the two most
+common usage patterns associated with conditional processing: <i>simple</i>
+conditional execution and <i>mutually exclusive</i> conditional execution.
+The JSTL conditional tags are similar to the XSLT instructions for conditional
+processing (<tt><xsl:if></tt> and <tt><xsl:choose></tt>).
+<p>A simple conditional execution tag evaluates its body content only if
+the test condition associated with it is true. In the following example,
+a special greeting is displayed only if this is a customer's first visit
+to the site.
+<p><tt> <c:if test="$user.visitCount == 1"></tt> <br>
+ <tt> This is your first visit. Welcome to the
+site!</tt>
+<br>
+ <tt> </c:if></tt>
+<p>With mutually exclusive conditional execution, only one among a number
+of possible alternative tags gets its body content evaluated. In the example
+below, the information displayed for a specific product depends on the
+verbosity level selected.
+<p><tt> <choose></tt> <br>
+ <tt> <when test="$verbosityLevel == 'short'></tt> <br>
+ <tt> <c:expr value="$product.shortDescription"/></tt>
+ <br>
+ <tt> </when></tt> <br>
+ <tt> <when test="$verbosityLevel == 'medium'></tt> <br>
+ <tt> <c:expr value="$product.mediumDescription"/></tt>
+ <br>
+ <tt> </when></tt><br>
+ <tt> <otherwise></tt> <br>
+ <tt> <c:expr value="$product.longDescription"/></tt>
+ <br>
+ <tt> </otherwise></tt> <br>
+ <tt> </choose></tt>
+<h3>
+2. <tt><if></tt></h3>
+The <tt><if></tt> tag evaluates its body only if the test condition
+returns true.
+<br>
+<table BORDER CELLSPACING=2 CELLPADDING=5 WIDTH="709" >
+ <tr BGCOLOR="#FFFACD">
+ <th ALIGN=LEFT COLSPAN="4">Attributes</th>
+ </tr>
+ <tr>
+ <td><tt>test</tt></td>
+ <td>required</td>
+ <td>expr</td>
+ <td>The test condition to be evaluated. The value returned by the attribute
+ must either be a <tt>boolean</tt> primitive or a <tt>Boolean</tt> object
+ (EL library). Must be a Boolean object in the RT library.</td>
+ </tr>
+ <tr>
+ <td><tt>var</tt></td>
+ <td>optional</td>
+ <td>string</td>
+ <td>Name of the page scope attribute used to store the current result of the
+ test condition. Visibility is "at_end".</td>
+ </tr>
+</table>
+
+<h3>
+3. <tt><choose></tt></h3>
+The <tt><choose></tt> tag performs conditional block execution embedded
+by the <tt><when></tt> sub tags. It renders the body of the first <tt><when></tt>
+tag whose test condition evaluates to true. If none of the test conditions
+of nested <tt><when></tt> tags evaluate to true, then the body of an
+<tt><otherwise></tt>
+tag is evaluated, if present.
+<p>The <tt><choose></tt> tag has no attributes.
+<h3>
+4. <tt><when></tt></h3>
+The <tt><when></tt> tag is used within a <tt><choose></tt> tag. The
+<tt><choose></tt>
+tag renders the body of the first <tt><when></tt> tag whose test condition
+evaluates to true. The immediate parent of a <tt><when></tt> tag must
+be a <tt><choose></tt> tag, otherwise an exception will be thrown.
+<br>
+<table BORDER CELLSPACING=2 CELLPADDING=5 WIDTH="709" >
+<tr BGCOLOR="#FFFACD">
+<th ALIGN=LEFT COLSPAN="4">Attributes</th>
+</tr>
+
+<tr>
+<td><tt>test</tt></td>
+
+<td>required</td>
+
+<td>expr</td>
+
+ <td>The test condition to be evaluated. The value returned by the attribute
+ must either be a <tt>boolean</tt> primitive or a <tt>Boolean</tt> object
+ (EL library). Must be a Boolean object in the RT library. </td>
+</tr>
+</table>
+
+<h3>
+5. <tt><otherwise></tt></h3>
+The <tt><otherwise></tt> tag is used as the last subtag within a <tt><choose></tt>
+tag. The <tt><choose></tt> tag renders the body of the <tt><otherwise></tt>
+tag if none of the preceding <tt><when></tt> tags test conditions evaluated
+to true. The immediate parent of an <tt><otherwise></tt> tag must be
+a <tt><choose></tt> tag otherwise an exception will be thrown.
+<p>This tag has no attributes.
+<h3> 6. Custom logic tags</h3>
+It is important to note that <tt><if></tt> and <tt><when></tt> tags
+have different semantics. These semantic differences are enforced by the
+fact that only <tt><when></tt> tags can be used within the context of
+a mutually exclusive conditional execution (<tt><choose></tt> tag).
+<p>This clean separation of behavior also impacts the way custom logic
+tags (i.e. tags who render their bodies depending on the result of a test
+condition) should be developed. Ideally, the result associated with the
+evaluation of custom logic tag should be usable both in the context of
+a simple conditional execution, as well as in a mutually exclusive conditional
+execution.
+<p>The proper way to support this is by simply having a custom logic tag
+export a boolean scripting variable. This boolean scripting variable can
+then be used as the test condition of a <tt><when></tt> subtag. For
+example:
+<p><tt> <paramExists name="hotel" var="needsHotel"/></tt> <br>
+ <tt> <choose></tt>
+<br>
+ <tt> <when test="$needsHotel"></tt> <br>
+ <tt> ...</tt>
+<br><tt> </when></tt>
+<br><tt> <otherwise></tt>
+<br><tt> ...</tt>
+<br><tt> </otherwise></tt>
+<br><tt> </choose></tt>
+<br>
+
+</body>
+</html>
diff --git a/doc/web/ExpressionLanguageSupport_FunctionalDescription_2_EA1.html b/doc/web/ExpressionLanguageSupport_FunctionalDescription_2_EA1.html
new file mode 100644
index 0000000..f93766b
--- /dev/null
+++ b/doc/web/ExpressionLanguageSupport_FunctionalDescription_2_EA1.html
@@ -0,0 +1,357 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Pierre Delisle">
+ <title>JSTL: Expression Language Support -- Functional Description</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h2>
+
+ <hr WIDTH="100%" noshade>
+</h2>
+
+<h2> Expression Language Support — Functional Description</h2>
+<hr width="100%" noshade>
+<h3>
+1. Introduction</h3>
+Support for an Expression Language (EL) is a clear requirement for JSTL1.0. We
+need to address this requirement even though it is utimately the responsibility
+of the JSR152 expert group to specify how an EL can be seamlessly integrated in
+JSP, as well as which expression language(s) is/are to be supported by JSP containers.
+<p>In our quest for an interim solution, JSTL is constrained by the fact
+that this solution must work in the context of JSP1.2, without requiring
+any change to the spec, and that it should integrate seamlessly with JSP.next
+(where an EL would be supported natively). It is also important to consider
+the fact that the specification of an expression language is a rather controversial
+issue that could trigger long debates among the expert group, preventing
+us from getting anything out in any timely fashion.
+<p>Our strategy therefore consists in allowing the easy integration, selection,
+and use of a variety of expression languages via an Expression Language
+Integration API, a set of tags, as well as conventions used throughout
+JSTL. We won't rule on any specific EL immediately. Rather we will allow
+various implementations of Expression Languages to all play in our sandbox.
+The hope is that through experimentation, it will be much easier to evaluate
+the merits of each approach, paving the way for the selection of a single
+or limited number of Expression Language(s) for the final draft of JSTL.
+<h3>
+2. Integration of an Expression Language in JSTL1.0</h3>
+An important requirement for support of an Expression Language within JSTL
+was that a single attribute should support a value specified in any of
+the following 3 forms:
+<p><tt> a. String literal
+att="15"</tt>
+<br><tt> b. rtexprvalue
+att="<%= foo.getBar() %>"</tt>
+<br><tt> c. elexprvalue
+att="$foo.bar"</tt>
+<p>This requirement made a lot of sense for the following reasons
+<ul>
+<li>
+logically consistent</li>
+
+<li>
+easy to learn</li>
+
+<li>
+lets our tags transition nicely into the future when JSP.next provides
+native support for an Expression Language</li>
+</ul>
+However, there are many issues in trying to support this given that it
+must work in the context of JSP1.2, without requiring any changes to the
+spec. The most important issue we identified is the danger that an rtexprvalue
+could return a String beginning with '$' (or any other metacharacter used
+by an EL to identify an elexprvalue). This wouldn't be a common 'accidental'
+case, but the fear is that it could become something of a security issue.
+If an rtexprvalue's result is based on user input -- e.g.,
+<p><tt> <%= request.getParameter("username")
+%></tt>
+<p>-- and the user 'maliciously' enters text beginning with '$' in order
+to establish a context for unchecked evaluation of an expression, an application
+might be coerced into acting in unintentional and unpredicted ways.
+To be safe, every rtexprvalue that picks up data from user input would
+need to be wrapped in a routine that escapes a leading '$' if present.
+<p>Because of this security concern, it was decided to use a different
+mechanism to integrate an EL. It consists in using <i>twin</i> tag libraries,
+as described in the next section.
+<h3>
+2. Twin Tag Libraries to support the Expression Language</h3>
+Among the mechanisms that are now available in JSP1.2 is the ability to deliver
+more than one taglib in the same JAR file. JSTL therefore has two flavors of libraries:
+<b>RT</b> (<b>rt</b>exprvalues) and <b>EL</b> (<b>el</b>exprvalues). They only
+differ in the way they support expressions for attribute values.
+<p>In an RT tag library, attributes that support expressions support them as 'rtexprvalues';
+ i.e. as expressions specified in the page's scripting language (and evaluated
+ at runtime). This is exactly how things currently work in tag libraries.
+<p>In an EL tag library, attributes that support expressions support them as 'elexprvalues';
+ i.e. as expressions specified in the JSTL Expression Language (and evaluated
+ at runtime as well). 'rtexprvalues' are not allowed when using an EL tag library.
+ An 'elexprvalue' is a String literal in the syntax of the EL. It is the responsibility
+ of the EL to define the metacharacter(s) used to discriminate expressions from
+ String literals (e.g. use $ at the beginning of an expression).
+<p>JSTL therefore provides two sets of URIs, one for tags that accept rtexprvalues,
+ and one for tags that accept elexprvalues. Twin libraries therefore support
+ the same tags with the same syntax, except that one takes rtexprvalues, the
+ other takes elexprvalues.
+<h4>
+Usage</h4>
+<p>These twin tag libraries can be accessed in the following way in a JSP page
+ (using the "core" taglib as an example):<br>
+ <br>
+ <tt> <%@ taglib uri="http://java.sun.com/jstl/ea/core"
+ prefix="c" %><br>
+ </tt><tt><%@ taglib uri="http://java.sun.com/jstl/ea/core-rt"
+ prefix="c-rt" %></tt> </p>
+<p>In our examples, we append the value '-rt' to differentiate the 'rtexprvalue"
+ library from its 'elexprvalue' twin. It is possible to use the two libraries
+ within the same page, although not recommended for clarity and consistency.
+</p>
+<p>Within the same tag, all attribute values specified as expressions will
+have to be specified either as 'rtexprvalue' or 'elexprvalue' (cannot mix
+within the same tag), depending on which tag library the tag belongs to.
+<h3>
+3. Expression Language Selection</h3>
+It is possible to define a web-application's default expression language
+via the context parameter <tt>javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass</tt>.
+The class specified must implement interface <tt>ExpressionEvaluator </tt>(see
+below).
+<p>It is also possible to override the default expression language setting
+with the <tt><expressionLanguage></tt> action. For example:
+<p><tt> <jx:expressionLanguage evaluator="<i>evaluator-class</i>"></tt>
+<br><tt> <jx:forEach items="{products/@key}"></tt>
+<br><tt>
+...</tt>
+<br><tt> </jx:forEach></tt>
+<br><tt> </jx:expressionLanguage></tt>
+<p>The scope of the expression language specified by the action <tt><expressionLanguage></tt>
+is limited to its body. <tt><expressionLanguage></tt> actions can be
+nested, where nested occurrences shadow their ancestors .
+<p>It is illegal to use an expression in a context where no expression
+evaluator is specified (i.e., no <tt>web.xml</tt> declaration and no enclosing
+<tt><expressionLanguage></tt>).
+<p>The above rules make it possible to validate the syntax of an
+<tt>elexprvalue</tt>
+at translation time.
+<p>If JSTL rules on a single EL, then both the context parameter and the
+tag will become illegal.
+<h3>
+6. Expression Language API</h3>
+User code is expected to only interact with <tt>ExpressionEvaluatorManager</tt>
+which is reponsible to delegate the requested operation to the currently
+<i>active
+</i><tt>ExpressionEvaluator</tt>.
+[Even if JSTL eventually selects a single EL, this will still be the way
+to access the EL]
+<p><tt> public class ExpressionEvaluatorManager {</tt>
+<br><tt> /**</tt>
+<br><tt> * Invokes the
+evaluate() method on the</tt>
+<br><tt> * "active" ExpressionEvaluator.</tt>
+<br><tt> */</tt>
+<br><tt> public static Object
+evaluate(String attributeName,</tt>
+<br><tt>
+String expression,</tt>
+<br><tt>
+Class expectedType,</tt>
+<br><tt>
+Tag tag,</tt>
+<br><tt>
+PageContext pageContext)</tt>
+<br><tt> throws
+ExpressionException, JspException;</tt>
+<br><tt> }</tt>
+<p>As a result of evaluating an expression, two types of Exceptions can
+be thrown by the ExpressionEvaluator.
+<ul>
+ <li> <tt>JspException</tt></li>
+ <p>Fatal condition that should never be caught by the user code. <br>
+
+ <li> <tt>ExpressionException</tt></li>
+ <br>
+ <p>An error related to the evaluation of a particular exception, which is not
+ expected to cause further problems when evaluating any other expressions.
+ Tags may catch this if they wish to detect failure of an expression to complete
+ evaluation satisfactorily.
+</ul>
+The distinction between these two types of exceptions is useful for actions
+such as <tt><expr></tt> that prefers displaying a default value rather
+than having an error page displayed should an object in the expression
+be inaccessible (e.g. if <tt>address</tt> yielded a null pointer in the
+expression <tt>$customer.address.city</tt>). The EL therefore decides what's
+fatal (<tt>JspException</tt>) and what isn't (<tt>ExpressionException</tt>).
+<p><tt> public class ExpressionException extends JspException;</tt>
+<p>The integration of custom Expression Languages will be possible
+during the Early Access phase of JSTL to help us experiment with various
+ELs. An Expression Language implementation simply needs to implement interface
+<tt>ExpressionEvaluator</tt>.
+Check the details of the JSTL implementation to see if there are any constraints
+on the implementation of an ExpressionEvaluator.
+<br>[For example, one could impose that the implementation of <tt>ExpressionEvaluator</tt>
+be thread-safe, and that there is no guarantee that a single instance
+will be used for all evaluations (if an implementation of an <tt>ExpressionEvaluator</tt>
+wants to store state (such as an expression cache), a static member variable
+with proper synchronization should then be used).]
+<p><tt> public interface ExpressionEvaluator {</tt>
+<br><tt> /**</tt>
+<br><tt> * Translation
+time validation of an expression.</tt>
+<br><tt> * This method
+will return a null String if the expression</tt>
+<br><tt> * is valid; otherwise
+an error message.</tt>
+<br><tt> */</tt>
+<br><tt> public String validate(String
+attributeName,</tt>
+<br><tt>
+String expression);</tt>
+<p><tt> /**</tt>
+<br><tt> * Evaluates the
+expression at request time.</tt>
+<br><tt> */</tt>
+<br><tt> public Object evaluate(String
+attributeName,</tt>
+<br><tt>
+String expression,</tt>
+<br><tt>
+Class expectedType,</tt>
+<br><tt>
+Tag tag,</tt>
+<br><tt>
+PageContext pageContext)</tt>
+<br><tt> throws
+ExpressionException, JspException;</tt>
+<br><tt> }</tt>
+<h3>
+7. Custom Tags using the JSTL Expression Language(s)</h3>
+Custom tag developers can support expression languages in their tags using
+the same conventions established in this document.
+<p>Assuming a custom action named <tt>foo</tt>; one could have the following
+implementation classes:
+<p><tt> FooTag</tt>
+<br><tt>
+/ \</tt>
+<br><tt> /
+\</tt>
+<br><tt> FooTagRT FooTagEL</tt>
+<p>The only code in FooTagRT and FooTagEL are the setter and getter methods
+for the attributes that support expressions (they cannot be inherited because
+the properties do not have the same type; String for EL and the "native"
+type for RT).
+<p>FooTagEL also needs to override doStartTag() to evaluate the elexprvalue
+first, and then call back into the base class. For example:
+<p><tt> public void setFoo(String fooEL) throws JspException {</tt>
+<br><tt> this.fooEL = fooEL;</tt>
+<br><tt> }</tt>
+<p><tt> public int doStartTag() throws JspException {</tt>
+<br><tt> foo = ExpressionEvaluatorManager.evaluate</tt>
+<br><tt>
+("foo", fooEL, FooType.class, this, pageContext);</tt>
+<br><tt> }</tt>
+<br><tt> return super.doStartTag();</tt>
+<br><tt> }</tt>
+<p>It is important to note that the evaluation of the expression must be
+performed within the <tt>doStartTag()</tt> method. The lifecycle of a tag
+is such that the setter method of values that no not change (string literals)
+may not necessarily be called if the tag is reused by the container. Since
+an elexprvalue is specified as a string literal, this could cause an elexprvalue
+to not to be "re-evaluated" if the evaluation were to be performed in the
+setter method.
+<p>Two TLDs must be written. The only differences are:
+<ul>
+<li>
+tool support info elements (short-name, description, etc...)</li>
+
+<li>
+<uri></li>
+
+<br>(e.g. "http://acme.com/mytaglib-rt", "http://acme.com/mytaglib-el")
+<li>
+<tag-class> for each attribute that supports expression values</li>
+
+<br>(e.g. FooTagRT vs FooTagEL)
+<li>
+<rtexprvalue> true for the RT tag library, false for EL tag library</li>
+</ul>
+When JSP.next comes, a unified tag library can be created. All there is
+to do is merge the base classes with the RT classes, and remove the 'EL'
+classes and the EL TLD.
+<h3>
+8. Validation of elexprvalues at translation time</h3>
+@@@ FIXME During the Early Access phase where multiple ELs are made available
+for experimentation, translation time validation of elexprvalues must be performed
+by a TagLibraryValidator so the proper ExpressionEvaluator can be invoked for
+the validation (a TEI would not be able to establish the execution context). One
+such TagLibraryValidator, <tt>ExpressionEvaluatorTLV</tt>, is made available
+to support translation time validation of elexprvalues of JSTL tags, as well
+as for any other custom tag library.
+<p>It supports an initialization parameter (<tt>custom-taglibs)</tt> to
+specify the list of custom tag libraries that should be validated for elexprvalues
+(* to specify all).
+<p>For example:
+<p><tt> <taglib></tt>
+<br><tt> ...</tt>
+<br><tt> <validator></tt>
+<br><tt> <validator-class>javax.servlet.jsp.jstl.core.ExpressionEvaluatorTLV</validator-class></tt>
+<br><tt> <init-param></tt>
+<br><tt> <param-name>custom-taglibs</param-name></tt>
+<br><tt> <param-value>*</param-value></tt>
+<br><tt> </init-param></tt>
+<br><tt> </validator></tt>
+<br><tt> ...</tt>
+<br><tt> </taglib></tt>
+<p>If the JSTL ends up specifying a single EL, then translation-time validation
+could be performed within the TagExtraInfoClass by simply calling <tt>ExpressionEvaluatorManager.validate()
+</tt>on
+each elexprvalue.
+<h3>
+9. Relationship with future JSP specs</h3>
+The expression language integration model for JSTL will work fine with
+JSP 1.2 containers and above. Nothing in that model gets in the way of
+the JSP specification should it decide to include native support for expression
+language(s).
+<p>When a JSP spec comes with native support for an EL (JSP.next), the
+assumption is that EL expressions would be supported natively only for
+attributes where rtexprvalue=true.
+<p>The twin libraries would behave as follows in a JSP.next environment:
+<ul>
+<li>
+<b>JSTL-1.0-RT</b></li>
+
+<br>Will keep working as before, with the addition that it will also be
+possible to specify elexprvalues.
+<li>
+<b>JSTL-1.0-EL</b></li>
+
+<br>Tags will keep working exactly as before; no change. The elexprvalues
+will still be evaluated by the tag library, and not the container since
+rtexprvalue=false for all attributes in that tag library.</ul>
+The only drawback to the semantics of 'EL is only interpreted in a rtexprvalue
+attribute' is that somebody can type a="$expr" and get a literal when they
+really meant "evaluate expr".
+<p>Is it important or not? One may argue that most attributes support rtexprvalues,
+except for the few cases where the value needs to be known at translation
+time (in which case elexprvalues cannot be used). For example:
+<ul>
+<li>
+scripting variable names</li>
+
+<li>
+value is the *type* of a scripting variable exported by the tag</li>
+
+<li>
+value needs to be known by a validator (e.g., for the <jsptl:expressionLanguage>
+tag)</li>
+</ul>
+This is a JSP.next issue. If this is seen as an important issue, it could
+be made a translation-time error to use unescaped $ syntax in a non-rtexpr
+attribute. But this would have the disadvantage of breaking JSPs that use
+the EL version of the twin tag libraries.
+<p>At the same time as JSP.next comes out, the goal would be to have a
+new version of the tag library that removes the distinction between RT
+and EL. For example: "http://java.sun.com/jsptl-1.0" (no suffix). The TLD
+would state a dependency on JSP.next.
+<br>
+<br>
+</body>
+</html>
diff --git a/doc/web/ExpressionTags_FunctionalDescription_1_EA1.html b/doc/web/ExpressionTags_FunctionalDescription_1_EA1.html
new file mode 100644
index 0000000..171e76e
--- /dev/null
+++ b/doc/web/ExpressionTags_FunctionalDescription_1_EA1.html
@@ -0,0 +1,130 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Pierre Delisle">
+ <title>JSTL: Expression Language Support Tags -- Functional Description</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h2>
+
+ <hr WIDTH="100%" noshade>
+</h2>
+
+<h2>
+Expression Language Support Tags - Functional Description</h2>
+<h2><tt><expr><br>
+ <set><br>
+ <declare> </tt></h2>
+<hr width="100%" noshade>
+<h3>
+1. <tt><expr></tt></h3>
+The <tt><expr></tt> action evaluates an expression and outputs the result
+of the evaluation to the current JspWriter object. It is the equivalent
+of <tt><%= %></tt> with the difference that it is meant for the Expression
+Language world (as opposed to the scripting language world).
+<p>The expression to be evaluated is specified via the attribute <tt>value</tt>
+and must be in the syntax of the current Expression Language. The result
+of the evaluation is coerced to a String and is subsequently emitted into
+the current JspWriter object.
+<p>For example:
+<p><tt> Hello <c:expr value="$request:name"/></tt>
+<p>is equivalent to
+<p><tt> Hello <%=pageContext.getAttribute("name", PageContext.SCOPE_REQUEST)%></tt>
+<p>assuming the expression language interprets the elexprvalue <tt>$request:name</tt>
+as meaning the value of the name attribute in the request scope.
+<p>As a convenience, this action also supports the notion of <i>default value</i>
+ for cases where the value of an object in the elexprvalue is not accessible.
+ The default condition is triggered when the Expression Language throws an ExpressionException
+ while evaluating the expression (to report failure to complete evaluation satisfactorily)
+ or if the evaluation of the expression completes, but the result is null. This
+ condition usually happens when one of the objects in the expression is null.
+ For example, in the example below, this exception would be thrown if the address
+ property of the customer object were null. Check the details of the expression
+ language to clearly understand under which circumstances the ExpressionException
+ is thrown.
+<p>The default value can be specified either via attribute <tt>default:</tt>
+<p><tt> <c:expr value="$customer.address.city" default="unknown"/></tt>
+<p>or within the body of the tag:
+<p><tt> <c:expr value="$customer.address.city"></tt>
+<br><tt> <acme:defaultCity/></tt>
+<br><tt> </c:expr></tt>
+<p>The two ways to specify a default value cannot be used simultaneously.
+<p>The <tt><expr></tt> action is only available in the EL version of
+ the library.
+<h3>
+2. <tt><set></tt></h3>
+The <tt><set></tt> action sets the value of an attribute in any of the
+JSP scopes (page, request, session, application). If the attribute does
+not already exist, it is created.
+<p>The JSP scoped attribute can be set either from attribute value:
+<p><tt> <c:set var="foo" scope="session" value="..."/></tt>
+<p>or from the body of the tag:
+<p><tt> <c:set var="foo"></tt> <br>
+ <tt> ...</tt>
+<br><tt> </c:set></tt>
+<p>Setting the value of a JSP scoped attribute from the tag's body content
+is useful to solve the problem associated with the fact that a tag attribute's
+value cannot be set from a tag. In the past, a tag developer would have
+to offer extra "attributes as tags" so the value of these attributes could
+be set from other tags. For example:
+<p><tt> <acme:atag></tt> <br>
+ <tt> <x:att1><x:foo>mumbojumbo</x:foo></x:att1></tt>
+<br>
+ <tt> </acme:atag></tt>
+<p>With the <tt><set></tt> tag, this can be handled without requiring
+the extra <tt><att1></tt> tag.
+<p><tt> <c:set var="att1"><x:foo>mumbojumbo</x:foo></c:set></tt>
+ <br>
+ <tt> <acme:atag att1="$att1"/></tt>
+<p><font size=+0>Attribute <tt>scope</tt> is used to specify the scope
+of the JSP attribute targetted by the <set> tag. It is an optional attribute
+that defaults to "page". The accepted values are restricted to: page, request,
+session, and application.</font>
+<p><font size=+0>The <set> tag is only available in the EL version of the library</font><font size=+0>.</font>
+<h3> 3. <tt><declare></tt></h3>
+Given that an Expression Language is supported in JSTL, the need for scripting
+should be reduced substantially. However, until a JSP.next comes around
+with native support for the Expression Language, page authors will still
+have to deal with situations where some attributes of non-JSTL tags must
+be specified as rtexprvalues.
+<p>For example, <myTag> below expects to receive an "Order" object using an
+ rtexprvalue. Because <code>var</code> is not exported as a scripting variable
+ in the <forEach> tag, the code below would trigger a translation time error
+ because the scripting variable customer does not exist.
+<p><tt> <c:forEach items="$customers" var="customer"></tt>
+ <br>
+ <tt> <acme:myTag order=<%=customer.getOrder()%>
+/></tt>
+<br><tt> </c:forEach></tt>
+<p>There needs to be a simple way to define a scripting variable to bridge
+the gap between the EL and scripting worlds until JSP.next comes.
+<p>The <tt><declare></tt> tag is used for that purpose. In the example below,
+ a scripting variable "customer" is created as a reference to the JSP scoped
+ attribute of the same name.
+<p><tt> <c:forEach items="$customers" var="customer"></tt>
+ <br>
+ <tt> <c:declare id="customer"
+ type="acme.Customer"/></tt> <br>
+ <tt> <acme:myTag order=<%=customer.getOrder()%>
+/></tt>
+<br><tt> </c:forEach></tt>
+<p>When jsp.next comes, the above code would simply become:
+<p><tt> <c:forEach items="$customers" var="customer"></tt>
+ <br>
+ <tt> <acme:myTag order="$customer.order"
+/></tt>
+<br><tt> </c:forEach></tt>
+<p>without requiring any modification to the <tt><acme:myTag></tt> tag.
+<p>The same requirement for a bridge between the EL and scripting worlds exists
+ whether a page author uses the EL or RT version of JSTL. This tag therefore
+ exists in both the EL and RT versions of thelibrary.
+<ul>
+ <li> <b><tt>id</tt></b> The name of the scripting variable to be exported</li>
+ <li> <b><tt>type</tt></b> The type of the scripting variable. Optional. Defaults
+ to java.lang.Object.</li>
+</ul>
+The visibility of the scripting variable is always AT_END. <br>
+
+</body>
+</html>
diff --git a/doc/web/GettingStarted.html b/doc/web/GettingStarted.html
new file mode 100644
index 0000000..95ff548
--- /dev/null
+++ b/doc/web/GettingStarted.html
@@ -0,0 +1,239 @@
+<html>
+<head>
+<title>JSTL: Getting Started</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<h1>Getting started with JSTL (EA2)</h1>
+
+<p>This document describes how to get up and running quickly with JSTL's
+second early-access release. It can be useful to page authors and tag
+developers who are interested in JSTL's functionality. Using the
+"jstl-examples" application is also a great way to familiarize yourself
+with JSTL's functionality and use.</p>
+
+<p><b>IMPORTANT:</b> This release of JSTL is an early-access release and
+does not represent a standard of any kind. The API and implementation are
+subject to change in the future. The major purpose of this release is to
+provide early information to the community of JSP developers about the
+direction and scope of JSTL. Community feedback is actively sought; if
+you have any comments, please email us at
+<a href="mailto:jsr052-comments@sun.com">jsr052-comments@sun.com</a>.
+
+<hr />
+<h2>Introduction</h2>
+
+<a name="#1.1" />
+<h3>What is JSTL? Where does it come from?</h3>
+
+<p>JSTL is the JSP(tm) Standard Tag Library. It is an effort of the Java
+Community Process (JCP) and comes out of the JSR-052 expert group.</p>
+
+<a name="#1.2" />
+<h3>What does JSTL do?</h3>
+
+<p>JSTL encapsulates, as simple tags, core functionality common to many
+JSP applications. For example, instead of suggesting that you iterate
+over lists using a scriptlet or different iteration tags from
+numerous vendors, JSTL defines a standard <forEach> tag that works
+the same everywhere.</p>
+
+<p>This standardization lets you learn a single tag and use it on multiple
+JSP containers. Also, when tags are standard, containers can recognize
+them and optimize their implementations.</p>
+
+<p>The current early-access release of JSTL has support for core iteration
+and control-flow features, text inclusion, internationalizaton-capable
+formatting tags, and XML-manipulation tags. It also supports an
+<i>expression language</i> to simplify page development, and it includes
+an experimental version of several such languages for testing purposes.
+Developers may also be interested in JSTL's current extensibility
+mechanisms; JSTL currently provides a framework for integrating custom
+tags with JSTL tags.</p>
+
+<h3>What does "early access" mean?</h3>
+
+<p>As we noted above, <b>this release of JSTL is not an official release;
+it does not represent a final standard of any kind</b>. Basing production
+systems on the APIs and implementations offered here is not advised. The
+good news is that you still have time to comment on JSTL before it is
+finalized: mail us at <a href="mailto:jsr052-comments@sun.com">
+jsr052-comments@sun.com</a> if you have any comments.</p>
+
+<h3>What has changed since EA1?</h3>
+<p>Please see the <a href="ReleaseNotes.html">Release Notes</a> document
+for information on JSTL RI changes.</p>
+
+<hr />
+<h2><a name="#2" />Getting started quickly</h2>
+
+<p>JSTL EA2 uses features provided only by the JSP 1.2 standard draft, so
+it requires a JSP 1.2 container. We recommend you test JSTL with Tomcat
+4.0.</p>
+
+<p>To install Tomcat, follow the instructions at <a
+href="http://jakarta.apache.org/tomcat">http://jakarta.apache.org/tomcat</a>.
+To install the JSTL libraries for use in a web application, follow the
+instructions at <a
+href="http://jakarta.apache.org/taglibs/binarydist.html">
+http://jakarta.apache.org/taglibs/binarydist.html</a>. You can also use
+the "jstl-examples" application as a guide.</p>
+
+<!--
+<p>If your web application does not already use an XML parser, you will
+need to make one available because current versions of Tomcat do not. See
+the Tomcat 4 release notes (RELEASE-NOTES-4.0-B7.txt in the top level
+directory of your Tomcat distribution) for more information about XML
+parsers in Tomcat 4.</p>
+-->
+
+<h3>Multiple tag libraries</h3>
+
+<p>See the <a href="Overview.html">Overview Document</a> for information
+on JSTL's constituent tag libraries. That document lists JSTL's
+current TLD URIs and recommended taglib prefixes.</p>
+
+<p>Using the JSTL libraries is simple; you simply need to import them into
+your JSP pages using the <b>taglib</b> directive. For instance, to import
+the core JSTL library into your page, you would include the following line
+at the top of your JSP page, as follows:</p>
+
+<pre>
+ <%@ taglib uri="http://java.sun.com/jstl/ea/core" prefix="c" %>
+</pre>
+
+<h3>Expression languages</h3>
+
+<p>Half of JSTL's tag libraries -- the recommended ones -- rely on an
+expression language. To facilitate experimentation and feedback, the
+JSTL RI currently lets you switch between a number of different languages.
+For EA2, the ECMAScript language is the default.</p>
+
+<p>The expression language for a web application is configured by
+setting the servlet context parameter
+<tt>javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass</tt> to the class
+containing the expression-evaluation logic you wish to use. In
+<tt>jstl.jar</tt>, the SPEL is identified by the class
+<tt>org.apache.taglibs.standard.lang.spel.Evaluator</tt>; JPath is identified
+by the class
+<tt>org.apache.taglibs.standard.lang.jpath.JPathExpressionEvaluator</tt>;
+JXPath's evaluator is
+<tt>org.apache.taglibs.standard.lang.jxpath.JXPathExpressionEvaluator</tt>;
+and the JavaScript/Rhino evaluator is
+<tt>org.apache.taglibs.standard.lang.javascript.javascript.JavascriptExpressionEvaluator</tt>.
+(For an example of how this context parameter is set, see the
+<tt>web.xml</tt> file that comes with the <tt>jstl-examples</tt>
+application.)</p>
+
+<p>In JSTL EA2, you can also mix different expression languages on the
+same page using the <tt><expressionLanguage></tt> tag. This tag's
+<tt>evaluator</tt> attribute points to the class containing the
+expression-evaluation logic you wish to use. See the Functional
+Description of expression-language support for more information.</p>
+
+<p>The attributes in tags for the EL version of the library do not accept
+rtexprvalues. Instead, you specify literal expressions that the tags
+evaluate at runtime. For example:</p>
+
+<pre>
+ <jx:forEach items="<b>$page:myItems</b>" />
+</pre>
+
+<i><b>Important:</b> The expression-language support included with JSTL
+JSTL EA2 should be considered even more experimental than the rest of the
+package. You should not assume that either the "pluggability" mechanism
+or the prepackaged languages themselves will remain in JSTL's final
+version, or even in the next EA releases.</i>
+
+<h3>Topics covered in JSTL EA2</h3>
+
+<p>As we mentioned above, JSTL EA2 includes core tags to support
+iteration, conditionals, and expression-language support. For more
+information on precisely how these tags work, you should read the
+"Functional Description" documents provided as part of this distribution.
+Here, we just offer a quick roadmap of each feature in order to help
+orient you.</p>
+
+<dl>
+<dt><b>Iteration</b></dt>
+
+<dd>The core iteration tag is <forEach>, which iterates over most
+collections and similar objects you'd think to iterate over.
+<forTokens> lets you iterate over tokens in a <tt>String</tt>
+object; it lets you specify the <tt>String</tt> and the delimiters.</dd>
+
+<dt><b>Conditionals</b></dt>
+
+<dd>JSTL EA2 supports a simple conditional <if> tag along with
+a collection of tags -- <choose>, <when>, and <otherwise>
+-- that support mutually exclusive conditionals. These latter three
+tags let you implement a typical <tt>if/else if/else if/else</tt>
+structure.</dd>
+
+<dt>
+<b>Expression languages</b></dt>
+
+<dd>We described the EL support in JSTL EA2 above. In addition to
+<expressionLanguage>, JSTL EA2 provides a few other tags to
+facilitate use of expression language. <expr> prints out the value
+of a particular expression in the current EL, similar to the way that the
+scriptlet expression (<%= ... %=>) syntax prints out the value of a
+expression in the scripting language (typically Java). <set> lets
+you set a scoped attribute (e.g., a value in the request, page, session,
+or application scopes) with the value of an expression.</dd>
+
+<dt>
+<b>Text inclusion</b></dt>
+
+<dd>JSP supports the <tt>jsp:include</tt> tag, but this standard action is
+limited in that it only supports relative URLs. JSTL EA2 introduces the
+<tt>c:import</tt> tag, which lets you retrieve absolute URLs. For
+instance, you can use <tt>c:import</tt> to retrieve information from the
+web using HTTP URLs, or from a file server using an FTP URL. The tag also
+has some advanced support for performance optimizations, avoiding
+unnecessary buffering of data that's retrieved.</dd>
+
+<dt>
+<b>I18N-capable text formatting</b></dt>
+
+<dd>Formatting data is one of the key tasks in many JSP pages. JSTL
+introduces tags to support data formatting and parsing. These tags
+rely on convenient machinery to support internationalized applications.
+</dd>
+
+<dt>
+<b>XML manipulation</b></dt>
+
+<dd>You can't look anywhere these days without seeing XML, and JSTL
+gives you convenient support for manipulating it from your JSP pages.
+Parse documents, use XPath to select content, and perform XSLT transformations
+from within your JSP pages.</dd>
+
+</dl>
+
+<h3>For tag developers...</h3>
+
+<p>Developers of custom tags should also read the "Functional
+Descriptions" provided for each topic addressed by JSTL EA2. JSTL EA2
+provides some abstract classes that assist with rapid development of tags
+and promote integration of custom tags with JSTL's tag set.</p>
+
+<p>For instance, custom tags can use JSTL's expression-language
+mechanism. As another example, extending
+<tt>javax.servlet.jsp.jstl.core.ConditionalTagSupport</tt> lets you write a
+conditional tag by merely implementing a single method that returns a
+<tt>boolean</tt> value correspondent with your tag's desired conditional
+behavior; also, this base class promotes JSTL's recommended model of
+conditional-tag design.</p>
+
+<p>Similarly, <tt>javax.servlet.jsp.jstl.core.IteratorTagSupport</tt> lets
+you easily implement iteration tags. The handlers for the <forEach>
+and <forTokens> tags extend this class and thus implement the
+<tt>javax.servlet.jsp.jstl.core.IteratorTag</tt> interface, which provides
+a well-defined mechanism for iteration tags to communicate with custom
+subtags you can write. See the "jstl-examples" application for one
+example of how you might use such custom subtags.</p>
+
+</body>
+</html>
diff --git a/doc/web/IOT_Import_FunctionalDescription_5_EA2.html b/doc/web/IOT_Import_FunctionalDescription_5_EA2.html
new file mode 100644
index 0000000..3390663
--- /dev/null
+++ b/doc/web/IOT_Import_FunctionalDescription_5_EA2.html
@@ -0,0 +1,346 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>Import Tag -- Functional Description</title>
+<style media="screen" type="text/css"><!--
+.fixme { color: red }
+--></style>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>
+ <hr width="100%" noshade>
+</h3>
+<h2> Import Tags — Functional Description <br>
+</h2>
+<h2> <tt><c:import><br>
+ </tt><tt><c:param><br>
+ <c:urlEncode> <br>
+ </tt></h2>
+<hr width="100%" noshade>
+<h3> 1. Introduction</h3>
+<p>In the JSP specification, a <jsp:include .../> element provides for the
+ inclusion of static and dynamic resources in the same context as the current
+ page. This is a very convenient feature that is widely used by page authors.
+</p>
+<p>However, <jsp:include> falls short in flexibility and efficiency when
+ page authors need to get access to resources that reside outside of the web
+ application, as well as when the content of the imported resource is used as
+ the source for a companion process/transformation element. More specifically:</p>
+<blockquote>
+ <p><b>Limited to web-app resources</b></p>
+ <p><jsp:include> only supports the inclusion of resources within the same
+ web application. In many situations, page authors have the need to import
+ the content of internet resources specified via an absolute URL. Moreover,
+ as sites grow in size, they may have to be implemented as a set of web applications
+ where importing resources across web-applications is a requirement.</p>
+ <p><b>Unnecessary buffering when the resource included is fed into another element
+ </b> </p>
+ <p>In the example below, the <transform> element uses the content of the
+ included resource as the input of its transformation. The <jsp:include>
+ reads the content of the response, writes it to the body content of the enclosing
+ <transform> element, which then re-reads the exact same content. It
+ would be more efficient if the <transform> element could access the
+ input source directly and avoid the buffering involved in the body content
+ of the <transform> tag.</p>
+ <pre> <acme:transform>
+ <jsp:include page="/exec/employeesList"/><br> <acme:transform/></pre>
+</blockquote>
+<p>The <import> tag has been designed to address the above shortcomings.</p>
+<h3>2. <import></h3>
+<p>There is a wide variety of resources that a page author might be interested
+ in including and/or processing within a JSP page. For instance, the example
+ below shows how the content of the README file at the ftp site of acme.com could
+ be included within the page.</p>
+<blockquote>
+ <p><code><c:import url="ftp://ftp.acme.com/README"/></code></p>
+</blockquote>
+<p>The main motivation behind <import> is to provide a simple, straightforward
+ mechanism to access resources that can be specified via a URL, nothing more.
+ If accessing a resource requires specifying more arguments, then a protocol
+ specific action (e.g. an <http> action) should be used for that purpose.
+ JSTL1.0 does not currently address these protocol specific elements but may
+ do so in future releases.</p>
+<p><import> is therefore the simple, generic way to access URL based resources
+ whose content can then be included and or processed within the JSP page.</p>
+<p><b>Exporting an object: String or Reader</b></p>
+<p>By default, the content of the resource is included inline into the JSP page.
+</p>
+<p>It is also possible to export the content of the resource in two different
+ ways: as a String object (attribute "var"), or as a Reader object
+ (attribute "varReader"). Process/Transform tags can get access to
+ a resource's content through that exported object. Only one of "var"
+ and "varReader" can be specified.</p>
+<p>Simplest way to export the resource content as an object is via the "var"
+ atttibute. The data is <i>cached</i> in a String object and is <i>reusable</i>.
+</p>
+<p>Although more complex in its usage, there may be some performance gains if
+ the resource content is exported as a Reader object (instead of String object).
+ Depending on the implementation and on the type of URL being accessed, it may
+ be possible to access the content directly, without any unnecessary buffering.
+ But please note that there are no performance guarantees; this is an implementation
+ detail.</p>
+<p>The use of the varReader attribute comes with some restrictions. It is the
+ responsibility of the <import> tag to ensure that if a Reader object is
+ exported, it is properly closed by the end of the page.<br>
+ <font size="-1">[If the responsibility was left to the consumer tag, this could
+ lead to resource leaks (e.g. connection left open, memory space for buffers)
+ until garbage collection is activated if a consumer tag would not close the
+ Reader, or simply if the page author would remove the consumer tag while leaving
+ inadvertantly the <import> tag in the page.]</font></p>
+<p>Because of this, the visibility of a varReader object is nested, so that the
+ Reader may be properly closed when reaching the closing </import>. It
+ therefore makes sense to export a Reader object only when the <import>
+ has nested content that consumes the resource. Using a bodyless <import>
+ tag with varReader is flagged as an error at translation time.<br>
+ <font size="-1">[This restriction could eventually be lifted when the JSP spec
+ supports the notion of page events that actions could register to. On a <i>pageExit</i>
+ event, an <import> tag would then simply release its resources if it had
+ not already been done, removing the requirement for nested visibility. An RFE
+ has been submitted to the JSP expert group.]</font></p>
+<p>It is also illegal to use nested <param> tags with varReader.<br>
+ <font size="-1">[Because varReader takes an arbitrary body and exposes a Reader
+ for it, it needs to open a connection when the start tag is encountered. But
+ if it opens the connection there, it won't have had a chance to hear from its
+ <param> subtags (which modify the URL that <import> connects to).]</font></p>
+<p><b>Character Encoding</b></p>
+<p>When the var attribute is used to expose a Reader object, it is possible to
+ specify the character encoding of the content at the input resource. For example:</p>
+<pre> <c:import url="..." varReader="doc" charEncoding="..."/></pre>
+<p>If the character encoding is not specified, the following rules apply:</p>
+<ul>
+ <li>If the response of the <import> request has a "content-type"
+ header field, then the character encoding specified is used (the imported
+ resource tells us about its encoding, we just use it)</li>
+ <li>Use ISO-8859-1 (which is the default value of charset for the contentType
+ of the JSP "page" directive)</li>
+</ul>
+<p>Note that the charEncoding attribute should normally only be required when
+ accessing absolute URL resources where the protocol is not HTTP, and where the
+ encoding is not ISO-8859-1.</p>
+<p>Also, when dealing with relative URLs and the HTTP protocol, if the target
+ resource declares a content encoding but proceeds to write a character invalid
+ in that encoding, the treatment of that character is undefined.</p>
+<h3>3. Relative and Absolute URLs</h3>
+<p>The <code>url</code> attribute is used to specify the URL of the resource to
+ access. It can either be an absolute URL (i.e. one that starts with a protocol
+ followed by a colon), a relative URL used to access a resource within the same
+ context, or a relative URL used to access a resource within a foreign context
+ (context name must be specified).</p>
+<p>The exact semantics of the <import> tag depends on what type of URL is
+ being accessed.</p>
+<p><b>Relative URL - same context</b></p>
+<p> This is processed in the exact same way as the standard include action (<jsp:include>)
+ of the JSP specification. The resource belongs to the same web-app as the including
+ page and it is specified as a relative URL. For example:</p>
+<pre> <c:import url="/copyright.html"/></pre>
+<p>As specified in the JSP spec, a relative URL may either be a <i>context-relative</i>
+ path, or a <i>page-relative</i> path. A context-relative path is a path that
+ starts with a “/”. It is to be interpreted as relative to the application
+ to which the JSP page belongs. A page-relative path is a path that does not
+ start with a “/”. It is to be interpreted as relative to the current
+ JSP page.</p>
+<p>The semantics of importing a resource specified with a relative URL in the
+ same context are the same as an include performed by a RequestDispatcher in
+ the Servlet specification. This means that the whole environment (request, session,
+ application) of the importing page is available to the target resource (including
+ request parameters of the importing page).</p>
+<p><b>Relative URL - foreign context</b><br>
+</p>
+<p> The resource belongs to a foreign context (web application) hosted under the
+ same container as the importing page. The context name for the resource is specified
+ via argument "context". For example:</p>
+<pre> <c:import url="/logo.html" context="/master"/></pre>
+<p>The relative URL must be context-relative (i.e. must start with a "/")
+ since the including page does not belong to the same context. Similarly, the
+ context name must also start with a "/".</p>
+<p>The semantics of importing a resource specified with a relative URL in a foreign
+ context are the same as an include performed by a RequestDispatcher on a foreign
+ context in the Servlet specification. This means that only the "request"
+ environment of the importing page is available to the target resource.</p>
+<p>It is important to note though that importing resources in foreign contexts
+ may not work in all containers. A security conscious environment may not allow
+ access to foreign contexts. As a workaround, a foreign context resource can
+ also be accessed using an absolute URL. For example:</p>
+<pre> <c:import url="http://www.acme.com/master/logo.html"/></pre>
+<p>However, it is much more efficient to use a relative URL because the resource
+ is then accessed using RequestDispatcher of the servlet API. </p>
+<p><b>Absolute URL</b></p>
+<p>Given that JSP1.2 assumes a J2SE platform at a minimum, the <import>
+ tag therefore supports at a minimum the protocols offered in that platform for
+ absolute URLs. More protocols can still be available to a web application, but
+ this will depend on the the class libraries made available to the webapp by
+ the platform the container runs on.</p>
+<p>The example below shows how a request is sent to a remote site to obtain a
+ list of customers, and how that list is then used as input to a notification
+ tag.</p>
+<pre> <c:import url="http://acme.com/exec/customers?country=USA" var="customers"/><br> <acme:notify in="$customers"/></pre>
+<p>When using an absolute URL to import a resource, none of the current execution
+ environment (request, session, application) is made available to the target
+ resource, even if that absolute URL resolves to the same host and context path.
+ Therefore, the request parameters of the importing page are not propagated to
+ the target "absolute URL".</p>
+<h3><b>4. <urlEncode></b></h3>
+<p>URL encoding refers to the process of encoding special characters in a string,
+ according to the encoding rules defined in RFC 1738 (section 2.2. URL Character
+ Encoding Issues). </p>
+<p>For example, a space must be encoded in a URL string as a '+':</p>
+<blockquote>
+ <p><code>http://www.acme.com/app/register?name=Aristide+Bertrand&country=Republique+Dominicaine
+ </code> </p>
+</blockquote>
+<p>The <urlEncode> action will encode the string specified in attribute
+ 'value'. If the value attribute is not specified, encoding is performed on the
+ tag's body content.</p>
+<p>By default, the result of the encoding is written to the page. It is also possible
+ to export the result of the encoding as a JSP scoped attribute (java.lang.String)
+ defined via attribute "var". For example:</p>
+<pre> <urlEncode var="nameEncoded" value="$name"/>
+</pre>
+<p>With respect to the <import> tag, it is important to note that all URLs
+ need to be encoded. However, URL encoding is normally necessary only when dealing
+ with query string parameters.</p>
+<p>For example, assuming the following absolute URL</p>
+<blockquote>
+ <p><code>http://www.acme.com/app/register</code></p>
+</blockquote>
+<p>to which two query string parameters must be passed: "name" and "country",
+ both of which are retrieved from JSP scoped attributes. Since special characters
+ can be part of these scoped attributes, they must be encoded before they can
+ be added to the URL. This could be done as follows:</p>
+<blockquote>
+ <p> <code><urlEncode var="nameEncoded" value="$name"/><br>
+ <urlEncode var="countryEncoded" value="$country"/><br>
+ <c:import url="$'http://www.acme.com/app/register?name='+nameEncoded+'&country='+countryEncoded"/></code></p>
+</blockquote>
+<p>However this is somewhat awkward. A better way is to use nested <param>
+ tags to specify the query string parameters to be added to the URL. As a convenience,
+ the <param> action has been designed such that query string parameters
+ (both "name" and "value") are automatically encoded for
+ the <import> action. The following could therefore be used without having
+ to worry about any encoding:</p>
+<blockquote>
+ <pre><c:import url="http://www.acme.com/app/register">
+ <param name="name" value="$name"/>
+ <param name="country" value="$country"/>
+</c:import></pre>
+</blockquote>
+<h3>5. <param></h3>
+<p>The <param> element can be used with <import> to specify request
+ parameters.</p>
+<p>One might argue that this is redundant given that the URL can be constructed
+ to include query string parameters.</p>
+<p>For example:</p>
+<pre> <c:import url="/exec/doIt><br> <c:param name="action" value="register"/><br> </c:import></pre>
+<p>is the same as:</p>
+<pre> <c:import url="/exec/doIt?action=register"/></pre>
+<p>It is indeed redundant, but is consistent with <jsp:include> supporting
+ nested <jsp:param> sub-elements. Moreover, it has been designed such that
+ the parameter "name" and "value" are automatically <i>url
+ encoded</i> (as described in the previous section). Automatic encoding can be
+ disabled using optional attribute "encode", whose value defaults to
+ "true" otherwise.</p>
+<p>It is important to note that that the query parameter aggregation rules work
+ the same way they do with <jsp:include>; the original parameters are augmented
+ with the new parameters, with new values taking precedence over existing values
+ when applicable.The scope of the new parameters is the import call; the new
+ parameters (and values) will not apply after the import. This is the same behavior
+ as in the ServletRequest include and forward methods (see Section 8.1.1 in the
+ Servlet 2.2 specification).</p>
+<p>For example:</p>
+<pre> <c:import url="http://acme.com/exec/doIt?foo=foovalOne"/><br> <c:param name="foo" value="fooval 2"/><br> <c:param name="bar" value="bar value"/><br> </c:import>
+</pre>
+modifies the absolute URL as follows:
+<pre> http://acme.com/exec/doIt?foo=fooval+2&bar=bar+value&foo=foovalOne</pre>
+<h3>5. Summary</h3>
+<table width="100%" border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">Import
+ Tags</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="39%"><b>Element</b></td>
+ <td width="61%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="39%" height="123">
+ <p><code><b><import><br>
+ </b><font color="#FF0000"><b><font color="#000000">url</font></b></font><font color="#0000FF">
+ <font color="#000000">var varReader charEncoding</font></font> <font color="#000000">context
+ </font><br>
+ <b></b><font color="#0000FF"> </font></code></p>
+ <p>Action for a simple, generic way to access URL based resources. Extends
+ <jsp:include> to support foreign contexts and absolute URLs, as
+ well as to export an object for explicit collaboration with process/transformation
+ tags (avoiding unnecessary buffering).</p>
+ </td>
+ <td width="61%" height="123">
+ <p><code><c:import url="ftp://ftp.acme.com/README"/><br>
+ <br>
+ </code><code><c:import url="/xml/doc.xml" varReader="in"/><br>
+ <acme:process in="$in"</code><code>/></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><param></b><br>
+ <font color="#000000"><b>name</b></font><font color="#CC0000"> </font><font color="#000000">value
+ encode</font></code></p>
+ <p>Sub-element to specify request parameters for the enclosing <import>.
+ If importing a resource using an absolute URL, the value of the parameter
+ is automatically encoded.</p>
+ </td>
+ <td width="61%">
+ <p><code><c:import url="/exec/register"><br>
+ <c:param name="id" value="foo"/><br>
+ </c:import> </code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><urlEncode></b><br>
+ <font color="#FF0000">value</font><font color="#CC0000"> </font><font color="#0000FF">var</font></code></p>
+ <p>URL encoding.</p>
+ </td>
+ <td width="61%">
+ <pre><a href="http://acme.com/register
+ ?name=<c:urlEncode value='$name'/>"/></pre>
+ </td>
+ </tr>
+</table>
+<h3>6. Notes</h3>
+<ul>
+ <li>
+ <p><c:import> tags are all independent from one another; they do not
+ create an implicit session among themselves using cookies.
+ </li>
+ <li>There is no way using the <import> tag to authenticate to a URL that
+ requires HTTP basic authentication.</li>
+</ul>
+<h3>7. Design decisions of interest</h3>
+<p>We know you'd eventually ask these questions. Here are the answers...</p>
+<p><b><a name="map"></a>Transparently map absolute URLs to relative ones when
+ possible? No.</b></p>
+<p>If a resource is specified as an absolute URL, it may still refer to a resource
+ located on the same container (same or foreign context). Why not have the <import>
+ tag transparently map absolute URLs to relative ones when possible to improve
+ performance? </p>
+<p>We've decided against it simply because doing things behind the scenes may
+ lead to confusion. Users should understand the difference between absolute and
+ relative URLs, and the impact of using one vs the other in terms of performance
+ as well as execution environment of the imported resource.</p>
+<p>So, even if a request with an absolute URL does go back to the same webapp,
+ we are not propogating session identity either.</p>
+<p><b>Transparently map foreign context relative URLs to absolute URLs in "security
+ conscious" containers? No.</b></p>
+<p>If accessing a resource in a foreign context using a relative URL fails (security
+ conscious container that does not allow it), why not design the tag so it transparently
+ maps the foreign context relative URL to an absolute URL? </p>
+<p>We've decided against it because for the same reason as above, as well as for
+ portability concerns. In container X, the resource might be accessed via RequestDispatcher
+ and has therefore access to request attributes, the foreign context session
+ and application environment. However, if in container Y the resource is accessed
+ via a new HTTP request, the resource is not accessed with that same environment.</p>
+</body>
+</html>
diff --git a/doc/web/IteratorTag_FunctionalDescription_2_EAI.html b/doc/web/IteratorTag_FunctionalDescription_2_EAI.html
new file mode 100644
index 0000000..bdcd7ab
--- /dev/null
+++ b/doc/web/IteratorTag_FunctionalDescription_2_EAI.html
@@ -0,0 +1,430 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>JSTL: Iterator Tags -- Functional Description</title>
+<style media="screen" type="text/css"><!--
+.fixme { color: red }
+--></style>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>
+
+ <hr width="100%" noshade>
+</h3>
+
+<h2> Iterator Tags — Functional Description</h2>
+
+<h2> <tt><forEach><br>
+ <forTokens></tt></h2>
+<hr width="100%" noshade>
+<h3>
+1. Introduction</h3>
+The <tt><forEach></tt> tag repeats its nested body content over the collection
+of objects defined by the <tt>items</tt> attribute. For example, the JSP code
+below creates an HTML table with one column that shows the default <i>display</i>
+value of each item in the collection.
+<pre> <table>
+ <c:forEach var="customer" items="$customers">
+ <tr><td><c:expr value="$customer"/></td></tr>
+ </c:forEach>
+ </table></pre>
+The <tt>forEach</tt> tag has the following features:
+<ul>
+<li>
+Supports all standard J2SE <a href="#items">collection types.</a></li>
+
+<li>
+Exports an object that holds the <a href="#currentItem">current item</a>
+of the iteration.</li>
+
+<li>
+Exports an object that holds information about the <a href="#status">status
+of the iteration.</a></li>
+
+<li>
+Supports <a href="#range">range attributes</a> to iterate over a subset
+of the original collection.</li>
+
+<li>
+Exposes an <a href="#IteratorTag">interface</a> as well as a <a href="#IteratorTagSupport">base
+implementation class</a> so developers can easily implement collaborating
+subtags as well their own iteration tags according to their specific needs.</li>
+</ul>
+The forEach tag is the <i>base</i> iteration tag. It handles the most common
+iteration cases conveniently. Other iteration tags are also provided in
+the stardard tag library to support specific, specialized functionality
+not handled by the <tt>forEach</tt> tag (e.g. the <tt>forTokens</tt> tag).
+Developers can also easily extend the behavior of this base iteration tag
+to customize it according to an application's specific needs.
+<h3>
+<a NAME="items"></a>2. Collection of objects to iterate over</h3>
+The <tt>forEach</tt> tag supports the following data types for the collection
+of objects to iterate over.
+<ul>
+ <li> Array of Java Objects</li>
+ <ul>
+ <li> If the array contains a set of primitive types, then the current item
+ for the iteration is automatically wrapped with its standard wrapper class
+ (e.g. <tt>Integer</tt> for <tt>int</tt>, <tt>Float</tt> for <tt>float</tt>,
+ etc...)</li>
+ </ul>
+ <li> Implementation of <tt>java.util.Collection</tt>. This includes among others:
+ <tt>List, LinkedList, ArrayList, Vector, Stack, Set.</tt></li>
+ <li> Implementation of <tt>java.util.Iterator</tt>.</li>
+ <ul>
+ <li> Use with caution. An <code>Iterator</code> object is not resettable so
+ it should not be used within more than one iteration tag.</li>
+ </ul>
+ <li> Implementation of <tt>java.util.Enumeration</tt>.
+ <ul>
+ <li>Use with caution. An <code>Enumeration</code> object is not resettable
+ so it should not be used within more than one iteration tag.</li>
+ </ul>
+ </li>
+ <li> Implementation of <tt>java.util.Map</tt>. This includes among others: <tt>HashMap,
+ Hashtable, Properties, Provider, Attributes. </tt>See below for additional
+ information about accessing the <a href="#currentItemMap">current item of
+ a Map</a>.</li>
+ <li> Implementation of <tt>java.sql.ResultSet</tt>, including <tt>javax.sql.RowSet</tt>.
+ See below for additional information about accessing the <a href="#currentItemResultSet">current
+ item of a ResultSet</a>.</li>
+ <li> String. The string represents a list of Comma Separated Values (e.g. "mon,tue,wed").</li>
+</ul>
+The <tt>items</tt> attribute is optional. If it is not specified, the <a href="#range">range
+attributes</a> must be specified to iterate a specific number of times over the
+tag's body.
+<h3>
+<a NAME="currentItem"></a>3. The current item</h3>
+<p>The current item of the iteration is made available via a JSP page scope attribute
+ defined with attribute <tt>var</tt>. Attribute var has nested visibility, i.e.
+ it only exists within the body of the <forEach> tag. At the end of the
+ tag, the attribute is removed (no prior value is restored). Attribute <tt>var</tt>
+ is optional. The page attribute is not created if a value is not defined for
+ <tt>var.</tt> </p>
+<p>Normally, each object exposed by the <tt>forEach</tt> tag is an item
+of the underlying collection being iterated over. However, if iterating
+over a <tt>Map </tt>or a<tt> ResultSet</tt>, the exposed object is as follows:
+<p><a NAME="currentItemMap"></a>If <tt>items</tt> is of type <tt>Map</tt>,
+then the current item will be of type <tt>Map.Entry</tt> which has the
+following two properties:
+<ul>
+<li>
+<tt>key</tt> - The key under which this item is stored in the underlying
+Map.</li>
+
+<li>
+<tt>value</tt> - The value that corresponds to this key.</li>
+</ul>
+So, to iterate over the values of a <tt>Hashtable</tt>, the code would
+be implemented as follows:
+<p><tt> <c:forEach var="entry" items="$myHashtable"/></tt> <br>
+ <tt> Next element is <c:expr value="$entry.value/></tt>
+ <br>
+ <tt> </c:forEach></tt>
+<p><a NAME="currentItemResultSet"></a>If items is of type <tt>ResultSet</tt>,
+ then the current item is the <tt>ResultSet</tt> object itself positioned at
+ the current row. Columns are accessed using the standard <tt>ResultSet</tt>
+ API.
+<h3>
+<a NAME="status"></a>5. Iteration Status</h3>
+The iterator tag also makes available a wealth of information relative to the
+iteration taking place. The set of properties supported by the status object is
+described <a href="#IteratorTagStatus">here</a>.
+<p>This status information is accessible by defining a JSP page scope attribute
+ via the <tt>status</tt> attribute. This page scope attribute has nested visibility,
+ i.e. it only exists within the body of the <forEach> tag. At the end of
+ the tag, the attribute is removed (no prior value is restored). This is an optional
+ attribute with no default. No page attribute is exposed if a value is not specified
+ for the<tt> status </tt>attribute.
+<p>In the example below, the JSP code creates an HTML table with the first
+column containing the position of the item in the collection, and the second
+containing the name of the employee.
+<pre> <table>
+ <c:forEach var="employee" items="$employees" status="status">
+ <tr>
+ <td><c:expr value="$status.count"/></td>
+ <td><c:expr value="$employee.name"/></td>
+ </tr>
+ </c:forEach>
+ </table></pre>
+
+<h3>
+<a NAME="range"></a>6. Range Attributes</h3>
+A set of range attributes is available to iterate on a subset of the collection
+of items. The <tt>begin</tt> and <tt>end</tt> indices can be specified,
+along with a <tt>step</tt>. If the <tt>items</tt> attribute is not specified,
+then the value of the current item is set to the integer value of the current
+index.
+<p>In this example, <tt>i</tt> would take values from 100 to 110 (included).
+<pre> <c:forEach var="i" begin="100" end="110">
+ <c:expr value="$i"/>
+ </c:forEach></pre>
+
+<table BORDER CELLSPACING=2 CELLPADDING=5 WIDTH="685" >
+<tr>
+<td ALIGN=CENTER WIDTH="10%"></td>
+
+<th ALIGN=CENTER>specified</th>
+
+<th ALIGN=CENTER>not specified</th>
+</tr>
+
+<tr>
+<th ALIGN=CENTER WIDTH="10%">begin</th>
+
+<td>iteration starts at the item located at the specified index. First
+item in the collection is at index 0.</td>
+
+ <td>Iteration starts at the first item if items is specified. Illegal if items
+ is also not specified.</td>
+</tr>
+
+<tr>
+<th ALIGN=CENTER WIDTH="10%">end</th>
+
+<td>iteration ends at the item located at the specified index (inclusive)</td>
+
+ <td>Iteration ends at the last element in the collection. Illegal if items
+ is also not specified.</td>
+</tr>
+
+<tr>
+<th ALIGN=CENTER WIDTH="10%">step</th>
+
+<td>the iteration will only process every 'step' item of the collection,
+starting with the first one</td>
+
+<td>Every item in the collection is processed</td>
+</tr>
+</table>
+
+<h3><a NAME="attributes"></a>8. Attributes:</h3>
+
+<table BORDER CELLSPACING=2 CELLPADDING=5 WIDTH="709" >
+ <tr BGCOLOR="#FFFACD">
+ <th ALIGN=LEFT COLSPAN="4">collection to iterate over</th>
+ </tr>
+ <tr>
+ <td><tt>items</tt></td>
+ <td>optional</td>
+ <td>expr</td>
+ <td>The collection of objects to iterate over. If not specified, the range
+ attributes <tt>begin</tt> and/or <tt>end</tt> are required to specify the
+ range of the iteration (for loop).</td>
+ </tr>
+ <tr>
+ <th ALIGN=LEFT COLSPAN="4" BGCOLOR="#FFFACD">current item</th>
+ </tr>
+ <tr>
+ <td height="0"><tt>var</tt></td>
+ <td height="0">optional</td>
+ <td height="0"><tt>String</tt></td>
+ <td height="0">Name of the page scope attribute used to store the current
+ object being iterated over. Visibility is "nested".</td>
+ </tr>
+ <tr>
+ <th ALIGN=LEFT COLSPAN="4" BGCOLOR="#FFFACD">iteration status</th>
+ </tr>
+ <tr>
+ <td><tt>status</tt></td>
+ <td>optional</td>
+ <td><tt>String</tt></td>
+ <td>Name of the variable used to store the current status of the iteration.
+ Visibility is "nested".</td>
+ </tr>
+ <tr>
+ <th ALIGN=LEFT COLSPAN="4" BGCOLOR="#FFFACD">range</th>
+ </tr>
+ <tr>
+ <td><tt>begin</tt></td>
+ <td>optional</td>
+ <td>expr</td>
+ <td>Iteration begins at the item located at the specified index. First item
+ has index 0.</td>
+ </tr>
+ <tr>
+ <td><tt>end</tt></td>
+ <td>optional</td>
+ <td>expr</td>
+ <td>Iteration ends at the item located at the specified index (inclusive).</td>
+ </tr>
+ <tr>
+ <td><tt>step</tt></td>
+ <td>optional</td>
+ <td>expr</td>
+ <td>Iteration will only process every 'step' item of the collection.</td>
+ </tr>
+</table>
+
+<h3>
+<a NAME="IteratorTagStatus"></a>9. IteratorTagStatus</h3>
+The iteration status object (attribute <tt>status</tt>) has the following properties.
+<br>
+
+<table BORDER CELLSPACING=2 CELLPADDING=5 WIDTH="688" >
+ <tr BGCOLOR="#FFFACD">
+ <th ALIGN=LEFT COLSPAN="3">current item</th>
+ </tr>
+ <tr BGCOLOR="#FFFACD">
+ <td ALIGN=LEFT BGCOLOR="#FFFFFF"><tt>current</tt></td>
+ <td ALIGN=LEFT BGCOLOR="#FFFFFF"><tt>Object</tt></td>
+ <td ALIGN=LEFT BGCOLOR="#FFFFFF">The current item. This object is also accessible
+ directly from the <tt>IteratorTag</tt> interface. It is also made available
+ here as a convenience.</td>
+ </tr>
+ <tr BGCOLOR="#FFFACD">
+ <th ALIGN=LEFT COLSPAN="3">current index / position</th>
+ </tr>
+ <tr>
+ <td><tt>index</tt></td>
+ <td><tt>int</tt></td>
+ <td>The absolute, 0 based index of the current item.</td>
+ </tr>
+ <tr>
+ <td ALIGN=LEFT><tt>count</tt></td>
+ <td ALIGN=LEFT><tt>int</tt></td>
+ <td ALIGN=LEFT>The relative, 1 based position of the current item. This increases
+ by 1 for each item, regardless of begin, end, or step.</td>
+ </tr>
+ <tr>
+ <td ALIGN=LEFT><tt>first</tt></td>
+ <td ALIGN=LEFT><tt>boolean</tt></td>
+ <td ALIGN=LEFT>Flag indicating if the current item is the first in the iteration.</td>
+ </tr>
+ <tr>
+ <td ALIGN=LEFT><tt>last</tt></td>
+ <td ALIGN=LEFT><tt>boolean</tt></td>
+ <td ALIGN=LEFT>Flag indicating if the current item is the last in the iteration.
+ This property is not supported when iterating over a ResultSet and step
+ is > 1. </td>
+ </tr>
+ <tr>
+ <th ALIGN=LEFT COLSPAN="3" BGCOLOR="#FFFACD">range</th>
+ </tr>
+ <tr>
+ <td COLSPAN="3"><font size=-1>These values (combined with count) are important
+ for allowing people to define special tags that tell when you're in the
+ middle of a list, or when you're in an even or odd part of the list, etc.
+ Because these values might have been specified as complex rtexprvalues or
+ EL expressions, it's valuable to have these in a "precomputed" form.</font></td>
+ </tr>
+ <tr>
+ <td><tt>beginSpecified</tt></td>
+ <td><tt>boolean</tt></td>
+ <td>Flag indicating if the <tt>begin</tt> attribute was specified.</td>
+ </tr>
+ <tr>
+ <td><tt>begin</tt></td>
+ <td><tt>int</tt></td>
+ <td>The value of the <tt>begin</tt> attribute as specified in the tag. If
+ the attribute was not specified, its corresponding value is undefined.</td>
+ </tr>
+ <tr>
+ <td><tt>endSpecified</tt></td>
+ <td><tt>boolean</tt></td>
+ <td>Flag indicating if the <tt>end</tt> attribute was specified.</td>
+ </tr>
+ <tr>
+ <td><tt>end</tt></td>
+ <td><tt>int</tt></td>
+ <td>The value of the <tt>end</tt> attribute as specified in the tag. If the
+ attribute was not specified, its corresponding value is undefined.</td>
+ </tr>
+ <tr>
+ <td><tt>stepSpecified</tt></td>
+ <td><tt>boolean</tt></td>
+ <td>Flag indicating if the <tt>step</tt> attribute was specified.</td>
+ </tr>
+ <tr>
+ <td><tt>step</tt></td>
+ <td><tt>int</tt></td>
+ <td>The value of the <tt>step</tt> attribute as specified in the tag. If the
+ attribute was not specified, its corresponding value is undefined.</td>
+ </tr>
+</table>
+
+<h3>
+<a NAME="IteratorTag"></a>10. Tag Collaboration</h3>
+Custom tags give developers the power to provide added functionality to
+a JSP application without having the page author to use Java code.
+<p>In this example, a page author must handle an item of the iteration
+differently depending whether it is an odd or even element.
+<p><tt> <c:forEach var="product" items="products" status="status"><br>
+ <c:declare id="status" type="javax.servlet.jsp.jstl.core.IteratorTagStatus"/></tt><br>
+ <tt> <c-rt:choose></tt> <br>
+ <tt> <c-rt:when test="<%= status.getCount()
+ % 2 == 0 %>"></tt> <br>
+ <tt> <!-- even item --></tt> <br>
+ <tt> </c-rt:when></tt> <br>
+ <tt> <c-rt:otherwise></tt> <br>
+ <tt> <!-- odd item --></tt> <br>
+ <tt> </c-rt:otherwise></tt> <br>
+ <tt> </c-rt:choose></tt> <br>
+ <tt> </c:forEach></tt>
+<p>If this type of processing needs to be repeated often in the web applications
+of a company, it might be worth to provide page authors with a couple extra
+tags that would remove the need for conditional tags and expressions. For
+example:
+<p><tt> <c:forEach items="$products"></tt> <br>
+ <tt> <xyz:even></tt>
+<br><tt> <!-- even item --></tt>
+<br><tt> </xyz:even></tt>
+<br><tt> <xyz:odd></tt>
+<br><tt> <!-- odd item --></tt>
+<br><tt> </xyz:odd></tt>
+<br>
+ <tt> </c:forEach></tt>
+<p>In order to make this possible, tags like <tt><odd></tt> and <tt><even></tt>
+need to be able to get access to the information exported by the <tt>forEach</tt>
+tag. This could be done explicitely, by specifying the name of the status
+object exported by the forEach tag. For example:
+<p><tt> <c:forEach items="<%=products%>" <font color="#3366FF">status="status"</font>></tt>
+ <br>
+ <tt> <xyz:even <font color="#3366FF">iter="status"</font>></tt>
+<br><tt> <!-- even item --></tt>
+<br><tt> </xyz:even></tt>
+<br><tt> <xyz:odd <font color="#3366FF">iter="status"</font>></tt>
+<br><tt> <!-- odd item --></tt>
+<br><tt> </xyz:odd></tt>
+<br>
+ <tt> </c:forEach></tt>
+<p>The cooperation between these tags and the forEach tag can also be done
+implicitely via the <tt>findAncestorWithClass()</tt> method of the JSP
+API. This is possible because the <tt>forEach</tt> tag implements an interface
+that can be used in the call to <tt>findAncestorWithClass</tt> to get to
+the enclosing <tt>forEach</tt> tag.
+<p>The interface is defined as follows:<br>
+ <br>
+ <tt> interface IteratorTag {</tt> <br>
+ <tt> public Object getCurrent();</tt> <br>
+ <tt> public IteratorTagStatus getIteratorStatus();</tt> <br>
+ <tt> }</tt>
+<p>Interface <code>IteratorTagStatus</code> was described in a previous section.
+<p>
+The fact that the <tt>forEach</tt> tag exposes an interface also means
+that other tags with iterative behavior can be developed using the same
+interface and will collaborate in the same manner with nested tags. See
+class <tt>IteratorTagSupport</tt> below to make this process even easier.
+<h3>
+<a NAME="IteratorTagSupport"></a>11. Tag Extensibility</h3>
+The forEach tag provides iteration capabilities for the most common cases.
+A developer simply needs to expose an appropriate kind of object to take
+advantage of it.
+<p>However, there will be situations where more specialized functionality
+will be required. A developer may need to write a new tag to expose new
+controlling functionality (e.g. for traversal order of a deep data structure,
+custom filtering, selection of appropriate objects from a custom data source).
+This is why the <tt>IteratorTagSupport </tt>class is provided. It will
+facilitate the implementation of <i>specialized</i> iterator tags that
+will meet an application's specific requirements.
+<pre> public abstract class IteratorTagSupport {
+ ... (see source code)...
+ }</pre>
+JSTL itself uses this inheritance-based mechanism to support additional specialized
+iterator tags. For example, the <tt><forTokens></tt> tag is specialized to
+support string tokens. It leverages the iteration behavior implemented in <tt>IteratorTagSupport</tt>,
+and simply exposes a set of attributes that facilitate the specification of how
+tokens are derived from a <tt>String </tt>object.
+</body>
+</html>
diff --git a/doc/web/Overview.html b/doc/web/Overview.html
new file mode 100644
index 0000000..5748514
--- /dev/null
+++ b/doc/web/Overview.html
@@ -0,0 +1,633 @@
+<html>
+<head>
+<title>JSTL: Overview</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<h1>Overview</h1>
+<p>This document provides a high level overview of the JSP™ Standard Tag
+ Library (JSTL) as it stands for EA2 (Early Access release 2). If you have a
+ strong opinion on the topic — positive (you really like it), or constructive
+ (we messed up some parts and you have some constructive comments for improvements)
+ — we'll be happy to hear from you at <a href="mailto:jsr052-comments@sun.com">jsr052-comments@sun.com</a>.
+ All comments will be read but we cannot guaranteee personal replies to all of
+ them. </p>
+<p>Make sure you read this document first, then check out the jstl-examples web
+ application in the release (once you have installed it on your web container
+ following the instructions in the <a href="GettingStarted.html">Getting Started</a>
+ document). This will help you get a good feel for what JSTL is all about. Then
+ browse the other docs to get all the details, and finally give JSTL a ride in
+ your own <b>prototype</b> web application. You should use JSTL only in prototype
+ webapps because this is Early Access and things may/will change as we gather
+ feedback and make adjustments. Thanks for your help making JSTL an awesome standard
+ tag library...</p>
+<h3>Design Philosophy</h3>
+<p>JSP tag libraries help provide a clean separation between the business logic
+ and the presentation layer of web applications. By keeping the programming logic
+ out of JSP pages, web designers are now empowered to develop sophisticated JSP
+ pages without having to resort to the scripting language associated with their
+ JSP pages (usually the Java programming language). </p>
+<p>The base design philosophy in JSTL is therefore to provide page authors with
+ a script free environment. EA2 defines the foundation elements to make this
+ possible.</p>
+<h3>Multiple TLDs</h3>
+<p>A Tag Library is a collection of actions that encapsulate functionality to
+ be used from within a JSP page. JSTL includes a wide variety of actions that
+ naturally fit into discrete functional areas. This is why JSTL, altough a single
+ standard tag library, is exposed via multiple TLDs to clearly show the functional
+ areas it covers, as well as to give each one of them their own namespace. The
+ table below lists these functional areas along with their URI. The table also
+ shows the prefixes used in our documentation and examples (although web applications
+ can use any prefix they want).</p>
+<div align="center">
+ <table border="1" cellpadding="5">
+ <tr>
+ <th>Funtional Area</th>
+ <th>URI</th>
+ <th>Prefix</th>
+ <th>Example</th>
+ </tr>
+ <tr>
+ <td>Core</td>
+ <td>http://java.sun.com/jstl/ea/core</td>
+ <td>
+ <div align="center"><font face="Courier New, Courier, mono">c</font></div>
+ </td>
+ <td><font face="Courier New, Courier, mono"><c:<i>tagname</i> ...></font></td>
+ </tr>
+ <tr>
+ <td>XML processing</td>
+ <td>http://java.sun.com/jstl/ea/xml</td>
+ <td>
+ <div align="center"><font face="Courier New, Courier, mono">x</font></div>
+ </td>
+ <td><font face="Courier New, Courier, mono"><x:<i>tagname</i> ...></font></td>
+ </tr>
+ <tr>
+ <td>I18N capable formatting</td>
+ <td>http://java.sun.com/jstl/ea/fmt</td>
+ <td>
+ <div align="center"><font face="Courier New, Courier, mono">fmt</font></div>
+ </td>
+ <td><font face="Courier New, Courier, mono"><fmt:<i>tagname</i> ...></font></td>
+ </tr>
+ <tr>
+ <td>Database access</td>
+ <td>http://java.sun.com/jstl/ea/db</td>
+ <td>
+ <div align="center"><font face="Courier New, Courier, mono">db</font></div>
+ </td>
+ <td><font face="Courier New, Courier, mono"><db:<i>tagname</i> ...></font></td>
+ </tr>
+ </table>
+</div>
+<h3><br>
+ Expression Language Support</h3>
+<p>A key contribution of JSTL is the integration of an Expression Language (EL).
+ An EL leverages the fact that JSP scoped attributes are the privileged way to
+ communicate information from the business logic to the JSP pages. It makes it
+ possible to easily access application data and manipulate it in simple ways
+ without having to use scriptlets or request-time expression values. </p>
+<p>For example, this conditional tag tests whether the country of a customer is
+ the USA.</p>
+<p><code> <c:if test="$customer.address.country == 'USA'"><br>
+ ...</code><br>
+ <code> </c:if></code></p>
+<p>There were quite a few issues involved with the support of an Expression Language
+ within JSTL given the constraint that it had to work without requiring any change
+ to the JSP spec. In order to be able to support both the scripting (rtexprvalues)
+ and the EL (elexprvalues) worlds, we had to come up with the concept of twin
+ tag libraries: one that supports the expression language, and one that supports
+ request time expression values. Our assumption is that people will mostly use
+ the EL-based tag libraries, while it is still possible for hard core scripting
+ page authors to use JSTL with rtexprvalues (provides benefits for type safety
+ and performance) via the request-time based tag libraries (their URI simply
+ has the "-rt" suffix appended).</p>
+<p>It is a hard task for the Expert Group to decide on a specific EL without first
+ getting the general feeling from the community. This is why JSTL currently
+ does not define a specific EL, but provides mechanisms for experimentation with
+ a variety of ELs. Tell us what you feel is important for that EL, and feel free
+ to implement one that others can experiment with. The goal is to select a single
+ EL once the JSTL spec is ready for Community Review.</p>
+<p>Early Access contains several candidate Expression Languages. One of them is
+ an implementation subset of ECMAScript (JavaScript) and is the one used by default.
+ You can read an <a href="@@@">overview of the ECMAScript subset of interest
+ for JSTL</a>.</p>
+<h3>Tag Collaboration</h3>
+<p>Tags usually collaborate with their environment in implicit and/or explicit
+ ways. Implicit collaboration is done via a well defined interface that allows
+ nested tags to work seamleasly with the ancestor tag exposing that interface.
+ The JSTL iterator tags support this mode of collaboration. Explicit collaboration
+ happens when a tag explicitely exposes information to its environment. Traditionally,
+ this has been done by exposing a scripting variable (with a JSP scoped attribute
+ providing the actual object). Because JSTL supports an expression language,
+ the need for scripting variables is significantly reduced. This is why all the
+ JSTL tags expose information only as JSP scoped attributes (no scripting variable
+ exposed). A bold move, we agree, but we feel this is the proper design decision
+ to support script-free JSP pages. </p>
+<p>The convention is to use the name "var" for any tag attribute that
+ exports information about the tag. For example, an iterator tag exposes the
+ current item of the collection it is iterating over in the following way:</p>
+<p><code> <c:forEach var="customer" items="$customers"></code><code><br>
+ ...</code><br>
+ <code> </c:forEach></code></p>
+<p>It is important to note that a name different than "id" was selected
+ to stress the fact that a variable is exposed (actually a JSP scoped attribute),
+ but not a scripting variable (which is normally the case when using an attribute
+ named "id").</p>
+<p>The convention also establishes the attribute "scope" to set the
+ scope (page, request, session, application) of the JSP scoped attribute.</p>
+<p>In situations where a tag exposes more than one piece of information, the name
+ "var" is used for the primary piece of information being exported,
+ and an appropriate name is selected for any other secondary piece of information
+ exposed (e.g. an iteration current status information is exported by the foreach
+ tag via attribute <code>status</code>.)</p>
+<p>The fact that JSTL tags do not expose scripting variables would make it hard
+ to collaborate with other tags whose data must be passed as rtexprvalues. To
+ that effect, tag <declare> allows to declare a scripting variable to be
+ associated with the JSP scoped attribute of the same name.</p>
+<h3>Tag Overloading</h3>
+<p>In JSTL, we try as much as possible to avoid too much "overloading"
+ of a tag; i.e. tags with lots of attributes that can do just about anything.
+ Rather, we privilege a larger number of tags with well focused behavior.</p>
+<hr noshade>
+<h2>JSTL EA2— Quick Reference</h2>
+<h2>Core Actions</h2>
+<table width="100%" border="1" cellpadding="5">
+ <tr bgcolor="#000099">
+ <td colspan="2"><b><font color="#FFFFFF" size="+1">Expression Language Support
+ Tags (Core)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="31%"><b>Element</b></td>
+ <td width="48%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="31%">
+ <p><code><b><expr></b></code><br>
+ <code><b>value</b> <font color="#000000">default</font> </code><br>
+ <br>
+ Like <code><%= ... %></code> but for EL expressions.<br>
+ </p>
+ </td>
+ <td width="48%">
+ <p><code><c:set var="city" value="$customer.address.city"><br>
+ <br>
+ <c:set var="customerFmt" scope="request"><br>
+ <font color=red><br>
+ </code><code><c:expr value="$customer"/><br>
+ </font><br>
+ </c:set></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="31%"><code><b><set></b></code><br>
+ <code><b>var</b> <font color="#000000">value</font> <font color="#000000">scope</font></code>
+ <br>
+ <br>
+ Sets the result of an expression evaluation in a scoped attribute.<br>
+ <code><br>
+ </code></td>
+ <td width="48%">
+ <p><code><c:set var="city" value="$customer.address.city"><br>
+ <br>
+ <c:set var="customerFmt" scope="request"><br>
+ <font color=red><br>
+ <c:expr value="$customer"/><br>
+ </font><br>
+ </c:set></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="31%">
+ <p><code><b><declare><br>
+ id</b> <font color="#000000">type</font><b> </b></code></p>
+ <p>Declares a scripting variable, initially defined by an existing scoped
+ attribute of the same name. The type of the variable defaults to java.lang.Object
+ but can be modified by using the 'type' attribute.</p>
+ </td>
+ <td width="48%">
+ <p><code><c:declare id="customer" type="acme.Customer"/></code></p>
+ </td>
+ </tr>
+</table>
+<br>
+<table width="100%" border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">Iterator
+ Tags (core)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="31%"><b>Element</b></td>
+ <td width="48%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="38%" height="123">
+ <p><code><b><forEach><br>
+ </b><font color="#0000FF">var items status<br>
+ begin end step</font></code></p>
+ <p>The basic iteration tag, accepting many different collection types and
+ supporting subsetting and other functionality</p>
+ </td>
+ <td width="48%" height="123"><code><c:forEach var="customer"
+ items="$customers"></code><code><br>
+ ...<br>
+ </c:forEach><br>
+ <br>
+ <c:forEach var="customer" items="$customers"<br>
+ status="status"
+ <br>
+ begin="100"
+ end="200" step="2"></code><code><br>
+ ...<br>
+ </c:forEach> </code></td>
+ </tr>
+ <tr>
+ <td width="38%">
+ <p><code><b><forTokens><br>
+ </b><font color="#0000FF">var items status<br>
+ begin end step</font><br>
+ delims <b> </b></code></p>
+ <p>Iterates over tokens, separated by the supplied delimiters</p>
+ </td>
+ <td width="48%"><code><c:forTokens var="token" items="blue|white|red"<br>
+ delims="|"></code><code><br>
+ ... <br>
+ </c:forTokens> </code></td>
+ </tr>
+ <tr>
+ <td width="38%"><code><b>interface IteratorTag</b></code></td>
+ <td>allows developers to write custom iteration tags by implementing the IteratorTag
+ interface.</td>
+ </tr>
+ <tr>
+ <td width="38%"><code><b>interface IteratorTagStatus</b></code></td>
+ <td>Provides an interface for objects representing the current status of an
+ iteration. JSTL 1.0 provides a mechanism for IteratorTags to return information
+ about the current index of the iteration and convenience methods to determine
+ whether or not the current round is either the first or last in the iteration.
+ It also lets authors use the status object to obtain information about the
+ iteration range, step, and current object.</td>
+ </tr>
+ <tr>
+ <td width="38%"><code><b>abstract class IteratorTagSupport </b></code></td>
+ <td>Since most iteration tags will behave identically with respect to actual
+ iterative behavior, JSTL 1.0 provides this base support class to facilitate
+ implementation. Many iteration tags will extend this and merely implement
+ the hasNext() and next() methods to provide contents for the handler to
+ iterate over.</td>
+ </tr>
+</table>
+<br>
+<table width="100%" border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">Conditional
+ Tags (core)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="31%"><b>Element</b></td>
+ <td width="48%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="42%" height="123">
+ <p><code><b><if><br>
+ </b>test<font color="#0000FF"> var</font><b> </b></code></p>
+ <p>Simple conditional tag, which evalutes its body if the supplied condition
+ is true and optionally exposes a Boolean page attribute representing the
+ evaluation of this condition.</p>
+ </td>
+ <td width="58%" height="123">
+ <p><code><c:if test="$customer.address.country == 'USA'">
+ </code><code><br>
+ ...<br>
+ </c:if><br>
+ <br>
+ <c:if var="isUsCustomer"<br>
+ test="$customer.address.country == 'USA'"/></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="42%">
+ <p><code><b><choose></b><br>
+ <b><when></b><br>
+ test<b> </b> <br>
+ <b><otherwise></b></code></p>
+ <p>Simple conditional tag that establishes a context for mutually exclusive
+ conditional operations, marked by<code> <when></code> and <code><otherwise>.</code></p>
+ </td>
+ <td width="58%">
+ <p><code><c:choose></code><code><br>
+ <when test="..."><br>
+ ...<br>
+ </when> </code><code><br>
+ <when test="..."><br>
+ ...<br>
+ </when> </code><code><br>
+ ...<br>
+ <otherwise><br>
+ ...<br>
+ </otherwise> </code><code></code><code> </code><code>
+ <br>
+ </c:choose> </code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="42%"><code><b>abstract class ConditionalTagSupport</b></code></td>
+ <td width="58%">Abstract class that facilitates implementation of conditional
+ tags -- specifically, tags in the style of <code><if></code>.</td>
+ </tr>
+</table>
+<br>
+<br>
+<table width="100%" border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">Import
+ Tags (core)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="39%"><b>Element</b></td>
+ <td width="61%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="39%" height="123">
+ <p><code><b><import><br>
+ </b><font color="#FF0000"><b><font color="#000000">url</font></b></font><font color="#0000FF">
+ <font color="#000000">var varReader charEncoding</font></font> <font color="#000000">context
+ </font><br>
+ <b></b><font color="#0000FF"> </font></code></p>
+ <p>Action for a simple, generic way to access URL based resources. Extends
+ <jsp:include> to support foreign contexts and absolute URLs, as
+ well as to export an object for explicit collaboration with process/transformation
+ tags (avoiding unnecessary buffering).</p>
+ </td>
+ <td width="61%" height="123">
+ <p><code><c:import url="ftp://ftp.acme.com/README"/><br>
+ <br>
+ </code><code><c:import url="/xml/doc.xml" varReader="in"/><br>
+ <acme:process in="$in"</code><code>/></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><param></b><br>
+ <font color="#000000"><b>name</b></font><font color="#CC0000"> </font><font color="#000000">value
+ encode</font></code></p>
+ <p>Sub-element to specify request parameters for the enclosing <import>.
+ If importing a resource using an absolute URL, the value of the parameter
+ is automatically encoded.</p>
+ </td>
+ <td width="61%">
+ <p><code><c:import url="/exec/register"><br>
+ <c:param name="id" value="foo"/><br>
+ </c:import> </code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><urlEncode></b><br>
+ <font color="#FF0000">value</font><font color="#CC0000"> </font><font color="#0000FF">var</font></code></p>
+ <p>URL encoding.</p>
+ </td>
+ <td width="61%">
+ <pre><a href="http://acme.com/register
+ ?name=<c:urlEncode value='$name'/>"/></pre>
+ </td>
+ </tr>
+</table>
+<p>
+<h2>XML Actions</h2>
+<table border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">XML Core
+ Tags (xml)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="318"><b>Element</b></td>
+ <td width="392"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="318"><code><b><parse></b></code><br>
+ <code><font color="#FF0000"><b><font color="#000000">var</font></b></font>
+ source filter</code><br>
+ <br>
+ Parses an XML and saves its internal representation into the JSP scoped
+ attribute specified by "var".</td>
+ <td width="392"> <code><c:import url="http://acme.com/athletes?country=ethiopia"
+ var="xml"/><br>
+ <x:parse source="$xml" var="athletes"/> </code></td>
+ </tr>
+ <tr>
+ <td width="318">
+ <p><code><b><expr></b></code><br>
+ <code><font color="#000000"><b>select</b></font></code><br>
+ <br>
+ Evaluates the given XPath expression and outputs its text value.<br>
+ </p>
+ </td>
+ <td width="392">
+ <p><code><x:expr select="$ath/name"/></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="318">
+ <p><code><b><set></b></code><br>
+ <code><font color="#000000"><b>var</b></font> <b><font color="#000000">select</font></b></code><br>
+ <br>
+ Evaluates the given XPath expression and saves the result into the JSP
+ scoped attribute specified by "var".</p>
+ </td>
+ <td width="392"> <code><x:set<br>
+ select="$athletes/athlete[country=$request:country]"
+ var="athletesOfCountry"/></code></td>
+ </tr>
+</table>
+<br>
+<table border="1" cellpadding="5" width="100%">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">XML Control
+ Flow Tags (xml)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="55%"><b>Element</b></td>
+ <td width="45%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="55%"><code><b><forEach></b></code><br>
+ <b> select</b> var<br>
+ <br>
+ Evaluates the given XPath expression and iterates over the result, setting
+ the context node to each element in the iteration.</td>
+ <td width="45%"><code><x:forEach select="$doc//author"><br>
+ <x:valueOf select="@name"><br>
+ </x:forEach> </code></td>
+ </tr>
+ <tr>
+ <td width="55%">
+ <p><code><b><if> <br>
+ select<br>
+ </b></code><br>
+ Simple conditional tag, which evalutes its body if the supplied Xpath
+ expression evaluates to true (as if by a call to the XPath "boolean"
+ function).</p>
+ </td>
+ <td width="45%"><code><x:if select="$customer/[location='UK']"><br>
+ UK based<br>
+ </x:if></code> </td>
+ </tr>
+ <tr>
+ <td width="55%">
+ <p><code><b><choose><br>
+ </b></code><code><b><when> <br>
+ select</b><b><br>
+ <otherwise></b></code><br>
+ <br>
+ Simple conditional tag that establishes a context for mutually exclusive
+ conditional operations, marked by<code> <when></code> and<code>
+ <otherwise>.</code></p>
+ </td>
+ <td width="45%"><code><x:choose></code><code><br>
+ <x:when select="..."><br>
+ ...<br>
+ </x:when> </code><code><br>
+ <x:when select="..."><br>
+ ...<br>
+ </x:when> </code><code><br>
+ ...<br>
+ <x:otherwise><br>
+ ...<br>
+ </x:otherwise> </code><code></code><code> </code><code>
+ <br>
+ </x:choose> </code></td>
+ </tr>
+</table>
+<br>
+<table width="100%" border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">XML Transformation
+ Tags (xml)</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="39%"><b>Element</b></td>
+ <td width="61%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="39%" height="123">
+ <p><code><b><transform><br>
+ </b><font color="#000000">source xslt </font><font color="#000000">transformer</font>
+ <font color="#000000">result</font> <font color="#000000"></font>var <br>
+ <b></b><font color="#0000FF"> </font></code></p>
+ <p>Applies a transformation to an XML document given a specific XSLT stylesheet
+ or a transformer object.</p>
+ </td>
+ <td width="61%" height="123">
+ <pre><c:import url="/xml/employees.xml" var="xml"/>
+<c:import url="/xslt/customerList.xsl" var="xslt"/><br><x:xslt source="$xml" xslt="$xslt"/></pre>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><param></b><br>
+ <font color="#000000"><b>name</b> value </font></code></p>
+ <p>Sub-element to specify request parameters for the enclosing <transform>.</p>
+ </td>
+ <td width="61%">
+ <pre>
+
+<x:transform source="$xml" xslt="$xslt"><br> <x:param name="foo" value="foo-value"/><br></x:transform></pre>
+ <p> </p>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><transformer></b><br>
+ <font color="#000000">xslt <b>var</b></font></code></p>
+ <p>Creates a "transformer" object for more efficient transformations
+ that use the same XSLT stylesheet.</p>
+ </td>
+ <td width="61%">
+ <pre><c:import url="/xslt/style.xsl" var="xslt"/><br><x:transformer xslt="$xslt" var="transformer"/><br>...<br><x:transform source="$xml" transformer="$transformer" />
+...
+<x:transform source="$xml2" transformer="$transformer" /></pre>
+ </td>
+ </tr>
+</table>
+<h2>Tag Library Validators</h2>
+<table width="100%" border="1" cellpadding="5">
+ <tr bgcolor="#000099">
+ <td colspan="2"><b><font color="#FFFFFF" size="+1">Tag Library Validators</font></b></td>
+ </tr>
+ <tr>
+ <td colspan="2">EA2 comes with two TagLibraryValidators (TLVs), which are
+ classes that ensure pages meet particular criteria before they can run.</td>
+ <tr bgcolor="#FFFF66">
+ <td width="31%"><b>Tag Library Validator</b></td>
+ <td width="48%"><b>Sample Usage</b></td>
+ </tr>
+ <tr>
+ <td width="19%"><code><b>JsptlCoreTLV</b></code><br>
+ </td>
+ <td width="53%">
+ <p>(Nothing special is required to use the Core TLV. This validator simply
+ does its best to ensure that JSTL's tags are used correctly, reporting
+ useful error messages when it can.)</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="19%"><code><b>ScriptFreeTLV</b></code></td>
+ <td width="53%"> The following directive on a JSP page invokes the ScriptFreeTLV
+ validator to make sure that no scripting elements appear on the page:
+ <pre><%@ taglib prefix="scriptfree"
+ uri="http://jakarta.apache.org/taglibs/jsptl/scriptfree" %></pre>
+ </td>
+ </tr>
+</table>
+<h2>Expression Language Selection</h2>
+<table width="100%" border="1" cellpadding="5">
+ <tr bgcolor="#000099">
+ <td colspan="2"><b><font color="#FFFFFF" size="+1">Expression Language Selection</font></b></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p>Temporary mechanisms that allow for runtime pluggability of expression-language
+ evaluators. This allows for experimentation with expression languages
+ and is not expected to remain in the final release of JSTL 1.0.</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="24%" bgcolor="#FFFF66"><b>Element</b></td>
+ <td width="76%" bgcolor="#FFFF66"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="24%">
+ <p><code><b>context parameter </b></code></p>
+ <p>Establishes the default Expression Language used by the web application.<br>
+ </p>
+ </td>
+ <td width="76%">
+ <p><code><context-param><br>
+ <param-name><br>
+ </code><code>javax.servlet.jstl.ExpressionEvaluatorClass<br>
+ </param-name><br>
+ <param-value><br>
+ org.apache.taglibs.standard.lang.spel.Evaluator<br>
+ </param-value><br>
+ </context-param></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="24%">
+ <p><code><b><expressionLanguage></b></code></p>
+ <p>Change the current Expression Language</p>
+ </td>
+ <td width="76%">
+ <p><code><c:expressionLanguage<br>
+ </code><code>evaluator="org.apache.taglibs.jstl.lang.jpath.Evaluator"><br>
+ ...<br>
+ </c:expressionLanguage></code></p>
+ </td>
+ </tr>
+</table>
+<p> </p>
+</body>
+</html>
diff --git a/doc/web/ReleaseNotes.html b/doc/web/ReleaseNotes.html
new file mode 100644
index 0000000..d567cd4
--- /dev/null
+++ b/doc/web/ReleaseNotes.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<title>JSTL: Release Notes</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<h1>JSTL: Release Notes</h1>
+
+<p><b>JSTL EA2 introduces a variety of new features, and it rounds out
+some of the support initially provided in EA1. This document contains a
+running list of additions and changes.</b></p>
+
+<hr />
+
+<dl>
+<dt><b>21 Nov 2001</b></dt>
+<dd>JSTL EA2 RI, version 1.0, introduced. Version includes the following
+major changes and additions:
+<ul>
+ <li>JSPTL has been renamed to JSTL.</li>
+ <li>The "jsptl" library at Jakarta Taglibs has been renamed to
+ "standard."</li>
+ <li>Tags for text inclusion and URL encoding introduced.</li>
+ <li>Tags for i18n-capable text formatting introduced.</li>
+ <li>Tags for XML manipulation introduced.</li>
+ <li>JSTL now divides functionality among multiple TLDs. Each TLD represents
+ a cohesive unit of functionality, such as "XML manipulation" and
+ "formatting." 'jx' and 'jr' are no longer used; they are replaced
+ with shorter abbreviations for the common cases (e.g., 'c', 'x').
+ <li>ECMAScript is now the default expression evaluator. Since the
+ first release of EA1, new languages include JXPath and ECMAScript.</li>
+ <li>The RI has been thoroughly repackaged; many classes have moved.</li>
+ <li>The package name for the JSTL API is now javax.servlet.jsp.jstl
+ and is subdivided into cohesive packages. (The old package for the
+ API was javax.servlet.jsptl.)</li>
+ <li>A small number of minor changes were made to the code. By and large,
+ these changes are not significant; the easiest way to discover
+ further details is to look at the CVS archive itself.</li>
+</ul>
+</dd>
+
+<dt><b>09 Oct 2001</b></dt>
+<dd>JSTL EA1 RI, version 1.2, introduced. This version includes support
+for ECMAScript.</dd>
+
+<dt><b>23 Jul 2001</b></dt>
+<dd>JSTL EA1 RI, version 1.1, is released. This version is compatible
+with Tomcat 4.0 B6 and Tomcat 4.0 release.</dd>
+
+<dt><b>10 Jul 2001</b></dt>
+<dd>JSTL EA1 RI first made available for download.</dd>
+
+<dt><b>08 Jul 2001</b></dt>
+<dd>Initial version of JSTL RI contributed by JSR-052 Expert Group
+ and imported into Jakarta CVS archive.</dd>
+
+</body>
+</html>
diff --git a/doc/web/XML_ControlFlow_FunctionalDescription_1_EA2.html b/doc/web/XML_ControlFlow_FunctionalDescription_1_EA2.html
new file mode 100644
index 0000000..d805eb2
--- /dev/null
+++ b/doc/web/XML_ControlFlow_FunctionalDescription_1_EA2.html
@@ -0,0 +1,144 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>XML ControlFlow -- Functional Description</title>
+<style media="screen" type="text/css"><!--
+.fixme { color: red }
+--></style>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>
+ <hr width="100%" noshade>
+</h3>
+<h2> XML Control Flow Tags — Functional Description <br>
+</h2>
+<h2> <tt><x:forEach></tt><tt><br>
+ <x:if><br>
+ <x:choose> <x:when> <x:otherwise> <br>
+ </tt></h2>
+<hr width="100%" noshade>
+<h3>1. Introduction</h3>
+<p>The core set of XML tags provides the basic functionality to easily parse and
+ access XML data. Another important piece of functionality is the ability to
+ iterate over elements in an XML document, as well as conditionally process JSP
+ code fragments depending on the result of an XPath expression. The actions presented
+ in this document provide these capabilities.</p>
+<h3>2. <forEach></h3>
+<p>The <forEach> action evaluates the given XPath expression and iterates
+ over the result, setting the context node to each element in the iteration.
+ For example:</p>
+<blockquote>
+ <p><code><x:forEach select="$doc//author"><br>
+ <x:valueOf select="@name"><br>
+ </x:forEach> </code></p>
+</blockquote>
+<p>Optional attribute "var" makes it possible to save the current context
+ node of the iteration in a JSP "page" attribute. The exported object
+ has nested visibility. It is illegal to specify any scope other than "page"
+ for "var".</p>
+<h3>3. <tt><if></tt></h3>
+<p>The <tt><if></tt> action has a "select" attribute that specifies
+ an XPath expression. The expression is evaluated and the resulting object is
+ converted to a boolean according to the <a href="#XpathBooleanFunction">semantics
+ of the XPath boolean function</a>. The tag renders its body if the result is
+ true. For example:</p>
+<blockquote>
+ <p><code><x:if select="$customer/[location='UK']"><br>
+ UK based<br>
+ </x:if></code>
+</blockquote>
+<h3>4. <tt><choose> <when> <otherwise></tt></h3>
+<p>The <tt><choose></tt> action selects one among a number of possible alternatives.
+ It consists of a sequence of <x:when> elements followed by an optional
+ <x:otherwise>. Each <x:when> element has a single attribute, select,
+ which specifies an XPath expression. When a <x:choose> element is processed,
+ each of the <x:when> elements has its expression evaluated in turn, and
+ the resulting object is converted to a boolean according to the <a href="#XpathBooleanFunction">semantics
+ of the XPath boolean function</a>. The body of the first, and only the first,
+ <x:when> whose result is true is rendered. </p>
+<p>If none of the test conditions of nested <tt><when></tt> tags evaluates
+ to true, then the body of an <tt><otherwise></tt> tag is evaluated, if present.
+</p>
+<blockquote>
+ <p><code><x:choose><br>
+ <x:when test="$customer/firstName"><br>
+ Hello <xtags:valueOf select="$customer/firstName"/><br>
+ </x:when><br>
+ <x:otherwise><br>
+ Hello there friend<br>
+ </x:otherwise><br>
+ </x:choose></code></p>
+</blockquote>
+<h3><a name="XpathBooleanFunction"></a>5. XPath "boolean" function</h3>
+<p>As specified in the XPath spec, the boolean function converts its arguments
+ to a boolean as follows:</p>
+<ul>
+ <li>a number is true if an only if it is neither positive or negative zero nor
+ NaN</li>
+ <li>a node-set is true if and only if it is non-empty</li>
+ <li>a string is true if and only if its lenght is non-zero</li>
+</ul>
+<h3>6. Summary</h3>
+<table border="1" cellpadding="5" width="100%">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">XML Control
+ Flow Tags</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="55%"><b>Element</b></td>
+ <td width="45%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="55%"><code><b><forEach></b></code><br>
+ <b> select</b> var<br>
+ <br>
+ Evaluates the given XPath expression and iterates over the result, setting
+ the context node to each element in the iteration.</td>
+ <td width="45%"><code><x:forEach select="$doc//author"><br>
+ <x:valueOf select="@name"><br>
+ </x:forEach> </code></td>
+ </tr>
+ <tr>
+ <td width="55%">
+ <p><code><b><if> <br>
+ select<br>
+ </b></code><br>
+ Simple conditional tag, which evalutes its body if the supplied Xpath
+ expression evaluates to true (as if by a call to the XPath "boolean"
+ function).</p>
+ </td>
+ <td width="45%"><code><x:if select="$customer/[location='UK']"><br>
+ UK based<br>
+ </x:if></code> </td>
+ </tr>
+ <tr>
+ <td width="55%">
+ <p><code><b><choose><br>
+ </b></code><code><b><when> <br>
+ select</b><b><br>
+ <otherwise></b></code><br>
+ <br>
+ Simple conditional tag that establishes a context for mutually exclusive
+ conditional operations, marked by<code> <when></code> and<code>
+ <otherwise>.</code></p>
+ </td>
+ <td width="45%"><code><x:choose></code><code><br>
+ <x:when select="..."><br>
+ ...<br>
+ </x:when> </code><code><br>
+ <x:when select="..."><br>
+ ...<br>
+ </x:when> </code><code><br>
+ ...<br>
+ <x:otherwise><br>
+ ...<br>
+ </x:otherwise> </code><code></code><code> </code><code>
+ <br>
+ </x:choose> </code></td>
+ </tr>
+</table>
+<h3> </h3>
+</body>
+</html>
diff --git a/doc/web/XML_Core_FunctionalDescription_2_EA2.html b/doc/web/XML_Core_FunctionalDescription_2_EA2.html
new file mode 100644
index 0000000..a5becfa
--- /dev/null
+++ b/doc/web/XML_Core_FunctionalDescription_2_EA2.html
@@ -0,0 +1,290 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>XML Core -- Functional Description</title>
+<style media="screen" type="text/css"><!--
+.fixme { color: red }
+--></style>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>
+ <hr width="100%" noshade>
+</h3>
+<h2> XML Core Tags — Functional Description <br>
+</h2>
+<h2> <tt><x:parse><br>
+ <x:expr><br>
+ <x:set></tt><tt><br>
+ </tt></h2>
+<hr width="100%" noshade>
+<h3>1. Introduction</h3>
+<p>Enterprise data used in the web tier is increasingly XML these days —
+ whether the enterprise data is a response coming from a Web Service, the result
+ of a stock quote from Nasdaq, a google search, babel fish translation, an Amazon
+ book search, NewsML news articles, or RSS for content syndication. When companies
+ cooperate over the web, XML is the data format of choice for exchanging information.<br>
+</p>
+<p>XML is therefore becoming more and more important in a page author's life.
+ The set of XML tags specified in JSTL is therefore meant to address the basic
+ XML needs a page author is likely to encounter.</p>
+<h4>XPath</h4>
+<p>A key aspect of dealing with XML documents is to be able to easily access their
+ content. <a href="http://www.w3.org/TR/xpath">XPath</a>, a W3C recommendation
+ since 1999, provides an easy notation for specifying and selecting parts of
+ an XML document. The XML tagset in JSTL is therefore based on XPath.</p>
+<p>For the <i>XPath challenged</i>, here are a few links to get you started quickly:</p>
+<ul>
+ <li><a href="http://www.zvon.org/xxl/XPathTutorial/General/examples.html">Zvon
+ XPath Tutorial</a></li>
+ <li><a href="http://www.oreilly.com/catalog/xmlnut/chapter/ch09.html">XML in
+ a Nutshell — Chapter 9 — XPath</a></li>
+</ul>
+<p>It is important to note that the Expert Group is still debating which <i>global</i>
+ Expression Language(s) will be officially supported by JSTL. While this discussion
+ is still taking place, the approach we've taken here is to consider XPath as
+ a <i>local</i> Expression Language that applies to the XML tagset. How this
+ local XPath Expression Language integrates with the Global Expression Language
+ as well as JSP.next is briefly discussed in this document. </p>
+<p>The assumption is that if XPath (or a derivative) is not selected as <i>the</i>
+ or one of <i>the</i> Global Expression Languages, this set of tags would probably
+ stay as is. If XPath were to become one of <i>the</i> Global ELs, the design
+ of these tags would probably change, the extent of which has not yet been addressed.<br>
+</p>
+<h3>2. XPath as a <i>local</i> Expression Language for the XML set of tags</h3>
+<p>What we're doing with our set of XML tags is expanding our notion of Expression
+ Language so it can also apply "locally" to tags that want to support
+ an EL that is not <i>the</i> global one(s) supported within JSTL.</p>
+<p>Below are the rules of integration that XPath follows as a <i>local</i> EL,
+ so we have the guarantees that it plays nicely within the JSP/JSTL environment.</p>
+<h4>XPath Context</h4>
+ In XPath, the context for evaluating an expression consists of::
+<ul>
+ <li> a node or nodeset (see below)</li>
+ <li>variable bindings (see below)</li>
+ <li>function library: the default function library comes with the XPath engine.
+ Some engines provide extension functions or allow customization to add new
+ functions. The XPath function library in JSTL is limited to the core function
+ library of the XPath specification.</li>
+ <li>namespace prefix definitions which allow namespace prefixes to be used within
+ the XPath expression<br>
+ ( e.g. /SOAP-ENV:Envelope/SOAP-ENV:Body/m:foo)</li>
+</ul>
+<p><b>Attributes to specify XPath Expressions</b></p>
+<p>In the JSTL set of XML tags, XPath expressions are always specified using
+ attribute "select". This therefore means that only values specified
+ for "select" attributes are evaluated using the XPath expression language.
+ All other attributes are evaluated using the rules associated with the currently
+ active global Expression Language. This should help avoid confusion between
+ XPath and the global Expression Language.</p>
+<p><b>XPath Variable Bindings</b></p>
+<p>JSTL supports variables in XPath expressions. The mapping of XPath variable
+ expressions is defined as follows:<p>
+<table border="1" cellpadding="2" cellspacing="1">
+ <tr>
+ <td><code>$foo</code></td>
+ <td>maps to <code>pageContext.findAttribute("foo")</code></td>
+ </tr>
+ <tr>
+ <td><code>$page:foo</code></td>
+ <td>maps to page scope</td>
+ </tr>
+ <tr>
+ <td><code>$request:foo</code></td>
+ <td>maps to request scope</td>
+ </tr>
+ <tr>
+ <td><code>$session:foo</code></td>
+ <td>maps to session scope</td>
+ </tr>
+ <tr>
+ <td><code>$app:foo</code></td>
+ <td>maps to application scope</td>
+ </tr>
+ <tr>
+ <td><code>$param:foo</code></td>
+ <td>maps to <code>request.getParameter("foo")</code></td>
+ </tr>
+ <tr>
+ <td><code>$initParam:foo</code></td>
+ <td>maps to <code>request.getInitParameter("foo")</code></td>
+ </tr>
+ <tr>
+ <td><code>$cookie:foo</code></td>
+ <td>maps to the cookie's value for name <code>foo</code></td>
+ </tr>
+ <tr>
+ <td><code>$header:foo</code></td>
+ <td>maps to <code>request.getHeader("foo")</code></td>
+ </tr>
+</table>
+<p>Through these mappings, scoped attributes, parameters, headers, and cookies
+ can all be used inside XPath expressions easily. For example:
+<blockquote>
+ <p> <code>/foo/bar[@x=$param:name]</code></p>
+</blockquote>
+<p> would find the "bar" element with an attribute "x" equal
+ to the value of the http request parameter "name".<br>
+</p>
+<p><b>Context Setup</b></p>
+<p>The context for the evaluation of an XPath Expression can be set in one of
+ two ways; either directly within the XPath expression:</p>
+<blockquote>
+ <p><code><x:parse source="$xml" var="doc"/><br>
+ <x:expr select="$doc/..."/></code></p>
+</blockquote>
+<p>or via an ancestor tag that sets a context that can be applied to its nested
+ tags. In the example below, the XPath expression specified in the select attribute
+ of <expr> has its context set to the current "atom" node in
+ the document.</p>
+<blockquote>
+ <p><code><x:forEach select="$doc//atom"/><br>
+ <x:expr select="name"/><br>
+ <x:forEach/> </code></p>
+</blockquote>
+<h4>Relationship between Local EL and the Global EL(s)</h4>
+<p>As mentioned in the previous section, only the "select" attribute
+ of xml tags can take XPath expressions. Global EL expressions and XPath expressions
+ cannot be mixed in the "select" attributes. </p>
+<p>With JSTL 1.0, the xml tagset knows that the value of select attributes are
+ XPath expressions. However, things will be different in JSP.next when the evaluation
+ of 'elexprvalues' are handled directly by the container. If the metacharacter
+ used to identify an 'elexprvalue' is defined as '$', this means that XPath expressions
+ starting with a variable would have to be escaped in a JSP.next environment,
+ unless JSP.next has provisions in the TLD to prevent expression evaluation.</p>
+<p>There might be other issues. These will be addressed once the discussions on
+ the Expression Language resume.</p>
+<h3>3. <parse></h3>
+<p>The <parse> action parses an XML document and saves the resulting object
+ in the JSP scoped attribute specified by attribute "var". The type
+ of the resulting object is not defined by the spec to allow implementations
+ to use whatever they deem best for efficient implementations of the XML tagset.</p>
+<p>The XML document can be specified either via the "source" attribute
+ (String or Reader object) </p>
+<blockquote>
+ <pre><jc:import url="http://acme.com/athletes?country=ethiopia" var="xml"/><br><x:parse source="$xml" var="athletes"/></pre>
+</blockquote>
+<p>or inline via the tag's body content:</p>
+<blockquote>
+ <pre><x:parse var="athletes">
+ <athletes>
+ <athlete>
+ <name>Abebe Bikila</name>
+ <country>Ethiopa</country><br> </athlete>
+ <athlete>
+ <name>Mamo Wolde</name>
+ <country>Ethiopia</country><br> </athlete>
+ </athletes>
+</x:parse>
+</pre>
+</blockquote>
+<p> When used in conjunction with the <parse> tag, the JSTL core tag <import>
+ provides access to a wide variety of URL-based input resources representing
+ XML documents.</p>
+<h4>Performance</h4>
+<p> If an implementation of the XML tagset is based on DOM-like structures (check
+ with the specific implementation you're using), there will be a significant
+ performance impact when dealing with large XML documents. To help with this,
+ attribute "filter" can be used to allow filtering of the input data
+ prior to having it parsed by the implementation into a DOM-like structure. </p>
+<p>For example, if one is interested in processing only the "European"
+ customers which represent only 10% of the original XML document received as
+ input, it will greatly reduce the size and complexity of the resulting DOM structure
+ if all non-European customers are pruned from the XML document prior to parsing.
+</p>
+<pre> <jc:import url="http://acme.com/customers" var="xml"/><br> <x:parse source="$xml" filter="$filterEuropeanCust" var="doc"/></pre>
+<p>The "filter" attribute accepts an object of type <code>org.xml.sax.XMLFilter</code>.</p>
+<p>If configuration of the filter is desirable, it is suggested that the developer
+ of the filter provide a custom tag for easy configuration by a page author.</p>
+<blockquote>
+ <p> <code><acme:myFilter var="filter" xpath="//author"
+ ... /><br>
+ <x:parse filter="$filter" .../></code></p>
+</blockquote>
+<h3>4. <expr></h3>
+<p>The <tt><expr></tt> action evaluates the given XPath expression on the current
+ context node and outputs the result of the evaluation to the current JspWriter
+ object. It is the equivalent of <tt><%= %></tt> and <code><jc:expr></code>,
+ with the difference that it is meant for the XPath Expression Language world
+ (as opposed to the scripting language world (<code><%= %></code>) and
+ the Global Expression Language world of JSTL <code><jc:expr></code>).
+</p>
+<p>The expression to be evaluated is specified via the attribute "select"
+ and must be in the XPath syntax. The result of the evaluation is coerced to
+ a String and is subsequently emitted into the current JspWriter object. </p>
+<p>For example: </p>
+<p><tt> <x:expr select="$athletes/athlete/name"/></tt> </p>
+<h3>5. <set></h3>
+<p>The <tt><set></tt> action evaluates an XPath expression (attribute "select")
+ and sets the result into a JSP scoped attribute specified by attribute "var".
+</p>
+<p>In this first example, the list of athletes from a specific country is saved
+ in scoped attribute athletesOfCountry:</p>
+<blockquote> <code><x:set select="$athletes/athlete[country=$request:country]"
+ var="athletesOfCountry"/>
+ </code></blockquote>
+<p>In this second example, the <set> action is used to set a context used
+ by other xml tags:</p>
+<blockquote>
+ <pre><x:set select="$athletes/athlete[id=$param:athleteId]" var="ath"/>
+
+<x:expr select="$ath/name"/><br><x:expr select="$ath/country"/></pre>
+</blockquote>
+<h3>6. Notes</h3>
+<ul>
+ <li>
+ <p>Some XPath expressions can be evaluated without a context<br>
+ For example:<br>
+ <code>starts-with($header:user-agent,
+ 'Mozilla 4.0')</code></p>
+ </li>
+</ul>
+<h3>7. Summary</h3>
+<table border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">XML Core
+ Tags</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="318"><b>Element</b></td>
+ <td width="392"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="318"><code><b><parse></b></code><br>
+ <code><font color="#FF0000"><b><font color="#000000">var</font></b></font>
+ source filter</code><br>
+ <br>
+ Parses an XML and saves its internal representation into the JSP scoped
+ attribute specified by "var".</td>
+ <td width="392"> <code><c:import url="http://acme.com/athletes?country=ethiopia"
+ var="xml"/><br>
+ <x:parse source="$xml" var="athletes"/> </code></td>
+ </tr>
+ <tr>
+ <td width="318">
+ <p><code><b><expr></b></code><br>
+ <code><font color="#000000"><b>select</b></font></code><br>
+ <br>
+ Evaluates the given XPath expression and outputs its text value.<br>
+ </p>
+ </td>
+ <td width="392">
+ <p><code><x:expr select="$ath/name"/></code></p>
+ </td>
+ </tr>
+ <tr>
+ <td width="318">
+ <p><code><b><set></b></code><br>
+ <code><font color="#000000"><b>var</b></font> <b><font color="#000000">select</font></b></code><br>
+ <br>
+ Evaluates the given XPath expression and saves the result into the JSP
+ scoped attribute specified by "var".</p>
+ </td>
+ <td width="392"> <code><x:set<br>
+ select="$athletes/athlete[country=$request:country]"
+ var="athletesOfCountry"/></code></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/doc/web/XML_Transformation_FunctionalDescription_3_EA2.html b/doc/web/XML_Transformation_FunctionalDescription_3_EA2.html
new file mode 100644
index 0000000..687fd3b
--- /dev/null
+++ b/doc/web/XML_Transformation_FunctionalDescription_3_EA2.html
@@ -0,0 +1,126 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>XML Transformation Tags -- Functional Description</title>
+<style media="screen" type="text/css"><!--
+.fixme { color: red }
+--></style>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>
+
+ <hr width="100%" noshade>
+</h3>
+
+<h2> XML Transformation Tags — Functional Description <br>
+</h2>
+
+<h2> <tt><x:transform><br>
+ <x:param> </tt><tt><br>
+ </tt><tt><x:transformer><br>
+ </tt></h2>
+<hr width="100%" noshade>
+<h3>1. <transform></h3>
+<p>The <transform> tag applies a transformation to an XML document (attribute
+ "source"), given a specific XSLT stylesheet (attribute "xslt").
+ If the source attribute is not specified, the input XML document is read from the
+ tag's body content. </p>
+<p>In the example below, the XML document to be transformed is retrieved from
+ an http request, while the XSLT stylesheet for the transformation is a webapp
+ resource. The result of the transformation is written to the page.</p>
+<pre> <c:import url="http://acme.com/customers?country=usa" var="xml"/>
+ <c:import url="/WEB-INF/xslt/customerList.xsl" var="xslt"/><br> <x:transform source="$xml" xslt="$xslt"/></pre>
+<p>The source and xslt attributes are objects of any of the following types: java.lang.String,
+ java.io.Reader, or javax.xml.transform.Source.</p>
+<p>As seen in the example above, the result of the transformation is written to
+ the page by default. It is also possible to capture the result of the transformation
+ in two other ways:</p>
+<ul>
+ <li>into a javax.xml.transform.Result object specified via attribute "result"
+ (object to be provided by page author)</li>
+ <li>into a org.w3c.dom.Document object, that will be stored in the JSP scope
+ attribute specified by "var". </li>
+</ul>
+<p>"var" and "result" are mutually exclusive. What's interesting
+ with the "var" attribute is that the exported document can be used
+ directly with the other xml tags. For example:</p>
+<blockquote>
+ <p><code><x:transform source="..." xslt=".." var="doc/><br>
+ <x:expr select="$doc/..."/></code></p>
+</blockquote>
+<p>The <transform> action also supports attribute "transformer"
+ described in section 3 (<transformer>) below.</p>
+<h3>2. <param></h3>
+<p>The <param> subtag can be used along with <transform> to set transformation
+ parameters. Attributes 'name' and 'value' are used to specify the parameter.
+ The value attribute is optional. If it is not specified the value is retrieved
+ from the tag's body.</p>
+<p>For example:</p>
+<pre> <x:transform source="$xml" xslt="$xslt"><br> <x:param name="foo" value="foo-value"/><br> </x:transform></pre>
+<h3>3. <transformer></h3>
+<p>It is sometimes the case that the same stylesheet transformation needs to be
+ applied multiple times to different source XML documents. A more efficient approach
+ is to process the transformation stylesheet once, and then save this "transformer"
+ object for successive transformations.</p>
+<p>As shown in the example below, the <transformer> tag can be used in collaboration
+ with the transformer attribute of <transform> to efficiently reuse a transformation
+ stylesheet.</p>
+<pre> <c:import url="/xslt/style.xsl" var="xslt"/><br> <x:transformer xslt="$xslt" var="transformer"/><br> <c:forEach items="$xmlDocs" var="xml"><br> ...<br> <x:transform source="$xml" transformer="$transformer" /><br> ...<br> </c:forEach></pre>
+The attribute xslt is optional. If not specified, the stylesheet is read from
+the tag's body content.
+<h3>4. Summary</h3>
+<table width="100%" border="1" cellpadding="5">
+ <tr>
+ <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="+1">XML Transformation
+ Tags</font></b></td>
+ </tr>
+ <tr bgcolor="#FFFF66">
+ <td width="39%"><b>Element</b></td>
+ <td width="61%"><b>Sample usage</b></td>
+ </tr>
+ <tr>
+ <td width="39%" height="123">
+ <p><code><b><transform><br>
+ </b><font color="#000000">source xslt </font><font color="#000000">transformer</font>
+ <font color="#000000">result</font> <font color="#000000"></font>var <br>
+ <b></b><font color="#0000FF"> </font></code></p>
+ <p>Applies a transformation to an XML document given a specific XSLT stylesheet
+ or a transformer object.</p>
+ </td>
+ <td width="61%" height="123">
+ <pre><c:import url="/xml/employees.xml" var="xml"/>
+<c:import url="/xslt/customerList.xsl" var="xslt"/><br><x:xslt source="$xml" xslt="$xslt"/></pre>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><param></b><br>
+ <font color="#000000"><b>name</b> value </font></code></p>
+ <p>Sub-element to specify request parameters for the enclosing <transform>.</p>
+ </td>
+ <td width="61%">
+ <pre>
+
+<x:transform source="$xml" xslt="$xslt"><br> <x:param name="foo" value="foo-value"/><br></x:transform></pre>
+ <p> </p>
+ </td>
+ </tr>
+ <tr>
+ <td width="39%">
+ <p><code><b><transformer></b><br>
+ <font color="#000000">xslt <b>var</b></font></code></p>
+ <p>Creates a "transformer" object for more efficient transformations
+ that use the same XSLT stylesheet.</p>
+ </td>
+ <td width="61%">
+ <pre><c:import url="/xslt/style.xsl" var="xslt"/><br><x:transformer xslt="$xslt" var="transformer"/><br>...<br><x:transform source="$xml" transformer="$transformer" />
+...
+<x:transform source="$xml2" transformer="$transformer" /></pre>
+ </td>
+ </tr>
+</table>
+<h3> </h3>
+</body>
+</html>
diff --git a/doc/web/index.html b/doc/web/index.html
new file mode 100644
index 0000000..39902e4
--- /dev/null
+++ b/doc/web/index.html
@@ -0,0 +1,116 @@
+<html>
+<head>
+<title>JSP Standard Tag Library</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<h1>The JSP™ Standard Tag Library (JSTL)</h1>
+<h2>Release: Early Access 1 (EA2)</h2>
+
+<p>Thanks for downloading the JSTL EA2 release. We hope you find the tags, documents,
+ and examples here of interest. We're curious to hear your feedback on this release,
+ which represents work in progress toward a standard JSP Tag Library. Please
+ contact us at</p>
+
+<pre> <a href="mailto:jsr052-comments@sun.com">jsr052-comments@sun.com</a>
+</pre>
+
+<p>with any comments you might have.</p>
+
+<p>Included in this distibution:</p>
+
+<h3>Documentation ('doc/web' directory)</h3>
+
+
+<ul>
+ <li><a href="GettingStarted.html">Getting Started</a>: A quick roadmap to help
+ you get started with this release.</li>
+ <li><a href="Overview.html">Overview</a>: An overview of JSTL's design philosophy
+ and current syntax.</li>
+ <li><a href="ReleaseNotes.html">Release Notes</a>: Changes since EA1, and
+ other historical information.</li>
+ <li>Functional descriptions: Technical guides representing the design considerations
+ and functionality of JSTL's tag set. Note that these are not formal specifications,
+ just technical overviews of functionality and intent.
+ <ul>
+ <li><a href="IteratorTag_FunctionalDescription_2_EAI.html"> Iteration</a></li>
+ <li><a href="Conditionals_FunctionalDescription_1_EA2.html"> Conditional
+ logic</a></li>
+ <li><a href="ExpressionLanguageSupport_FunctionalDescription_2_EA2.html">
+ Expression-language support</a></li>
+ <li><a href="ExpressionTags_FunctionalDescription_1_EA2.html"> Expression-language
+ tags</a>
+ <ul>
+ <li>The <a href="spel"> Simplest Possible Expression Language (SPEL)
+ </a> </li>
+ <li>EcmaScript examples: see the <a href="/jsptl-examples/ecmascript/index.html">
+ JSTL-examples/ecmascript</a> web application </li>
+ </ul>
+ </li>
+ <li><a href="IOT_Import_FunctionalDescription_5_EA2.html">Import tags</a></li>
+ <li>XML tags
+ <ul>
+ <li><a href="XML_Core_FunctionalDescription_2_EA2.html">core</a></li>
+ <li><a href="XML_ControlFlow_FunctionalDescription_1_EA2.html">control
+ flow</a></li>
+ <li><a href="XML_Transformation_FunctionalDescription_3_EA2.html">transformation</a></li>
+ </ul>
+ </li>
+ <li>I18N & Formatting tags</li>
+ </ul>
+ </li>
+</ul>
+
+<h3>Examples ('examples' directory)</h3>
+
+<p> The JSTL-examples application included with this distribution
+ demonstrates the current capabilities of JSTL, exploring idioms
+ and usage patterns when appropriate.</p>
+
+<h3>Reference implementation ('src' and 'conf' directories)</h3>
+
+<p> Every effort has been made to provide a functional, robust, and
+ speedy reference implementation (RI) for the current functionality
+ JSTL offers. For developers, the code is commented thoroughly
+ to help provide an understanding of design considerations and
+ salient implementation details.</p>
+
+<p> Classes in the javax.servlet.JSTL represent the current
+ draft of the JSTL API classes. Classes under org.apache.*
+ represent the reference implementation, expected to be released
+ through Jakarta Taglibs. The package structure for the RI is
+ organized as follows:</p>
+
+<pre>
+ org.apache.taglibs.standard
+ .tag tag handlers and routines related to them
+ .common handlers and support routines common for RT/EL attributes
+ .core core library (common)
+ .fmt internationalization-capable formatting tags (common)
+ .xml XML manipulation library (common)
+ .el handlers specific to expression language (EL) evaluation
+ .core core library (EL)
+ .fmt internationalization-capable formatting tags (EL)
+ .xml XML manipulation library (EL)
+ .rt handlers specific to rtexprvalue (rt) evaluation
+ .core core library (rt)
+ .fmt internationalization-capable formatting tags (rt)
+ .xml XML manipulation library (rt)
+ .tei TagExtraInfo classes (common to both libraries)
+ .tlv TagLibraryValidator classes (and associated helpers)
+ .lang expression-language support and implementation
+ .dummy dummy ExpressionEvaluator
+ .support ExpressionEvaluator, ExpressionEvaluatorManager
+ .spel SPEL
+ .jpath JPath
+ .jxpath JXPath
+ .javascript ECMAScript (JavaScript/Rhino)
+</pre>
+
+<p>Enjoy!</p>
+
+<pre>
+ -- JSR-052 (JSTL) Expert Group
+ (<a href="mailto:jsr052-comments@sun.com">jsr052-comments@sun.com</a>)
+</pre>
diff --git a/doc/web/spel/index.html b/doc/web/spel/index.html
new file mode 100644
index 0000000..e60c3a1
--- /dev/null
+++ b/doc/web/spel/index.html
@@ -0,0 +1,211 @@
+<html>
+<head><title>SPEL Implementation</title></head>
+
+<body>
+<h1>SPEL Implementation</h1>
+<h4>Nathan Abramson (arista@atg.com)</h4>
+
+<h2>Overview</h2>
+
+<p>This distribution contains an implementation of the <a
+href="spel.html">Simplest Possible Expression Language (SPEL) for the
+JSTL</a>. In addition to the implementation, the distribution
+contains regression tests for the parser and evaluator, and a simple
+performance test.
+
+<p>The distribution contains the following directories and files:
+
+<ul>
+<li><b>doc/</b> - documentation
+<li><b>src/</b> - all source files
+<li><b>lib/classes.jar</b> - compiled classes
+</ul>
+
+<h2>Implementation Notes</h2>
+
+<ul>
+
+<li>The class files are found in the package
+<b>org.apache.taglibs.standard.lang.spel</b>.
+
+<li>The class implementing ExpressionEvaluator is
+<b>org.apache.taglibs.standard.lang.spel.Evaluator</b>
+
+<li>The implementation assumes that the ExpressionEvaluator interface
+is found at <b>javax.servlet.jsp.jstl.core.ExpressionEvaluator</b>, with the
+following definition (taken from Shawn's implementation):
+
+<ul><pre>
+public String validate(String attributeName,
+ String expression);
+public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException;
+</pre></ul>
+
+<p>If this is not the package or definition of the ExpressionEvaluator
+interface, the appropriate changes should be made to the <a
+href="../src/org.apache.taglibs.standard/lang/spel/Evaluator.java">src/org/apache/taglibs/jsptl/lang/spel/Evaluator.java</a>
+source file. In any case, the <a
+href="../src/javax/servlet/jsptl/ExpressionEvaluator.java">ExpressionEvaluator
+implementation</a> should be removed from the distribution, and the
+distribution should be compiled against the "real" implementation of
+that class.
+
+<li>The parser was generated using <a
+href="http://www.webgain.com/products/metamata/java_doc.html">JavaCC</a>.
+The parser definition is found in <a
+href="../src/org.apache.taglibs.standard/lang/spel/SpelParser.jj">src/org/apache/taglibs/jsptl/lang/spel/SpelParser.jj</a>,
+and all files generated by JavaCC are placed into the
+org.apache.taglibs.standard.lang.spel.parser package. Note that JavaCC is not
+required to compile the SPEL implementation - it is only needed if the
+grammar in the SpelParser.jj file changes.
+
+<li>JavaCC 1.0 was used to generate the parser. If desired, the most
+recent version of JavaCC can be used to regenerate the parser, but the
+<a href="#regressionTests">regression tests</a> should then be run to
+make sure the behavior hasn't changed.
+
+<li>All localizable error messages are stored in the <a
+href="../src/org.apache.taglibs.standard/lang/spel/Resources.properties">src/org/apache/taglibs/jsptl/lang/spel/Resources.properties</a>
+file. This file must be copied into the final distribution with the
+generated class files.
+
+</ul>
+
+<a name="regressionTests"><h2>Regression Tests</h2></a>
+
+<p>There are two sets of automated regression tests - the first tests
+the parser, and the second tests the full evaluator. In both cases,
+the tester takes an input file containing expressions to be parsed or
+evaluated, processes each expression, and writes the results or errors
+to an output file. The output file can then be compared against an
+expected output file to see if any regression has occurred.
+
+<p>In both cases, input lines that are blank or start with "#" are
+copied to the output file without interpretation. This allows
+comments to appear in the output file, which can aid in debugging.
+
+<h4>Parser tests</h4>
+
+<p>The parser test input file is found at <a
+href="../src/org.apache.taglibs.standard/lang/spel/test/parserTests.txt">src/org/apache/taglibs/jsptl/lang/spel/test/parserTests.txt</a>.
+Each line represents an expression to be parsed - the expression is
+parsed, and printed back out in the evaluator's "canonical form". For
+example, in the canonical form, all Strings are enclosed by double
+quotes, all names are prefixed by a scope operator ":", etc.
+
+<p>The expected outputs are found at <a
+href="../src/org.apache.taglibs.standard/lang/spel/test/parserTestsExpectedOutput.txt">src/org/apache/taglibs/jsptl/lang/spel/test/parserTestsExpectedOutput.txt</a>
+
+<p>The parser tests can be run like this:
+
+<ul><pre>
+java org.apache.taglibs.standard.lang.spel.test.ParserTest {inputFile} {outputFile} [{expectedOutputFile}]
+</pre></ul>
+
+The {expectedOutputFile} is optional - if supplied, the test will
+compare the ouput file with the expected output file and print whether
+the test passed or failed.
+
+<h4>Evaluation tests</h4>
+
+<p>For the evaluation test, a "dummy" PageContext was created
+containing some beans with properties in various scopes. That
+PageContext is created in the "createTestContext" method of <a
+href="../src/org.apache.taglibs.standard/lang/spel/test/EvaluationTest.java">src/org/apache/taglibs/jsptl/lang/spel/test/EvaluationTest.java</a>.
+
+<p>The evaluation test input file is found at <a
+href="../src/org.apache.taglibs.standard/lang/spel/test/evaluationTests.txt">src/org/apache/taglibs/jsptl/lang/spel/test/evaluationTests.txt</a>.
+Each line represents an expression to be parsed, followed by a line
+specifying the expected type - the expression is parsed, and the
+resulting value is printed along with its class.
+
+<p>The expected outputs are found at <a
+href="../src/org.apache.taglibs.standard/lang/spel/test/evaluationTestsExpectedOutput.txt">src/org/apache/taglibs/jsptl/lang/spel/test/evaluationTestsExpectedOutput.txt</a>
+
+<p>The evaluation tests can be run like this:
+
+<ul><pre>
+java org.apache.taglibs.standard.lang.spel.test.EvaluationTest {inputFile} {outputFile} [{expectedOutputFile}]
+</pre></ul>
+
+The {expectedOutputFile} is optional - if supplied, the test will
+compare the ouput file with the expected output file and print whether
+the test passed or failed.
+
+<a name="optimizations"><h2>Optimizations</h2></a>
+
+<p>Because expression evaluation could conceivably make up a large
+portion of a JSP's rendering time, a great deal of emphasis was placed
+on performance. The following performance optimizations were used:
+
+<ul>
+
+<p><li>Parsed expressions are cached, so that each expression is
+parsed only once. To avoid synchronization bottlenecks, the cache is
+only synchronized around determining if an expression is in the cache,
+and putting a parsed expression into the cache. This means that two
+threads could both end up parsing and caching the same uncached
+expression at the same time, but the result of this is harmless. This
+caching happens in the Evaluator class.
+
+<p><li>The Evaluator class is also responsible for parsing literals
+(expressions not starting with "$"). The results of these parsings
+are also cached, but in this case the key is {expression,
+expectedType}. Rather than creating an actual key class (which would
+require object creations for each lookup), the tuple key is simulated
+by having two levels of caches: expected type -> expression -> parsed
+expression.
+
+<p><li>The mapping from {class,propertyName} to PropertyDescriptor is
+cached by the BeanInfoManager. The PropertyDescriptors are used by
+the "{bean}.{property}" construct.
+
+<p><li>In cases where a primitive type needs to be wrapped in an
+object (such as the final casting from expression result to expected
+type), the PrimitiveObjects class is used to do the wrapping. This
+class precalculates the wrappings for bytes and chars with values from
+0-255, and shorts, ints, and longs with values from -1000 to 1000.
+Wrapped values in those ranges will not require any object creations
+to represent their primitive values.
+
+</ul>
+
+<a name="performanceTests"><h2>Performance Tests</h2></a>
+
+<p>The distribution includes a single performance test which evaluates
+an expression many times. The expression is:
+
+<ul><pre>
+session:bean1a.bean1.int1 < 24
+</pre></ul>
+
+<p>To test for synchronization bottlenecks, the test spawns several
+threads which simultaneously evaluate the expression many times.
+
+<p>The test then runs again, but evaluates the expression "by hand"
+using direct API calls - i.e.,
+pageContext.getAttribute(...).getBean1().getInt1 () < 24. So the
+performance test essentially determines the cost of using an
+expression instead of an rtexprvalue.
+
+<p>The test is run like this:
+
+<ul><pre>
+org.apache.taglibs.standard.lang.spel.test.PerformanceTest {#threads} {#iterations/thread}
+</pre></ul>
+
+<p>The initial results are encouraging - running 20 threads over
+100000 iterations/thread, a ThinkPad 600E could do ~50000
+iterations/second using the evaluator, and ~110000 iterations/second
+using the API calls. So using the API calls in this example is only
+twice as fast as using the evaluator, which means that the expression
+language introduces a significant, but not severe performance penalty.
+
+<h4><i>$Change: 181170 $$DateTime: 2001/06/26 08:09:32 $$Author$</i></h4>
+
+</html>
diff --git a/doc/web/spel/spel.html b/doc/web/spel/spel.html
new file mode 100644
index 0000000..e901130
--- /dev/null
+++ b/doc/web/spel/spel.html
@@ -0,0 +1,533 @@
+<html>
+<head><title>Simplest Possible Expression Language (SPEL) for
+JSPSTL</title></head>
+
+<body>
+<h1>Simplest Possible Expression Language (SPEL) for JSPSTL</h1>
+<h4>Nathan Abramson (arista@atg.com)</h4>
+
+<h2>Overview</h2>
+
+<p>The SPEL is designed to be the simplest possible JSPSTL expression
+language that is still useful. The only required features of the SPEL
+are:
+
+<ul>
+
+<li>notion of scope (page, request, session, app)
+<li>nested attributes
+<li>relational operators
+
+</ul>
+
+<p>The idea is to design a language that will eventually grow, keeping
+in mind that future versions of the language should be backwards
+compatible with this version of the SPEL.
+
+<h2>Syntax</h2>
+
+<p>The syntax is extremely simple. Attributes are accessed by name,
+with an optional scope ("page:", "request:", "session:", "app:").
+Properties of attributes are accessed using the "." operator, and may
+be nested arbitrarily. Attribute and property names must be java
+identifiers, unless they are quoted. Relational comparisons are
+allowed using the relational operators (==, !=, <, >, <=,
+>=). Comparisons may be made against other values, or against
+boolean, String, integer, or floating point literals.
+
+<p>The following are the constructs supported by the SPEL:
+
+<table>
+
+<tr>
+<td><b>Expression</b></td>
+<td>::=</td>
+<td><b>Value</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>RelationalExpression</b></td>
+</tr>
+
+<tr>
+<td><b>RelationalExpression</b></td>
+<td>::=</td>
+<td><b>Value RelOp Value</b></td>
+</tr>
+
+<tr>
+<td><b>RelOp</b></td>
+<td>::=</td>
+<td><b>'=='</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| '!='</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| '<'</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| '>'</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| '<='</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| '>='</b></td>
+</tr>
+
+<tr>
+<td><b>Value</b></td>
+<td>::=</td>
+<td><b>PropertyValue</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>Literal</b></td>
+</tr>
+
+<tr>
+<td><b>PropertyValue</b></td>
+<td>::=</td>
+<td><b>NamedValue</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>PropertyValue</b> '.' <b>Identifier</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>PropertyValue</b> '.' <b>StringLiteral</b></td>
+</tr>
+
+<tr>
+<td><b>NamedValue</b></td>
+<td>::=</td>
+<td><b>ScopedIdentifier</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>Identifier</b></td>
+</tr>
+
+<tr>
+<td><b>ScopedIdentifier</b></td>
+<td>::=</td>
+<td><b>ScopeName</b> ':' <b>Identifier</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>ScopeName</b> ':' <b>StringLiteral</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| ':' (<b>Identifier</b> | <b>StringLiteral</b>)</td>
+</tr>
+
+<tr>
+<td><b>ScopeName</b></td>
+<td>::=</td>
+<td>'page'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'request'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'session'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'app'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'header'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'param'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'paramvalues'</td>
+</tr>
+
+<tr>
+<td><b>Identifier</b></td>
+<td>::=</td>
+<td><i>Java language identifier</i></td>
+</tr>
+
+<tr>
+<td><b>Literal</b></td>
+<td>::=</td>
+<td><b>BooleanLiteral</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>IntegerLiteral</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>FloatingPointLiteral</b></td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>StringLiteral</b></td>
+</tr>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| <b>NullLiteral</b></td>
+</tr>
+
+<tr>
+<td><b>BooleanLiteral</b></td>
+<td>::=</td>
+<td>'true'</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| 'false'</td>
+</tr>
+
+<tr valign="top">
+<td><b>StringLiteral</b></td>
+<td>::=</td>
+<td>'([^'\]|\'|\\)*'</td>
+<tr>
+<td> </td>
+<td> </td>
+<td>| "([^'\]|\'|\\)*"</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>i.e., a string of any characters enclosed by single or double
+quotes, where \ is used to escape ', ", and \.</td>
+</tr>
+
+<tr>
+<td><b>IntegerLiteral</b></td>
+<td>::=</td>
+<td>["+","-"] ["1"-"9"] (["0"-"9"])*</td>
+</tr>
+
+<tr>
+<td><b>FloatingPointLiteral</b></td>
+<td>::=</td>
+<td> (["+","-"])? (["0"-"9"])+ "." (["0"-"9"])* (["e","E"] (["+","-"])? (["0"-"9"])+)?</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| (["+","-"])? "." (["0"-"9"])+ (["e","E"] (["+","-"])? (["0"-"9"])+)?</td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td>| (["+","-"])? (["0"-"9"])+ ["e","E"] (["+","-"])? (["0"-"9"])+</td>
+</tr>
+
+<tr>
+<td><b>NullLiteral</b></td>
+<td>::=</td>
+<td>'null'</td>
+</tr>
+
+</table>
+
+<p>Notes:
+
+<ul>
+
+<li>An identifier is constrained to be a Java identifier - i.e., no
+"-", no "/", etc. without quoting. Eventually this may be expanded,
+but this is the minimum.
+
+<li>A String only recognizes a limited set of escape sequences, and \
+may not appear unescaped. This may eventually be expanded, but once
+again, this is the minimum.
+
+<li>The definitions for integer and floating point literal are pretty
+much taken from the Java definitions.
+
+<li>The relational operator for equality is "==" (double equals).
+This is to be more Java-like, but is it the best idea?
+
+<li>There are no logical operators (and, or, not). Designing these
+introduces the notion of grouping (parentheses) and order of
+precedence, and also deciding what the actual operators should be (and
+vs. &&), which also introduces the notion of reserved words.
+It is possible that keeping these out severely limits the usefulness
+of the language. Should they be introduced?
+
+</ul>
+
+<h2>Reservered Words</h2>
+
+<p>The following words are reserved for the language and should not be
+used as identifiers without being quoted.
+
+<ul><table>
+<tr valign="top">
+
+<td><pre>
+and
+or
+not
+</pre></td>
+
+<td> </td>
+
+<td><pre>
+eq
+ne
+lt
+</pre></td>
+
+<td> </td>
+
+<td><pre>
+gt
+le
+ge
+</pre></td>
+
+<td> </td>
+
+<td><pre>
+true
+false
+null
+</pre></td>
+
+<td> </td>
+
+<td><pre>
+instanceof
+</pre></td>
+
+</tr>
+</table></ul>
+
+<p>Note that these words may not be in the language now, but they may
+be in the future, so developers should avoid using these words now.
+
+<h2>Named Values</h2>
+
+<p>If a named value is specified with a scope of "page", "request",
+"session", or "app", its value is the value of that name in the given
+scope. If no scope is given, the value is found according to the
+rules of PageContext.findAttribute(name).
+
+<p>If a named value is specified with a scope of "header", its value
+is obtained by calling HttpServletRequest.getHeader(String).
+
+<p>If a named value is specified with a scope of "param", its value is
+obtained by calling ServletRequest.getParameter(String).
+
+<p>If a named value is specified with a scope of "paramvalues", its
+value is obtained by calling
+ServletRequest.getParameterValues(String).
+
+<p>In any of these cases, if a value is not found, the result is an <a
+href="#expressionExceptions">ExpressionException</a>, not "null".
+
+<h2>Property Values</h2>
+
+<p>The expression "value . propertyName" denotes a property
+expression. The property is found through introspection by treating
+the value as a JavaBean and calling the appropriate setter method. If
+the result is a primitive value, the result is converted to the Object
+equivalent of the primitive.
+
+<ul>
+
+<li>It is an error if the bean value is null.
+
+<li>It is an error if the specified property is not found in the bean.
+
+<li>It is an error if calling the getter results in an error.
+
+</ul>
+
+<p>Note that these error conditions might be relaxed in the future,
+but for now they are as strict as possible.
+
+<p>In the future, the "." operator might be extended to interpret
+other name/value collections, such as Maps, but for now this is not
+the case. Note that in the future, the "Map behavior" might happen
+automatically, so JavaBeans should avoid implementing "java.util.Map"
+to avoid having their behavior change in the future.
+
+<h2>Type Conversion</h2>
+
+<p>Every expression is evaluated in the context of an "expected type".
+The result of the expression evaluation may not match the expected
+type exactly, so the following rules are applied:
+
+<ul>
+
+<li>If the expected type is assignable from the value's type, no
+conversion is required.
+
+<li>If the expected type is an Object type and the value is null, no
+conversion is required.
+
+<li>If the expected type is a primitive and the value is null, an
+error results.
+
+<li>If the expected type is a primitive and the value is the Object
+equivalent of that primitive, the Object equivalent is returned.
+
+<li>If the expected type (or its Object equivalent) is a numeric type,
+and the value is also a numeric type, the value is converted to the
+expected type, even if loss of precision would occur. The numeric
+types are: byte, short, int, long, float, double.
+
+<li>Any other condition is an error
+
+</ul>
+
+<h2>Relational Comparisons</h2>
+
+<p>The following rules are applied to evaluate a relational
+comparison.
+
+<h3>Rules for == and !=</h3>
+
+<p>The rules for equality are as follows:
+
+<ul>
+
+<li>If both values are null, the values are considered to be equal
+
+<li>If only one value is null, the values are not equal
+
+<li>If both values are the same object, the values are considered to
+be equal
+
+<li>If both values are numeric types, then the value with the least
+precise type is "cast up" to the type of the other value, and their
+values are compared. The order of numeric types from least precise to
+most precise is byte, short, int, long, float, double
+
+<li>If leftHandValue.equals(rightHandValue), the values are considered
+to be equal
+
+<li>In all other cases, the values are not equal
+
+</ul>
+
+<h3>Rules for >, <, >=, <=</h3>
+
+<p>The rules for ordered comparisons are as follows:
+
+<ul>
+
+<li>If both values are Strings, the Strings are comapared according to
+the rules of String.compareTo(String).
+
+<li>If both values are numeric types, then the value with the least
+precise type is "cast up" to the type of the other value, and their
+values are compared. The order of numeric types from least precise to
+most precise is byte, short, int, long, float, double
+
+<li>All other cases result in an error
+
+</ul>
+
+<a name="expressionExceptions"><h2>ExpressionExceptions</h2></a>
+
+<p>The ExpressionException mechanism in the JSTL is provided as a way
+for expression languages to indicate that there was a problem
+evaluating an expression, but the problem was small enough that a
+default value could be substituted in its place without invoking the
+entire JSP error handling mechanism.
+
+<p>The SPEL throws javax.servlet.jsp.jstl.core.ExpressionException in the
+following situations:
+
+<ul>
+
+<li>A NamedValue (e.g., "session:profile") can't be found. If the
+specified name is not found in the specified scope, then an
+ExpressionException is thrown, not a null value.
+
+<li>A requested property of a bean can't be evaluated, either because:
+
+<ul>
+
+<li>the bean's value is null
+
+<li>the bean does not have the specified property
+
+<li>the bean's property is not readable
+
+<li>there is an error invoking the bean's read method
+
+</ul>
+
+</ul>
+
+<h2>Literals and Delimiter</h2>
+
+<p>The SPEL is responsible for handling both expressions and
+literals. Expressions begin with a "$" character. For example:
+
+<ul><pre>
+<mytags:if test="$bean1.a < 3" />
+</pre></ul>
+
+<p>Any value that does not begin with "$" is treated as a literal that
+is parsed to the expected type using the PropertyEditor for the
+expected type:
+
+<ul><pre>
+<mytags:if test="true" />
+</pre></ul>
+
+<p>There may be literal values that start with the "$" character. If
+that is the case, the value must be escaped using the "\" character.:
+
+<ul><pre>
+<mytags:price price="\$3.95" />
+</pre></ul>
+
+<p>If a value starts with "\$", it is treated as a literal value with
+the leading "\" removed.
+
+<h4><i>$Change: 181991 $$DateTime: 2001/07/02 16:12:52 $$Author$</i></h4>
+
+</html>
diff --git a/examples/conf/jstl-examples.tld b/examples/conf/jstl-examples.tld
new file mode 100644
index 0000000..5ca8c3c
--- /dev/null
+++ b/examples/conf/jstl-examples.tld
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <tlib-version>1.0 EA2</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>ex</short-name>
+
+ <tag>
+ <name>escapeHtml</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.EscapeHtmlTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>reader</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>writer</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>resource</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.ResourceTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>resource</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>file</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.FileTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>file</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>odd</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.OddTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <name>even</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.EvenTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <name>usCustomer</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.UsCustomerTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>customer</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>customerFmt</name>
+ <tag-class>org.apache.taglibs.standard.examples.taglib.CustomerFmtTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>customer</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>fmt</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>SPath</name>
+ <tag-class>org.apache.taglibs.standard.extra.spath.SPathTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+</taglib>
diff --git a/examples/conf/web.xml b/examples/conf/web.xml
new file mode 100644
index 0000000..2e95363
--- /dev/null
+++ b/examples/conf/web.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
+
+<web-app>
+
+ <description>
+ Examples for the 'standard' taglib (JSTL)
+ </description>
+
+ <!-- Modify this context parameter to set a new class to be the default
+ expression language for the application. -->
+ <context-param>
+ <param-name>javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass</param-name>
+ <param-value>org.apache.taglibs.standard.lang.spel.Evaluator</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.taglibs.standard.examples.startup.Init</listener-class>
+ </listener>
+
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/ea/core</taglib-uri>
+ <taglib-location>/WEB-INF/c.tld</taglib-location>
+ </taglib>
+
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/ea/core-rt</taglib-uri>
+ <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
+ </taglib>
+
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/ea/xml</taglib-uri>
+ <taglib-location>/WEB-INF/x.tld</taglib-location>
+ </taglib>
+
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/ea/xml-rt</taglib-uri>
+ <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
+ </taglib>
+
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/ea/fmt</taglib-uri>
+ <taglib-location>/WEB-INF/fmt.tld</taglib-location>
+ </taglib>
+
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/ea/fmt-rt</taglib-uri>
+ <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
+ </taglib>
+
+ <taglib>
+ <taglib-uri>/jstl-examples-taglib</taglib-uri>
+ <taglib-location>/WEB-INF/jstl-examples.tld</taglib-location>
+ </taglib>
+</web-app>
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/beans/Address.java b/examples/src/org/apache/taglibs/jsptl/examples/beans/Address.java
new file mode 100644
index 0000000..b6a2229
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/beans/Address.java
@@ -0,0 +1,201 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.beans;
+
+/**
+ * Object that represents a Customer.
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+
+public class Address {
+
+ //*********************************************************************
+ // Instance variables
+
+ /** Holds value of property line1. */
+ private String line1;
+
+ /** Holds value of property line2. */
+ private String line2;
+
+ /** Holds value of property city. */
+ private String city;
+
+ /** Holds value of property zip. */
+ private String zip;
+
+ /** Holds value of property state. */
+ private String state;
+
+ /** Holds value of property country. */
+ private String country;
+
+ //*********************************************************************
+ // Constructor
+
+ public Address(String line1, String line2, String city,
+ String state, String zip, String country) {
+ setLine1(line1);
+ setLine2(line2);
+ setCity(city);
+ setState(state);
+ setZip(zip);
+ setCountry(country);
+ }
+
+ //*********************************************************************
+ // Accessors
+
+ /** Getter for property line1.
+ * @return Value of property line1.
+ */
+ public String getLine1() {
+ return line1;
+ }
+
+ /** Setter for property line1.
+ * @param line1 New value of property line1.
+ */
+ public void setLine1(String line1) {
+ this.line1 = line1;
+ }
+
+ /** Getter for property line2.
+ * @return Value of property line2.
+ */
+ public String getLine2() {
+ return line2;
+ }
+
+ /** Setter for property line2.
+ * @param line2 New value of property line2.
+ */
+ public void setLine2(String line2) {
+ this.line2 = line2;
+ }
+
+ /** Getter for property city.
+ * @return Value of property city.
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /** Setter for property city.
+ * @param city New value of property city.
+ */
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ /** Getter for property zip.
+ * @return Value of property zip.
+ */
+ public String getZip() {
+ return zip;
+ }
+
+ /** Setter for property zip.
+ * @param zip New value of property zip.
+ */
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+
+ /** Getter for property country.
+ * @return Value of property country.
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /** Setter for property country.
+ * @param country New value of property country.
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /** Getter for property state.
+ * @return Value of property state.
+ */
+ public String getState() {
+ return state;
+ }
+
+ /** Setter for property state.
+ * @param state New value of property state.
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ //*********************************************************************
+ // Utility Methods
+
+ /**
+ * Return a String representation of this object.
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(line1).append(" ");
+ sb.append(city).append(" ");
+ sb.append(country);
+ return (sb.toString());
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/beans/Customer.java b/examples/src/org/apache/taglibs/jsptl/examples/beans/Customer.java
new file mode 100644
index 0000000..9e95795
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/beans/Customer.java
@@ -0,0 +1,260 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.beans;
+
+import java.util.Date;
+import java.text.*;
+
+/**
+ * Object that represents a Customer.
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+
+public class Customer {
+
+ //*********************************************************************
+ // Instance variables
+
+ /** Holds value of property key. */
+ int key;
+
+ /** Holds value of property lastName. */
+ private String lastName;
+
+ /** Holds value of property firstName. */
+ private String firstName;
+
+ /** Holds value of property birthDate. */
+ private Date birthDate;
+
+ /** Holds value of property address. */
+ private Address address;
+
+ /** Holds value of property phoneHome. */
+ private String phoneHome;
+
+ /** Holds value of property phoneCell. */
+ private String phoneCell;
+
+ static DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
+
+ //*********************************************************************
+ // Constructors
+
+ public Customer() {}
+
+ public Customer(int key,
+ String lastName,
+ String firstName,
+ Date birthDate,
+ Address address,
+ String phoneHome,
+ String phoneCell) {
+ init(key, lastName, firstName, birthDate, address, phoneHome, phoneCell);
+ }
+
+ public void init(int key,
+ String lastName,
+ String firstName,
+ Date birthDate,
+ Address address,
+ String phoneHome,
+ String phoneCell) {
+ setKey(key);
+ setLastName(lastName);
+ setFirstName(firstName);
+ setBirthDate(birthDate);
+ setAddress(address);
+ setPhoneHome(phoneHome);
+ setPhoneCell(phoneCell);
+ }
+
+ //*********************************************************************
+ // Properties
+
+ /**
+ * Getter for property key.
+ * @return Value of property key.
+ */
+ public int getKey() {
+ return key;
+ }
+
+ /**
+ * Setter for property key.
+ * @param key New value of property key.
+ */
+ public void setKey(int key) {
+ this.key = key;
+ }
+
+ /**
+ * Getter for property lastName.
+ * @return Value of property lastName.
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * Setter for property lastName.
+ * @param lastName New value of property lastName.
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * Getter for property firstName.
+ * @return Value of property firstName.
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * Setter for property firstName.
+ * @param firstName New value of property firstName.
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * Getter for property birthDate.
+ * @return Value of property birthDate.
+ */
+ public Date getBirthDate() {
+ return birthDate;
+ }
+
+ /**
+ * Setter for property birthDate.
+ * @param birthDate New value of property birthDate.
+ */
+ public void setBirthDate(Date birthDate) {
+ this.birthDate = birthDate;
+ }
+
+ /**
+ * Getter for property address.
+ * @return Value of property address.
+ */
+ public Address getAddress() {
+ return address;
+ }
+
+ /**
+ * Setter for property address.
+ * @param address New value of property address.
+ */
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ /**
+ * Getter for property phoneHome.
+ * @return Value of property phoneHome.
+ */
+ public String getPhoneHome() {
+ return phoneHome;
+ }
+
+ /**
+ * Setter for property phoneHome.
+ * @param phoneHome New value of property phoneHome.
+ */
+ public void setPhoneHome(String phoneHome) {
+ this.phoneHome = phoneHome;
+ }
+
+ /**
+ * Getter for property phoneCell.
+ * @return Value of property phoneCell.
+ */
+ public String getPhoneCell() {
+ return phoneCell;
+ }
+
+ /**
+ * Setter for property phoneCell.
+ * @param phoneCell New value of property phoneCell.
+ */
+ public void setPhoneCell(String phoneCell) {
+ this.phoneCell = phoneCell;
+ }
+
+ //*********************************************************************
+ // Utility Methods
+
+ /**
+ * Return a String representation of this object.
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[").append(key).append("] ");
+ sb.append(getLastName()).append(", ");
+ sb.append(getFirstName()).append(" ");
+ sb.append(df.format(getBirthDate())).append(" ");
+ sb.append(getAddress()).append(" ");
+ if(getPhoneHome() != null) sb.append(getPhoneHome()).append(" ");
+ if(getPhoneCell() != null) sb.append(getPhoneCell());
+ return (sb.toString());
+ }
+}
+
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/beans/Customers.java b/examples/src/org/apache/taglibs/jsptl/examples/beans/Customers.java
new file mode 100644
index 0000000..9276ac7
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/beans/Customers.java
@@ -0,0 +1,140 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.beans;
+
+import java.util.*;
+import java.text.*;
+
+/**
+ * Customers Datastore.
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+
+public class Customers {
+
+ //*********************************************************************
+ // Instance variables
+
+ private static Vector customers = new Vector();
+ private static int nextSeqNo = 0;
+
+ //*********************************************************************
+ // Datastore operations
+
+ public static void create(
+ String lastName,
+ String firstName,
+ String birthDate,
+ String line1,
+ String line2,
+ String city,
+ String state,
+ String zip,
+ String country) {
+ create(lastName, firstName, birthDate, line1, line2, city, state, zip,
+ country, null, null);
+ }
+
+ /**
+ * Create new customer
+ */
+ public static void create(
+ String lastName,
+ String firstName,
+ String birthDate,
+ String line1,
+ String line2,
+ String city,
+ String state,
+ String zip,
+ String country,
+ String phoneHome,
+ String phoneCell) {
+ Customer customer =
+ new Customer(++nextSeqNo, lastName, firstName,
+ genDate(birthDate), genAddress(line1, line2, city, state, zip, country),
+ phoneHome, phoneCell);
+ customers.add(customer);
+ }
+
+ /**
+ * Find all customers
+ */
+ public static Collection findAll() {
+ return customers;
+ }
+
+ //*********************************************************************
+ // Utility methods
+
+ private static Date genDate(String dateString) {
+ DateFormat df = new SimpleDateFormat("M/d/y");
+ Date date;
+ try {
+ date = df.parse(dateString);
+ } catch (Exception ex) {
+ date = null;
+ }
+ return date;
+ }
+
+ private static Address genAddress(String line1, String line2, String city,
+ String state, String zip, String country) {
+ return new Address(line1, line2, city, state, zip, country);
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/i18n/Resources_de.java b/examples/src/org/apache/taglibs/jsptl/examples/i18n/Resources_de.java
new file mode 100644
index 0000000..c3d91aa
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/i18n/Resources_de.java
@@ -0,0 +1,21 @@
+package org.apache.taglibs.standard.examples.i18n;
+
+import java.util.*;
+
+public class Resources_de extends ListResourceBundle {
+ private static Object[][] contents;
+
+ static {
+ contents = new Object[][] {
+ { "greetingMorning", "Guten Morgen!" },
+ { "greetingEvening", "Guten Abend!" },
+ { "currentTime", "Heutiges Datum und Uhrzeit: {0}" },
+ { "com.acme.labels.cancel", "Abbrechen" },
+ { "java.lang.ArithmeticException", "/ durch 0" }
+ };
+ }
+
+ public Object[][] getContents() {
+ return contents;
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/i18n/Resources_it.java b/examples/src/org/apache/taglibs/jsptl/examples/i18n/Resources_it.java
new file mode 100644
index 0000000..27ced85
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/i18n/Resources_it.java
@@ -0,0 +1,17 @@
+package org.apache.taglibs.standard.examples.i18n;
+
+import java.util.*;
+
+public class Resources_it extends ListResourceBundle {
+ private static Object[][] contents;
+
+ static {
+ contents = new Object[][] {
+ { "greetingMorning", "Buon giorno!" }
+ };
+ }
+
+ public Object[][] getContents() {
+ return contents;
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/startup/Init.java b/examples/src/org/apache/taglibs/jsptl/examples/startup/Init.java
new file mode 100644
index 0000000..115512f
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/startup/Init.java
@@ -0,0 +1,155 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.startup;
+
+import java.util.*;
+
+import javax.servlet.*;
+import org.apache.taglibs.standard.examples.beans.*;
+
+/**
+ * Initialization class. Builds all the data structures
+ * used in the "examples" webapp.
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class Init implements ServletContextListener {
+
+ //*********************************************************************
+ // ServletContextListener methods
+
+ // recovers the one context parameter we need
+ public void contextInitialized(ServletContextEvent sce) {
+ //p("contextInitialized");
+ init(sce);
+ }
+
+ public void contextDestroyed(ServletContextEvent sce) {
+ //p("contextInitialized");
+ }
+
+ //*********************************************************************
+ // Initializations
+
+ private void init(ServletContextEvent sce) {
+ /*
+ * Customers
+ */
+ Customers.create("Richard", "Maurice", "5/15/35",
+ "123 Chemin Royal", "Appt. #301",
+ "Montreal", "QC", "H3J 9R9", "Canada");
+ Customers.create("Mikita", "Stan", "12/25/47",
+ "45 Fisher Blvd", "Suite 203",
+ "Chicago", "IL", "65982", "USA", "(320)876-9784", null);
+ Customers.create("Gilbert", "Rod", "3/11/51",
+ "123 Main Street", "",
+ "New-York City", "NY", "19432", "USA");
+ Customers.create("Howe", "Gordie", "7/25/46",
+ "7654 Wings Street", "",
+ "Detroit", "MG", "07685", "USA", "(465)675-0761", "(465)879-9802");
+ Customers.create("Sawchuk", "Terrie", "11/05/46",
+ "12 Maple Leafs Avenue", "",
+ "Toronto", "ON", "M5C 1Z1", "Canada");
+ sce.getServletContext().setAttribute("customers", Customers.findAll());
+
+ /**
+ * Array of primitives (int)
+ */
+ int[] intArray = new int[] {10, 20, 30, 40, 50};
+ sce.getServletContext().setAttribute("intArray", intArray);
+
+ /**
+ * Array of Objects (String)
+ */
+ String[] stringArray = new String[] {
+ "A first string",
+ "La deuxieme string",
+ "Ella troisiemo stringo",
+ };
+ sce.getServletContext().setAttribute("stringArray", stringArray);
+
+ /**
+ * Map (Properties)
+ */
+ // we use a Hashtable so we can get an Enumeration easily, below
+ Hashtable numberMap = new Hashtable();
+ sce.getServletContext().setAttribute("numberMap", numberMap);
+ numberMap.put(new Integer(1), "uno");
+ numberMap.put(new Integer(2), "dos");
+ numberMap.put(new Integer(3), "tres");
+ numberMap.put(new Integer(4), "cuatro");
+ numberMap.put(new Integer(5), "cinco");
+ numberMap.put(new Integer(6), "seis");
+ numberMap.put(new Integer(7), "siete");
+ numberMap.put(new Integer(8), "ocho");
+ numberMap.put(new Integer(9), "nueve");
+ numberMap.put(new Integer(10), "diez");
+
+ /**
+ * Enumeration
+ */
+ Enumeration enum = numberMap.keys();
+ sce.getServletContext().setAttribute("enum", enum);
+ }
+
+ //*********************************************************************
+ // Initializations
+
+ private void p(String s) {
+ System.out.println("[Init] " + s);
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/CustomerFmtTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/CustomerFmtTag.java
new file mode 100644
index 0000000..5a72066
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/CustomerFmtTag.java
@@ -0,0 +1,156 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.core.*;
+
+import org.apache.taglibs.standard.examples.beans.Customer;
+
+/**
+ * <p>Tag handler for <customerFmt>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class CustomerFmtTag extends TagSupport {
+
+ //*********************************************************************
+ // Instance variables
+
+ /** Holds value of property customer. */
+ private Customer customer;
+
+ /** Holds value of property fmt. */
+ private String fmt;
+
+ //*********************************************************************
+ // Constructors
+
+ public CustomerFmtTag() {
+ super();
+ init();
+ }
+
+ private void init() {
+ customer = null;
+ fmt = null;
+ }
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public int doStartTag() throws JspException {
+ JspWriter out = pageContext.getOut();
+ try {
+ if (fmt.equalsIgnoreCase("short")) {
+ out.println(customer.getFirstName() + " " +
+ customer.getLastName());
+ } else if (fmt.equalsIgnoreCase("long")) {
+ out.println(customer.getFirstName() + " " +
+ customer.getLastName() + " " + customer.getAddress());
+ } else {
+ out.println("invalid format");
+ }
+ } catch (IOException ex) {}
+
+ return SKIP_BODY;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+ //*********************************************************************
+ // Accessors
+
+ /**
+ * Getter for property customer.
+ * @return Value of property customer.
+ */
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ /**
+ * Setter for property customer.
+ * @param customer New value of property customer.
+ */
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ /**
+ * Getter for property fmt.
+ * @return Value of property fmt.
+ */
+ public String getFmt() {
+ return fmt;
+ }
+
+ /**
+ * Setter for property fmt.
+ * @param fmt New value of property fmt.
+ */
+ public void setFmt(String fmt) {
+ this.fmt = fmt;
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/EscapeHtmlTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/EscapeHtmlTag.java
new file mode 100644
index 0000000..1fcad71
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/EscapeHtmlTag.java
@@ -0,0 +1,191 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import java.io.*;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+
+import org.apache.taglibs.standard.examples.util.*;
+
+/**
+ * <p>Tag handler for <escapeHtml>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class EscapeHtmlTag extends BodyTagSupport {
+
+ //*********************************************************************
+ // Instance variables
+
+ private String reader;
+ private String writer;
+
+ //*********************************************************************
+ // Constructors
+
+ public EscapeHtmlTag() {
+ super();
+ init();
+ }
+
+ private void init() {
+ reader = null;
+ writer = null;
+ }
+
+
+ //*********************************************************************
+ // Tag's properties
+
+ /**
+ * Tag's 'reader' attribute
+ */
+ public void setReader(String reader) {
+ this.reader = reader;
+ }
+
+ /**
+ * Tag's 'writer' attribute
+ */
+ public void setWriter(String reader) {
+ this.writer = writer;
+ }
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public int doEndTag() throws JspException {
+ Reader in;
+ Writer out;
+
+ if (reader == null) {
+ String bcs = getBodyContent().getString().trim();
+ if (bcs == null || bcs.equals("")) {
+ throw new JspTagException("In <escapeHtml>, 'reader' " +
+ "not specified and no non-whitespace content inside the tag.");
+ }
+ in = Util.castToReader(bcs);
+ } else {
+ in = Util.castToReader(eval("reader", reader, Object.class));
+ }
+
+ if (writer == null) {
+ out = pageContext.getOut();
+ } else {
+ out = Util.castToWriter(eval("writer", writer, Object.class));
+ }
+
+ transform(in, out);
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Releases any resources we may have (or inherit)
+ */
+ public void release() {
+ super.release();
+ init();
+ }
+
+ //*********************************************************************
+ // Tag's scific behavior methods
+
+ /**
+ * Transform
+ */
+ public void transform(Reader reader, Writer writer)
+ throws JspException {
+ int c;
+ try {
+ writer.write("<pre>");
+ while ((c = reader.read()) != -1) {
+ if (c == '<') {
+ writer.write("<");
+ } else if (c == '>') {
+ writer.write(">");
+ } else {
+ writer.write(c);
+ }
+ }
+ writer.write("</pre>");
+ } catch (IOException ex) {
+ throw new JspException("EscapeHtml: " +
+ "error copying chars", ex);
+ }
+ }
+
+ //*********************************************************************
+ // Utility methods
+
+ /**
+ * Evaluate elexprvalue
+ */
+ private Object eval(String attName, String attValue, Class clazz)
+ throws JspException {
+ Object obj = ExpressionEvaluatorManager.evaluate(
+ attName, attValue, clazz, this, pageContext);
+ if (obj == null) {
+ throw new NullAttributeException("escapeHtml", attName);
+ } else {
+ return obj;
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/EvenTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/EvenTag.java
new file mode 100644
index 0000000..e31246c
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/EvenTag.java
@@ -0,0 +1,83 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.core.*;
+
+/**
+ * <p>Tag handler for <odd>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class EvenTag extends TagSupport {
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public int doStartTag() throws JspException {
+ IteratorTag iteratorTag = (IteratorTag)findAncestorWithClass(
+ this, IteratorTag.class);
+ if (iteratorTag == null) {
+ throw new JspTagException("<even> must be nested within an IteratorTag");
+ }
+
+ int count = iteratorTag.getIteratorStatus().getCount();
+ return (count % 2 == 0) ? EVAL_BODY_INCLUDE : SKIP_BODY;
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/FileTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/FileTag.java
new file mode 100644
index 0000000..7098a08
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/FileTag.java
@@ -0,0 +1,179 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import java.io.*;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+
+import org.apache.taglibs.standard.examples.util.*;
+
+/**
+ * <p>Tag handler for <file>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class FileTag extends TagSupport {
+
+ //*********************************************************************
+ // Instance variables
+
+ private String id;
+ private String file;
+
+ private Reader reader;
+
+ //*********************************************************************
+ // Constructors
+
+ public FileTag() {
+ super();
+ init();
+ }
+
+ private void init() {
+ id = null;
+ file = null;
+ }
+
+ //*********************************************************************
+ // Tag's properties
+
+ /**
+ * Tag's 'id' attribute
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Tag's 'file' attribute
+ */
+ public void setfile(String file) {
+ this.file = file;
+ }
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public int doStartTag() throws JspException {
+ reader = getReaderFromFile((String)eval("file", file, String.class));
+ exposeVariable(reader);
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ try {
+ reader.close();
+ } catch (IOException ex) {}
+ reader = null;
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Releases any files we may have (or inherit)
+ */
+ public void release() {
+ super.release();
+ init();
+ }
+
+ //*********************************************************************
+ // Tag's scific behavior methods
+
+ public Reader getReaderFromFile(String name) throws JspException {
+ String absoluteFilePath = null;
+ try {
+ absoluteFilePath =
+ pageContext.getServletContext().getRealPath(name);
+ File file = new File(absoluteFilePath);
+ reader = new FileReader(file);
+ return reader;
+ } catch (IOException ex) {
+ throw new JspException(
+ "Could not access " + absoluteFilePath + ". "
+ + ex.getMessage(), ex);
+ }
+ }
+
+ //*********************************************************************
+ // Utility methods
+
+ /**
+ * Evaluate elexprvalue
+ */
+ private Object eval(String attName, String attValue, Class clazz)
+ throws JspException {
+ Object obj = ExpressionEvaluatorManager.evaluate(
+ attName, attValue, clazz, this, pageContext);
+ if (obj == null) {
+ throw new NullAttributeException("file", attName);
+ } else {
+ return obj;
+ }
+ }
+
+ private void exposeVariable(Reader reader) {
+ if (id != null) {
+ pageContext.setAttribute(id, reader);
+ }
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/NullAttributeException.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/NullAttributeException.java
new file mode 100644
index 0000000..20b0b48
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/NullAttributeException.java
@@ -0,0 +1,81 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import javax.servlet.jsp.JspTagException;
+
+/**
+ * <p>NullAttributeException is a JspTagException that will be thrown
+ * by the JSTL RI handlers when a tag attribute illegally evaluates
+ * to 'null'.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class NullAttributeException extends JspTagException {
+
+ /**
+ * Constructs a ExpressionException with appropriate information.
+ *
+ * @param tag The name of the tag in which the error occurred.
+ * @param att The attribute value for which the error occurred.
+ */
+ public NullAttributeException(String tag, String att) {
+ super("The '" + att + "' attribute illegally evaluated to 'null' "
+ + "in <" + tag + ">.");
+ }
+}
+
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/OddTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/OddTag.java
new file mode 100644
index 0000000..3e7715c
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/OddTag.java
@@ -0,0 +1,87 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.core.*;
+
+/**
+ * <p>Tag handler for <odd>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class OddTag extends TagSupport {
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public int doStartTag() throws JspException {
+ IteratorTag iteratorTag = (IteratorTag)findAncestorWithClass(
+ this, IteratorTag.class);
+ if (iteratorTag == null) {
+ throw new JspTagException("<odd> must be nested within an IteratorTag");
+ }
+
+ int count = iteratorTag.getIteratorStatus().getCount();
+ System.out.println("count: " + count);
+ System.out.println("count odd/even: " + (count % 2));
+ return (count % 2 == 1) ? EVAL_BODY_INCLUDE : SKIP_BODY;
+ }
+}
+
+
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/ResourceTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/ResourceTag.java
new file mode 100644
index 0000000..bc8b4cd
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/ResourceTag.java
@@ -0,0 +1,187 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import java.io.*;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+
+import org.apache.taglibs.standard.examples.util.*;
+
+/**
+ * <p>Tag handler for <resource>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class ResourceTag extends TagSupport {
+
+ //*********************************************************************
+ // Instance variables
+
+ private String id;
+ private String resource;
+
+ private Reader reader;
+
+ //*********************************************************************
+ // Constructors
+
+ public ResourceTag() {
+ super();
+ init();
+ }
+
+ private void init() {
+ id = null;
+ resource = null;
+ }
+
+ //*********************************************************************
+ // Tag's properties
+
+ /**
+ * Tag's 'id' attribute
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Tag's 'resource' attribute
+ */
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public int doStartTag() throws JspException {
+ reader = getReaderFromResource((String)eval("resource", resource, String.class));
+ exposeVariable(reader);
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ try {
+ reader.close();
+ } catch (IOException ex) {}
+ reader = null;
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Releases any resources we may have (or inherit)
+ */
+ public void release() {
+ super.release();
+ init();
+ }
+
+ //*********************************************************************
+ // Tag's scific behavior methods
+
+ private Reader getReaderFromResource(String name) throws JspException {
+ HttpServletRequest request =
+ (HttpServletRequest)pageContext.getRequest();
+ HttpServletResponse response =
+ (HttpServletResponse)pageContext.getResponse();
+ RequestDispatcher rd = null;
+
+ // The response of the local URL becomes the reader that
+ // we export. Need temporary storage.
+ IOBean ioBean = new IOBean();
+ Writer writer = ioBean.getWriter();
+ ServletResponseWrapper responseWrapper =
+ new ServletResponseWrapperForWriter(
+ response, new PrintWriter(writer));
+ rd = pageContext.getServletContext().getRequestDispatcher(name);
+ try {
+ rd.include(request, responseWrapper);
+ return ioBean.getReader();
+ } catch (Exception ex) {
+ throw new JspException(ex);
+ }
+ }
+
+ //*********************************************************************
+ // Utility methods
+
+ /**
+ * Evaluate elexprvalue
+ */
+ private Object eval(String attName, String attValue, Class clazz)
+ throws JspException {
+ Object obj = ExpressionEvaluatorManager.evaluate(
+ attName, attValue, clazz, this, pageContext);
+ if (obj == null) {
+ throw new NullAttributeException("escapeHtml", attName);
+ } else {
+ return obj;
+ }
+ }
+
+ private void exposeVariable(Reader reader) {
+ if (id != null) {
+ pageContext.setAttribute(id, reader);
+ }
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/taglib/UsCustomerTag.java b/examples/src/org/apache/taglibs/jsptl/examples/taglib/UsCustomerTag.java
new file mode 100644
index 0000000..1a8527b
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/taglib/UsCustomerTag.java
@@ -0,0 +1,148 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.taglib;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.core.*;
+
+import org.apache.taglibs.standard.examples.beans.Customer;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+import org.apache.taglibs.standard.examples.util.*;
+
+/**
+ * <p>Tag handler for <usCustomer>
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class UsCustomerTag extends ConditionalTagSupport {
+
+ //*********************************************************************
+ // Instance Variables
+
+ /** Holds value of property customer. */
+ private String customer;
+
+ //*********************************************************************
+ // Constructor and lusCustomerecycle management
+
+ public UsCustomerTag() {
+ super();
+ init();
+ }
+
+ private void init() {
+ customer = null;
+ }
+
+ //*********************************************************************
+ // TagSupport methods
+
+ public void release() {
+ super.release();
+ init();
+ }
+
+ //*********************************************************************
+ // ConditionalTagSupport methods
+
+ protected boolean condition() throws JspException {
+ Customer customerObj = (Customer)eval("customer", customer, Customer.class);
+ if (customerObj == null) {
+ throw new NullAttributeException("usCustomer", "test");
+ } else {
+ System.out.println("country: " + customerObj.getAddress().getCountry());
+ return (customerObj.getAddress().getCountry().equalsIgnoreCase("USA"));
+ }
+ }
+
+ //*********************************************************************
+ // Accessors
+
+ /**
+ * Getter for property customer.
+ * @return Value of property customer.
+ */
+ public String getCustomer() {
+ return customer;
+ }
+
+ /**
+ * Setter for property customer.
+ * @param customer New value of property customer.
+ */
+ public void setCustomer(String customer) {
+ this.customer = customer;
+ }
+
+ //*********************************************************************
+ // Utility methods
+
+ /**
+ * Evaluate elexprvalue
+ */
+ private Object eval(String attName, String attValue, Class clazz)
+ throws JspException {
+ Object obj = ExpressionEvaluatorManager.evaluate(
+ attName, attValue, clazz, this, pageContext);
+ if (obj == null) {
+ throw new NullAttributeException(attName, attValue);
+ } else {
+ return obj;
+ }
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/util/IOBean.java b/examples/src/org/apache/taglibs/jsptl/examples/util/IOBean.java
new file mode 100644
index 0000000..26e7ee3
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/util/IOBean.java
@@ -0,0 +1,98 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.util;
+
+import java.io.*;
+import javax.servlet.jsp.JspException;
+
+/**
+ * <p>String repository for Reader/Writer.
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class IOBean {
+ StringWriter stringWriter = null;
+ String content = null;
+
+ public Reader getReader() throws JspException {
+ //p("getReader()");
+ if (content == null) {
+ if (stringWriter == null) {
+ throw new JspException(
+ "content must first be added to the bean via the writer");
+ }
+ content = stringWriter.toString();
+ }
+ return new StringReader(content);
+ }
+
+ public Writer getWriter() {
+ //p("getWriter()");
+ content = null;
+ stringWriter = new StringWriter();
+ return stringWriter;
+ }
+
+ public void release() {
+ stringWriter = null;
+ content = null;
+ }
+
+ private void p(String s) {
+ System.out.println("[IOBean] " + s);
+ }
+}
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/util/ServletResponseWrapperForWriter.java b/examples/src/org/apache/taglibs/jsptl/examples/util/ServletResponseWrapperForWriter.java
new file mode 100644
index 0000000..40a1d4a
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/util/ServletResponseWrapperForWriter.java
@@ -0,0 +1,101 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.util;
+
+import java.io.PrintWriter;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.jsp.*;
+
+/**
+ * ServletResponseWrapper used for the the generation of
+ * semi-dynamic pages.
+ * <p>
+ * This 'wrapped' response object is passed as the second argument
+ * to the internal RequestDispatcher.include(). It channels
+ * all output text into the PrintWriter specified in the
+ * constructor (which is associated with the file where the
+ * output of the JSP page has to be saved).
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class ServletResponseWrapperForWriter
+ extends HttpServletResponseWrapper
+{
+ /**
+ * The writer that will get all the output of the response.
+ */
+ PrintWriter writer;
+
+ public ServletResponseWrapperForWriter(ServletResponse response,
+ PrintWriter writer)
+ {
+ super((HttpServletResponse)response);
+ this.writer = writer;
+ }
+
+ /**
+ * Returns the Writer associated with the response.
+ */
+ public java.io.PrintWriter getWriter()
+ throws java.io.IOException
+ {
+ return writer;
+ }
+}
+
diff --git a/examples/src/org/apache/taglibs/jsptl/examples/util/Util.java b/examples/src/org/apache/taglibs/jsptl/examples/util/Util.java
new file mode 100644
index 0000000..cdf73e0
--- /dev/null
+++ b/examples/src/org/apache/taglibs/jsptl/examples/util/Util.java
@@ -0,0 +1,95 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.examples.util;
+
+import java.io.*;
+import javax.servlet.jsp.*;
+
+/**
+ * <p>Utility class for examples webapp.
+ *
+ * @author Pierre Delisle
+ * @version $Revision$ $Date$
+ */
+public class Util {
+
+ public static Writer castToWriter(Object obj) throws JspException {
+ if (obj instanceof OutputStream) {
+ return new OutputStreamWriter((OutputStream)obj);
+ } else if (obj instanceof Writer) {
+ return (Writer)obj;
+ /*@@@
+ } else if (obj instanceof String) {
+ return new StringWriter();
+ */
+ }
+ throw new JspException("Invalid type '" + obj.getClass().getName() +
+ "' for castToWriter()");
+ }
+
+ public static Reader castToReader(Object obj) throws JspException {
+ if (obj instanceof InputStream) {
+ return new InputStreamReader((InputStream)obj);
+ } else if (obj instanceof Reader) {
+ return (Reader)obj;
+ } else if (obj instanceof String) {
+ return new StringReader((String)obj);
+ }
+ throw new JspException("Invalid type '" + obj.getClass().getName() +
+ "' for castToReader()");
+ }
+}
+
diff --git a/examples/web/ShowSource.jsp b/examples/web/ShowSource.jsp
new file mode 100644
index 0000000..18dc0ef
--- /dev/null
+++ b/examples/web/ShowSource.jsp
@@ -0,0 +1,23 @@
+<!--
+ Displays the content of the file specified in request
+ parameter "filename".
+-->
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<%@ taglib prefix="ex" uri="/jsptl-examples-taglib" %>
+<html>
+<head>
+ <title>JSTL: Source code for <c:expr value="$param:filename"/></title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Source code for: <c:expr value="$param:filename"/></h3>
+
+<hr>
+<c:import varReader="reader" url="$param:filename">
+<%-- <ex:file id="reader" file="$param:filename"> --%>
+ <ex:escapeHtml reader="$reader"/>
+<%-- </ex:file> --%>
+</c:import>
+<hr>
+</body>
+</html>
diff --git a/examples/web/Templates/ExamplesTemplate.dwt b/examples/web/Templates/ExamplesTemplate.dwt
new file mode 100644
index 0000000..c5a9297
--- /dev/null
+++ b/examples/web/Templates/ExamplesTemplate.dwt
@@ -0,0 +1,44 @@
+<html>
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>Untitled Document</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="../import/index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+<!-- #BeginEditable "body" -->{body}<!-- #EndEditable -->
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/examples/web/conditionals/Choose.jsp b/examples/web/conditionals/Choose.jsp
new file mode 100644
index 0000000..b5ebcc2
--- /dev/null
+++ b/examples/web/conditionals/Choose.jsp
@@ -0,0 +1,27 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Conditional Support -- Mutually Exclusive Conditional Execution Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Mutually Exclusive Conditional Execution</h3>
+
+<h4>USA:blue Canada:red Others:green</h4>
+
+<c:forEach var="customer" items="$customers">
+ <c:choose>
+ <c:when test="$customer.address.country == 'USA'">
+ <font color="blue">
+ </c:when>
+ <c:when test="$customer.address.country == 'Canada'">
+ <font color="red">
+ </c:when>
+ <c:otherwise>
+ <font color="green">
+ </c:otherwise>
+ </c:choose>
+ <c:expr value="$customer"/></font><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/conditionals/CustomLogicTag.jsp b/examples/web/conditionals/CustomLogicTag.jsp
new file mode 100644
index 0000000..12c7da6
--- /dev/null
+++ b/examples/web/conditionals/CustomLogicTag.jsp
@@ -0,0 +1,36 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<%@ taglib prefix="ex" uri="/jstl-examples-taglib" %>
+
+<html>
+<head>
+ <title>JSTL: Conditional Support -- Custom Logic Tag Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h3>Custom Logic Tag</h3>
+
+<h4>Customers living in the USA</h4>
+
+<h4>Simple Conditional Execution</h4>
+<c:forEach var="customer" items="$customers">
+ <ex:usCustomer customer="$customer">
+ <c:expr value="$customer"/><br>
+ </ex:usCustomer>
+</c:forEach>
+
+<h4>Mutually Exclusive Conditional Execution</h4>
+
+<c:forEach var="customer" items="$customers">
+ <ex:usCustomer customer="$customer" var="isUsCustomer"/>
+ <c:choose>
+ <c:when test="$isUsCustomer">
+ <font color="blue">
+ </c:when>
+ <c:otherwise>
+ <font color="green">
+ </c:otherwise>
+ </c:choose>
+ <c:expr value="$customer"/></font><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/conditionals/FailureLocal.jsp b/examples/web/conditionals/FailureLocal.jsp
new file mode 100644
index 0000000..893485b
--- /dev/null
+++ b/examples/web/conditionals/FailureLocal.jsp
@@ -0,0 +1,27 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Conditional Support -- Mutually Exclusive Conditional Execution Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Mutually Exclusive Conditional Execution</h3>
+
+<h4>USA:blue Canada:red Others:green</h4>
+
+<c:forEach var="customer" items="$customers">
+ <c:choose>
+ <c:otherwise>
+ <font color="green">
+ </c:otherwise>
+ <c:when test="$customer.address.country == 'USA'">
+ <font color="blue">
+ </c:when>
+ <c:when test="$customer.address.country == 'Canada'">
+ <font color="red">
+ </c:when>
+ </c:choose>
+ <c:expr value="$customer"/></font><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/conditionals/If.jsp b/examples/web/conditionals/If.jsp
new file mode 100644
index 0000000..c5b4605
--- /dev/null
+++ b/examples/web/conditionals/If.jsp
@@ -0,0 +1,19 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Conditional Support -- Simple Conditional Execution Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h3>Simple Conditional Execution</h3>
+
+<h4>Customers living in the USA</h4>
+
+<c:forEach var="customer" items="$customers">
+ <c:if test="$customer.address.country == 'USA'">
+ <c:expr value="$customer"/><br>
+ </c:if>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/conditionals/index.html b/examples/web/conditionals/index.html
new file mode 100644
index 0000000..95006cd
--- /dev/null
+++ b/examples/web/conditionals/index.html
@@ -0,0 +1,70 @@
+<html><!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: Conditional Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script></head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="../import/index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+<!-- #BeginEditable "body" -->
+<h2>Conditional Tags Examples</h2>
+<h3><if> Simple Conditional Execution <a href="../ShowSource.jsp?filename=/conditionals/If.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="If.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Only shows a customer from the customer list if the last name is "Howe".<br>
+<h3> <choose> Mutually Exclusive Conditional Execution <a href="../ShowSource.jsp?filename=/conditionals/Choose.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a>
+ <a href="Choose.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+<p>Customers from the USA will be printed in blue, those from Canada in red, and
+ others in green.</p>
+<h3>Custom Logic Tag <a href="../ShowSource.jsp?filename=/conditionals/CustomLogicTag.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a> <a href="CustomLogicTag.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>JSTL exposes in its API the abstract class ConditionalTagSupport to facilitate
+ the implementation of custom conditional tags that leverage the standard conditional
+ behavior defined in JSTL. This example shows custom tag <usCustomer> that returns true if
+its customer attribute value points to a US customer.
+ It can be used both in the context of a simple conditional execution, as well
+ as in the context of a mutually conditional execution by exposing the result
+ of the conditional execution in a JSP page attribute via the tag attribute 'var'.
+</p>
+<!-- #EndEditable -->
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate --></html>
diff --git a/examples/web/ecmascript/ArithmeticOperators.jsp b/examples/web/ecmascript/ArithmeticOperators.jsp
new file mode 100644
index 0000000..a2af77a
--- /dev/null
+++ b/examples/web/ecmascript/ArithmeticOperators.jsp
@@ -0,0 +1,116 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Arithmetic Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Arithmetic Operators</h3>
+
+<p>The Arithmetic operators perform various operations on either numeric or string operands.</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("a", new Integer(4)); %>
+<% request.setAttribute("b", new Integer(7)); %>
+<% request.setAttribute("c", new Integer(0)); %>
+
+<h4>Operator: + (Addition)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> + <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a + b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: - (Subtraction)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> - <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a - b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: * (Multiplication)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> * <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a * b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: / (Division)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> / <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a / b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: % (Modulo)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> % <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a % b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: - (Unary Negation)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code>-<c:expr value="$a"/></code></td>
+ <td><c:expr value="$-a"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ++ (Increment)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code>++<c:expr value="$a"/></code></td>
+ <td><c:expr value="$++a"/></td>
+ </tr>
+</table>
+
+<h4>Operator: -- (Decrement)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code>--<c:expr value="$a"/></code></td>
+ <td><c:expr value="$--a"/></td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/ArrayAccess.jsp b/examples/web/ecmascript/ArrayAccess.jsp
new file mode 100644
index 0000000..886641a
--- /dev/null
+++ b/examples/web/ecmascript/ArrayAccess.jsp
@@ -0,0 +1,36 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Simple Array Access Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Array Access</h3>
+
+<p>EcmaScript uses the [] notation to access array elements. If the first operand is an array then the second operand (the one that goes between the brackets) should be an expression that evaluates to an integer. If the first operand is a reference to an object then the second operand should be an expression that evaluates to a string that names a property of the object.
+
+<p>Here is an example:</p>
+
+<h4>Favorite Actor and Role</h4>
+
+<% request.setAttribute("myArray", new String[] {"Harrison", "Ford", "Indiana", "Jones"}); %>
+
+<table border="1">
+ <tr>
+ <th>Array Index</th>
+ <th>Value</th>
+ </tr>
+ <c:forEach var="i" begin="0" end="3" status="status">
+ <c:declare id="status" type="javax.servlet.jsp.jstl.core.IteratorTagStatus"/>
+ <tr>
+ <%-- demonstrating how to use expression to get index --%>
+ <td>Array[<c:expr value="$i"/>]</td>
+ <%-- demonstrating how to use status object to get index --%>
+ <td><c:expr value="$myArray[status.index]"/></td>
+ </tr>
+ </c:forEach>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/AssignmentOperators.jsp b/examples/web/ecmascript/AssignmentOperators.jsp
new file mode 100644
index 0000000..969d7d1
--- /dev/null
+++ b/examples/web/ecmascript/AssignmentOperators.jsp
@@ -0,0 +1,177 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Assignment Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Assignment Operators</h3>
+
+<p>The Assignment operator has right to left associativity. Each assignment expression has a value that is the value of the right hand side</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("a", new Integer(4)); %>
+<% request.setAttribute("b", new Integer(7)); %>
+<% request.setAttribute("c", new Integer(0)); %>
+
+<h4>Operator: =</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> = <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a = b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: a = b == c</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> = <jx:expr value="$b"/> == <jx:expr value="$c"/></code></td>
+ <td><c:expr value="$a = b == c"/></td>
+ </tr>
+</table>
+
+<h4>Operator: +=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> += <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a += b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: -=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> -= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a -= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: *=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> *= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a *= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: /=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> /= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a /= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: %=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> %= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a %= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: <<=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> <<= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a <<= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: >>=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> >>= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a >>= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: >>>=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> >>>= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a >>>= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: &=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> &= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a &= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: |=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> |= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a |= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ^=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> ^= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a ^= b"/></td>
+ </tr>
+</table>
+
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/BitwiseOperators.jsp b/examples/web/ecmascript/BitwiseOperators.jsp
new file mode 100644
index 0000000..2364095
--- /dev/null
+++ b/examples/web/ecmascript/BitwiseOperators.jsp
@@ -0,0 +1,104 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Bitwise Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Bitwise Operators</h3>
+
+<p>The Bitwise operators perform boolean algebra on the individual bits of the operands or shift bits left and right. It is used to manipulate the binary numbers and binary representation of decimal integers. The operators return Nan if the operands are not integers or are too large to fit in a 32-bit integer representation.</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("a", new Integer(13)); %>
+<% request.setAttribute("b", new Integer(1)); %>
+<% request.setAttribute("c", new Integer(0)); %>
+
+<h4>Operator: & (Bitwise And)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> & <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a & b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: | (Bitwise Or)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> | <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a | b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ^ (Bitwise Xor)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> ^ <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a ^ b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ~ (Bitwise Not)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code>~<c:expr value="$a"/></code></td>
+ <td><c:expr value="$~a"/></td>
+ </tr>
+</table>
+
+<h4>Operator: << (Shift Left)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> << <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a << b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: >> (Shift Right with Sign)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> >> <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a >> b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: >>> (Shift Right Zero Fill)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> >>> <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a >>> b"/></td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/ComparisonOperators.jsp b/examples/web/ecmascript/ComparisonOperators.jsp
new file mode 100644
index 0000000..22069a2
--- /dev/null
+++ b/examples/web/ecmascript/ComparisonOperators.jsp
@@ -0,0 +1,133 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Comparison Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Comparison Operators</h3>
+
+<p>The Comparison operators compare values for equality and identity and return a boolean value depending on the result of the comparison. Numbers, strings, and boolean values are compared by value. Objects, arrays, and functions are compared by reference.</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("myString", new String("Harrison Ford")); %>
+<% request.setAttribute("a", new Integer(4)); %>
+<% request.setAttribute("b", new Integer(7)); %>
+<% request.setAttribute("c", new Integer(0)); %>
+
+<h4>Operator: == (Equality)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> == <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a == b"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$myString"/> == <jx:expr value="$myString"/></code></td>
+ <td><c:expr value="$myString == myString"/></td>
+ </tr>
+</table>
+
+<h4>Operator: != (Inequality)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> != <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a != b"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$myString"/> != <jx:expr value="$myString"/></code></td>
+ <td><c:expr value="$myString != myString"/></td>
+ </tr>
+</table>
+
+<h4>Operator: === (Identity)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> === <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a === b"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$myString"/> === <jx:expr value="$myString"/></code></td>
+ <td><c:expr value="$myString === myString"/></td>
+ </tr>
+</table>
+
+<h4>Operator: !== (Non-Identity)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> !== <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a !== b"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$myString"/> !== <jx:expr value="$myString"/></code></td>
+ <td><c:expr value="$myString !== myString"/></td>
+ </tr>
+</table>
+
+<h4>Operator: < (Less Than)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> < <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a < b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: > (Greater Than)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> > <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a > b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: <= (Less Than or Equal)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> <= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a <= b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: >= (Greater Than or Equal)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> >= <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a >= b"/></td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/ConditionalOperator.jsp b/examples/web/ecmascript/ConditionalOperator.jsp
new file mode 100644
index 0000000..7b9d3a9
--- /dev/null
+++ b/examples/web/ecmascript/ConditionalOperator.jsp
@@ -0,0 +1,50 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Conditional Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Conditional Operators</h3>
+
+<p>The Conditional operator ?: can be used as a short cut for an if/else statement. A JSTL conditional tag can also be used to verify the test condition.</p>
+
+<% request.setAttribute("true", "true"); %>
+<% request.setAttribute("false", "false"); %>
+<% request.setAttribute("ifResult", "IF result"); %>
+<% request.setAttribute("elseResult", "ELSE result"); %>
+<% request.setAttribute("myDate", new Date()); %>
+
+<p>Here are some examples:</p>
+
+<h4>Conditional Operators:</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$true"/> ? <jx:expr value="$ifResult"/> : <jx:expr value="$elseResult"/> </code></td>
+ <td><c:expr value="$true ? ifResult : elseResult"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$false"/> ? <jx:expr value="$ifResult"/> : <jx:expr value="$elseResult"/> </code></td>
+ <td><c:expr value="$false ? ifResult : elseResult"/></td>
+ </tr>
+ <tr>
+ <td><code><c:if test="$true == true"> IF result </jx:if> </code></td>
+ <td><c:if test="$true == true"> IF result</jx:if> </td>
+ </tr>
+ <tr>
+ <td><code><c:if test="$false == true"> IF result </jx:if> </code></td>
+ <td><c:if test="$false == true"> IF result </jx:if> </td>
+ </tr>
+ <tr>
+ <td><code><c:if test="$myDate.year == 101"> 1900 + 101 = 2001 </jx:if> </code></td>
+ <td><c:if test="$myDate.year == 101"> 1900 + 101 = 2001</jx:if> </td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/FunctionCall.jsp b/examples/web/ecmascript/FunctionCall.jsp
new file mode 100644
index 0000000..06ed393
--- /dev/null
+++ b/examples/web/ecmascript/FunctionCall.jsp
@@ -0,0 +1,64 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Function Call Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Function Call</h3>
+
+<p>In EcmaScript, the () operator is used to invoke functions. The () operator evaluates each of the operands and then invokes the function specified by the first operand</p>
+
+<p>Here is an example:</p>
+
+<% request.setAttribute("myString", new String ("Harrison Ford")); %>
+
+
+<h4>Sample list of Function calls</h4>
+
+<table border="1">
+ <tr>
+ <th>Function Call</th>
+ <th>Result</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>String.italics()</td>
+ <td><c:expr value="$myString.italics()"/></td>
+ <td>Make the specified string italic</td>
+ </tr>
+ <tr>
+ <td>String.bold()</td>
+ <td><c:expr value="$myString.bold()"/></td>
+ <td>Make the specified string bold</td>
+ </tr>
+ <tr>
+ <td>new String("Hello there")</td>
+ <td><c:expr value="$new String('Hello there')"/></td>
+ <td>create a new EcmaScript string</td>
+ </tr>
+ <tr>
+ <td>Math.randon()</td>
+ <td><c:expr value="$Math.random()"/></td>
+ <td>Random value</td>
+ </tr>
+ <tr>
+ <td>Math.abs(-5)</td>
+ <td><c:expr value="$Math.abs(-5)"/></td>
+ <td>Absolute value</td>
+ </tr>
+ <tr>
+ <td>Math.round(57.55)</td>
+ <td><c:expr value="$Math.round(57.555)"/></td>
+ <td>Round to the nearest integer</td>
+ </tr>
+ <tr>
+ <td>Math.sin(5)</td>
+ <td><c:expr value="$Math.sin(5)"/></td>
+ <td>Sine value</td>
+ </tr>
+</table>
+
+</body>
+</html>
+
diff --git a/examples/web/ecmascript/LogicalOperators.jsp b/examples/web/ecmascript/LogicalOperators.jsp
new file mode 100644
index 0000000..644b66a
--- /dev/null
+++ b/examples/web/ecmascript/LogicalOperators.jsp
@@ -0,0 +1,55 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Logical Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Logical Operators</h3>
+
+<p>The Logical operators are used to perform boolean algebra</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("a", "true"); %>
+<% request.setAttribute("b", "false"); %>
+
+<h4>Operator: && (Logical AND)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> && <jx:expr value="$b"/></code></td>
+ <td><c:expr value="$a && b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: || (Logical OR)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$a"/> || <jx:expr value="$b"/> </code></td>
+ <td><c:expr value="$a || b"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ! (Logical NOT)</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code>!<c:expr value="$a"/></code></td>
+ <td><c:expr value="$!a"/></td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/MapAccess.jsp b/examples/web/ecmascript/MapAccess.jsp
new file mode 100644
index 0000000..c27cbb5
--- /dev/null
+++ b/examples/web/ecmascript/MapAccess.jsp
@@ -0,0 +1,33 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Simple Map.Entry Access Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Map.Entry Access</h3>
+
+<p>In EcmaScript you can access the key and corresponding value of the Map.Entry object directly.</p>
+
+<p>Here is an example:</p>
+
+<h4>Customer list of system properties</h4>
+
+<table border="1">
+ <tr>
+ <th>Map.Entry Object</th>
+ <th>Value</th>
+ <th>Key</th>
+ </tr>
+<c:forEach var="prop" items="$systemProperties" begin="1" end="5">
+ <tr>
+ <td>prop</td>
+ <td><c:expr value="$prop.value"/></td>
+ <td><c:expr value="$prop.key"/></td>
+ </tr>
+</c:forEach>
+</table>
+
+</body>
+</html>
+
diff --git a/examples/web/ecmascript/PropertyAccess.jsp b/examples/web/ecmascript/PropertyAccess.jsp
new file mode 100644
index 0000000..3c54aef
--- /dev/null
+++ b/examples/web/ecmascript/PropertyAccess.jsp
@@ -0,0 +1,46 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Simple Property Access Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Property Access</h3>
+
+<p>EcmaScript uses the dot (.) notation to access elements of an object. The . operator expects an object as its left operand and the name of an object property as its right operand. The right operand should not be a string or a variable that contains a string but should be the literal name of the property without quotes.</p>
+
+<p>Here is an example:</p>
+
+<% request.setAttribute("myDate", new Date()); %>
+
+<h4>Customer list of system properties</h4>
+
+<table border="1">
+ <tr>
+ <th>Object</th>
+ <th>Property</th>
+ <th>Value</th>
+ </tr>
+<c:forEach var="prop" items="$systemProperties" begin="1" end="5">
+ <tr>
+ <td>prop</td>
+ <td>prop.getKey()</td>
+ <td><c:expr value="$prop.key"/></td>
+ </tr>
+</c:forEach>
+ <tr>
+ <td>Date</td>
+ <td>Date.toString()</td>
+ <td><c:expr value="$myDate.toString()"/></td>
+ </tr>
+ <tr>
+ <td>Date</td>
+ <td>Date.getYear()</td>
+ <td><c:expr value="$myDate.year"/></td>
+ </tr>
+</table>
+
+</body>
+</html>
+
diff --git a/examples/web/ecmascript/StringOperators.jsp b/examples/web/ecmascript/StringOperators.jsp
new file mode 100644
index 0000000..c2561d8
--- /dev/null
+++ b/examples/web/ecmascript/StringOperators.jsp
@@ -0,0 +1,135 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Simple String Operator Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>String Operators</h3>
+
+<p>EcmaScript has several operators that produce special effects when used with Strings. For instance, the + operator concatenates strings. The comparison operators compare two strings using alphabetical order. Note that all capitol letters come before all lowercase letters.</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("strArray", new String[] {"Harrison", "Ford", "abc", "ABC", "1", "2"}); %>
+
+<%--
+<table border="1">
+ <tr>
+ <th>Name</th>
+ <th>Value</th>
+ </tr>
+ <c:forEach var="i" begin="0" end="5" status="status">
+ <c:declare id="status" type="javax.servlet.jsp.jstl.core.IteratorTagStatus"/>
+ <tr>
+ <td>strArray[<c:expr value="$i"/>]</td>
+ <td><c:expr value="$strArray[status.index]"/></td>
+ </tr>
+ </c:forEach>
+</table>
+--%>
+
+<h4>Operator: +</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[0]"/> + " " + <jx:expr value="$strArray[1]"/></code></td>
+ <td><c:expr value="$strArray[0] + ' ' + strArray[1]"/></td>
+ </tr>
+</table>
+
+<h4>Operator: <</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[3]"/> < <jx:expr value="$strArray[2]"/></code></td>
+ <td><c:expr value="$strArray[3] < strArray[2]"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[4]"/> < <jx:expr value="$strArray[5]"/></code></td>
+ <td><c:expr value="$strArray[4] < strArray[5]"/></td>
+ </tr>
+</table>
+
+<h4>Operator: <=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[2]"/> <= <jx:expr value="$strArray[2]"/> </code></td>
+ <td><c:expr value="$strArray[2] <= strArray[2]"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ></h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[3]"/> > <jx:expr value="$strArray[2]"/></code></td>
+ <td><c:expr value="$strArray[3] > strArray[2]"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[4]"/> > <jx:expr value="$strArray[5]"/></code></td>
+ <td><c:expr value="$strArray[4] > strArray[5]"/></td>
+ </tr>
+</table>
+
+<h4>Operator: >=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[2]"/> >= <jx:expr value="$strArray[3]"/></code></td>
+ <td><c:expr value="$strArray[2] >= strArray[3]"/></td>
+ </tr>
+</table>
+
+<h4>Operator: ==</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[0]"/> == <jx:expr value="$strArray[0]"/></code></td>
+ <td><c:expr value="$strArray[0] == strArray[0]"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[0]"/> == <jx:expr value="$strArray[1]"/></code></td>
+ <td><c:expr value="$strArray[0] == strArray[1]"/></td>
+ </tr>
+</table>
+
+<h4>Operator: !=</h4>
+<table border="1">
+ <tr>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[0]"/> != <jx:expr value="$strArray[1]"/></code></td>
+ <td><c:expr value="$strArray[0] != strArray[1]"/></td>
+ </tr>
+ <tr>
+ <td><code><c:expr value="$strArray[0]"/> != <jx:expr value="$strArray[0]"/></code></td>
+ <td><c:expr value="$strArray[0] != strArray[0]"/></td>
+ </tr>
+</table>
+
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/StringSupport.jsp b/examples/web/ecmascript/StringSupport.jsp
new file mode 100644
index 0000000..65e6fa7
--- /dev/null
+++ b/examples/web/ecmascript/StringSupport.jsp
@@ -0,0 +1,141 @@
+<%@ page import="java.util.*" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: EcmaScript EL Support -- Simple String Support Examples</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>String Support</h3>
+
+<p>The EcmaScript String object type has methods for operating on string values. Many of these methods simply make a copy of the string with HTML tags added before and after. Other methods can extract a character or substring or serach for a character in a substring. Here are examples of a few of these methods</p>
+
+<p>Here are some examples:</p>
+
+<% request.setAttribute("fullString", new String("Harrison Ford")); %>
+<% request.setAttribute("numString", new String("7/13/1942: Happy Birthday")); %>
+<% request.setAttribute("harrison", new String("Harrison")); %>
+<% request.setAttribute("ford", new String("Ford")); %>
+<% request.setAttribute("rocks", new String(" Rocks")); %>
+<% request.setAttribute("a", new String("a")); %>
+<% request.setAttribute("two", new String("2")); %>
+<% request.setAttribute("five", new String("5")); %>
+<% request.setAttribute("myColor", new String("00FF00")); %>
+<% request.setAttribute("mySize", new Integer("5")); %>
+
+<h4>String Support Examples</h4>
+<table border="1" width="95%">
+ <tr>
+ <th>String Value</th>
+ <th>Operation</th>
+ <th>Result</th>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.anchor()</code></td>
+ <td><c:expr value="$fullString.anchor(harrison)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.big()</code></td>
+ <td><c:expr value="$fullString.big()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.bold()</code></td>
+ <td><c:expr value="$fullString.bold()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.charAt(<c:expr value="$two"/>)</code></td>
+ <td><c:expr value="$fullString.charAt(two)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.concat(<c:expr value="$rocks"/>)</code></td>
+ <td><c:expr value="$fullString.concat(rocks)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.fontcolor(<c:expr value="$myColor"/>)</code></td>
+ <td><c:expr value="$fullString.fontcolor(myColor)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.fontSize(<c:expr value="$mySize"/>)</code></td>
+ <td><c:expr value="$fullString.fontsize(mySize)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.indexOf(<c:expr value="$ford"/>)</code></td>
+ <td><c:expr value="$fullString.indexOf(ford)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.italics()</code></td>
+ <td><c:expr value="$fullString.italics()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.length</code></td>
+ <td><c:expr value="$fullString.length"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.link(<c:expr value="$ford"/>)</code></td>
+ <td><c:expr value="$fullString.link(ford)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.slice(<c:expr value="$two"/>, <jx:expr value="$five"/>)</code></td>
+ <td><c:expr value="$fullString.slice(two, five)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.small()</code></td>
+ <td><c:expr value="$fullString.small()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.strike()</code></td>
+ <td><c:expr value="$fullString.strike()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.sub()</code></td>
+ <td><c:expr value="$fullString.sub()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.substring(<c:expr value="$two"/>, <jx:expr value="$five"/>)</code></td>
+ <td><c:expr value="$fullString.substring(two, five)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.toLowerCase()</code></td>
+ <td><c:expr value="$fullString.toLowerCase()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$fullString"/></td>
+ <td><code>String.toUpperCase()</code></td>
+ <td><c:expr value="$fullString.toUpperCase()"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$numString"/></td>
+ <td><code>parseInt(<c:expr value="$numString"/>)</code></td>
+ <td><c:expr value="$parseInt(numString)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$numString"/></td>
+ <td><code>escape(<c:expr value="$numString"/>)</code></td>
+ <td><c:expr value="$escape(numString)"/></td>
+ </tr>
+ <tr>
+ <td><c:expr value="$escape(numString)"/></td>
+ <td><code>unescape(<c:expr value="$escape(numString)"/>)</code></td>
+ <td><c:expr value="$unescape(escape(numString))"/></td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/examples/web/ecmascript/index.html b/examples/web/ecmascript/index.html
new file mode 100644
index 0000000..4baff14
--- /dev/null
+++ b/examples/web/ecmascript/index.html
@@ -0,0 +1,125 @@
+<html>
+<!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: EcmaScript Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script>
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="index.html">EcmaScript</a>
+ • <a href="../import/index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+
+<!-- #BeginEditable "body" -->
+<h2>EcmaScript Expression Language Examples</h2>
+<p>In order to use EcmaScript, make sure to set the context parameter to the EcmaScript expression language in your web.xml file as follows:<p>
+<pre>
+ <context-param>
+ <param-name>javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass</param-name>
+ <param-value>org.apache.taglibs.standard.lang.javascript.JavascriptExpressionEvaluator</param-value>
+ </context-param>
+</pre>
+
+
+
+<h3>Arithmetic Operators <a href="../ShowSource.jsp?filename=/ecmascript/ArithmeticOperators.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ArithmeticOperators.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Arithmetic Operators perform various operations on either numeric or string operands.<br>
+
+<h3>Comparison Operators <a href="../ShowSource.jsp?filename=/ecmascript/ComparisonOperators.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ComparisonOperators.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Comparison Operators compare values for equality and identity.<br>
+
+<h3>String Operators <a href="../ShowSource.jsp?filename=/ecmascript/StringOperators.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="StringOperators.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Comparison Operators produce special effects when used with Strings.<br>
+
+<h3>String Support <a href="../ShowSource.jsp?filename=/ecmascript/StringSupport.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="StringSupport.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+The EcmaScript String Object type has many useful methods for operating on string values.<br>
+
+<h3>Logical Operators <a href="../ShowSource.jsp?filename=/ecmascript/LogicalOperators.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="LogicalOperators.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Logical Operators are used to perform boolean algebra.<br>
+
+<h3>Bitwise Operators <a href="../ShowSource.jsp?filename=/ecmascript/BitwiseOperators.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="BitwiseOperators.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Bitwise Operators perform boolean algebra on individual bits or are used to shift bits.</br>
+
+<h3>Assignment Operators <a href="../ShowSource.jsp?filename=/ecmascript/AssignmentOperators.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="AssignmentOperators.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Assignment Operators are shortcuts for combining assignment with another operation.<br>
+
+<h3>Conditional Operator <a href="../ShowSource.jsp?filename=/ecmascript/ConditionalOperator.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ConditionalOperator.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Conditional Operator is a shortcut for an if/else statement.<br>
+
+<h3>Array Access <a href="../ShowSource.jsp?filename=/ecmascript/ArrayAccess.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ArrayAccess.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Individual elements of an array can be accessed using the [] notation.<br>
+
+<h3>Property Access <a href="../ShowSource.jsp?filename=/ecmascript/PropertyAccess.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="PropertyAccess.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Elements of an object can be accessed using the . notation.<br>
+
+<h3>Map Access <a href="../ShowSource.jsp?filename=/ecmascript/MapAccess.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="MapAccess.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+The key and value of a Map.Entry object can be accessed directly.<br>
+
+<h3>Function Call <a href="../ShowSource.jsp?filename=/ecmascript/FunctionCall.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="FunctionCall.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Functions can be invoked using the () operator.<br>
+<!-- #EndEditable -->
+
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate -->
+</html>
diff --git a/examples/web/elsupport/Declare.jsp b/examples/web/elsupport/Declare.jsp
new file mode 100644
index 0000000..ec56418
--- /dev/null
+++ b/examples/web/elsupport/Declare.jsp
@@ -0,0 +1,26 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<%@ taglib prefix="ex" uri="/jstl-examples-taglib" %>
+
+<html>
+<head>
+ <title>JSTL: Expression Language Support -- Declare Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h3><declare></h3>
+
+<h4>Using custom tag that requires an rtexprvalue (<customerFmt> with short format)</h4>
+<c:forEach var="customer" items="$customers">
+ <c:declare id="customer" type="org.apache.taglibs.standard.examples.beans.Customer"/>
+ <ex:customerFmt customer="<%= customer%>" fmt="short"/><br>
+</c:forEach>
+
+<p>
+
+<h4>Using custom tag that requires an rtexprvalue (<customerFmt> with long format)</h4>
+<c:forEach var="customer" items="$customers">
+ <c:declare id="customer" type="org.apache.taglibs.standard.examples.beans.Customer"/>
+ <ex:customerFmt customer="<%= customer%>" fmt="long"/><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/elsupport/Expr.jsp b/examples/web/elsupport/Expr.jsp
new file mode 100644
index 0000000..bb60bcf
--- /dev/null
+++ b/examples/web/elsupport/Expr.jsp
@@ -0,0 +1,24 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<html>
+<head>
+ <title>JSTL: Expression Language Support -- Expr Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h3><expr></h3>
+
+<table border="1">
+ <c:forEach var="customer" items="$customers">
+ <tr>
+ <td><c:expr value="$customer.lastName"/></td>
+ <td><c:expr value="$customer.phoneHome" default="no home phone specified"/></td>
+ <td>
+ <c:expr value="$customer.phoneCell">
+ <font color="red">no cell phone specified</font>
+ </c:expr>
+ </td>
+ </tr>
+ </c:forEach>
+</table>
+</body>
+</html>
diff --git a/examples/web/elsupport/Set.jsp b/examples/web/elsupport/Set.jsp
new file mode 100644
index 0000000..bf92734
--- /dev/null
+++ b/examples/web/elsupport/Set.jsp
@@ -0,0 +1,33 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Expression Language Support -- Set Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3><set></h3>
+
+<h4>Setting application scope attribute "customerTable"</h4>
+
+<c:set var="customerTable" scope="application">
+<table border="1">
+ <c:forEach var="customer" items="$customers">
+ <tr>
+ <td><c:expr value="$customer.lastName"/></td>
+ <td><c:expr value="$customer.address" default="no address specified"/></td>
+ <td>
+ <c:expr value="$customer.address">
+ <font color="red">no address specified</font>
+ </c:expr>
+ </td>
+ </tr>
+ </c:forEach>
+</table>
+</c:set>
+
+<p>
+Using customerTable in another JSP page
+<a href="../ShowSource.jsp?filename=/elsupport/Set2.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+<a href="../elsupport/Set2.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</body>
+</html>
diff --git a/examples/web/elsupport/Set2.jsp b/examples/web/elsupport/Set2.jsp
new file mode 100644
index 0000000..cf619bd
--- /dev/null
+++ b/examples/web/elsupport/Set2.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<html>
+<head>
+ <title>JSTL: Expression Language Support -- Set 2 Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h3><set></h3>
+
+<h4>Using "customerTable" application scope attribute defined in Set.jsp a first time</h4>
+<c:expr value="$customerTable"/>
+
+<h4>Using "customerTable" application scope attribute defined in Set.jsp a second time</h4>
+<c:expr value="$customerTable"/>
+</body>
+</html>
diff --git a/examples/web/elsupport/index.html b/examples/web/elsupport/index.html
new file mode 100644
index 0000000..8180ac9
--- /dev/null
+++ b/examples/web/elsupport/index.html
@@ -0,0 +1,68 @@
+<html><!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: Expression Language Support Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script></head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="../import/index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+<!-- #BeginEditable "body" -->
+<h2>Expression Language Support Tags Examples</h2>
+<h3><expr> <a href="../ShowSource.jsp?filename=/elsupport/Expr.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="../elsupport/Expr.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+This example features <expr> used with default values using the default
+attribute as well as the tag's body content. <br>
+<h3> <set> <a href="../ShowSource.jsp?filename=/elsupport/Set.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a>
+ <a href="../elsupport/Set.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>We set the value of an application scope attribute from the <set> tag
+ body content. This application scope variable is then used in a second JSP page.</p>
+<h3><declare> <a href="../ShowSource.jsp?filename=/elsupport/Declare.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a>
+ <a href="../elsupport/Declare.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>In order for JSTL tags to collaborate with custom tags that only accept rtexprvalues,
+ the <declare> tag must be used to create a scripting variable. In this
+ example, the page attribute created by the <forEach> tag is used in the
+ <declare> tag to export a scripting variable that is then used in custom
+ tag <customerFmt>.</p>
+<!-- #EndEditable -->
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate --></html>
diff --git a/examples/web/format/Exception.jsp b/examples/web/format/Exception.jsp
new file mode 100644
index 0000000..94ffb49
--- /dev/null
+++ b/examples/web/format/Exception.jsp
@@ -0,0 +1,21 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: I18N Support -- Exception Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<%@ page isErrorPage="true" %>
+Looking up exception's fully qualified class name in resource bundle:<br>
+<fmt:locale value="de"/>
+<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="deBundle"/>
+<ul>
+ <li> Localized exception message:<br>
+ <fmt:exception bundle="$deBundle"/>
+ <li> Localized exception message plus stack trace:<br>
+ <fmt:exception bundle="$deBundle" stackTrace="true"/>
+</ul>
+
+</body>
+</html>
diff --git a/examples/web/format/FormatDateTime.jsp b/examples/web/format/FormatDateTime.jsp
new file mode 100644
index 0000000..3c99d84
--- /dev/null
+++ b/examples/web/format/FormatDateTime.jsp
@@ -0,0 +1,26 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting Support -- Date and Time Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Formatting Dates and Times</h3>
+
+<ul>
+ <li> Formatting current date as "GMT":
+ <fmt:timeZone value="GMT">
+ <fmt:formatDate type="both"/>
+ </fmt:timeZone>
+
+ <li> Formatting current date as "GMT+1:00", and parse
+ its date and time components:<br>
+ <fmt:timeZone value="GMT+1:00"/>
+ <fmt:formatDate type="both" dateStyle="long" timeStyle="long" var="formattedDate"/>
+ <fmt:parseDate value="$formattedDate" type="both" var="parsedDate"/>
+ Parsed date: <fmt:formatDate value="$parsedDate" type="date"/><br>
+ Parsed time: <fmt:formatDate value="$parsedDate" type="time"/>
+</ul>
+
+</body>
+</html>
diff --git a/examples/web/format/FormatNumber.jsp b/examples/web/format/FormatNumber.jsp
new file mode 100644
index 0000000..59b16a5
--- /dev/null
+++ b/examples/web/format/FormatNumber.jsp
@@ -0,0 +1,26 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting Support -- Number, Currency, and Percent Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Formatting Numbers, Currencies, and Percentages</h3>
+
+<ul>
+ <li> Format as number:
+ <fmt:formatNumber value="123456789"/>
+
+ <li> Format as currency:
+ <fmt:formatNumber value="123456789" type="currency"/>
+
+ <li> Format as percentage:
+ <fmt:formatNumber value="123456789" type="percent"/>
+
+ <li> Format as currency, parse, and print parsed result:
+ <fmt:formatNumber value="123456789" type="currency" var="cur"/>
+ <fmt:parseNumber value="$cur" type="currency"/>
+</ul>
+
+</body>
+</html>
diff --git a/examples/web/format/GermanLocale.jsp b/examples/web/format/GermanLocale.jsp
new file mode 100644
index 0000000..00780ca
--- /dev/null
+++ b/examples/web/format/GermanLocale.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- German Locale Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>German Locale</h3>
+
+<fmt:locale value="de"/>
+<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources">
+ <fmt:message key="greetingMorning"/>
+</fmt:bundle>
+
+</body>
+</html>
diff --git a/examples/web/format/ItalianLocale.jsp b/examples/web/format/ItalianLocale.jsp
new file mode 100644
index 0000000..c701f47
--- /dev/null
+++ b/examples/web/format/ItalianLocale.jsp
@@ -0,0 +1,15 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- Italian Locale Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Italian Locale</h3>
+
+<fmt:locale value="it"/>
+<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="itBundle" scope="page"/>
+<fmt:message key="greetingMorning" bundle="$itBundle"/>
+
+</body>
+</html>
diff --git a/examples/web/format/MessageFormat.jsp b/examples/web/format/MessageFormat.jsp
new file mode 100644
index 0000000..bb4274c
--- /dev/null
+++ b/examples/web/format/MessageFormat.jsp
@@ -0,0 +1,34 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- MessageFormat Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>MessageFormat</h3>
+
+<fmt:formatDate type="both" var="currentDateString"/>
+<fmt:parseDate value="$currentDateString" type="both" var="currentDate"/>
+
+<ul>
+ <li> String argument:<br>
+ <fmt:messageFormat value="Current time: {0}">
+ <fmt:messageArg value="$currentDateString"/>
+ </fmt:messageFormat>
+
+ <li> <tt>java.util.Date</tt> argument:<br>
+ <fmt:messageFormat value="Current time: {0}">
+ <fmt:messageArg value="$currentDate"/>
+ </fmt:messageFormat>
+
+ <li> Using <messageArg> body:<br>
+ <fmt:messageFormat value="Current time: {0{">
+ <fmt:messageArg>
+ <fmt:formatDate type="both"/>
+ </fmt:messageArg>
+ </fmt:messageFormat>
+</ul>
+
+</ul>
+</body>
+</html>
diff --git a/examples/web/format/MissingResourceBundle.jsp b/examples/web/format/MissingResourceBundle.jsp
new file mode 100644
index 0000000..36b008b
--- /dev/null
+++ b/examples/web/format/MissingResourceBundle.jsp
@@ -0,0 +1,22 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- Missing Resource Bundle Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Missing Resource Bundle</h3>
+
+<ul>
+ <li> Implicit collaboration with <bundle> (via ancestry chain):<br>
+ <fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources">
+ <fmt:message key="greetingMorning"/>
+ </fmt:bundle>
+
+ <li> Explicit collaboration with <bundle> (via <tt>var</tt> attribute):<br>
+ <fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="enBundle"/>
+ <fmt:message key="greetingEvening" bundle="$enBundle"/>
+</ul>
+
+</body>
+</html>
diff --git a/examples/web/format/ParametricReplacement.jsp b/examples/web/format/ParametricReplacement.jsp
new file mode 100644
index 0000000..97c383f
--- /dev/null
+++ b/examples/web/format/ParametricReplacement.jsp
@@ -0,0 +1,34 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- Parametric Replacement Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parametric Replacement</h3>
+
+<fmt:locale value="de"/>
+<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="deBundle"/>
+<fmt:formatDate type="both" var="currentDateString"/>
+<fmt:parseDate value="$currentDateString" type="both" var="currentDate"/>
+<ul>
+ <li> String argument:<br>
+ <fmt:message key="currentTime" bundle="$deBundle">
+ <fmt:messageArg value="$currentDateString"/>
+ </fmt:message>
+
+ <li> <tt>java.util.Date</tt> argument:<br>
+ <fmt:message key="currentTime" bundle="$deBundle">
+ <fmt:messageArg value="$currentDate"/>
+ </fmt:message>
+
+ <li> Using <messageArg> body:<br>
+ <fmt:message key="currentTime" bundle="$deBundle">
+ <fmt:messageArg>
+ <fmt:formatDate type="both"/>
+ </fmt:messageArg>
+ </fmt:message>
+</ul>
+
+</body>
+</html>
diff --git a/examples/web/format/PrefixAttribute.jsp b/examples/web/format/PrefixAttribute.jsp
new file mode 100644
index 0000000..5fcda9a
--- /dev/null
+++ b/examples/web/format/PrefixAttribute.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- Prefix Attribute Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Prefix Attribute</h3>
+
+<fmt:locale value="de"/>
+<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources" prefix="com.acme.labels.">
+ <fmt:message key="cancel"/>
+</fmt:bundle>
+
+</body>
+</html>
diff --git a/examples/web/format/ThrowException.jsp b/examples/web/format/ThrowException.jsp
new file mode 100644
index 0000000..0ba73fc
--- /dev/null
+++ b/examples/web/format/ThrowException.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>Throw Exception</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<%@ page errorPage="Exception.jsp" %>
+<%-- throws java.lang.ArithmeticException: / by zero --%>
+<%
+int i = 5/0;
+%>
+
+</body>
+</html>
diff --git a/examples/web/format/UndefinedKey.jsp b/examples/web/format/UndefinedKey.jsp
new file mode 100644
index 0000000..c6d19b6
--- /dev/null
+++ b/examples/web/format/UndefinedKey.jsp
@@ -0,0 +1,15 @@
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/ea/fmt" %>
+
+<html>
+<head>
+ <title>JSTL: Formatting/I18N Support -- Undefined Key Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Undefined Key</h3>
+
+<fmt:locale value="it"/>
+<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="itBundle"/>
+<fmt:message key="invalidKey" bundle="$itBundle"/>
+
+</body>
+</html>
diff --git a/examples/web/format/index.html b/examples/web/format/index.html
new file mode 100644
index 0000000..a5cb69a
--- /dev/null
+++ b/examples/web/format/index.html
@@ -0,0 +1,117 @@
+<html>
+<!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: EcmaScript Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script>
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+
+<!-- #BeginEditable "body" -->
+<h2>Formatting/I18N Tags Examples</h2>
+
+<h3>German <a href="../ShowSource.jsp?filename=/format/GermanLocale.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="GermanLocale.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Using resource bundle for German locale.
+<br>
+
+<h3>Italian <a href="../ShowSource.jsp?filename=/format/ItalianLocale.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ItalianLocale.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Using resource bundle for Italian locale.
+<br>
+
+<h3>Missing Resource Bundle <a href="../ShowSource.jsp?filename=/format/MissingResourceBundle.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="MissingResourceBundle.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Trying to access a resource bundle that does not exist.
+<br>
+
+<h3>Undefined Key <a href="../ShowSource.jsp?filename=/format/UndefinedKey.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="UndefinedKey.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Looking up an undefined key in a resource bundle.
+<br>
+
+<h3>Parametric Replacement <a href="../ShowSource.jsp?filename=/format/ParametricReplacement.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ParametricReplacement.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Parametric replacement examples.
+<br>
+
+<h3>MessageFormat <a href="../ShowSource.jsp?filename=/format/MessageFormat.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="MessageFormat.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Message formatting examples.
+<br>
+
+<h3>Prefix <a href="../ShowSource.jsp?filename=/format/PrefixAttribute.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="PrefixAttribute.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Prepending prefix to message key.
+<br>
+
+<h3>Date <a href="../ShowSource.jsp?filename=/format/FormatDateTime.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="FormatDateTime.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Formatting dates and times.
+<br>
+
+<h3>Number <a href="../ShowSource.jsp?filename=/format/FormatNumber.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="FormatNumber.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Formatting numbers.
+<br>
+
+<h3>Exception <a href="../ShowSource.jsp?filename=/format/ThrowException.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ThrowException.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Formatting error page exception.
+<br>
+
+<!-- #EndEditable -->
+
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate -->
+</html>
diff --git a/examples/web/global.css b/examples/web/global.css
new file mode 100644
index 0000000..9826fd0
--- /dev/null
+++ b/examples/web/global.css
@@ -0,0 +1,4 @@
+body { font-family: Arial, Helvetica, sans-serif}
+h1 { color: #000099}
+h2 { color: #000099}
+h3 { color: #000099}
diff --git a/examples/web/images/code.gif b/examples/web/images/code.gif
new file mode 100644
index 0000000..93af2cd
--- /dev/null
+++ b/examples/web/images/code.gif
Binary files differ
diff --git a/examples/web/images/execute.gif b/examples/web/images/execute.gif
new file mode 100644
index 0000000..f64d70f
--- /dev/null
+++ b/examples/web/images/execute.gif
Binary files differ
diff --git a/examples/web/images/return.gif b/examples/web/images/return.gif
new file mode 100644
index 0000000..af4f68f
--- /dev/null
+++ b/examples/web/images/return.gif
Binary files differ
diff --git a/examples/web/import/Absolute.jsp b/examples/web/import/Absolute.jsp
new file mode 100644
index 0000000..941e88c
--- /dev/null
+++ b/examples/web/import/Absolute.jsp
@@ -0,0 +1,18 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- Absolute URL Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Absolute URL</h3>
+
+<h4>CNN's RSS XML feed:</h4>
+<blockquote>
+ <pre>
+ <c:import url="http://www.cnn.com/cnn.rss"/>
+ </pre>
+</blockquote>
+
+</body>
+</html>
diff --git a/examples/web/import/AbsoluteFtp.jsp b/examples/web/import/AbsoluteFtp.jsp
new file mode 100644
index 0000000..d91e5dd
--- /dev/null
+++ b/examples/web/import/AbsoluteFtp.jsp
@@ -0,0 +1,18 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- Absolute URL Example (non-HTTP)</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Absolute URL (non-HTTP)</h3>
+
+<h4>Free Software Foundation's FTP site:</h4>
+<blockquote>
+ <pre>
+ <c:import url="ftp://ftp.gnu.org/README"/>
+ </pre>
+</blockquote>
+
+</body>
+</html>
diff --git a/examples/web/import/ContextRelative.jsp b/examples/web/import/ContextRelative.jsp
new file mode 100644
index 0000000..14eb49f
--- /dev/null
+++ b/examples/web/import/ContextRelative.jsp
@@ -0,0 +1,17 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- Context-relative URL example</title>
+</head>
+<body bgcolor="#FFFFFF">
+Assuming you have the "examples" webapp installed, here's a file from it...
+
+<blockquote>
+ <pre>
+ <c:import url="/jsp/simpletag/foo.jsp" context="/examples"/>
+ </pre>
+</blockquote>
+
+</body>
+</html>
diff --git a/examples/web/import/Encode.jsp b/examples/web/import/Encode.jsp
new file mode 100644
index 0000000..d1d4ffb
--- /dev/null
+++ b/examples/web/import/Encode.jsp
@@ -0,0 +1,33 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- URL Encoding Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>URL Encoding</h3>
+
+<h4><urlEncode></h4>
+
+<table border="1" bgcolor="#dddddd">
+ <tr>
+ <td>ABC</td>
+ <td><c:urlEncode value="abc"/></td>
+ </tr>
+ <tr>
+ <td>123</td>
+ <td><c:urlEncode value="123"/></td>
+ </tr>
+ <tr>
+ <td>&</td>
+ <td><c:urlEncode value="&"/></td>
+ </tr>
+ <tr>
+ <td>JSTL is fun</td>
+ <td><c:urlEncode value="JSTL is fun"/></td>
+ </tr>
+ <tr>
+ <td>a=b</td>
+ <td><c:urlEncode>a=b</jx:urlEncode></td> <%-- bodies work too --%>
+ </tr>
+</table>
diff --git a/examples/web/import/EncodeContextRelative.jsp b/examples/web/import/EncodeContextRelative.jsp
new file mode 100644
index 0000000..0f88569
--- /dev/null
+++ b/examples/web/import/EncodeContextRelative.jsp
@@ -0,0 +1,23 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- URL Encoding Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>URL Encoding</h3>
+
+<h4><urlEncode></h4>
+
+<c:urlEncode var="name" value="horwat"/>
+<c:urlEncode var="email" value="horwatMail"/>
+<c:urlEncode var="action" value="Submit"/>
+
+<c:import url="/jsp/cal/cal1.jsp" context="/examples">
+ <c:param name="name" value="$name"/>
+ <c:param name="email" value="$email"/>
+ <c:param name="action" value="$action"/>
+</c:import>
+
+<%--
+--%>
diff --git a/examples/web/import/EncodeQueryString.jsp b/examples/web/import/EncodeQueryString.jsp
new file mode 100644
index 0000000..11f32c1
--- /dev/null
+++ b/examples/web/import/EncodeQueryString.jsp
@@ -0,0 +1,17 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- URL Encoding Example with Query String</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>URL Encoding with Query String</h3>
+
+<h4><urlEncode></h4>
+
+<c:urlEncode var="name" value="horwat"/>
+<c:urlEncode var="email" value="horwatMail"/>
+<c:urlEncode var="action" value="Submit"/>
+
+<c:import url="$'/jsp/cal/cal1.jsp?name=' + name + '&email=' + email + '&action=' + action" context="/examples"/>
+
diff --git a/examples/web/import/ExposeString.jsp b/examples/web/import/ExposeString.jsp
new file mode 100644
index 0000000..176897e
--- /dev/null
+++ b/examples/web/import/ExposeString.jsp
@@ -0,0 +1,20 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- String exposure</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>String exposure</h3>
+
+<c:import var="cnn" url="http://www.cnn.com/cnn.rss"/>
+
+<h4>CNN's RSS XML feed:</h4>
+<blockquote>
+ <pre>
+ <c:expr value="$cnn"/>
+ </pre>
+</blockquote>
+
+</body>
+</html>
diff --git a/examples/web/import/ExposeStringRelative.jsp b/examples/web/import/ExposeStringRelative.jsp
new file mode 100644
index 0000000..8fc6c80
--- /dev/null
+++ b/examples/web/import/ExposeStringRelative.jsp
@@ -0,0 +1,15 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- String exposure for relative URL</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>String exposure for relative URL</h3>
+
+<c:import var="cnn" url="LocalSample.jsp"/>
+
+<c:expr value="$cnn"/>
+
+</body>
+</html>
diff --git a/examples/web/import/LocalSample.jsp b/examples/web/import/LocalSample.jsp
new file mode 100644
index 0000000..5034d43
--- /dev/null
+++ b/examples/web/import/LocalSample.jsp
@@ -0,0 +1,14 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- Simple static example to be included
+ in other pages</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Local example target page</h3>
+
+<h4>• This output comes from LocalSample.jsp • </h4>
+
+</body>
+</html>
diff --git a/examples/web/import/Param.jsp b/examples/web/import/Param.jsp
new file mode 100644
index 0000000..b893e0d
--- /dev/null
+++ b/examples/web/import/Param.jsp
@@ -0,0 +1,13 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<%--
+ -- These URLs likely don't exist, but the error that gets reported
+ -- back should help you see how <param> modifies the URL.
+ --
+ --%>
+
+<c:import url="http://localhost/foo" charEncoding="foo">
+ <c:param name="a" value="b"/>
+ <c:param name="c" value="d"/>
+ <c:param name="equals" value="="/> <%-- encoded --%>
+</c:import>
diff --git a/examples/web/import/Relative.jsp b/examples/web/import/Relative.jsp
new file mode 100644
index 0000000..ecfbb79
--- /dev/null
+++ b/examples/web/import/Relative.jsp
@@ -0,0 +1,18 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- Relative URL Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Relative URL</h3>
+
+<h4>Import from current directory:</h4>
+<blockquote>
+ <pre>
+ <c:import url="LocalSample.jsp"/>
+ </pre>
+</blockquote>
+
+</body>
+</html>
diff --git a/examples/web/import/StartSlash.jsp b/examples/web/import/StartSlash.jsp
new file mode 100644
index 0000000..7afe280
--- /dev/null
+++ b/examples/web/import/StartSlash.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: I/O Support -- Malformed URL example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<blockquote>
+ <pre>
+ <c:import url="jsp/simpletag/foo.jsp" context="/examples"/>
+ </pre>
+</blockquote>
+
+</body>
+</html>
diff --git a/examples/web/import/index.html b/examples/web/import/index.html
new file mode 100644
index 0000000..d107ec4
--- /dev/null
+++ b/examples/web/import/index.html
@@ -0,0 +1,132 @@
+<html>
+<!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: Import Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script>
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+
+<!-- #BeginEditable "body" -->
+<h2>Import Tags Examples</h2>
+<p>If you are using a Proxy server, you will need to set the following System Properties when starting the VM:</p>
+<pre>
+ http.proxyHost
+ http.proxyPort
+ ftp.proxyHost
+ ftp.proxyPort
+</pre>
+<br>
+
+
+<h3>Absolute <a href="../ShowSource.jsp?filename=/import/Absolute.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="Absolute.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Using an Absolute URL to import a resource.
+<br>
+
+<h3>Relative <a href="../ShowSource.jsp?filename=/import/Relative.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="Relative.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Using a Relative URL to import a resource.
+<br>
+
+<h3>Context Relative <a href="../ShowSource.jsp?filename=/import/ContextRelative.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ContextRelative.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Importing a resource relative to a foreign context.
+<br>
+
+<h3>Absolute (FTP) <a href="../ShowSource.jsp?filename=/import/AbsoluteFtp.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="AbsoluteFtp.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Using an Absolute URL to import a resource using a different protocol other than HTTP.
+<br>
+
+<h3>Encode <a href="../ShowSource.jsp?filename=/import/Encode.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="Encode.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+URL encoding examples.
+<br>
+
+<h3>Encode Context Relative <a href="../ShowSource.jsp?filename=/import/EncodeContextRelative.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="EncodeContextRelative.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+URL encoding examples using a relative context and nested param tags.
+<br>
+
+<h3>Encode Query String <a href="../ShowSource.jsp?filename=/import/EncodeQueryString.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="EncodeQueryString.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+URL encoding examples using a relative context and query string.
+<br>
+
+<h3>String Exposure Absolute <a href="../ShowSource.jsp?filename=/import/ExposeString.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ExposeString.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Exposing the content of the resource as a String Object.
+<br>
+
+<h3>String Exposure Relative <a href="../ShowSource.jsp?filename=/import/ExposeStringRelative.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="ExposeStringRelative.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Exposing the content of a relative URL's resource as a String Object.
+<br>
+
+<h3>Param <a href="../ShowSource.jsp?filename=/import/Param.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="Param.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Using <param> element to specify request parameters. Also demonstrating how request parameters can be URL encoded (default). (NOTE: Returns error page that shows how request parameters are encoded)
+<br>
+
+<h3>Malformed URL <a href="../ShowSource.jsp?filename=/import/StartSlash.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="StartSlash.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+A relative URL must start with a "/" in a foreign context. (NOTE: This example will result in a ServletException describing the error condition).
+<br>
+
+<!-- #EndEditable -->
+
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate -->
+</html>
diff --git a/examples/web/index.html b/examples/web/index.html
new file mode 100644
index 0000000..924a7d2
--- /dev/null
+++ b/examples/web/index.html
@@ -0,0 +1,147 @@
+<html><!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: Examples Web Application</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="global.css" type="text/css">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="index.html">Introduction</a>
+ • <a href="iterators/index.html">Iterators</a> • <a href="conditionals/index.html">Conditionals</a>
+ • <a href="elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ <br />
+ • </font><a href="ecmascript/index.html">EcmaScript</a></font></b></font>
+ <font color="#FFFFFF">•</font> <a href="import/index.html"><b>Import</b></a><font>
+ <font color="#FFFFFF">•</font> <a href="format/index.html"><b>i18n-capable formatting</b></a>
+ <font color="#FFFFFF">•</font> <a href="xml/index.html"><b>XML</b></a>
+ </td>
+ </tr>
+</table>
+<!-- #BeginEditable "body" -->
+<h1>Welcome to the jsptl-examples web application!</h1>
+<p>This web application includes a variety of sample JSP pages that showcase the
+ JSTL tags currently being specified within the <a href="http://www.jcp.org/jsr/detail/52.jsp">JSR-052
+ Expert Group</a>.
+<p><b>WARNING: This is EARLY ACCESS (EA). The goal of this EA program is to keep
+ the community informed of the EG's progress as well as to give the community
+ a chance to experiment with the standard tag library (JSTL) early in the specification
+ process so that valuable feedback can quickly be channelled back to the Expert
+ Group.</b>
+<h3>Documentation</h3>
+<p>Documentation on the JSTL tags is available at <a href="http://jakarta.apache.org/taglibs/doc/jsptl-doc">http://jakarta.apache.org/taglibs/doc/jsptl-doc</a>.
+ It is also available as the jsptl-docs web application of the jsptl EA2 release.
+<h3>Mailing Lists</h3>
+<p>There are three ways to obtain information from or send your comments to the
+ JSR052 Expert Group:
+<ol>
+ <li><b>Support</b>: For support/usage questions, please use the <a href="mailto:taglibs-user@jakarta.apache.org">user
+ mailing list</a> of jakarta-taglibs. </li>
+ <li><b>Development</b>: For bugs, development related questions, please use
+ the <a href="mailto:taglibs-dev@jakarta.apache.org">developer mailing list</a>
+ of jakarta-taglibs</li>
+ <li><b>Comments to the JSR052 EG</b>: To provide the Expert Group with feedback
+ on the JSTL, use either the <a href="mailto:taglibs-dev@jakarta.apache.org">developers
+ mailing list</a> at Jakarta, or you may contact the expert group privately
+ at <a href="mailto:jsr052-comments@sun.com">jsr052-comments@sun.com</a>. All
+ comments will be read, but we cannot guarantee a personal reply to all messages
+ received.</li>
+</ol>
+<h3>Examples</h3>
+<p>The JSTL examples have been divided in the following category:</p>
+<ul>
+ <li><a href="iterators/index.html">Iterator Tags</a> (<forEach>, <forToken>)</li>
+ <li><a href="conditionals/index.html">Conditional Tags</a> (<if>, <choose>)</li>
+ <li><a href="elsupport/index.html">Expression Language Support Tags</a> (<expr>,
+ <set>, <define>)</li>
+ <li><a href="misc/index.html">Miscellaneous</a> (various tests)</li>
+ <li><a href="ecmascript/index.html">EcmaScript Examples</a> (examples showcasing some of EcmaScript's features)</li>
+</ul>
+<p>The navigation bar at the top of each index page provides quick navigation
+ to each set of example pages.</p>
+<p>When navigating the examples, the following icons will allow you to look at
+ the source code as well as execute the example JSP page.</p>
+<table border="1" align="center" cellpadding="10">
+ <tr>
+ <td width="30"><img src="images/code.gif"></td>
+ <td>Look at the source code of the example JSP page</td>
+ </tr>
+ <tr>
+ <td width="30"><img src="images/execute.gif"></td>
+ <td>Execute the example JSP page</td>
+ </tr>
+</table>
+<h3>Infrastructure</h3>
+<p>The source code for the JSTL examples includes class <code>startup.Init</code>
+ to initilialize the objects used in the examples. This allows us to mimic the
+ environment that would normally be used within an MVC architecture: the Controller
+ invokes the business logic, saves the objects required by the web application
+ into JSP scoped attributes (usually request), and then invokes the proper JSP
+ page. For the sake of this "examples" webapp, all objects are saved
+ in the application scope.</p>
+<p>The application attributes are:</p>
+<ul>
+ <li><code>customers</code><br>
+ A collection of Customer objects</li>
+ <li><code>intArray</code><br>
+ An array of int's</li>
+ <li><code>stringArray</code><br>
+ An array of Strings</li>
+ <li><code>numberMap</code><br>
+ A Map instance associating Integer objects with their Spanish names</li>
+ <li><code>enum</code><br>
+ An enumeration on numberMap from above.<br>
+ </li>
+</ul>
+<p>The classes of interest that hold the information manipulated by the JSP pages
+ are:</p>
+<ul>
+ <li>Customer
+ <ul>
+ <li>int key</li>
+ <li>String lastName</li>
+ <li>String firstName</li>
+ <li>Date birthDate</li>
+ <li>Address address<br>
+ <br>
+ </li>
+ </ul>
+ </li>
+ <li>Address
+ <ul>
+ <li>String line1</li>
+ <li>String line2</li>
+ <li>String city</li>
+ <li>String state</li>
+ <li>String country</li>
+ </ul>
+ </li>
+</ul>
+<!-- #EndEditable -->
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate --></html>
diff --git a/examples/web/iterators/Collaboration.jsp b/examples/web/iterators/Collaboration.jsp
new file mode 100644
index 0000000..1ec0f3e
--- /dev/null
+++ b/examples/web/iterators/Collaboration.jsp
@@ -0,0 +1,43 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<%@ taglib prefix="jr" uri="http://java.sun.com/jstl/ea/jr" %>
+<%@ taglib prefix="ex" uri="/jstl-examples-taglib" %>
+
+<html>
+<head>
+ <title>JSTL: Iterator Support -- Collaboration Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Collaboration</h3>
+
+<h4>Without custom tags</h4>
+
+<table>
+<c:forEach var="customer" items="$customers" status="status">
+ <tr>
+ <c:declare id="status" type="javax.servlet.jsp.jstl.core.IteratorTagStatus"/>
+ <jr:choose>
+ <jr:when test="<%= status.getCount() % 2 == 1 %>">
+ <td bgcolor="#FFFF66">
+ </jr:when>
+ <jr:otherwise>
+ <td bgcolor="#99FFCC">
+ </jr:otherwise>
+ </jr:choose>
+ <c:expr value="$customer"/></td>
+ </tr>
+</c:forEach>
+</table>
+
+<h4>Using custom tags <even> and <odd></h4>
+
+<table>
+<c:forEach var="customer" items="$customers">
+ <tr>
+ <ex:odd><td bgcolor="#FFFF66"></ex:odd>
+ <ex:even><td bgcolor="#99FFCC"></ex:even>
+ <c:expr value="$customer"/></td>
+ </tr>
+</c:forEach>
+</table>
+</body>
+</html>
diff --git a/examples/web/iterators/DataTypes.jsp b/examples/web/iterators/DataTypes.jsp
new file mode 100644
index 0000000..2d641cc
--- /dev/null
+++ b/examples/web/iterators/DataTypes.jsp
@@ -0,0 +1,40 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Iterator Support -- Data Types Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Data Types</h3>
+
+<h4>Array of primitives (int)</h4>
+
+<c:forEach var="i" items="$intArray">
+ <c:expr value="$i"/> •
+</c:forEach>
+
+<h4>Array of objects (String)</h4>
+
+<c:forEach var="string" items="$stringArray">
+ <c:expr value="$string"/><br>
+</c:forEach>
+
+<h4>Enumeration (warning: this only works until enumeration is exhausted!)</h4>
+
+<c:forEach var="item" items="$enum" begin="2" end="10" step="2">
+ <c:expr value="$item"/><br>
+</c:forEach>
+
+<h4>Properties (Map)</h4>
+
+<c:forEach var="prop" items="$numberMap" begin="1" end="5">
+ <c:expr value="$prop.key"/> = <jx:expr value="$prop.value"/><br>
+</c:forEach>
+
+<h4>String (Comma Separated Values)</h4>
+
+<c:forEach var="token" items="bleu,blanc,rouge">
+ <c:expr value="$token"/><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/iterators/ForTokens.jsp b/examples/web/iterators/ForTokens.jsp
new file mode 100644
index 0000000..be3e595
--- /dev/null
+++ b/examples/web/iterators/ForTokens.jsp
@@ -0,0 +1,25 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Iterator Support -- forTokens Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h3><forTokens></h3>
+
+<h4>String with '|' delimiter</h4>
+
+<c:forTokens var="token" items="bleu,blanc,rouge|vert,jaune|blanc,rouge"
+ delims="|">
+ <c:expr value="$token"/> •
+</c:forTokens>
+
+<h4>String with '|' and ',' delimiters</h4>
+
+<c:forTokens var="token" items="bleu,blanc,rouge|vert,jaune|blanc,rouge"
+ delims="|,">
+ <c:expr value="$token"/> •
+</c:forTokens>
+</body>
+</html>
diff --git a/examples/web/iterators/Simple.jsp b/examples/web/iterators/Simple.jsp
new file mode 100644
index 0000000..de5f647
--- /dev/null
+++ b/examples/web/iterators/Simple.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Iterator Support -- Simple Iteration Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Simple Iteration</h3>
+
+<h4>Customer list</h4>
+
+<c:forEach var="customer" items="$customers">
+ <c:expr value="$customer"/><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/iterators/SimpleRange.jsp b/examples/web/iterators/SimpleRange.jsp
new file mode 100644
index 0000000..86f5a87
--- /dev/null
+++ b/examples/web/iterators/SimpleRange.jsp
@@ -0,0 +1,16 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Iterator Support -- Simple Range Iteration Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Simple Range Iteration</h3>
+
+<h4>1 to 10</h4>
+
+<c:forEach var="i" begin="1" end="10">
+ <c:expr value="$i"/> •
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/iterators/Status.jsp b/examples/web/iterators/Status.jsp
new file mode 100644
index 0000000..c362a1d
--- /dev/null
+++ b/examples/web/iterators/Status.jsp
@@ -0,0 +1,53 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Iterator Support -- Iteration Status Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Iteration Status</h3>
+
+<h4>Using status information: current, index, count, first, last</h4>
+<table border="1">
+ <tr>
+ <th>index</th>
+ <th>count</th>
+ <th>last name</th>
+ <th>first name</th>
+ <th>first?</th>
+ <th>last?</th>
+ </tr>
+ <c:forEach var="customer" items="$customers" status="status">
+ <tr>
+ <td><c:expr value="$status.index"/></td>
+ <td><c:expr value="$status.count"/></td>
+ <td><c:expr value="$status.current.lastName"/></td>
+ <td><c:expr value="$status.current.firstName"/></td>
+ <td><c:expr value="$status.first"/></td>
+ <td><c:expr value="$status.last"/></td>
+ </tr>
+ <c:if test="$status.last">
+ <c:set var="count" value="$status.count"/>
+ </c:if>
+ </c:forEach>
+</table>
+<p>There are <c:expr value="$count"/> customers in the list.
+
+<p>
+
+<h4>Iteration using range attributes</h4>
+<c:forEach var="i" begin="100" end="200" step="5" status="status">
+ <c:if test="$status.first">
+ begin:<c:expr value="$status.begin">begin</jx:expr>
+ end:<c:expr value="$status.end">end</jx:expr>
+ step:<c:expr value="$status.step">step</jx:expr><br>
+ sequence:
+ </c:if>
+ <c:expr value="$i"/>
+ <c:if test="$status.last">
+ <br>There are <c:expr value="$status.count"/> numbers in the list.
+ </c:if>
+</c:forEach>
+<p>
+</body>
+</html>
diff --git a/examples/web/iterators/index.html b/examples/web/iterators/index.html
new file mode 100644
index 0000000..cbedfdb
--- /dev/null
+++ b/examples/web/iterators/index.html
@@ -0,0 +1,89 @@
+<html>
+<!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: Iterator Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script>
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="../import/index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+<!-- #BeginEditable "body" -->
+<h2>Iterator Tags Examples</h2>
+<h3>Simple <a href="../ShowSource.jsp?filename=/iterators/Simple.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="Simple.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Simply displays the default <code>toString()</code> value of the items in the
+<code>Customers</code> collection.<br>
+<h3> Range <a href="../ShowSource.jsp?filename=/iterators/SimpleRange.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a>
+ <a href="SimpleRange.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+<p>Another simple example. Similar to the previous one, except that in this case
+ there is no collection to iterate over. The <code>items</code> attribute is
+ optional in the <code><forEach></code> tag. When it is not specified,
+ the range attributes must be used to iterate a specific number of times over
+ the tag's body. In this example, we simply iterate over the integer values specified
+ by the range attributes.</p>
+<h3>Data Types <a href="../ShowSource.jsp?filename=/iterators/DataTypes.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a> <a href="DataTypes.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>The <code><forEach></code> tag supports a large number of data types
+ for the collection of objects to iterate over. In this example, we feature the
+ following data types: array of primitives, array of objects, Enumeration, Properties
+ (Map), String (Comma Separated Values).</p>
+<h3>Iteration Status <a href="../ShowSource.jsp?filename=/iterators/Status.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a> <a href="Status.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>The iterator tag exposes a wealth of information relative to the iteration
+ taking place. This example features some of that status information.</p>
+<h3>Collaboration <a href="../ShowSource.jsp?filename=/iterators/Collaboration.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a> <a href="Collaboration.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>The iterator tags expose interface IteratorTag to allow custom tags to establish
+ implicit collaboration. This example shows two custom tags, <even> and
+ <odd> who take advantage of this implicit collaboration.</p>
+<h3><forTokens> <a href="../ShowSource.jsp?filename=/iterators/ForTokens.jsp"><img src="../images/code.gif" width="24" height="24" onMouseDown="MM_callJS('showJspCode(\"Simple2.jsp\")')" border="0"></a> <a href="ForTokens.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a></h3>
+<p>The <forEach> tag provides the basic iteration capabilities. <forTokens>
+ is a specialization for the handling of Strings of tokens. Essentially the same
+ as <forEach>, except that it only applies to Strings of tokens and that
+ it has an extra attribute "delims" to specify the token delimiter.</p>
+<h3>Extensibility (ToBeDone)</h3>
+<p>JSTL exposes in its API the abstract class IteratorTagSupport to facilitate
+ the implementation of custom iterator tags that leverage the standard iteration
+ behavior defined in JSTL. This example shows a custom iterator tag that ...</p>
+<!-- #EndEditable -->
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate -->
+</html>
diff --git a/examples/web/misc/IteratorTest.jsp b/examples/web/misc/IteratorTest.jsp
new file mode 100644
index 0000000..ebcdc11
--- /dev/null
+++ b/examples/web/misc/IteratorTest.jsp
@@ -0,0 +1,42 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+
+<html>
+<head>
+ <title>JSTL: Miscellaneous -- Various Iterator Tests Example</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Various tests for Iterator tags</h3>
+
+<h4>Iteration with only end specified (no items): end="10"</h4>
+(illegal)
+<%--
+<c:forEach var="i" end="10">
+ <c:expr value="$i"/> •
+</c:forEach>
+--%>
+
+<h4>Iteration with only begin specified (no items): begin="10"</h4>
+(illegal)
+<%--
+<c:forEach var="i" begin="10">
+ <c:expr value="$i"/> •
+</c:forEach>
+--%>
+
+<h4>Iteration with only begin specified (with items): begin="2"</h4>
+
+<c:forEach var="i" items="$customers" begin="2" status="status">
+ index: <c:expr value="$status.index"/> •
+ count: <c:expr value="$status.count"/> •
+ item: <c:expr value="$i"/><br>
+</c:forEach>
+
+<h4>Iteration with only end specified (with items): end="1"</h4>
+
+<c:forEach var="i" items="$customers" end="1" status="status">
+ index: <c:expr value="$status.index"/> •
+ count: <c:expr value="$status.count"/> •
+ item: <c:expr value="$i"/><br>
+</c:forEach>
+</body>
+</html>
diff --git a/examples/web/misc/index.html b/examples/web/misc/index.html
new file mode 100644
index 0000000..79b5533
--- /dev/null
+++ b/examples/web/misc/index.html
@@ -0,0 +1,50 @@
+<html><!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: Miscellaneous Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="../import/index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+<!-- #BeginEditable "body" -->
+<h2>Miscellaneous</h2>
+<h3>Iterator Tags Tests <a href="../ShowSource.jsp?filename=/misc/IteratorTest.jsp"><img src="../images/code.gif" width="24" height="24" border="0"></a>
+ <a href="../misc/IteratorTest.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a>
+</h3>
+Some tests on the iterator tags.<br>
+<!-- #EndEditable -->
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate --></html>
diff --git a/examples/web/xml/Expr.jsp b/examples/web/xml/Expr.jsp
new file mode 100644
index 0000000..e058d16
--- /dev/null
+++ b/examples/web/xml/Expr.jsp
@@ -0,0 +1,29 @@
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Parse / Expr</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / Expr</h3>
+
+<x:parse var="a">
+ <a>
+ <b>
+ <c>
+ foo
+ </c>
+ </b>
+ <d>
+ bar
+ </d>
+ </a>
+</x:parse>
+
+<x:expr select="$a//c"/>
+<x:expr select="$a/a/d"/>
+
+<hr />
+
+</body>
+</html>
diff --git a/examples/web/xml/Filter.jsp b/examples/web/xml/Filter.jsp
new file mode 100644
index 0000000..fe89e92
--- /dev/null
+++ b/examples/web/xml/Filter.jsp
@@ -0,0 +1,33 @@
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+<%@ taglib prefix="ex" uri="/jstl-examples-taglib" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Parse / Filter / Expr</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / Filter / Expr</h3>
+
+<ex:SPath var="spath" select="//a"/>
+<x:parse var="a" filter="$spath">
+ <nope>
+ <a>
+ <b>
+ <c>
+ foo
+ </c>
+ </b>
+ <d>
+ bar
+ </d>
+ </a>
+ </nope>
+</x:parse>
+
+<x:expr select="$a//c"/>
+<x:expr select="$a/a/d"/>
+
+<hr />
+
+</body>
+</html>
diff --git a/examples/web/xml/ForEach.jsp b/examples/web/xml/ForEach.jsp
new file mode 100644
index 0000000..7013ac3
--- /dev/null
+++ b/examples/web/xml/ForEach.jsp
@@ -0,0 +1,43 @@
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Parse / ForEach</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / ForEach</h3>
+
+<x:parse var="document">
+ <doc>
+ <a>
+ <b foo="foo">foo 1</b>
+ </a>
+ <a>
+ <c foo="bar">bar 2</c>
+ </a>
+ <a>
+ <d foo="bar">bar 3</d>
+ </a>
+ <a>
+ <d foo="foo">foo 4</d>
+ </a>
+ </doc>
+</x:parse>
+
+<x:forEach select="$document//a">
+ -> <x:expr select="."/>
+ <br />
+</x:forEach>
+
+<hr />
+
+<x:forEach select="$document//a">
+ ->
+ <x:if select=".//d">
+ <d> element present
+ </x:if>
+ <br />
+</x:forEach>
+
+</body>
+</html>
diff --git a/examples/web/xml/If.jsp b/examples/web/xml/If.jsp
new file mode 100644
index 0000000..94f23ac
--- /dev/null
+++ b/examples/web/xml/If.jsp
@@ -0,0 +1,42 @@
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Parse / If</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / If</h3>
+
+<x:parse var="a">
+ <a>
+ <b>
+ <c>
+ foo
+ </c>
+ </b>
+ <d>
+ bar
+ </d>
+ </a>
+</x:parse>
+
+<x:if select="$a//c">
+ $a//c exists
+</x:if>
+
+<br />
+
+<x:if select="$a/a/d">
+ $a/a/d exists
+</x:if>
+
+<br />
+
+<x:if select="$a/w/o/l">
+ $a/w/o/l exists
+</x:if>
+
+<hr />
+
+</body>
+</html>
diff --git a/examples/web/xml/Set.jsp b/examples/web/xml/Set.jsp
new file mode 100644
index 0000000..df69374
--- /dev/null
+++ b/examples/web/xml/Set.jsp
@@ -0,0 +1,31 @@
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Parse / Set / Expr</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / Set / Expr</h3>
+
+<x:parse var="a">
+ <a>
+ <b>
+ <c>
+ foo
+ </c>
+ </b>
+ <d>
+ <e>
+ bar
+ </e>
+ </d>
+ </a>
+</x:parse>
+
+<x:set var="d" select="$a//d"/>
+<x:expr select="$d/e"/>
+
+<hr />
+
+</body>
+</html>
diff --git a/examples/web/xml/Transform.jsp b/examples/web/xml/Transform.jsp
new file mode 100644
index 0000000..b04a833
--- /dev/null
+++ b/examples/web/xml/Transform.jsp
@@ -0,0 +1,50 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Transform</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / Expr</h3>
+
+<c:set var="xml">
+ <a><b>header!</b></a>
+</c:set>
+
+<c:set var="xsl">
+ <?xml version="1.0"?>
+ <xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:template match="text()">
+ <h1><xsl:value-of select="."/></h1>
+ </xsl:template>
+
+ </xsl:stylesheet>
+</c:set>
+
+Prints "header" as a header:<br />
+<x:transform source="$xml" xslt="$xsl"/>
+
+<hr />
+
+Prints "header" in normal size:<br />
+<x:transform source="$xml" xslt="$xsl" var="doc"/>
+<x:expr select="$doc//h1"/>
+
+<hr />
+
+Prints "header" as a header again:
+<x:transformer xslt="$xsl" var="transformer"/>
+<x:transform source="$xml" transformer="$transformer"/>
+
+<hr />
+
+Prints "Second header" as a header:
+<x:transform transformer="$transformer">
+ <blah><blah><blah>Second header</blah></blah></blah>
+</x:transform>
+
+</body>
+</html>
diff --git a/examples/web/xml/When.jsp b/examples/web/xml/When.jsp
new file mode 100644
index 0000000..a720626
--- /dev/null
+++ b/examples/web/xml/When.jsp
@@ -0,0 +1,68 @@
+<%@ taglib prefix="x" uri="http://java.sun.com/jstl/ea/xml" %>
+
+<html>
+<head>
+ <title>JSTL: XML Support -- Parse / When</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h3>Parse / When</h3>
+
+<x:parse var="a">
+ <a>
+ <b>
+ <c foo="bar">
+ foo
+ </c>
+ </b>
+ <d>
+ bar
+ </d>
+ </a>
+</x:parse>
+
+<x:choose>
+ <x:when select='$a//c[@foo="bar"]'>
+ @foo = bar
+ </x:when>
+ <x:when select='$a//c[@foo="foo"]'>
+ @foo = foo
+ </x:when>
+ <x:otherwise>
+ @foo not recognized
+ </x:otherwise>
+</x:choose>
+
+<br />
+
+<x:choose>
+ <x:when select='$a//c[@foo="foo"]'>
+ @foo = foo
+ </x:when>
+ <x:when select='$a//c[@foo="bar"]'>
+ @foo = bar
+ </x:when>
+ <x:otherwise>
+ @foo not recognized
+ </x:otherwise>
+</x:choose>
+
+<br />
+
+<x:choose>
+ <x:when select='$a//c[@foo="barr"]'>
+ @foo = barr
+ </x:when>
+ <x:when select='$a//c[@foo="fooo"]'>
+ @foo = fooo
+ </x:when>
+ <x:otherwise>
+ @foo not recognized
+ </x:otherwise>
+</x:choose>
+
+<br />
+
+<hr />
+
+</body>
+</html>
diff --git a/examples/web/xml/index.html b/examples/web/xml/index.html
new file mode 100644
index 0000000..6846a11
--- /dev/null
+++ b/examples/web/xml/index.html
@@ -0,0 +1,120 @@
+<html>
+<!-- #BeginTemplate "/web/Templates/ExamplesTemplate.dwt" -->
+<head>
+<!-- #BeginEditable "doctitle" -->
+<title>JSTL: EcmaScript Tags Examples</title>
+<!-- #EndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="../global.css" type="text/css">
+<script language="JavaScript">
+<!--
+function MM_callJS(jsStr) { //v2.0
+ return eval(jsStr)
+}
+//-->
+</script>
+</head>
+<body bgcolor="#FFFFFF" text="#000000">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="0"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="0"><font size="-1" color="#000099"> <b>Beware —
+ API and Tags may/will change</b></font></td>
+ <td align="right" height="0"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b><a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052 EG</a></b></font></td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#CCCCFF"><font color="#CCFF00"><b><font color="#000099">JSTL
+ Examples</font><font color="#FFFFFF"> <a href="../index.html">Introduction</a>
+ • <a href="../iterators/index.html">Iterators</a> • <a href="../conditionals/index.html">Conditionals</a>
+ • <a href="../elsupport/index.html">EL Support </a></font><font color="#CCFF00"><b><font color="#FFFFFF">•
+ <a href="../misc/index.html">Misc</a></font></b></font><font color="#FFFFFF">
+ • <a href="../ecmascript/index.html">EcmaScript</a>
+ • <a href="index.html">Import</a></font></b></font></td>
+ </tr>
+</table>
+
+<!-- #BeginEditable "body" -->
+<h2>XML Examples</h2>
+
+<h3>Expr
+ <a href="../ShowSource.jsp?filename=/xml/Expr.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="Expr.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Retrieving a String from a parsed XML document <br />
+
+<h3>Filter
+ <a href="../ShowSource.jsp?filename=/xml/Filter.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="Filter.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Applying a SAX XMLFilter object to a document before parsing <br />
+
+<h3>ForEach
+ <a href="../ShowSource.jsp?filename=/xml/ForEach.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="ForEach.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Iterating over XML nodes <br />
+
+<h3>If
+ <a href="../ShowSource.jsp?filename=/xml/If.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="If.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Basing a decision on the status of an XML document <br />
+
+<h3>Set
+ <a href="../ShowSource.jsp?filename=/xml/Set.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="Set.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Storing an object resulting from an XPath expression <br />
+
+<h3>Transform
+ <a href="../ShowSource.jsp?filename=/xml/Transform.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="Transform.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Applying XSLT transformations <br />
+
+<h3>When
+ <a href="../ShowSource.jsp?filename=/xml/When.jsp">
+ <img src="../images/code.gif" width="24" height="24" border="0">
+ </a>
+ <a href="When.jsp">
+ <img src="../images/execute.gif" width="24" height="24" border="0">
+ </a> </h3>
+Mutually exclusive conditionals based on the status of an XML document <br />
+
+<!-- #EndEditable -->
+
+<hr noshade color="#000099">
+<table width="100%" border="0" cellpadding="5">
+ <tr>
+ <td height="24"><font size="-1" color="#000099"><b>JSTL Early Access</b></font></td>
+ <td align="center" height="24"><font size="-1" color="#000099"> <b>Beware
+ — API and Tags may/will change</b></font></td>
+ <td align="right" height="24"><font size="-1" color="#003399"><a href="mailto:taglibs-user@jakarta.apache.org"><b>support</b></a>
+ <b> <a href="mailto:taglibs-dev@jakarta.apache.org">development</a>
+ <a href="mailto:jsr052-comments@sun.com">comments to JSR052
+ EG</a></b></font></td>
+ </tr>
+</table>
+</body>
+<!-- #EndTemplate -->
+</html>
diff --git a/lib/commons-JXPath-0.1-dev.jar b/lib/commons-JXPath-0.1-dev.jar
new file mode 100644
index 0000000..447408f
--- /dev/null
+++ b/lib/commons-JXPath-0.1-dev.jar
Binary files differ
diff --git a/lib/crimson.jar b/lib/crimson.jar
new file mode 100644
index 0000000..8fb80cf
--- /dev/null
+++ b/lib/crimson.jar
Binary files differ
diff --git a/lib/jaxen-full.jar b/lib/jaxen-full.jar
new file mode 100644
index 0000000..6de609b
--- /dev/null
+++ b/lib/jaxen-full.jar
Binary files differ
diff --git a/lib/js.jar b/lib/js.jar
new file mode 100644
index 0000000..6693d8e
--- /dev/null
+++ b/lib/js.jar
Binary files differ
diff --git a/lib/saxpath.jar b/lib/saxpath.jar
new file mode 100644
index 0000000..99b2868
--- /dev/null
+++ b/lib/saxpath.jar
Binary files differ
diff --git a/lib/xalan.jar b/lib/xalan.jar
new file mode 100644
index 0000000..9ee659b
--- /dev/null
+++ b/lib/xalan.jar
Binary files differ
diff --git a/src/javax/servlet/jsp/jstl/fmt/LocalizableException.java b/src/javax/servlet/jsp/jstl/fmt/LocalizableException.java
new file mode 100644
index 0000000..9d19b63
--- /dev/null
+++ b/src/javax/servlet/jsp/jstl/fmt/LocalizableException.java
@@ -0,0 +1,81 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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 javax.servlet.jsp.jstl.fmt;
+
+/**
+ * A localizable exception.
+ *
+ * @author Jan Luehe
+ */
+
+public interface LocalizableException {
+
+ /**
+ * Returns the exception's message key from which the exception's
+ * localized message is derived via a resource bundle lookup.
+ *
+ * @return the exception's message key
+ */
+ public String getMessageKey();
+
+ /**
+ * Returns the arguments for parametric replacement on the exception's
+ * localized message.
+ *
+ * @return the exception's message arguments
+ */
+ public Object[] getMessageArgs();
+}
diff --git a/src/org/apache/taglibs/standard/extra/i18n/Locale.java b/src/org/apache/taglibs/standard/extra/i18n/Locale.java
new file mode 100644
index 0000000..cd9177f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/i18n/Locale.java
@@ -0,0 +1,238 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.i18n;
+
+import java.util.*;
+import java.text.*;
+import javax.servlet.jsp.*;
+import org.apache.taglibs.standard.tag.common.fmt.BundleSupport;
+import org.apache.taglibs.standard.tag.common.fmt.MessageSupport;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Exposes the resource bundle locale-determination logic through utility
+ * methods to any tag handlers that need to produce localized messages.
+ *
+ * <p> A resource bundle's locale is determined as follows:
+ *
+ * <ul>
+ * <li> If the <tt>javax.servlet.jsp.jsptl.i18n.locale</tt> scoped
+ * attribute exists, use the locale stored as its value.
+ *
+ * <li> Otherwise, compare the client's preferred locales (in order of
+ * preference) against the available locales for the resource bundle's base
+ * name, and use the best matching locale.
+ * The best matching locale is defined as the client's preferred locale that
+ * matches both the language and country components of an available locale for
+ * the base name in question. This is considered an exact match.
+ * If no exact match exists, the first client locale that matches (just) the
+ * language component of an available locale is used.
+ *
+ * <li> If no match is found, use the fallback locale given by the
+ * <tt>javax.servlet.jsp.jsptl.i18n.fallbackLocale</tt> scoped attribute, if it
+ * exists.
+ *
+ * <li> Otherwise, use the runtime's default locale.
+ * </ul>
+ *
+ * @author Jan Luehe
+ */
+
+public class Locale {
+
+ /**
+ * Retrieves the localized message corresponding to the given key.
+ *
+ * The given key is looked up in the resource bundle whose base
+ * name is retrieved from the
+ * <tt>javax.servlet.jsp.jsptl.i18n.basename</tt> scoped attribute and
+ * whose locale is determined according to the algorithm described in
+ * the header of this class.
+ *
+ * If the <tt>javax.servlet.jsp.jsptl.i18n.basename</tt> attribute is not
+ * found in any of the scopes, or no resource bundle with that base name
+ * exists, or the given key is undefined in the resource bundle that was
+ * loaded as a result of this call, the string
+ * "???<key>???" is returned, where
+ * "<key>" is replaced with the given <tt>key</tt>
+ * argument.
+ *
+ * @param pageContext the page in which the given key must be localized
+ * @param key the message key to be looked up
+ *
+ * @return the localized message corresponding to the given key
+ */
+ public static String getLocalizedMessage(PageContext pageContext,
+ String key) {
+ return getLocalizedMessage(pageContext, key, null, null);
+ }
+
+ /**
+ * Retrieves the localized message corresponding to the given key.
+ *
+ * The given key is looked up in the resource bundle with the given
+ * base name whose locale is determined according to the
+ * algorithm described in the header of this class.
+ *
+ * If no resource bundle with the given base name exists,
+ * or the given key is undefined in the resource bundle that was loaded as
+ * a result of this call, the string
+ * "???<key>???" is returned, where
+ * "<key>" is replaced with the given <tt>key</tt>
+ * argument.
+ *
+ * @param pageContext the page in which the given key must be localized
+ * @param key the message key to be looked up
+ * @param basename the resource bundle base name
+ *
+ * @return the localized message corresponding to the given key
+ */
+ public static String getLocalizedMessage(PageContext pageContext,
+ String key,
+ String basename) {
+ return getLocalizedMessage(pageContext, key, null, basename);
+ }
+
+ /**
+ * Retrieves the localized message corresponding to the given key and
+ * performs parametric replacement using the arguments specified in the
+ * <tt>args</tt> parameter.
+ *
+ * The given key is looked up in the resource bundle whose base
+ * name is retrieved from the
+ * <tt>javax.servlet.jsp.jsptl.i18n.basename</tt> scoped attribute and
+ * whose locale is determined according to the algorithm described in the
+ * header of this class.
+ *
+ * Before being returned, the result of the lookup undergoes parametric
+ * replacement, using the arguments specified in the <tt>args</tt>
+ * parameter.
+ *
+ * If the <tt>javax.servlet.jsp.jsptl.i18n.basename</tt> attribute is not
+ * found in any of the scopes, or no resource bundle with that base name
+ * exists, or the given key is undefined in the resource bundle that was
+ * loaded as a result of this call, the string
+ * "???<key>???" is returned, where
+ * "<key>" is replaced with the given <tt>key</tt>
+ * argument.
+ *
+ * @param pageContext the page in which the given key must be localized
+ * @param key the message key to be looked up
+ * @param args the arguments for parametric replacement
+ *
+ * @return the localized message corresponding to the given key
+ */
+ public static String getLocalizedMessage(PageContext pageContext,
+ String key,
+ Object[] args) {
+ return getLocalizedMessage(pageContext, key, args, null);
+ }
+
+ /**
+ * Retrieves the localized message corresponding to the given key.
+ *
+ * The given key is looked up in the resource bundle with the given
+ * base name whose locale is determined according to the
+ * algorithm described in the header of this class.
+ *
+ * Before being returned, the result of the lookup undergoes parametric
+ * replacement, using the arguments specified in the <tt>args</tt>
+ * parameter.
+ *
+ * If no resource bundle with the given base name exists,
+ * or the given key is undefined in the resource bundle that was loaded as
+ * a result of this call, the string "???<key>???" is
+ * returned, where "<key>" is replaced with the given
+ * <tt>key</tt> argument.
+ *
+ * @param pageContext the page in which the given key must be localized
+ * @param key the message key to be looked up
+ * @param args the arguments for parametric replacement
+ * @param basename the resource bundle base name
+ *
+ * @return the localized message corresponding to the given key
+ */
+ public static String getLocalizedMessage(PageContext pageContext,
+ String key,
+ Object[] args,
+ String basename) {
+ ResourceBundle bundle = null;
+ String message = MessageSupport.UNDEFINED_KEY + key
+ + MessageSupport.UNDEFINED_KEY;
+
+ if (basename != null)
+ bundle = BundleSupport.getBundle(pageContext, basename);
+ else
+ bundle = BundleSupport.getDefaultBundle(
+ pageContext, BundleSupport.DEFAULT_BASENAME);
+
+ if (bundle != null) {
+ try {
+ message = bundle.getString(key);
+ if (args != null) {
+ MessageFormat formatter = new MessageFormat("");
+ formatter.setLocale(bundle.getLocale());
+ formatter.applyPattern(message);
+ message = formatter.format(args);
+ }
+ } catch (MissingResourceException mre) {
+ }
+ }
+
+ return message;
+ }
+}
+
diff --git a/src/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java b/src/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java
new file mode 100644
index 0000000..ae623c3
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java
@@ -0,0 +1,377 @@
+/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */
+package org.apache.taglibs.standard.extra.spath;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public final class ASCII_CharStream
+{
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private java.io.Reader inputStream;
+
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = (char)((char)0xff & buffer[bufpos]);
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public ASCII_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public ASCII_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public ASCII_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public ASCII_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java b/src/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java
new file mode 100644
index 0000000..b4e53e7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java
@@ -0,0 +1,520 @@
+/* Generated By:JavaCC: Do not edit this line. ASCII_UCodeESC_CharStream.java Version 0.7pre6 */
+package org.apache.taglibs.standard.extra.spath;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (with java-like unicode escape processing).
+ */
+
+public final class ASCII_UCodeESC_CharStream
+{
+ public static final boolean staticFlag = false;
+ static final int hexval(char c) throws java.io.IOException {
+ switch(c)
+ {
+ case '0' :
+ return 0;
+ case '1' :
+ return 1;
+ case '2' :
+ return 2;
+ case '3' :
+ return 3;
+ case '4' :
+ return 4;
+ case '5' :
+ return 5;
+ case '6' :
+ return 6;
+ case '7' :
+ return 7;
+ case '8' :
+ return 8;
+ case '9' :
+ return 9;
+
+ case 'a' :
+ case 'A' :
+ return 10;
+ case 'b' :
+ case 'B' :
+ return 11;
+ case 'c' :
+ case 'C' :
+ return 12;
+ case 'd' :
+ case 'D' :
+ return 13;
+ case 'e' :
+ case 'E' :
+ return 14;
+ case 'f' :
+ case 'F' :
+ return 15;
+ }
+
+ throw new java.io.IOException(); // Should never come here
+ }
+
+ public int bufpos = -1;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private java.io.Reader inputStream;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private char[] nextCharBuf;
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int nextCharInd = -1;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ bufpos += (bufsize - tokenBegin);
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ bufpos -= tokenBegin;
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+ available = (bufsize += 2048);
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ int i;
+ if (maxNextCharInd == 4096)
+ maxNextCharInd = nextCharInd = 0;
+
+ try {
+ if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
+ 4096 - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ if (bufpos != 0)
+ {
+ --bufpos;
+ backup(0);
+ }
+ else
+ {
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+ throw e;
+ }
+ }
+
+ private final char ReadByte() throws java.io.IOException
+ {
+ if (++nextCharInd >= maxNextCharInd)
+ FillBuff();
+
+ return nextCharBuf[nextCharInd];
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0)
+ : ++bufpos];
+ }
+
+ tokenBegin = 0;
+ bufpos = -1;
+
+ return readChar();
+ }
+
+ private final void AdjustBuffSize()
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = 0;
+ available = tokenBegin;
+ }
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+ }
+
+ char c;
+
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\'))
+ {
+ UpdateLineColumn(c);
+
+ int backSlashCnt = 1;
+
+ for (;;) // Read all the backslashes
+ {
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ try
+ {
+ if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\')
+ {
+ UpdateLineColumn(c);
+ // found a non-backslash char.
+ if ((c == 'u') && ((backSlashCnt & 1) == 1))
+ {
+ if (--bufpos < 0)
+ bufpos = bufsize - 1;
+
+ break;
+ }
+
+ backup(backSlashCnt);
+ return '\\';
+ }
+ }
+ catch(java.io.IOException e)
+ {
+ if (backSlashCnt > 1)
+ backup(backSlashCnt);
+
+ return '\\';
+ }
+
+ UpdateLineColumn(c);
+ backSlashCnt++;
+ }
+
+ // Here, we have seen an odd number of backslash's followed by a 'u'
+ try
+ {
+ while ((c = (char)((char)0xff & ReadByte())) == 'u')
+ ++column;
+
+ buffer[bufpos] = c = (char)(hexval(c) << 12 |
+ hexval((char)((char)0xff & ReadByte())) << 8 |
+ hexval((char)((char)0xff & ReadByte())) << 4 |
+ hexval((char)((char)0xff & ReadByte())));
+
+ column += 4;
+ }
+ catch(java.io.IOException e)
+ {
+ throw new Error("Invalid escape character at line " + line +
+ " column " + column + ".");
+ }
+
+ if (backSlashCnt == 1)
+ return c;
+ else
+ {
+ backup(backSlashCnt - 1);
+ return '\\';
+ }
+ }
+ else
+ {
+ UpdateLineColumn(c);
+ return (c);
+ }
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
+ int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ nextCharBuf = new char[4096];
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
+ int startline, int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream,
+ int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ nextCharBuf = new char[4096];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ nextCharInd = bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream,
+ int startline, int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ nextCharBuf = null;
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/AbsolutePath.java b/src/org/apache/taglibs/standard/extra/spath/AbsolutePath.java
new file mode 100644
index 0000000..01c5aba
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/AbsolutePath.java
@@ -0,0 +1,88 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.util.List;
+
+/**
+ * <p>Represents an absolute SPath expression. Essentially a marker
+ * class.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class AbsolutePath extends Path {
+
+ private boolean all;
+ private RelativePath base;
+
+ /**
+ * Constructs a new AbsolutePath object based on a RelativePath.
+ * An absolute path is the same as a relative path, except that it
+ * begins with '/' or '//' (which one, of those two, can be
+ * determined by the first Step returned from getSteps()).
+ */
+ public AbsolutePath(RelativePath base) {
+ if (base == null)
+ throw new IllegalArgumentException("non-null base required");
+ this.base = base;
+ }
+
+ // inherit JavaDoc comment
+ public List getSteps() {
+ // simply return our base's Step objects
+ return base.getSteps();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/AttributePredicate.java b/src/org/apache/taglibs/standard/extra/spath/AttributePredicate.java
new file mode 100644
index 0000000..c0201ac
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/AttributePredicate.java
@@ -0,0 +1,96 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.util.List;
+
+/**
+ * <p>Represents a predicate expression concerning a single attribute.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class AttributePredicate extends Predicate {
+
+ private String attribute, target;
+
+ /**
+ * Constructs a new AttributePredicate, given an attribute name
+ * and a target literal (with which to test equality).
+ */
+ public AttributePredicate(String attribute, String target) {
+ if (attribute == null)
+ throw new IllegalArgumentException("non-null attribute needed");
+ if (attribute.indexOf(":") != -1)
+ throw new IllegalArgumentException(
+ "namespace-qualified attribute names are not currently " +
+ "supported");
+ this.attribute = attribute;
+
+ if (target == null)
+ throw new IllegalArgumentException("non-null target needed");
+ // strip quotation marks from target
+ this.target = target.substring(1, target.length() - 1);
+ }
+
+ /**
+ * Returns true if the given SAX AttributeList is suitable, given our
+ * attribute name and target; returns false otherwise.
+ */
+ public boolean isMatchingAttribute(org.xml.sax.Attributes a) {
+ String attValue = a.getValue("", attribute);
+ return (attValue != null && attValue.equals(target));
+ }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/ParseException.java b/src/org/apache/taglibs/standard/extra/spath/ParseException.java
new file mode 100644
index 0000000..3e00f5c
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/ParseException.java
@@ -0,0 +1,191 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+package org.apache.taglibs.standard.extra.spath;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/Path.java b/src/org/apache/taglibs/standard/extra/spath/Path.java
new file mode 100644
index 0000000..3148573
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/Path.java
@@ -0,0 +1,75 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.util.List;
+
+/**
+ * <p>Represents a simple path (SPath) expression. A path is an ordered
+ * list of Steps.
+ *
+ * @author Shawn Bayern
+ */
+public abstract class Path {
+
+ /**
+ * Retrives an ordered list of Step objects representing this
+ * expression. The result is safely modifiable by the caller and
+ * must support List.add(Object) and List.add(int, Object).
+ */
+ public abstract List getSteps();
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/Predicate.java b/src/org/apache/taglibs/standard/extra/spath/Predicate.java
new file mode 100644
index 0000000..138cf38
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/Predicate.java
@@ -0,0 +1,67 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.util.List;
+
+/**
+ * <p>Represents a simple predicate expression.</p>
+ *
+ * @author Shawn Bayern
+ */
+public abstract class Predicate {
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/RelativePath.java b/src/org/apache/taglibs/standard/extra/spath/RelativePath.java
new file mode 100644
index 0000000..e30b2af
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/RelativePath.java
@@ -0,0 +1,94 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.util.*;
+
+/**
+ * <p>Represents a relative SPath expression.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class RelativePath extends Path {
+
+ private RelativePath next;
+ private Step step;
+
+ /**
+ * Constructs a new RelativePath object, based on a Step and another
+ * (possibly null) RelativePath. If 'all' is true, then the path
+ * matches all instances of 'next' underneath 'step'; otherwise;
+ * 'next' must be an immediate child of 'step'.
+ */
+ public RelativePath(Step step, RelativePath next) {
+ if (step == null)
+ throw new IllegalArgumentException("non-null step required");
+ this.step = step;
+ this.next = next;
+ }
+
+ // inherit JavaDoc comment
+ public List getSteps() {
+ // simply merge our 'step' with our 'next'
+ List l;
+ if (next != null)
+ l = next.getSteps();
+ else
+ l = new Vector();
+ l.add(0, step);
+ return l;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/SPathFilter.java b/src/org/apache/taglibs/standard/extra/spath/SPathFilter.java
new file mode 100644
index 0000000..6ba8b48
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/SPathFilter.java
@@ -0,0 +1,306 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.io.*;
+import java.util.*;
+import org.xml.sax.*;
+import org.xml.sax.helpers.*;
+
+// for main()
+import org.apache.xalan.serialize.Serializer;
+import org.apache.xalan.serialize.SerializerFactory;
+import org.apache.xalan.templates.OutputProperties;
+
+/**
+ * <p>Filters a SAX stream based on a single supplied SPath
+ * expression.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class SPathFilter extends XMLFilterImpl {
+
+ //*********************************************************************
+ // Protected state
+
+ /** The steps in the SPath expression we use for filtering. */
+ protected List steps;
+
+ //*********************************************************************
+ // Private state in support of filtering
+
+ private int depth; // depth in parsed document
+ private Stack acceptedDepths; // depth of acceptance
+ private int excludedDepth; // depth of exclusion
+
+ private static final boolean DEBUG = false;
+
+ //*********************************************************************
+ // Main method (for testing)
+
+ /** Simple command-line interface, mostly for testing. */
+ public static void main(String args[])
+ throws ParseException, IOException, SAXException {
+// temporary...
+System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
+
+ // retrieve and parse the expression
+ String expr = args[0];
+ SPathParser s = new SPathParser(expr);
+ Path p = s.expression();
+
+ // construct the appropriate SAX chain
+ // (reader -> us -> serializer)
+ XMLReader r = XMLReaderFactory.createXMLReader();
+ XMLFilter f1 = new SPathFilter(p);
+ XMLFilter f2 = new XMLFilterImpl();
+ f1.setParent(r);
+ f2.setParent(f1);
+ Serializer sz = SerializerFactory.getSerializer
+ (OutputProperties.getDefaultMethodProperties("xml"));
+ sz.setOutputStream(System.out);
+ f2.setContentHandler(sz.asContentHandler());
+
+ // go!
+ f2.parse(new InputSource(System.in));
+ System.out.println();
+ }
+
+ //*********************************************************************
+ // Constructor and initialization methods
+
+ /** Constructs a new SPathFilter, given a Path. */
+ public SPathFilter(Path path) {
+ init();
+ this.steps = path.getSteps();
+ }
+
+ /** Initializes state used for filtering. */
+ private void init() {
+ depth = 0;
+ excludedDepth = -1;
+ acceptedDepths = new Stack();
+ }
+
+ //*********************************************************************
+ // ContentHandler methods
+
+ // startElement() and endElement() both require and modify filter
+ // state. They contain and direct the bulk of the filter's operation.
+
+ /** Filter for startElement(). */
+ public void startElement(String uri,
+ String localName,
+ String qName,
+ Attributes a) throws SAXException {
+ // always update the depth
+ depth++;
+
+ // if we're in an accepted section, simply pass through
+ if (isAccepted()) {
+ getContentHandler().startElement(uri, localName, qName, a);
+ return;
+ }
+
+ // likewise, if we're excluded, then simply block and return
+ if (isExcluded())
+ return;
+
+ // now, not accepted or excluded, let's see if we've got a match.
+ // we need to get the appropriate step based on the number of
+ // steps we've previously accepted
+ Step currentStep = (Step) steps.get(acceptedDepths.size());
+
+ if (nodeMatchesStep(currentStep, uri, localName, qName, a)) {
+ if (DEBUG)
+ System.err.println("*** Progressive match (" + acceptedDepths.size() + "): " + localName);
+ // new match (progressive)
+ acceptedDepths.push(new Integer(depth - 1));
+
+ // is it enough? give acceptance another chance...
+ if (isAccepted())
+ getContentHandler().startElement(uri, localName, qName, a);
+ } else if (!currentStep.isDepthUnlimited()) {
+ // if the step was preceded by '/' instead of '//', then
+ // we can't have a match at this node or beneath it
+ excludedDepth = depth - 1;
+ }
+
+ // nothing left to check; no reason to include node
+ return;
+ }
+
+ /** Filter for endElement(). */
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException {
+ // reduce the depth
+ depth--;
+
+ if (isExcluded()) {
+ // determine if exclusion ends with us
+ if (excludedDepth == depth)
+ excludedDepth = -1;
+
+ // either way, we have been excluded, so pass nothing through
+ return;
+ }
+
+ // if we're excepted (for now), include ourselves...
+ if (isAccepted())
+ getContentHandler().endElement(uri, localName, qName);
+
+ if (DEBUG) {
+ System.err.println("*** Closing tag: " + localName);
+ System.err.println("*** acceptedDepths.size(): " + acceptedDepths.size());
+ System.err.println("*** last accepted depth: " + ((Integer)acceptedDepths.peek()).intValue());
+ System.err.println("*** depth: " + depth);
+ }
+
+ // now, back off if we correspond to a "successful" start tag
+ if (acceptedDepths.size() > 0 &&
+ (((Integer)acceptedDepths.peek()).intValue()) == depth)
+ acceptedDepths.pop();
+ }
+
+ // The remaining ContentHandler functions require only one bit of
+ // state: are we in a mode where we pass them through, or does
+ // the current state dictate that we ignore them. They need no other
+ // information and cannot have any effect on the current state.
+
+ /** Filter for ignoreableWhitespace(). */
+ public void ignorableWhitespace(char[] ch, int start, int length)
+ throws SAXException {
+ if (isAccepted())
+ getContentHandler().ignorableWhitespace(ch, start, length);
+ }
+
+ /** Filter for characters(). */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if (isAccepted())
+ getContentHandler().characters(ch, start, length);
+ }
+
+ /** Filter for startPrefixMapping(). */
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ if (isAccepted())
+ getContentHandler().startPrefixMapping(prefix, uri);
+ }
+
+ /** Filter for endPrefixMapping(). */
+ public void endPrefixMapping(String prefix)
+ throws SAXException {
+ if (isAccepted())
+ getContentHandler().endPrefixMapping(prefix);
+ }
+
+ /** Filter for processingInstruction(). */
+ public void processingInstruction(String target, String data)
+ throws SAXException {
+ if (isAccepted())
+ getContentHandler().processingInstruction(target, data);
+ }
+
+ /** Filter for skippedEntity(). */
+ public void skippedEntity(String name) throws SAXException {
+ if (isAccepted())
+ getContentHandler().skippedEntity(name);
+ }
+
+ // We reset state in startDocument(), in case we're reused
+ /** Resets state. */
+ public void startDocument() {
+ init();
+ }
+
+ //*********************************************************************
+ // Private utility methods
+
+ public static boolean nodeMatchesStep(Step s,
+ String uri,
+ String localName,
+ String qName,
+ Attributes a) {
+ // if the name doesn't match, then we've got a loser
+ if (!s.isMatchingName(uri, localName))
+ return false;
+
+ // it's still in the game; check the predicates
+ List l = s.getPredicates();
+ for (int i = 0; l != null && i < l.size(); i++) {
+ Predicate p = (Predicate) l.get(i);
+ if (!(p instanceof AttributePredicate))
+ throw new UnsupportedOperationException
+ ("only attribute predicates are supported by filter");
+ if (!((AttributePredicate) p).isMatchingAttribute(a))
+ return false; // all predicates must match
+ }
+
+ // it's survived
+ return true;
+ }
+
+ /** Returns true if events should be passed through, false otherwise. */
+ private boolean isAccepted() {
+ return (acceptedDepths.size() >= steps.size());
+ }
+
+ /** Returns true if events should be blocked, false otherwise. */
+ private boolean isExcluded() {
+ return (excludedDepth != -1);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/SPathParser.java b/src/org/apache/taglibs/standard/extra/spath/SPathParser.java
new file mode 100644
index 0000000..f24258a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/SPathParser.java
@@ -0,0 +1,533 @@
+/* Generated By:JavaCC: Do not edit this line. SPathParser.java */
+package org.apache.taglibs.standard.extra.spath;
+
+import java.util.Vector;
+
+public class SPathParser implements SPathParserConstants {
+
+ /** Simple command-line parser interface, primarily for testing. */
+ public static void main(String args[]) throws ParseException
+ {
+ SPathParser parser = new SPathParser(System.in);
+ Path p = parser.expression();
+ java.util.List l = p.getSteps();
+
+ // output for simple testing
+ System.out.println();
+ if (p instanceof AbsolutePath)
+ System.out.println("Root: /");
+ for (int i = 0; i < l.size(); i++) {
+ Step s = (Step) l.get(i);
+ System.out.print("Step: " + s.getName());
+ if (s.isDepthUnlimited())
+ System.out.print("(*)");
+ System.out.println();
+ }
+ }
+
+ // custom constructor to accept a String
+ public SPathParser(String x) {
+ this(new java.io.StringReader(x));
+ }
+
+//*********************************************************************
+// Actual SPath grammar
+ final public Path expression() throws ParseException {
+ Path expr;
+ if (jj_2_1(2147483647)) {
+ expr = absolutePath();
+ jj_consume_token(0);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case QNAME:
+ case NSWILDCARD:
+ case SLASH:
+ case STAR:
+ expr = relativePath();
+ jj_consume_token(0);
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ {if (true) return expr;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public AbsolutePath absolutePath() throws ParseException {
+ RelativePath relPath;
+ jj_consume_token(SLASH);
+ relPath = relativePath();
+ {if (true) return new AbsolutePath(relPath);}
+ throw new Error("Missing return statement in function");
+ }
+
+// as an example, we use recursion here to handle a list
+ final public RelativePath relativePath() throws ParseException {
+ RelativePath relPath = null;
+ Step step;
+ step = step();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SLASH:
+ jj_consume_token(SLASH);
+ relPath = relativePath();
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ ;
+ }
+ {if (true) return new RelativePath(step, relPath);}
+ throw new Error("Missing return statement in function");
+ }
+
+// as an example, we use inline code here to handle a list
+/*
+ * (i'm doing something perhaps unusual here, including the <SLASH>
+ * as if it were part of the step. this mechanism for differentiating
+ * '/' from '//' seems most natural, even if it is a bit unconventional.)
+ */
+ final public Step step() throws ParseException {
+ Token slash = null;
+ String nt;
+ Vector pl = null;
+ Predicate p;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SLASH:
+ slash = jj_consume_token(SLASH);
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ ;
+ }
+ nt = nameTest();
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case START_BRACKET:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_1;
+ }
+ p = predicate();
+ if (pl == null) pl = new Vector();
+ pl.add(p);
+ }
+ // if 'slash != null', then we have '//' versus '/'
+ {if (true) return new Step(slash != null, nt, pl);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String nameTest() throws ParseException {
+ Token name;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STAR:
+ name = jj_consume_token(STAR);
+ break;
+ case NSWILDCARD:
+ name = jj_consume_token(NSWILDCARD);
+ break;
+ case QNAME:
+ name = jj_consume_token(QNAME);
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return name.toString();}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Predicate predicate() throws ParseException {
+ Predicate p;
+ jj_consume_token(START_BRACKET);
+ p = attributePredicate();
+ jj_consume_token(END_BRACKET);
+ {if (true) return p;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Predicate attributePredicate() throws ParseException {
+ Token attname, target;
+ jj_consume_token(AT);
+ attname = jj_consume_token(QNAME);
+ jj_consume_token(EQUALS);
+ target = jj_consume_token(LITERAL);
+ {if (true) return new AttributePredicate(attname.toString(), target.toString());}
+ throw new Error("Missing return statement in function");
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_1();
+ jj_save(0, xla);
+ return retval;
+ }
+
+ final private boolean jj_3R_13() {
+ if (jj_scan_token(AT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(QNAME)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(EQUALS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_2()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_10() {
+ if (jj_scan_token(NSWILDCARD)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_11() {
+ if (jj_scan_token(QNAME)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_2() {
+ if (jj_scan_token(SLASH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_3()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_12() {
+ if (jj_scan_token(START_BRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_13()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(END_BRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_8() {
+ if (jj_3R_12()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_5() {
+ if (jj_scan_token(SLASH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_3()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_6() {
+ if (jj_scan_token(SLASH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_3() {
+ if (jj_3R_4()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_5()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_4() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_6()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_7()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_8()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_9() {
+ if (jj_scan_token(STAR)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_7() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_9()) {
+ jj_scanpos = xsp;
+ if (jj_3R_10()) {
+ jj_scanpos = xsp;
+ if (jj_3R_11()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ public SPathParserTokenManager token_source;
+ ASCII_UCodeESC_CharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[5];
+ final private int[] jj_la1_0 = {0x6014,0x2000,0x2000,0x10000,0x4014,};
+ final private JJCalls[] jj_2_rtns = new JJCalls[1];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ public SPathParser(java.io.InputStream stream) {
+ jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+ token_source = new SPathParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public SPathParser(java.io.Reader stream) {
+ jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+ token_source = new SPathParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public SPathParser(SPathParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(SPathParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.Vector jj_expentries = new java.util.Vector();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
+ int[] oldentry = (int[])(enum.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ final public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[20];
+ for (int i = 0; i < 20; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 5; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 20; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+ final private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 1; i++) {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ }
+ jj_rescan = false;
+ }
+
+ final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/SPathParser.jj b/src/org/apache/taglibs/standard/extra/spath/SPathParser.jj
new file mode 100644
index 0000000..d65af36
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/SPathParser.jj
@@ -0,0 +1,297 @@
+//*********************************************************************
+// SPath grammar (JavaCC)
+// Author: Shawn Bayern
+// For JSTL reference implementation (Apache Jakarta Taglibs)
+
+
+//*********************************************************************
+// Configuration and boilerplate
+
+options {
+ STATIC = false; // we'll need multiple instances
+ JAVA_UNICODE_ESCAPE = true; // XML uses Unicode too
+}
+
+PARSER_BEGIN(SPathParser)
+
+package org.apache.taglibs.standard.extra.spath;
+
+import java.util.Vector;
+
+public class SPathParser {
+
+ /** Simple command-line parser interface, primarily for testing. */
+ public static void main(String args[]) throws ParseException
+ {
+ SPathParser parser = new SPathParser(System.in);
+ Path p = parser.expression();
+ java.util.List l = p.getSteps();
+
+ // output for simple testing
+ System.out.println();
+ if (p instanceof AbsolutePath)
+ System.out.println("Root: /");
+ for (int i = 0; i < l.size(); i++) {
+ Step s = (Step) l.get(i);
+ System.out.print("Step: " + s.getName());
+ if (s.isDepthUnlimited())
+ System.out.print("(*)");
+ System.out.println();
+ }
+ }
+
+ // custom constructor to accept a String
+ public SPathParser(String x) {
+ this(new StringReader(x));
+ }
+
+}
+
+PARSER_END(SPathParser)
+
+//*********************************************************************
+// Literals
+
+TOKEN :
+{
+ < LITERAL:
+ ("\"" ((~["\"","\\"]) | ("\\" ( ["\\","\""] )))* "\"") |
+ ("\'" ((~["\'","\\"]) | ("\\" ( ["\\","\'"] )))* "\'")
+ >
+}
+
+//*********************************************************************
+// Primitive identifiers
+
+TOKEN :
+{
+ < QNAME: (<NCNAME><COLON>)? (<NCNAME>) >
+ |< NCNAME: (<LETTER> | <UNDERSCORE>) (<NCNAMECHAR>)* >
+ |< NSWILDCARD: (<NCNAME><COLON><STAR>) >
+ |< #NCNAMECHAR: (<LETTER>|<DIGIT>|<DOT>|<DASH>|<UNDERSCORE>|
+ <COMBINING_CHAR>|<EXTENDER>) >
+ |< #LETTER:
+ (
+ ["\u0041"-"\u005A"] | ["\u0061"-"\u007A"] | ["\u00C0"-"\u00D6"] |
+ ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u00FF"] | ["\u0100"-"\u0131"] |
+ ["\u0134"-"\u013E"] | ["\u0141"-"\u0148"] | ["\u014A"-"\u017E"] |
+ ["\u0180"-"\u01C3"] | ["\u01CD"-"\u01F0"] | ["\u01F4"-"\u01F5"] |
+ ["\u01FA"-"\u0217"] | ["\u0250"-"\u02A8"] | ["\u02BB"-"\u02C1"] |
+ "\u0386" | ["\u0388"-"\u038A"] | "\u038C" | ["\u038E"-"\u03A1"] |
+ ["\u03A3"-"\u03CE"] | ["\u03D0"-"\u03D6"] | "\u03DA" | "\u03DC" |
+ "\u03DE" | "\u03E0" | ["\u03E2"-"\u03F3"] | ["\u0401"-"\u040C"] |
+ ["\u040E"-"\u044F"] | ["\u0451"-"\u045C"] | ["\u045E"-"\u0481"] |
+ ["\u0490"-"\u04C4"] | ["\u04C7"-"\u04C8"] | ["\u04CB"-"\u04CC"] |
+ ["\u04D0"-"\u04EB"] | ["\u04EE"-"\u04F5"] | ["\u04F8"-"\u04F9"] |
+ ["\u0531"-"\u0556"] | "\u0559" | ["\u0561"-"\u0586"] |
+ ["\u05D0"-"\u05EA"] | ["\u05F0"-"\u05F2"] | ["\u0621"-"\u063A"] |
+ ["\u0641"-"\u064A"] | ["\u0671"-"\u06B7"] | ["\u06BA"-"\u06BE"] |
+ ["\u06C0"-"\u06CE"] | ["\u06D0"-"\u06D3"] | "\u06D5" |
+ ["\u06E5"-"\u06E6"] | ["\u0905"-"\u0939"] | "\u093D" |
+ ["\u0958"-"\u0961"] | ["\u0985"-"\u098C"] | ["\u098F"-"\u0990"] |
+ ["\u0993"-"\u09A8"] | ["\u09AA"-"\u09B0"] | "\u09B2" |
+ ["\u09B6"-"\u09B9"] | ["\u09DC"-"\u09DD"] | ["\u09DF"-"\u09E1"] |
+ ["\u09F0"-"\u09F1"] | ["\u0A05"-"\u0A0A"] | ["\u0A0F"-"\u0A10"] |
+ ["\u0A13"-"\u0A28"] | ["\u0A2A"-"\u0A30"] | ["\u0A32"-"\u0A33"] |
+ ["\u0A35"-"\u0A36"] | ["\u0A38"-"\u0A39"] | ["\u0A59"-"\u0A5C"] |
+ "\u0A5E" | ["\u0A72"-"\u0A74"] | ["\u0A85"-"\u0A8B"] | "\u0A8D" |
+ ["\u0A8F"-"\u0A91"] | ["\u0A93"-"\u0AA8"] | ["\u0AAA"-"\u0AB0"] |
+ ["\u0AB2"-"\u0AB3"] | ["\u0AB5"-"\u0AB9"] | "\u0ABD" | "\u0AE0" |
+ ["\u0B05"-"\u0B0C"] | ["\u0B0F"-"\u0B10"] | ["\u0B13"-"\u0B28"] |
+ ["\u0B2A"-"\u0B30"] | ["\u0B32"-"\u0B33"] | ["\u0B36"-"\u0B39"] |
+ "\u0B3D" | ["\u0B5C"-"\u0B5D"] | ["\u0B5F"-"\u0B61"] |
+ ["\u0B85"-"\u0B8A"] | ["\u0B8E"-"\u0B90"] | ["\u0B92"-"\u0B95"] |
+ ["\u0B99"-"\u0B9A"] | "\u0B9C" | ["\u0B9E"-"\u0B9F"] |
+ ["\u0BA3"-"\u0BA4"] | ["\u0BA8"-"\u0BAA"] | ["\u0BAE"-"\u0BB5"] |
+ ["\u0BB7"-"\u0BB9"] | ["\u0C05"-"\u0C0C"] | ["\u0C0E"-"\u0C10"] |
+ ["\u0C12"-"\u0C28"] | ["\u0C2A"-"\u0C33"] | ["\u0C35"-"\u0C39"] |
+ ["\u0C60"-"\u0C61"] | ["\u0C85"-"\u0C8C"] | ["\u0C8E"-"\u0C90"] |
+ ["\u0C92"-"\u0CA8"] | ["\u0CAA"-"\u0CB3"] | ["\u0CB5"-"\u0CB9"] |
+ "\u0CDE" | ["\u0CE0"-"\u0CE1"] | ["\u0D05"-"\u0D0C"] |
+ ["\u0D0E"-"\u0D10"] | ["\u0D12"-"\u0D28"] | ["\u0D2A"-"\u0D39"] |
+ ["\u0D60"-"\u0D61"] | ["\u0E01"-"\u0E2E"] | "\u0E30" |
+ ["\u0E32"-"\u0E33"] | ["\u0E40"-"\u0E45"] | ["\u0E81"-"\u0E82"] |
+ "\u0E84" | ["\u0E87"-"\u0E88"] | "\u0E8A" | "\u0E8D" |
+ ["\u0E94"-"\u0E97"] | ["\u0E99"-"\u0E9F"] | ["\u0EA2"-"\u0EA3"] |
+ "\u0EA5" | "\u0EA7" | ["\u0EAA"-"\u0EAB"] | ["\u0EAD"-"\u0EAE"] |
+ "\u0EB0" | ["\u0EB2"-"\u0EB3"] | "\u0EBD" | ["\u0EC0"-"\u0EC4"] |
+ ["\u0F40"-"\u0F47"] | ["\u0F49"-"\u0F69"] | ["\u10A0"-"\u10C5"] |
+ ["\u10D0"-"\u10F6"] | "\u1100" | ["\u1102"-"\u1103"] |
+ ["\u1105"-"\u1107"] | "\u1109" | ["\u110B"-"\u110C"] |
+ ["\u110E"-"\u1112"] | "\u113C" | "\u113E" | "\u1140" | "\u114C" |
+ "\u114E" | "\u1150" | ["\u1154"-"\u1155"] | "\u1159" |
+ ["\u115F"-"\u1161"] | "\u1163" | "\u1165" | "\u1167" | "\u1169" |
+ ["\u116D"-"\u116E"] | ["\u1172"-"\u1173"] | "\u1175" |
+ "\u119E" | "\u11A8" | "\u11AB" | ["\u11AE"-"\u11AF"] |
+ ["\u11B7"-"\u11B8"] | "\u11BA" | ["\u11BC"-"\u11C2"] | "\u11EB" |
+ "\u11F0" | "\u11F9" | ["\u1E00"-"\u1E9B"] | ["\u1EA0"-"\u1EF9"] |
+ ["\u1F00"-"\u1F15"] | ["\u1F18"-"\u1F1D"] | ["\u1F20"-"\u1F45"] |
+ ["\u1F48"-"\u1F4D"] | ["\u1F50"-"\u1F57"] | "\u1F59" | "\u1F5B" |
+ "\u1F5D" | ["\u1F5F"-"\u1F7D"] | ["\u1F80"-"\u1FB4"] |
+ ["\u1FB6"-"\u1FBC"] | "\u1FBE" | ["\u1FC2"-"\u1FC4"] |
+ ["\u1FC6"-"\u1FCC"] | ["\u1FD0"-"\u1FD3"] | ["\u1FD6"-"\u1FDB"] |
+ ["\u1FE0"-"\u1FEC"] | ["\u1FF2"-"\u1FF4"] | ["\u1FF6"-"\u1FFC"] |
+ "\u2126" | ["\u212A"-"\u212B"] | "\u212E" | ["\u2180"-"\u2182"] |
+ ["\u3041"-"\u3094"] | ["\u30A1"-"\u30FA"] | ["\u3105"-"\u312C"] |
+ ["\uAC00"-"\uD7A3"] | ["\u4E00"-"\u9FA5"] | "\u3007" |
+ ["\u3021"-"\u3029"]
+ )
+ >
+ |< #DIGIT:
+ (
+ ["\u0030"-"\u0039"] | ["\u0660"-"\u0669"] | ["\u06F0"-"\u06F9"] |
+ ["\u0966"-"\u096F"] | ["\u09E6"-"\u09EF"] | ["\u0A66"-"\u0A6F"] |
+ ["\u0AE6"-"\u0AEF"] | ["\u0B66"-"\u0B6F"] | ["\u0BE7"-"\u0BEF"] |
+ ["\u0C66"-"\u0C6F"] | ["\u0CE6"-"\u0CEF"] | ["\u0D66"-"\u0D6F"] |
+ ["\u0E50"-"\u0E59"] | ["\u0ED0"-"\u0ED9"] | ["\u0F20"-"\u0F29"]
+ )
+ >
+ |< #COMBINING_CHAR:
+ (
+ ["\u0300"-"\u0345"] | ["\u0360"-"\u0361"] | ["\u0483"-"\u0486"] |
+ ["\u0591"-"\u05A1"] | ["\u05A3"-"\u05B9"] | ["\u05BB"-"\u05BD"] |
+ "\u05BF" | ["\u05C1"-"\u05C2"] | "\u05C4" | ["\u064B"-"\u0652"] |
+ "\u0670" | ["\u06D6"-"\u06DC"] | ["\u06DD"-"\u06DF"] |
+ ["\u06E0"-"\u06E4"] | ["\u06E7"-"\u06E8"] | ["\u06EA"-"\u06ED"] |
+ ["\u0901"-"\u0903"] | "\u093C" | ["\u093E"-"\u094C"] | "\u094D" |
+ ["\u0951"-"\u0954"] | ["\u0962"-"\u0963"] | ["\u0981"-"\u0983"] |
+ "\u09BC" | "\u09BE" | "\u09BF" | ["\u09C0"-"\u09C4"] |
+ ["\u09C7"-"\u09C8"] | ["\u09CB"-"\u09CD"] | "\u09D7" |
+ ["\u09E2"-"\u09E3"] | "\u0A02" | "\u0A3C" | "\u0A3E" | "\u0A3F" |
+ ["\u0A40"-"\u0A42"] | ["\u0A47"-"\u0A48"] | ["\u0A4B"-"\u0A4D"] |
+ ["\u0A70"-"\u0A71"] | ["\u0A81"-"\u0A83"] | "\u0ABC" |
+ ["\u0ABE"-"\u0AC5"] | ["\u0AC7"-"\u0AC9"] | ["\u0ACB"-"\u0ACD"] |
+ ["\u0B01"-"\u0B03"] | "\u0B3C" | ["\u0B3E"-"\u0B43"] |
+ ["\u0B47"-"\u0B48"] | ["\u0B4B"-"\u0B4D"] | ["\u0B56"-"\u0B57"] |
+ ["\u0B82"-"\u0B83"] | ["\u0BBE"-"\u0BC2"] | ["\u0BC6"-"\u0BC8"] |
+ ["\u0BCA"-"\u0BCD"] | "\u0BD7" | ["\u0C01"-"\u0C03"] |
+ ["\u0C3E"-"\u0C44"] | ["\u0C46"-"\u0C48"] | ["\u0C4A"-"\u0C4D"] |
+ ["\u0C55"-"\u0C56"] | ["\u0C82"-"\u0C83"] | ["\u0CBE"-"\u0CC4"] |
+ ["\u0CC6"-"\u0CC8"] | ["\u0CCA"-"\u0CCD"] | ["\u0CD5"-"\u0CD6"] |
+ ["\u0D02"-"\u0D03"] | ["\u0D3E"-"\u0D43"] | ["\u0D46"-"\u0D48"] |
+ ["\u0D4A"-"\u0D4D"] | "\u0D57" | "\u0E31" | ["\u0E34"-"\u0E3A"] |
+ ["\u0E47"-"\u0E4E"] | "\u0EB1" | ["\u0EB4"-"\u0EB9"] |
+ ["\u0EBB"-"\u0EBC"] | ["\u0EC8"-"\u0ECD"] | ["\u0F18"-"\u0F19"] |
+ "\u0F35" | "\u0F37" | "\u0F39" | "\u0F3E" | "\u0F3F" |
+ ["\u0F71"-"\u0F84"] | ["\u0F86"-"\u0F8B"] | ["\u0F90"-"\u0F95"] |
+ "\u0F97" | ["\u0F99"-"\u0FAD"] | ["\u0FB1"-"\u0FB7"] | "\u0FB9" |
+ ["\u20D0"-"\u20DC"] | "\u20E1" | ["\u302A"-"\u302F"] | "\u3099" |
+ "\u309A"
+ ) >
+ |< #EXTENDER:
+ (
+ "\u00B7" | "\u02D0" | "\u02D1" | "\u0387" | "\u0640" | "\u0E46" |
+ "\u0EC6" | "\u3005" | ["\u3031"-"\u3035"] | ["\u309D"-"\u309E"] |
+ ["\u30FC"-"\u30FE"]
+ ) >
+ |< #UNDERSCORE: "_" >
+ |< #DOT: "." >
+ |< #DASH: "-" >
+}
+
+//*********************************************************************
+// Separators
+
+TOKEN :
+{
+ < SLASH: "/" >
+ |< STAR: "*" >
+ |< COLON: ":" >
+ |< START_BRACKET: "[" >
+ |< END_BRACKET: "]" >
+ |< AT: "@" >
+ |< EQUALS: "=" >
+}
+
+
+//*********************************************************************
+// Actual SPath grammar
+
+Path expression():
+{
+ Path expr;
+}
+{
+ ( LOOKAHEAD(absolutePath()) expr = absolutePath() <EOF>
+ | expr = relativePath() <EOF> )
+ { return expr; }
+}
+
+AbsolutePath absolutePath():
+{
+ RelativePath relPath;
+}
+{
+ ( <SLASH> relPath = relativePath() )
+ { return new AbsolutePath(relPath); }
+}
+
+// as an example, we use recursion here to handle a list
+RelativePath relativePath():
+{
+ RelativePath relPath = null;
+ Step step;
+}
+{
+ ( step = step()
+ (<SLASH> relPath = relativePath())? )
+ {
+ return new RelativePath(step, relPath);
+ }
+}
+
+// as an example, we use inline code here to handle a list
+/*
+ * (i'm doing something perhaps unusual here, including the <SLASH>
+ * as if it were part of the step. this mechanism for differentiating
+ * '/' from '//' seems most natural, even if it is a bit unconventional.)
+ */
+Step step():
+{
+ Token slash = null;
+ String nt;
+ Vector pl = null;
+ Predicate p;
+}
+{
+ ( (slash = <SLASH>)?
+ nt = nameTest()
+ ( p = predicate()
+ {
+ if (pl == null) pl = new Vector();
+ pl.add(p);
+ }
+ )*
+ )
+ {
+ // if 'slash != null', then we have '//' versus '/'
+ return new Step(slash != null, nt, pl);
+ }
+}
+
+String nameTest():
+{
+ Token name;
+}
+{
+ ( name = <STAR> | name = <NSWILDCARD> | name = <QNAME> )
+ { return name.toString(); }
+}
+
+Predicate predicate():
+{
+ Predicate p;
+}
+{
+ ( <START_BRACKET> p = attributePredicate() <END_BRACKET> )
+ { return p; }
+}
+
+Predicate attributePredicate():
+{
+ Token attname, target;
+}
+{
+ ( <AT> attname = <QNAME> <EQUALS> target = <LITERAL> )
+ { return new AttributePredicate(attname.toString(), target.toString()); }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java b/src/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java
new file mode 100644
index 0000000..5944252
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java
@@ -0,0 +1,52 @@
+/* Generated By:JavaCC: Do not edit this line. SPathParserConstants.java */
+package org.apache.taglibs.standard.extra.spath;
+
+public interface SPathParserConstants {
+
+ int EOF = 0;
+ int LITERAL = 1;
+ int QNAME = 2;
+ int NCNAME = 3;
+ int NSWILDCARD = 4;
+ int NCNAMECHAR = 5;
+ int LETTER = 6;
+ int DIGIT = 7;
+ int COMBINING_CHAR = 8;
+ int EXTENDER = 9;
+ int UNDERSCORE = 10;
+ int DOT = 11;
+ int DASH = 12;
+ int SLASH = 13;
+ int STAR = 14;
+ int COLON = 15;
+ int START_BRACKET = 16;
+ int END_BRACKET = 17;
+ int AT = 18;
+ int EQUALS = 19;
+
+ int DEFAULT = 0;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "<LITERAL>",
+ "<QNAME>",
+ "<NCNAME>",
+ "<NSWILDCARD>",
+ "<NCNAMECHAR>",
+ "<LETTER>",
+ "<DIGIT>",
+ "<COMBINING_CHAR>",
+ "<EXTENDER>",
+ "\"_\"",
+ "\".\"",
+ "\"-\"",
+ "\"/\"",
+ "\"*\"",
+ "\":\"",
+ "\"[\"",
+ "\"]\"",
+ "\"@\"",
+ "\"=\"",
+ };
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java b/src/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java
new file mode 100644
index 0000000..bfb7475
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java
@@ -0,0 +1,684 @@
+/* Generated By:JavaCC: Do not edit this line. SPathParserTokenManager.java */
+package org.apache.taglibs.standard.extra.spath;
+import java.util.Vector;
+
+public class SPathParserTokenManager implements SPathParserConstants
+{
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjStopAtPos(0, 14);
+ case 47:
+ return jjStopAtPos(0, 13);
+ case 58:
+ return jjStopAtPos(0, 15);
+ case 61:
+ return jjStopAtPos(0, 19);
+ case 64:
+ return jjStopAtPos(0, 18);
+ case 91:
+ return jjStopAtPos(0, 16);
+ case 93:
+ return jjStopAtPos(0, 17);
+ default :
+ return jjMoveNfa_0(0, 0);
+ }
+}
+private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private final void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+ 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec2 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec3 = {
+ 0x0L, 0xffffffffffffc000L, 0xfffff0007fffffffL, 0x7fffffL
+};
+static final long[] jjbitVec4 = {
+ 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
+};
+static final long[] jjbitVec5 = {
+ 0x7ff3ffffffffffffL, 0x7ffffffffffffdfeL, 0xffffffffffffffffL, 0xfc31ffffffffe00fL
+};
+static final long[] jjbitVec6 = {
+ 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x3L
+};
+static final long[] jjbitVec7 = {
+ 0x0L, 0x0L, 0xfffffffbffffd740L, 0xffffd547f7fffL
+};
+static final long[] jjbitVec8 = {
+ 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff0003L, 0x33fcfffffff199fL
+};
+static final long[] jjbitVec9 = {
+ 0xfffe000000000000L, 0xfffffffe027fffffL, 0x7fL, 0x707ffffff0000L
+};
+static final long[] jjbitVec10 = {
+ 0x7fffffe00000000L, 0xfffe0000000007feL, 0x7cffffffffffffffL, 0x60002f7fffL
+};
+static final long[] jjbitVec11 = {
+ 0x23ffffffffffffe0L, 0x3ff000000L, 0x3c5fdfffff99fe0L, 0x30003b0000000L
+};
+static final long[] jjbitVec12 = {
+ 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100000000L
+};
+static final long[] jjbitVec13 = {
+ 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L
+};
+static final long[] jjbitVec14 = {
+ 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L
+};
+static final long[] jjbitVec15 = {
+ 0x3fffdfffffddfe0L, 0x300000000L, 0x0L, 0x0L
+};
+static final long[] jjbitVec16 = {
+ 0xd7ffffffffffeL, 0x3fL, 0x200d6caefef02596L, 0x1fL
+};
+static final long[] jjbitVec17 = {
+ 0x0L, 0x3fffffffeffL, 0x0L, 0x0L
+};
+static final long[] jjbitVec18 = {
+ 0x0L, 0x0L, 0xffffffff00000000L, 0x7fffffffff003fL
+};
+static final long[] jjbitVec19 = {
+ 0x500000000007daedL, 0x2c62ab82315001L, 0xf580c90040000000L, 0x201080000000007L
+};
+static final long[] jjbitVec20 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL
+};
+static final long[] jjbitVec21 = {
+ 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL
+};
+static final long[] jjbitVec22 = {
+ 0x4c4000000000L, 0x0L, 0x7L, 0x0L
+};
+static final long[] jjbitVec23 = {
+ 0x3fe00000080L, 0xfffffffffffffffeL, 0xfffffffe001fffffL, 0x7ffffffffffffffL
+};
+static final long[] jjbitVec24 = {
+ 0x1fffffffffe0L, 0x0L, 0x0L, 0x0L
+};
+static final long[] jjbitVec25 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L
+};
+static final long[] jjbitVec26 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L
+};
+static final long[] jjbitVec27 = {
+ 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL
+};
+static final long[] jjbitVec28 = {
+ 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x30003L
+};
+static final long[] jjbitVec29 = {
+ 0xffffffffffffffffL, 0x30000003fL, 0xfffffffbffffd7c0L, 0xffffd547f7fffL
+};
+static final long[] jjbitVec30 = {
+ 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff007bL, 0x33fcfffffff199fL
+};
+static final long[] jjbitVec31 = {
+ 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe007fL, 0x707ffffff0016L
+};
+static final long[] jjbitVec32 = {
+ 0x7fffffe00000000L, 0xffff03ff0007ffffL, 0x7cffffffffffffffL, 0x3ff3dffffef7fffL
+};
+static final long[] jjbitVec33 = {
+ 0xf3ffffffffffffeeL, 0xffcfff1e3fffL, 0xd3c5fdfffff99feeL, 0x3ffcfb080399fL
+};
+static final long[] jjbitVec34 = {
+ 0xd36dfdfffff987e4L, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100003bbfL
+};
+static final long[] jjbitVec35 = {
+ 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L
+};
+static final long[] jjbitVec36 = {
+ 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL
+};
+static final long[] jjbitVec37 = {
+ 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x0L, 0x0L
+};
+static final long[] jjbitVec38 = {
+ 0x7ff7ffffffffffeL, 0x3ff7fffL, 0x3bff6caefef02596L, 0x3ff3f5fL
+};
+static final long[] jjbitVec39 = {
+ 0xc2a003ff03000000L, 0xfffe03fffffffeffL, 0x2fe3ffffebf0fdfL, 0x0L
+};
+static final long[] jjbitVec40 = {
+ 0x0L, 0x0L, 0x0L, 0x21fff0000L
+};
+static final long[] jjbitVec41 = {
+ 0x3efffe000000a0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x77ffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 19;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if (curChar == 39)
+ jjCheckNAddStates(0, 2);
+ else if (curChar == 34)
+ jjCheckNAddStates(3, 5);
+ break;
+ case 1:
+ if ((0xfffffffbffffffffL & l) != 0L)
+ jjCheckNAddStates(3, 5);
+ break;
+ case 3:
+ if (curChar == 34)
+ jjCheckNAddStates(3, 5);
+ break;
+ case 4:
+ if (curChar == 34 && kind > 1)
+ kind = 1;
+ break;
+ case 5:
+ case 8:
+ if (curChar == 39)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 6:
+ if ((0xffffff7fffffffffL & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 9:
+ if (curChar == 39 && kind > 1)
+ kind = 1;
+ break;
+ case 11:
+ if ((0x3ff600000000000L & l) != 0L)
+ jjAddStates(6, 7);
+ break;
+ case 12:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 13;
+ break;
+ case 14:
+ if ((0x3ff600000000000L & l) == 0L)
+ break;
+ if (kind > 2)
+ kind = 2;
+ jjstateSet[jjnewStateCnt++] = 14;
+ break;
+ case 15:
+ if ((0x3ff600000000000L & l) == 0L)
+ break;
+ if (kind > 3)
+ kind = 3;
+ jjstateSet[jjnewStateCnt++] = 15;
+ break;
+ case 16:
+ if ((0x3ff600000000000L & l) != 0L)
+ jjAddStates(8, 9);
+ break;
+ case 17:
+ if (curChar == 58)
+ jjstateSet[jjnewStateCnt++] = 18;
+ break;
+ case 18:
+ if (curChar == 42 && kind > 4)
+ kind = 4;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 2)
+ kind = 2;
+ jjCheckNAddStates(10, 15);
+ break;
+ case 1:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(3, 5);
+ break;
+ case 2:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ case 3:
+ if (curChar == 92)
+ jjCheckNAddStates(3, 5);
+ break;
+ case 6:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 7:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 8;
+ break;
+ case 8:
+ if (curChar == 92)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 11:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ jjCheckNAddTwoStates(11, 12);
+ break;
+ case 13:
+ case 14:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 2)
+ kind = 2;
+ jjCheckNAdd(14);
+ break;
+ case 15:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(15);
+ break;
+ case 16:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ jjCheckNAddTwoStates(16, 17);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int hiByte = (int)(curChar >> 8);
+ int i1 = hiByte >> 6;
+ long l1 = 1L << (hiByte & 077);
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 2)
+ kind = 2;
+ jjCheckNAddStates(10, 15);
+ break;
+ case 1:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjAddStates(3, 5);
+ break;
+ case 6:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjAddStates(0, 2);
+ break;
+ case 11:
+ if (jjCanMove_2(hiByte, i1, i2, l1, l2))
+ jjCheckNAddTwoStates(11, 12);
+ break;
+ case 13:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 2)
+ kind = 2;
+ jjCheckNAdd(14);
+ break;
+ case 14:
+ if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 2)
+ kind = 2;
+ jjCheckNAdd(14);
+ break;
+ case 15:
+ if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(15);
+ break;
+ case 16:
+ if (jjCanMove_2(hiByte, i1, i2, l1, l2))
+ jjCheckNAddTwoStates(16, 17);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 19 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static final int[] jjnextStates = {
+ 6, 7, 9, 1, 2, 4, 11, 12, 16, 17, 11, 12, 14, 15, 16, 17,
+};
+private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec2[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec0[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec4[i2] & l2) != 0L);
+ case 1:
+ return ((jjbitVec5[i2] & l2) != 0L);
+ case 2:
+ return ((jjbitVec6[i2] & l2) != 0L);
+ case 3:
+ return ((jjbitVec7[i2] & l2) != 0L);
+ case 4:
+ return ((jjbitVec8[i2] & l2) != 0L);
+ case 5:
+ return ((jjbitVec9[i2] & l2) != 0L);
+ case 6:
+ return ((jjbitVec10[i2] & l2) != 0L);
+ case 9:
+ return ((jjbitVec11[i2] & l2) != 0L);
+ case 10:
+ return ((jjbitVec12[i2] & l2) != 0L);
+ case 11:
+ return ((jjbitVec13[i2] & l2) != 0L);
+ case 12:
+ return ((jjbitVec14[i2] & l2) != 0L);
+ case 13:
+ return ((jjbitVec15[i2] & l2) != 0L);
+ case 14:
+ return ((jjbitVec16[i2] & l2) != 0L);
+ case 15:
+ return ((jjbitVec17[i2] & l2) != 0L);
+ case 16:
+ return ((jjbitVec18[i2] & l2) != 0L);
+ case 17:
+ return ((jjbitVec19[i2] & l2) != 0L);
+ case 30:
+ return ((jjbitVec20[i2] & l2) != 0L);
+ case 31:
+ return ((jjbitVec21[i2] & l2) != 0L);
+ case 33:
+ return ((jjbitVec22[i2] & l2) != 0L);
+ case 48:
+ return ((jjbitVec23[i2] & l2) != 0L);
+ case 49:
+ return ((jjbitVec24[i2] & l2) != 0L);
+ case 159:
+ return ((jjbitVec25[i2] & l2) != 0L);
+ case 215:
+ return ((jjbitVec26[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec3[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec27[i2] & l2) != 0L);
+ case 1:
+ return ((jjbitVec5[i2] & l2) != 0L);
+ case 2:
+ return ((jjbitVec28[i2] & l2) != 0L);
+ case 3:
+ return ((jjbitVec29[i2] & l2) != 0L);
+ case 4:
+ return ((jjbitVec30[i2] & l2) != 0L);
+ case 5:
+ return ((jjbitVec31[i2] & l2) != 0L);
+ case 6:
+ return ((jjbitVec32[i2] & l2) != 0L);
+ case 9:
+ return ((jjbitVec33[i2] & l2) != 0L);
+ case 10:
+ return ((jjbitVec34[i2] & l2) != 0L);
+ case 11:
+ return ((jjbitVec35[i2] & l2) != 0L);
+ case 12:
+ return ((jjbitVec36[i2] & l2) != 0L);
+ case 13:
+ return ((jjbitVec37[i2] & l2) != 0L);
+ case 14:
+ return ((jjbitVec38[i2] & l2) != 0L);
+ case 15:
+ return ((jjbitVec39[i2] & l2) != 0L);
+ case 16:
+ return ((jjbitVec18[i2] & l2) != 0L);
+ case 17:
+ return ((jjbitVec19[i2] & l2) != 0L);
+ case 30:
+ return ((jjbitVec20[i2] & l2) != 0L);
+ case 31:
+ return ((jjbitVec21[i2] & l2) != 0L);
+ case 32:
+ return ((jjbitVec40[i2] & l2) != 0L);
+ case 33:
+ return ((jjbitVec22[i2] & l2) != 0L);
+ case 48:
+ return ((jjbitVec41[i2] & l2) != 0L);
+ case 49:
+ return ((jjbitVec24[i2] & l2) != 0L);
+ case 159:
+ return ((jjbitVec25[i2] & l2) != 0L);
+ case 215:
+ return ((jjbitVec26[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec3[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, null, null, null, null, null, null,
+"\57", "\52", "\72", "\133", "\135", "\100", "\75", };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+};
+private ASCII_UCodeESC_CharStream input_stream;
+private final int[] jjrounds = new int[19];
+private final int[] jjstateSet = new int[38];
+protected char curChar;
+public SPathParserTokenManager(ASCII_UCodeESC_CharStream stream)
+{
+ if (ASCII_UCodeESC_CharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+}
+public SPathParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+public void ReInit(ASCII_UCodeESC_CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 19; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 1 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+private final Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ t.image = (im == null) ? input_stream.GetImage() : im;
+ t.beginLine = input_stream.getBeginLine();
+ t.beginColumn = input_stream.getBeginColumn();
+ t.endLine = input_stream.getEndLine();
+ t.endColumn = input_stream.getEndColumn();
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public final Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+}
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/SPathTag.java b/src/org/apache/taglibs/standard/extra/spath/SPathTag.java
new file mode 100644
index 0000000..b056a8a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/SPathTag.java
@@ -0,0 +1,125 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>Tag handler that exposes SPath functionality.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class SPathTag extends TagSupport {
+
+ //*********************************************************************
+ // Internal state
+
+ private String select; // tag attribute
+ private String var; // tag attribute
+
+ //*********************************************************************
+ // Construction and initialization
+
+ /**
+ * Constructs a new handler. As with TagSupport, subclasses should
+ * not provide other constructors and are expected to call the
+ * superclass constructor.
+ */
+ public SPathTag() {
+ super();
+ init();
+ }
+
+ // resets local state
+ private void init() {
+ select = var = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // applies XPath expression from 'select' and exposes a filter as 'var'
+ public int doStartTag() throws JspException {
+ try {
+ SPathFilter s = new SPathFilter(new SPathParser(select).expression());
+ pageContext.setAttribute(var, s);
+ return SKIP_BODY;
+ } catch (ParseException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Attribute accessors
+
+ public void setSelect(String select) {
+ this.select = select;
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/Step.java b/src/org/apache/taglibs/standard/extra/spath/Step.java
new file mode 100644
index 0000000..a5fce5b
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/Step.java
@@ -0,0 +1,170 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.extra.spath;
+
+import java.util.List;
+
+/**
+ * <p>Represents a 'step' in an SPath expression.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class Step {
+
+ private boolean depthUnlimited;
+ private String name;
+ private List predicates;
+
+ // record a few things for for efficiency...
+ private String uri, localPart;
+
+ /**
+ * Constructs a new Step object, given a name and a (possibly null)
+ * list of predicates. A boolean is also passed, indicating
+ * whether this particular Step is relative to the 'descendent-or-self'
+ * axis of the node courrently under consideration. If true, it is;
+ * if false, then this Step is rooted as a direct child of the node
+ * under consideration.
+ */
+ public Step(boolean depthUnlimited, String name, List predicates) {
+ if (name == null)
+ throw new IllegalArgumentException("non-null name required");
+ this.depthUnlimited = depthUnlimited;
+ this.name = name;
+ this.predicates = predicates;
+ }
+
+ /**
+ * Returns true if the given name matches the Step object's
+ * name, taking into account the Step object's wildcards; returns
+ * false otherwise.
+ */
+ public boolean isMatchingName(String uri, String localPart) {
+ // check and normalize arguments
+ if (localPart == null)
+ throw new IllegalArgumentException("need non-null localPart");
+ if (uri != null && uri.equals(""))
+ uri = null;
+
+ // split name into uri/localPart if we haven't done so already
+ if (this.localPart == null && this.uri == null)
+ parseStepName();
+
+ // generic wildcard
+ if (this.uri == null && this.localPart.equals("*"))
+ return true;
+
+ // match will null namespace
+ if (uri == null && this.uri == null
+ && localPart.equals(this.localPart))
+ return true;
+
+ if (uri != null && this.uri != null && uri.equals(this.uri)) {
+ // exact match
+ if (localPart.equals(this.localPart))
+ return true;
+
+ // namespace-specific wildcard
+ if (this.localPart.equals("*"))
+ return true;
+ }
+
+ // no match
+ return false;
+ }
+
+ /** Returns true if the Step's depth is unlimited, false otherwise. */
+ public boolean isDepthUnlimited() {
+ return depthUnlimited;
+ }
+
+ /** Returns the Step's node name. */
+ public String getName() {
+ return name;
+ }
+
+ /** Returns a list of this Step object's predicates. */
+ public List getPredicates() {
+ return predicates;
+ }
+
+ /** Lazily computes some information about our name. */
+ private void parseStepName() {
+ String prefix;
+ int colonIndex = name.indexOf(":");
+
+ if (colonIndex == -1) {
+ // no colon, so localpart is simply name (even if it's "*")
+ prefix = null;
+ localPart = name;
+ } else {
+ prefix = name.substring(0, colonIndex);
+ localPart = name.substring(colonIndex + 1);
+ }
+
+ uri = mapPrefix(prefix);
+ }
+
+ /** Returns a URI for the given prefix, given our mappings. */
+ private String mapPrefix(String prefix) {
+ // ability to specify a mapping is, as of yet, unimplemented
+ if (prefix == null)
+ return null;
+ else
+ throw new IllegalArgumentException(
+ "unknown prefix '" + prefix + "'");
+ }
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/Token.java b/src/org/apache/taglibs/standard/extra/spath/Token.java
new file mode 100644
index 0000000..af47066
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/Token.java
@@ -0,0 +1,81 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+package org.apache.taglibs.standard.extra.spath;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public final String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/extra/spath/TokenMgrError.java b/src/org/apache/taglibs/standard/extra/spath/TokenMgrError.java
new file mode 100644
index 0000000..0d341b8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/extra/spath/TokenMgrError.java
@@ -0,0 +1,133 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+package org.apache.taglibs.standard.extra.spath;
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/dummy/DummyEvaluator.java b/src/org/apache/taglibs/standard/lang/dummy/DummyEvaluator.java
new file mode 100644
index 0000000..51f6c08
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/dummy/DummyEvaluator.java
@@ -0,0 +1,92 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.dummy;
+
+import javax.servlet.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.lang.support.*;
+
+/**
+ * <p>A trivial ExpressionEvaluator suitable only for testing
+ * (unless your applications are incredibly simple <i>and</i>
+ * idiosyncratic)! Every expression is considered valid and
+ * and evaluates to the String "JSTL". Literals (strings not
+ * beginning with '$') are passed through.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class DummyEvaluator implements ExpressionEvaluator {
+
+ // always returns null (to indicate validity)
+ public String validate(String attributeName, String expression) {
+ return null;
+ }
+
+ // always returns "JSTL" for strings that begin with '$'
+ public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException {
+ if (expression.startsWith("$"))
+ return "JSTL";
+ else
+ return expression;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/javascript/JavascriptExpressionEvaluator.java b/src/org/apache/taglibs/standard/lang/javascript/JavascriptExpressionEvaluator.java
new file mode 100644
index 0000000..6285fc0
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/javascript/JavascriptExpressionEvaluator.java
@@ -0,0 +1,178 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.javascript;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import java.util.Enumeration;
+
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluator;
+import org.apache.taglibs.standard.lang.spel.Evaluator;
+import org.mozilla.javascript.*;
+
+
+
+public class JavascriptExpressionEvaluator implements ExpressionEvaluator {
+
+ /**
+ * Translation time validation of an expression.
+ * This method will return a null String if the expression
+ * is valid; otherwise an error message.
+ */
+ public String validate(String attributeName,
+ String expression) {
+ return null;
+ }
+
+ /**
+ * Evaluates the expression at request time.
+ * Rhino is the java implementation of JavaScript.
+ *
+ */
+ public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException {
+
+ Object result = null;
+ Evaluator evalLiteral = new Evaluator();
+
+ // Creates and enters a Context. Context stores information
+ // about the execution environment of a script
+ Context cx = Context.enter();
+
+ // Initialize standard objects
+ Scriptable scope = cx.initStandardObjects(null);
+
+ // Put PageContext attributes/parameters in Rhino Scope
+ putAttributesInScope(scope, cx, pageContext, PageContext.PAGE_SCOPE);
+ putAttributesInScope(scope, cx, pageContext, PageContext.REQUEST_SCOPE);
+ putAttributesInScope(scope, cx, pageContext, PageContext.SESSION_SCOPE);
+ putAttributesInScope(scope, cx, pageContext, PageContext.APPLICATION_SCOPE);
+ putParametersInScope(scope, cx, pageContext);
+
+
+ // Evaluate string
+ try {
+ // skip $, use the SPEL evaluate literal method 'cuz why reinvent the wheel?
+ if (expression.startsWith("$")) {
+ expression = expression.substring(1);
+ result = cx.evaluateString(scope, expression, "", 0, null); // expression
+ }
+ else result = evalLiteral.evaluateLiteral(expression, pageContext, expectedType); //literal
+
+ // Unwrap scoped object
+ if (result instanceof Wrapper)
+ result = ((Wrapper) result).unwrap();
+
+ if (result instanceof NativeString)
+ result = result.toString();
+
+ } catch (JavaScriptException jse) {
+ throw new JspException(jse.getMessage());
+ }
+
+ //System.out.println("RHINO result: " + result + ":");
+
+ if (result != null && !expectedType.isInstance(result)) {
+ throw new JspException("The tag expected an object of type ["
+ + expectedType.getName() + "] for the " + attributeName
+ + " attribute. However, it received an "
+ + "object of type [" + result.getClass().getName() + "]");
+ }
+
+ return result;
+ }
+
+ /**
+ * put PageContext attributes into Rhino scope
+ */
+ void putAttributesInScope(Scriptable rhinoScope,
+ Context rhinoContext,
+ PageContext pageContext,
+ int scope) {
+ Enumeration attributes = null;
+ Object value = null;
+ String attribute = null;
+
+ attributes = pageContext.getAttributeNamesInScope(scope);
+ while (attributes !=null && attributes.hasMoreElements()) {
+ attribute = (String)attributes.nextElement();
+ value = pageContext.getAttribute(attribute, scope);
+ rhinoScope.put(attribute, rhinoScope, rhinoContext.toObject(value, rhinoScope));
+ }
+ }
+
+ /**
+ * put PageContext parameters into Rhino scope
+ */
+ void putParametersInScope(Scriptable rhinoScope,
+ Context rhinoContext,
+ PageContext pageContext) {
+ Enumeration attributes = null;
+ Object value = null;
+ String attribute = null;
+
+ attributes = (pageContext.getRequest()).getParameterNames();
+ while (attributes !=null && attributes.hasMoreElements()) {
+ attribute = (String)attributes.nextElement();
+ value = (pageContext.getRequest()).getParameter(attribute);
+ rhinoScope.put(attribute, rhinoScope, rhinoContext.toObject(value, rhinoScope));
+ }
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/JPathExpressionEvaluator.java b/src/org/apache/taglibs/standard/lang/jpath/JPathExpressionEvaluator.java
new file mode 100644
index 0000000..142ce23
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/JPathExpressionEvaluator.java
@@ -0,0 +1,131 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.lang.support.*;
+import javax.servlet.jsp.jstl.core.IteratorTag;
+
+
+public class JPathExpressionEvaluator implements ExpressionEvaluator {
+ /**
+ * Translation time validation of an expression.
+ * This method will return a null String if the expression
+ * is valid; otherwise an error message.
+ */
+ public String validate(String attributeName,
+ String expression) {
+ String result = null;
+ try {
+ if (expression.startsWith("$")) {
+ // skip '$'
+ Expression exp = Parser.parse(expression.substring(1));
+ exp.validate(); // expression
+ } else
+ return null; // literal
+ } catch (ParseException e) {
+ result = "The attribute for " + attributeName + " was not "
+ + "valid.\n" + e.getMessage();
+ } catch (ValidationException e) {
+ result = "The attribute for " + attributeName + " was not "
+ + "valid.\n" + e.getMessage();
+ }
+ return result;
+ }
+
+ /**
+ * Evaluates the expression at request time.
+ */
+ public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException {
+ Object result = null;
+ IterationContext icontext = null;
+
+ IteratorTag parent = (IteratorTag) TagSupport.findAncestorWithClass(tag, IteratorTag.class);
+ if (parent == null) {
+ icontext = null;
+ } else {
+ icontext = new StatusIterationContext(parent.getIteratorStatus());
+ }
+
+ try {
+ if (expression.startsWith("$")) {
+ // skip '$'
+ Expression exp = Parser.parse(expression.substring(1));
+ result = exp.evaluate(pageContext, icontext); // exp.
+ } else
+ result = new String(expression); // lit.
+ } catch (ParseException e) {
+ throw new JspException(e.getMessage());
+ } catch (EvaluationException e) {
+ throw new JspException(e.getMessage());
+ }
+ if (result != null && !expectedType.isInstance(result)) {
+ throw new JspException("The tag expected an object of type ["
+ + expectedType.getName() + "] for the " + attributeName
+ + " attribute. However, it received an "
+ + "object of type [" + result.getClass().getName() + "]");
+ }
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/CollectionAdapter.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/CollectionAdapter.java
new file mode 100644
index 0000000..7b9aaa6
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/CollectionAdapter.java
@@ -0,0 +1,145 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+
+import java.util.*;
+
+public class CollectionAdapter extends JSPAdapter implements JSPList {
+
+ private Expression predicate;
+
+ private Iterator iterator;
+ private int size;
+ private int position;
+ private Object current;
+
+ public Object next() {
+ position++;
+ current = iterator.next();
+ return current;
+ }
+
+ public Object getCurrent() {
+ return current;
+ }
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public int getLast() {
+ return size;
+ }
+
+ private void setCollection(Collection c) {
+ this.iterator = c.iterator();
+ this.size = c.size();
+ this.position = 0;
+ }
+
+ public boolean applyPredicate(PageContext pageContext, Predicate predicate) throws ConversionException, EvaluationException {
+ boolean oneItem = false;
+ Object result;
+ boolean predicateTrue;
+ if (position != 0) {
+ throw new ConversionException("You cannot apply a predicate to "
+ + "a JSPList that has begun to be iterated");
+ }
+ Collection predicated = new ArrayList();
+ while (iterator.hasNext()) {
+ this.next();
+ result = predicate.evaluate(pageContext, new JSPListIterationContext(this));
+ if (result instanceof Double) {
+ oneItem = true;
+ predicateTrue = ((Double)result).doubleValue() == position;
+ } else {
+ oneItem = false;
+ predicateTrue = Convert.toBoolean(result).booleanValue();
+ }
+ if (predicateTrue) {
+ predicated.add(current);
+ }
+ }
+ this.iterator = predicated.iterator();
+ this.size = predicated.size();
+ this.position = 0;
+ return oneItem;
+ }
+
+ public static Object adapt(Object o) {
+ CollectionAdapter adapter = new CollectionAdapter();
+ adapter.setCollection((Collection)o);
+ return adapter;
+ }
+
+ public static Class[] getAdaptedClasses() {
+ Class[] adaptedClasses = {Collection.class};
+ return adaptedClasses;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/ConversionException.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/ConversionException.java
new file mode 100644
index 0000000..f295a8d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/ConversionException.java
@@ -0,0 +1,77 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import javax.servlet.jsp.*;
+
+public class ConversionException extends Exception {
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable".
+ */
+
+ public ConversionException() {
+ super();
+ }
+
+ public ConversionException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/Convert.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/Convert.java
new file mode 100644
index 0000000..0842e33
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/Convert.java
@@ -0,0 +1,352 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import java.text.*;
+import java.util.*;
+
+public class Convert {
+
+ public static Double toDouble(Object o) throws ConversionException {
+ Double converted;
+ o = performBasicConversions(o);
+ if (o == null) {
+ converted = new Double(Double.NaN);
+ } else if (o instanceof Boolean) {
+ converted = toDouble((Boolean)o);
+ } else if (o instanceof Double) {
+ converted = toDouble((Double)o);
+ } else if (o instanceof String) {
+ converted = toDouble((String)o);
+ } else if (o instanceof JSPDate) {
+ converted = toDouble((JSPDate)o);
+ } else if (o instanceof JSPList) {
+ converted = toDouble((JSPList)o);
+ } else {
+ converted = toDouble(Convert.toString(o));
+ //throw new ConversionException("Object [" + o + "] cannot be "
+ //+ "converted to a Double");
+ }
+ return converted;
+ }
+
+ private static Double toDouble(Boolean b) throws ConversionException {
+ Double converted;
+ if (b.booleanValue() == true) {
+ converted = new Double(1);
+ } else {
+ converted = new Double(0);
+ }
+ return converted;
+ }
+
+ private static Double toDouble(Double d) throws ConversionException {
+ return d;
+ }
+
+ private static Double toDouble(String s) throws ConversionException {
+ Double converted;
+ try {
+ converted = Double.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ converted = new Double(Double.NaN);
+ }
+ return converted;
+ }
+
+ private static Double toDouble(JSPDate d) throws ConversionException {
+ Double converted;
+ converted = d.getTime();
+ return converted;
+ }
+
+
+ private static Double toDouble(JSPList list) throws ConversionException {
+ Double converted;
+ converted = Convert.toDouble(Convert.toString(list));
+ return converted;
+ }
+
+
+ public static Boolean toBoolean(Object o) throws ConversionException {
+ Boolean converted;
+ o = performBasicConversions(o);
+ if (o == null) {
+ converted = new Boolean(false);
+ } else if (o instanceof Boolean) {
+ converted = toBoolean((Boolean)o);
+ } else if (o instanceof Double) {
+ converted = toBoolean((Double)o);
+ } else if (o instanceof String) {
+ converted = toBoolean((String)o);
+ } else if (o instanceof JSPDate) {
+ converted = toBoolean((JSPDate)o);
+ } else if (o instanceof JSPList) {
+ converted = toBoolean((JSPList)o);
+ } else {
+ converted = toBoolean(Convert.toString(o));
+ //throw new ConversionException("Object [" + o + "] cannot be "
+ //+ "converted to a Boolean");
+ }
+ return converted;
+ }
+
+ private static Boolean toBoolean(Boolean b) throws ConversionException {
+ return b;
+ }
+
+ private static Boolean toBoolean(Double d) throws ConversionException {
+ Boolean converted;
+ if (d == null) {
+ converted = new Boolean(false);
+ } else if (!d.isNaN() && d.doubleValue() != 0 && d.doubleValue() != -0) {
+ converted = new Boolean(true);
+ } else {
+ converted = new Boolean(false);
+ }
+ return converted;
+ }
+
+ private static Boolean toBoolean(String s) throws ConversionException {
+ Boolean converted;
+ if (s == null) {
+ converted = new Boolean(false);
+ } else if (s.length() != 0) {
+ converted = new Boolean(true);
+ } else {
+ converted = new Boolean(false);
+ }
+ return converted;
+ }
+
+ private static Boolean toBoolean(JSPDate d) throws ConversionException {
+ Boolean converted;
+ converted = Convert.toBoolean(Convert.toString(d));
+ return converted;
+ }
+
+ private static Boolean toBoolean(JSPList list) throws ConversionException {
+ Boolean converted;
+ if (list == null || !list.hasNext()) {
+ converted = new Boolean(false);
+ } else {
+ if (list.getPosition() != 0) {
+ throw new ConversionException("cannot convert a list to "
+ + "a Boolean if the list is not at the starting "
+ + "position" );
+ }
+ converted = new Boolean(true);
+ }
+ return converted;
+ }
+
+
+ public static String toString(Object o) throws ConversionException {
+ String converted;
+ o = performBasicConversions(o);
+ if (o == null) {
+ converted = new String("");
+ } else if (o instanceof Boolean) {
+ converted = toString((Boolean)o);
+ } else if (o instanceof Double) {
+ converted = toString((Double)o);
+ } else if (o instanceof String) {
+ converted = toString((String)o);
+ } else if (o instanceof JSPDate) {
+ converted = toString((JSPDate)o);
+ } else if (o instanceof JSPList) {
+ converted = toString((JSPList)o);
+ } else {
+ converted = o.toString();
+ //throw new ConversionException("Object [" + o + "] cannot be "
+ //+ "converted to a String");
+ }
+ return converted;
+ }
+
+ private static String toString(Boolean b) throws ConversionException {
+ return b.toString();
+ }
+
+ private static String toString(Double d) throws ConversionException {
+ String converted;
+ if (d == null || d.isNaN()) {
+ converted = new String("NaN");
+ } else if (d.doubleValue() == 0 || d.doubleValue() == -0) {
+ converted = new String("0");
+ } else if (d.doubleValue() == Double.POSITIVE_INFINITY) {
+ converted = new String("Infinity");
+ } else if (d.doubleValue() == Double.NEGATIVE_INFINITY) {
+ converted = new String("-Infinity");
+ } else if (Math.floor(d.doubleValue()) == d.doubleValue()) {
+ NumberFormat form;
+ form = NumberFormat.getInstance();
+ try {
+ ((DecimalFormat)form).applyPattern("#");
+ converted = form.format(d);
+ } catch (IllegalArgumentException iae) {
+ converted = new String("NaN");
+ }
+ } else {
+ converted = d.toString();
+ }
+ return converted;
+ }
+
+ private static String toString(String s) throws ConversionException {
+ return s;
+ }
+
+ private static String toString(JSPDate d) throws ConversionException {
+ String converted;
+ converted = DateFormat.getDateInstance().format(new Date(d.getTime().longValue()));
+ return converted;
+ }
+
+ private static String toString(JSPList list) throws ConversionException {
+ String converted;
+ if (list == null || !list.hasNext()) {
+ converted = "";
+ } else {
+ if (list.getPosition() != 0) {
+ throw new ConversionException("cannot convert a list to "
+ + "a String if the list is not at the starting "
+ + "position" );
+ }
+ converted = Convert.toString(list.next());
+ }
+ return converted;
+ }
+
+ public static JSPDate toJSPDate(Object o) throws ConversionException {
+ JSPDate converted;
+ o = performBasicConversions(o);
+ if (o == null) {
+ throw new ConversionException("cannot convert null to a JSPDate");
+ } else if (o instanceof JSPDate) {
+ converted = toJSPDate((JSPDate)o);
+ } else {
+ throw new ConversionException("Object [" + o + "] cannot be "
+ + "converted to a JSPList");
+ }
+ return converted;
+ }
+
+ private static JSPDate toJSPDate(JSPDate date) throws ConversionException {
+ return date;
+ }
+
+ private static JSPDate toJSPDate(GregorianCalendar gc) throws ConversionException {
+ return (JSPDate)GregorianCalendarAdapter.adapt(gc);
+ }
+
+ public static JSPList toJSPList(Object o) throws ConversionException {
+ JSPList converted;
+ o = performBasicConversions(o);
+ if (o == null) {
+ throw new ConversionException("cannot convert null to a JSPList");
+ } else if (o instanceof JSPList) {
+ converted = toJSPList((JSPList)o);
+ } else {
+ throw new ConversionException("Object [" + o + "] cannot be "
+ + "converted to a JSPList");
+ }
+ return converted;
+ }
+
+ private static JSPList toJSPList(JSPList list) throws ConversionException {
+ return list;
+ }
+
+ private static Object performBasicConversions(Object o) {
+ Object converted;
+ if (o == null) {
+ converted = null;
+ } else if (o instanceof Short) {
+ converted = new Double(((Short)o).toString());
+ } else if (o instanceof Integer) {
+ converted = new Double(((Integer)o).toString());
+ } else if (o instanceof Float) {
+ converted = new Double(((Float)o).toString());
+ } else if (o instanceof Long) {
+ converted = new Double(((Long)o).toString());
+ } else if (o instanceof Byte) {
+ converted = new String(((Byte)o).toString());
+ } else if (o instanceof Character) {
+ converted = new String(((Character)o).toString());
+ } else {
+ converted = o;
+ }
+ converted = Convert.toJSPType(converted);
+ return converted;
+ }
+
+ public static Object toJSPType(Object o) {
+ Object converted;
+ if (o == null) {
+ converted = null;
+ } else if (o instanceof Collection) {
+ converted = CollectionAdapter.adapt(o);
+ } else if (o instanceof GregorianCalendar) {
+ converted = GregorianCalendarAdapter.adapt(o);
+ } else {
+ converted = o;
+ }
+ return converted;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/GregorianCalendarAdapter.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/GregorianCalendarAdapter.java
new file mode 100644
index 0000000..b4e5b46
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/GregorianCalendarAdapter.java
@@ -0,0 +1,106 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+public class GregorianCalendarAdapter implements JSPDate {
+
+ private GregorianCalendar calendar;
+
+ public GregorianCalendarAdapter(GregorianCalendar calendar) {
+ this.calendar = calendar;
+ }
+
+ public GregorianCalendarAdapter(int year, int month, int day) {
+ calendar = new GregorianCalendar(year, month, day);
+ }
+
+ public GregorianCalendarAdapter(int year, int month, int day, int hour,
+ int minute) {
+ calendar = new GregorianCalendar(year, month, day, hour, minute);
+ }
+
+ public GregorianCalendarAdapter(int year, int month, int day, int hour,
+ int minute, int second) {
+ calendar = new GregorianCalendar(year, month, day, hour, minute, second);
+ }
+
+ public void roll(int field, int amount) {
+ calendar.roll(field, amount);
+ }
+
+ public void add(int field, int amount) {
+ calendar.add(field, amount);
+ }
+
+ public Double getTime() {
+ return new Double(calendar.getTime().getTime());
+ }
+
+ public static Object adapt(Object o) {
+ GregorianCalendarAdapter adapter = new GregorianCalendarAdapter((GregorianCalendar)o);
+ return adapter;
+ }
+
+ public static Class[] getAdaptedClasses() {
+ Class[] adaptedClasses = {GregorianCalendar.class};
+ return adaptedClasses;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/IterationContext.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/IterationContext.java
new file mode 100644
index 0000000..31ce821
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/IterationContext.java
@@ -0,0 +1,66 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+public interface IterationContext {
+ public Object getCurrent();
+ public int getPosition();
+ public int getLast();
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPAdapter.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPAdapter.java
new file mode 100644
index 0000000..43321f8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPAdapter.java
@@ -0,0 +1,68 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+
+public abstract class JSPAdapter {
+ public static Object adapt(Object o) {
+ return o;
+ }
+ public static Class[] getAdaptedClasses() {
+ Class[] adaptedClasses = {};
+ return adaptedClasses;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPDate.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPDate.java
new file mode 100644
index 0000000..3ee7d06
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPDate.java
@@ -0,0 +1,65 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+
+public interface JSPDate {
+ public void roll(int field, int amount);
+ public void add(int field, int amount);
+ public Double getTime();
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPList.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPList.java
new file mode 100644
index 0000000..bb0f28c
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPList.java
@@ -0,0 +1,70 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+public interface JSPList extends Iterator {
+ public Object next();
+ public Object getCurrent();
+ public boolean hasNext();
+ public int getPosition();
+ public int getLast();
+ public boolean applyPredicate(PageContext pageContext, Predicate predicate) throws ConversionException, EvaluationException;
+ public void remove();
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPListIterationContext.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPListIterationContext.java
new file mode 100644
index 0000000..96dea9a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPListIterationContext.java
@@ -0,0 +1,78 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+public class JSPListIterationContext implements IterationContext {
+ private JSPList list;
+ public JSPListIterationContext(JSPList list) {
+ this.list = list;
+ }
+ public Object getCurrent() {
+ return list.getCurrent();
+ }
+
+ public int getPosition() {
+ return list.getPosition();
+ }
+
+ public int getLast() {
+ return list.getLast();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPListUnion.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPListUnion.java
new file mode 100644
index 0000000..76dce1f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/JSPListUnion.java
@@ -0,0 +1,146 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.*;
+
+import java.util.*;
+
+public class JSPListUnion implements JSPList {
+
+ private Expression predicate;
+
+ private JSPList left;
+ private JSPList right;
+ private int position;
+ private Object current;
+ boolean first;
+
+ public JSPListUnion(JSPList left, JSPList right) {
+ this.left = left;
+ this.right = right;
+ this.position = 0;
+ first = true;
+ }
+
+ public Object next() {
+ if (first) {
+ if (left.hasNext()) {
+ current = left.next();
+ } else {
+ first = false;
+ current = right.next();
+ }
+ } else {
+ current = right.next();
+ }
+ position++;
+ return current;
+ }
+
+ public Object getCurrent() {
+ return current;
+ }
+
+ public boolean hasNext() {
+ boolean result = left.hasNext() || right.hasNext();
+ return result;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public int getLast() {
+ return (left.getLast() + right.getLast());
+ }
+
+ public boolean applyPredicate(PageContext pageContext, Predicate predicate) throws ConversionException, EvaluationException {
+ Object result;
+ boolean oneItem = false;
+ boolean predicateTrue;
+ if (position != 0) {
+ throw new ConversionException("You cannot apply a predicate to "
+ + "a JSPList that has begun to be iterated");
+ }
+ Collection predicated = new ArrayList();
+ while (this.hasNext()) {
+ this.next();
+ result = predicate.evaluate(pageContext, new JSPListIterationContext(this));
+ if (result instanceof Double) {
+ oneItem = true;
+ predicateTrue = ((Double)result).doubleValue() == position;
+ } else {
+ oneItem = false;
+ predicateTrue = Convert.toBoolean(result).booleanValue();
+ }
+ if (predicateTrue) {
+ predicated.add(current);
+ }
+ }
+ this.left = Convert.toJSPList(predicated);
+ this.right = Convert.toJSPList(new ArrayList());
+ this.position = 0;
+ first = true;
+ return oneItem;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/adapter/StatusIterationContext.java b/src/org/apache/taglibs/standard/lang/jpath/adapter/StatusIterationContext.java
new file mode 100644
index 0000000..9caf08e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/adapter/StatusIterationContext.java
@@ -0,0 +1,80 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.adapter;
+
+import org.apache.taglibs.standard.lang.jpath.expression.*;
+import javax.servlet.jsp.jstl.core.IteratorTagStatus;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+public class StatusIterationContext implements IterationContext {
+ private IteratorTagStatus status;
+ public StatusIterationContext(IteratorTagStatus status) {
+ this.status = status;
+ }
+ public Object getCurrent() {
+ return status.getCurrent();
+ }
+
+ public int getPosition() {
+ return status.getCount();
+ }
+
+ public int getLast() {
+ throw new UnsupportedOperationException("The status object does not "
+ + "support finding the size of a list");
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/encoding/HtmlEncoder.java b/src/org/apache/taglibs/standard/lang/jpath/encoding/HtmlEncoder.java
new file mode 100644
index 0000000..051a726
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/encoding/HtmlEncoder.java
@@ -0,0 +1,116 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.encoding;
+
+/**
+ *<p>The <tt>HtmlEncoder</tt> provides methods to encode output into html
+ */
+public class HtmlEncoder {
+
+ private static final String[] htmlCode = new String[256];
+
+ static {
+ for (int i = 0; i < 10; i++) {
+ htmlCode[i] = "�" + i + ";";
+ }
+
+ for (int i = 10; i < 32; i++) {
+ htmlCode[i] = "�" + i + ";";
+ }
+
+ for (int i = 32; i < 128; i++) {
+ htmlCode[i] = String.valueOf((char)i);
+ }
+
+ // Special characters
+ htmlCode['\n'] = "<BR>\n";
+ htmlCode['\"'] = """; // double quote
+ htmlCode['&'] = "&"; // ampersand
+ htmlCode['<'] = "<"; // lower than
+ htmlCode['>'] = ">"; // greater than
+
+ for (int i = 128; i < 256; i++) {
+ htmlCode[i] = "&#" + i + ";";
+ }
+ }
+
+ /**
+ * <p>Encode the given text into html.</p>
+ *
+ * @param string the text to encode
+ * @return the encoded string
+ *
+ */
+ public static String encode(String string) {
+ int n = string.length();
+ char character;
+ StringBuffer buffer = new StringBuffer();
+ // loop over all the characters of the String.
+ for (int i = 0; i < n; i++) {
+ character = string.charAt(i);
+ // the Htmlcode of these characters are added to a StringBuffer one by one
+ try {
+ buffer.append(htmlCode[character]);
+ }
+ catch(ArrayIndexOutOfBoundsException aioobe) {
+ buffer.append(character);
+ }
+ }
+ return buffer.toString();
+ }
+
+}
+
diff --git a/src/org/apache/taglibs/standard/lang/jpath/encoding/OutputEncoder.java b/src/org/apache/taglibs/standard/lang/jpath/encoding/OutputEncoder.java
new file mode 100644
index 0000000..05dbc92
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/encoding/OutputEncoder.java
@@ -0,0 +1,91 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.encoding;
+
+/**
+ *<p>The <tt>OutputEncoder</tt> provides methods to encode output
+ */
+public class OutputEncoder {
+
+ public static int HTML = 1;
+
+ /**
+ * <p>Encode the given text with html.</p>
+ *
+ * @param string the text to encode
+ * @return the encoded string
+ *
+ */
+ public static String encode(String string, int encodingMethod) {
+ String encoded = null;
+ if (encodingMethod == OutputEncoder.HTML) {
+ encoded = HtmlEncoder.encode(string);
+ }
+ return encoded;
+ }
+
+ public static int getEncodingMethod(String encodingMethodText) {
+ int encodingMethod;
+ if (encodingMethodText.equals("html")) {
+ encodingMethod = OutputEncoder.HTML;
+ } else {
+ encodingMethod = OutputEncoder.HTML;
+ }
+ return encodingMethod;
+ }
+
+}
+
diff --git a/src/org/apache/taglibs/standard/lang/jpath/example/9567 b/src/org/apache/taglibs/standard/lang/jpath/example/9567
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/example/9567
diff --git a/src/org/apache/taglibs/standard/lang/jpath/example/Event.java b/src/org/apache/taglibs/standard/lang/jpath/example/Event.java
new file mode 100644
index 0000000..4228c78
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/example/Event.java
@@ -0,0 +1,93 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.example;
+
+import java.util.*;
+
+
+public class Event {
+ private GregorianCalendar date;
+ private String place;
+ private String note;
+
+ public Event(
+ GregorianCalendar date,
+ String place) {
+ this.date = date;
+ this.place = place;
+ }
+
+ public Event(
+ GregorianCalendar date,
+ String place, String note) {
+ this.date = date;
+ this.place = place;
+ this.note = note;
+ }
+
+ public GregorianCalendar getDate() {
+ return date;
+ }
+
+ public String getPlace() {
+ return place;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/example/Family.java b/src/org/apache/taglibs/standard/lang/jpath/example/Family.java
new file mode 100644
index 0000000..453f511
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/example/Family.java
@@ -0,0 +1,101 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.example;
+
+
+import java.util.*;
+
+
+public class Family {
+ private int id;
+ private Person[] children = null ;
+ private Person husband = null ;
+ private Person wife = null ;
+ private Event marriage;
+
+ public Family(int id,
+ Person husband,
+ Person wife,
+ Event marriage,
+ Person[] children) {
+ this.id = id;
+ this.husband = husband;
+ this.wife = wife;
+ this.marriage = marriage;
+ this.children = children;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public Person getHusband() {
+ return husband;
+ }
+
+ public Person getWife() {
+ return wife;
+ }
+
+ public Event getMarriage() {
+ return marriage;
+ }
+
+ public Person[] getChildren() {
+ return children;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/example/Person.java b/src/org/apache/taglibs/standard/lang/jpath/example/Person.java
new file mode 100644
index 0000000..6620ab3
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/example/Person.java
@@ -0,0 +1,142 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.example;
+
+
+import java.util.*;
+
+
+public class Person {
+ private int id;
+ private String firstName = "" ;
+ private String lastName = "" ;
+ private String gender = "" ;
+ private Collection spouseFamilies;
+ private Collection childFamilies;
+ private Person father = null ;
+ private Event birth;
+ private Event death;
+ private Event burial;
+ private String note;
+
+ public Person(int id, String firstName,
+ String lastName,
+ String gender,
+ Event birth,
+ Event death,
+ Event burial,
+ String note) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.gender = gender;
+ this.spouseFamilies = new ArrayList();
+ this.childFamilies = new ArrayList();
+ this.birth = birth;
+ this.death = death;
+ this.burial = burial;
+ this.note = note;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public Event getBirth() {
+ return birth;
+ }
+
+ public Event getDeath() {
+ return death;
+ }
+
+ public Event getBurial() {
+ return burial;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public Collection getSpouseFamilies() {
+ return spouseFamilies;
+ }
+
+ public Collection getChildFamilies() {
+ return childFamilies;
+ }
+
+ public void addSpouseFamily(Family spouseFamily) {
+ spouseFamilies.add(spouseFamily);
+ }
+
+ public void addChildFamily(Family childFamily) {
+ childFamilies.add(childFamily);
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ASCII_CharStream.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ASCII_CharStream.java
new file mode 100644
index 0000000..bc96922
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ASCII_CharStream.java
@@ -0,0 +1,432 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public final class ASCII_CharStream
+{
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private java.io.Reader inputStream;
+
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = (char)((char)0xff & buffer[bufpos]);
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public ASCII_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public ASCII_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public ASCII_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public ASCII_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/AddDateFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/AddDateFunction.java
new file mode 100644
index 0000000..8c50e8a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/AddDateFunction.java
@@ -0,0 +1,282 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+/**
+ * The AddDateFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class AddDateFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the AddDateFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public AddDateFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the AddDateFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public AddDateFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "date-add(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ JSPDate result;
+
+ try {
+ result = Convert.toJSPDate(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ int arg3 = Convert.toDouble(jjtGetChild(2).evaluate(pageContext,
+ icontext)).intValue();
+ int field = getCalendarConstant(arg2);
+
+ result.add(field, arg3);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+
+ /**
+ * The getCalendarConstant method
+ *
+ *
+ * @param field
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ private int getCalendarConstant(String field) throws EvaluationException {
+
+ int result;
+
+ if (field.equals("era")) {
+ result = Calendar.ERA;
+ } else if (field.equals("year")) {
+ result = Calendar.YEAR;
+ } else if (field.equals("month")) {
+ result = Calendar.MONTH;
+ } else if (field.equals("weekOfYear")) {
+ result = Calendar.WEEK_OF_YEAR;
+ } else if (field.equals("date")) {
+ result = Calendar.DATE;
+ } else if (field.equals("dayOfMonth")) {
+ result = Calendar.DAY_OF_MONTH;
+ } else if (field.equals("dayOfYear")) {
+ result = Calendar.DAY_OF_YEAR;
+ } else if (field.equals("dayOfWeek")) {
+ result = Calendar.DAY_OF_WEEK;
+ } else if (field.equals("dayOfWeekInMonth")) {
+ result = Calendar.DAY_OF_WEEK_IN_MONTH;
+ } else if (field.equals("amPm")) {
+ result = Calendar.AM_PM;
+ } else if (field.equals("hour")) {
+ result = Calendar.HOUR;
+ } else if (field.equals("hourOfDay")) {
+ result = Calendar.HOUR_OF_DAY;
+ } else if (field.equals("minute")) {
+ result = Calendar.MINUTE;
+ } else if (field.equals("second")) {
+ result = Calendar.SECOND;
+ } else if (field.equals("millisecond")) {
+ result = Calendar.MILLISECOND;
+ } else {
+ throw new EvaluationException(this,
+ "An invalid date field was supplied");
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/AdditionOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/AdditionOperator.java
new file mode 100644
index 0000000..0d24391
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/AdditionOperator.java
@@ -0,0 +1,211 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.math.*;
+
+/**
+ * The AdditionOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class AdditionOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the AdditionOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public AdditionOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the AdditionOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public AdditionOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.PLUS) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ * This method uses the <tt>BigDecimal</tt> class with conversions
+ * to ensure proper results from the operation.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ BigDecimal leftSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).toString());
+ BigDecimal rightSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).toString());
+
+ result = new Double((leftSide.add(rightSide)).doubleValue());
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/AndOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/AndOperator.java
new file mode 100644
index 0000000..36acd11
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/AndOperator.java
@@ -0,0 +1,208 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The AndOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class AndOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the AndOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public AndOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the AndOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public AndOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.AND) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Boolean result;
+
+ try {
+ boolean leftSide =
+ Convert.toBoolean(jjtGetChild(0).evaluate(pageContext,
+ icontext)).booleanValue();
+ boolean rightSide =
+ Convert.toBoolean(jjtGetChild(1).evaluate(pageContext,
+ icontext)).booleanValue();
+
+ result = new Boolean(leftSide && rightSide);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/BooleanFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/BooleanFunction.java
new file mode 100644
index 0000000..2a8de62
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/BooleanFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The BooleanFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class BooleanFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the BooleanFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public BooleanFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the BooleanFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public BooleanFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "string(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Boolean result;
+
+ try {
+ result = Convert.toBoolean(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/BooleanLiteral.java b/src/org/apache/taglibs/standard/lang/jpath/expression/BooleanLiteral.java
new file mode 100644
index 0000000..6a63442
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/BooleanLiteral.java
@@ -0,0 +1,187 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The BooleanLiteral class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class BooleanLiteral extends SimpleNode {
+
+ protected boolean val;
+
+ /**
+ * Used to create an instance of the BooleanLiteral class
+ *
+ *
+ * @param id
+ *
+ */
+ public BooleanLiteral(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the BooleanLiteral class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public BooleanLiteral(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+ return String.valueOf(val);
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return new Boolean(val);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/CeilingFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/CeilingFunction.java
new file mode 100644
index 0000000..0579041
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/CeilingFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The CeilingFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class CeilingFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the CeilingFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public CeilingFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the CeilingFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public CeilingFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "ceiling(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ result = Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Double(Math.ceil(result.doubleValue()));
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ConcatFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ConcatFunction.java
new file mode 100644
index 0000000..d41fc1e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ConcatFunction.java
@@ -0,0 +1,222 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The ConcatFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ConcatFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the ConcatFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public ConcatFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the ConcatFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public ConcatFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "concat(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ StringBuffer buff = new StringBuffer();
+
+ try {
+ for (int i = 0; i < jjtGetNumChildren(); i++) {
+ buff.append(Convert
+ .toString(jjtGetChild(i)
+ .evaluate(pageContext, icontext)));
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return buff.toString();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ContainsFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ContainsFunction.java
new file mode 100644
index 0000000..18a711b
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ContainsFunction.java
@@ -0,0 +1,225 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The ContainsFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ContainsFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the ContainsFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public ContainsFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the ContainsFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public ContainsFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "substring(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Boolean result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+
+ result = new Boolean(arg1.indexOf(arg2) != -1);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/CountFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/CountFunction.java
new file mode 100644
index 0000000..971a65f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/CountFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The CountFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class CountFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the CountFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public CountFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the CountFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public CountFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "count(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ JSPList result;
+
+ try {
+ result = Convert.toJSPList(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Double(result.getLast());
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/CurrentFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/CurrentFunction.java
new file mode 100644
index 0000000..afac1ef
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/CurrentFunction.java
@@ -0,0 +1,196 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The CurrentFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class CurrentFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the CurrentFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public CurrentFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the CurrentFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public CurrentFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "current()";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ if (icontext == null) {
+ throw new EvaluationException("The evaluate() function can "
+ + "only be used in the context of a predicate");
+ }
+
+ return icontext.getCurrent();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/DateFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/DateFunction.java
new file mode 100644
index 0000000..8d4b0eb
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/DateFunction.java
@@ -0,0 +1,275 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The DateFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class DateFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the DateFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public DateFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the DateFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public DateFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "date(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ JSPDate d;
+
+ try {
+ if (jjtGetNumChildren() == 3) {
+ int year =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).intValue();
+ int month =
+ Convert.toDouble(jjtGetChild(1)
+ .evaluate(pageContext, icontext)).intValue() - 1;
+ int date =
+ Convert.toDouble(jjtGetChild(2).evaluate(pageContext,
+ icontext)).intValue();
+
+ d = new GregorianCalendarAdapter(year, month, date);
+ } else if (jjtGetNumChildren() == 5) {
+ int year =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).intValue();
+ int month =
+ Convert.toDouble(jjtGetChild(1)
+ .evaluate(pageContext, icontext)).intValue() - 1;
+ int date =
+ Convert.toDouble(jjtGetChild(2).evaluate(pageContext,
+ icontext)).intValue();
+ int hour =
+ Convert.toDouble(jjtGetChild(3).evaluate(pageContext,
+ icontext)).intValue();
+ int minute =
+ Convert.toDouble(jjtGetChild(4).evaluate(pageContext,
+ icontext)).intValue();
+
+ d = new GregorianCalendarAdapter(year, month, date, hour,
+ minute);
+ } else if (jjtGetNumChildren() == 6) {
+ int year =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).intValue();
+ int month =
+ Convert.toDouble(jjtGetChild(1)
+ .evaluate(pageContext, icontext)).intValue() - 1;
+ int date =
+ Convert.toDouble(jjtGetChild(2).evaluate(pageContext,
+ icontext)).intValue();
+ int hour =
+ Convert.toDouble(jjtGetChild(3).evaluate(pageContext,
+ icontext)).intValue();
+ int minute =
+ Convert.toDouble(jjtGetChild(4).evaluate(pageContext,
+ icontext)).intValue();
+ int second =
+ Convert.toDouble(jjtGetChild(5).evaluate(pageContext,
+ icontext)).intValue();
+
+ d = new GregorianCalendarAdapter(year, month, date, hour,
+ minute, second);
+ } else {
+ throw new EvaluationException(this,
+ "date does not have the proper"
+ + "number of arguments");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return d;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/DivisionOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/DivisionOperator.java
new file mode 100644
index 0000000..06f3069
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/DivisionOperator.java
@@ -0,0 +1,210 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.math.*;
+
+/**
+ * The DivisionOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class DivisionOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the DivisionOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public DivisionOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the DivisionOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public DivisionOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.DIV) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ BigDecimal leftSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).toString());
+ BigDecimal rightSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).toString());
+
+ result = new Double((leftSide.divide(rightSide,
+ BigDecimal.ROUND_HALF_EVEN)).doubleValue());
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/EncodeHtmlFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/EncodeHtmlFunction.java
new file mode 100644
index 0000000..a4fc917
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/EncodeHtmlFunction.java
@@ -0,0 +1,206 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import org.apache.taglibs.standard.lang.jpath.encoding.*;
+import javax.servlet.jsp.*;
+import java.net.*;
+
+/**
+ * The EncodeHtmlFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class EncodeHtmlFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the EncodeHtmlFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public EncodeHtmlFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the EncodeHtmlFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public EncodeHtmlFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "encode-html(" + jjtGetChild(0).toNormalizedString()
+ + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ result =
+ HtmlEncoder
+ .encode(Convert
+ .toString(jjtGetChild(0)
+ .evaluate(pageContext, icontext)));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/EncodeUrlFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/EncodeUrlFunction.java
new file mode 100644
index 0000000..467cd8d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/EncodeUrlFunction.java
@@ -0,0 +1,205 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.net.*;
+
+/**
+ * The EncodeUrlFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class EncodeUrlFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the EncodeUrlFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public EncodeUrlFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the EncodeUrlFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public EncodeUrlFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "encode-url(" + jjtGetChild(0).toNormalizedString()
+ + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ result =
+ URLEncoder
+ .encode(Convert
+ .toString(jjtGetChild(0)
+ .evaluate(pageContext, icontext)));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/EqualsOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/EqualsOperator.java
new file mode 100644
index 0000000..973a1af
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/EqualsOperator.java
@@ -0,0 +1,239 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The EqualsOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class EqualsOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the EqualsOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public EqualsOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the EqualsOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public EqualsOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.EQ) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ boolean result;
+
+ try {
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object rightSide = jjtGetChild(1).evaluate(pageContext, icontext);
+
+ if ((leftSide instanceof Boolean)
+ || (rightSide instanceof Boolean)) {
+ result = (Convert.toBoolean(leftSide).booleanValue()
+ == Convert.toBoolean(rightSide).booleanValue());
+ } else if ((leftSide instanceof Double)
+ || (rightSide instanceof Double)) {
+ result = (Convert.toDouble(leftSide).doubleValue()
+ == Convert.toDouble(rightSide).doubleValue());
+ } else if ((leftSide instanceof String)
+ || (rightSide instanceof String)) {
+ result =
+ Convert.toString(leftSide)
+ .equals(Convert.toString(rightSide));
+ } else if ((leftSide instanceof Comparable)
+ && (rightSide instanceof Comparable)) {
+ try {
+ int comp = ((Comparable) leftSide).compareTo(rightSide);
+
+ if (comp == 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException cce) {
+ throw new EvaluationException(this,
+ "child nodes ["
+ + jjtGetChild(0).toNormalizedString() + "] and ["
+ + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } else {
+ throw new EvaluationException(this,
+ "child nodes [" + jjtGetChild(0).toNormalizedString()
+ + "] and [" + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/EvaluationException.java b/src/org/apache/taglibs/standard/lang/jpath/expression/EvaluationException.java
new file mode 100644
index 0000000..abc26f7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/EvaluationException.java
@@ -0,0 +1,291 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The EvaluationException class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class EvaluationException extends Exception {
+
+ protected boolean specialConstructor;
+ public String image;
+ protected SimpleNode node;
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable".
+ */
+ public EvaluationException() {
+
+ super();
+
+ specialConstructor = false;
+ }
+
+ /**
+ * Used to create an instance of the EvaluationException class
+ *
+ *
+ * @param message
+ *
+ */
+ public EvaluationException(String message) {
+
+ super(message);
+
+ specialConstructor = false;
+ }
+
+ /**
+ * Used to create an instance of the EvaluationException class
+ *
+ *
+ * @param currentNode
+ * @param message
+ *
+ */
+ public EvaluationException(SimpleNode currentNode, String message) {
+
+ super(message);
+
+ specialConstructor = true;
+ node = currentNode;
+ }
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" to generate an evaluation
+ * error message and returns it. If this object has been created
+ * due to an evaluation error, and you do not catch it (it gets thrown
+ * during the evaluation), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ *
+ * @return the error message
+ */
+ public String getMessage() {
+
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+
+ String expected = "";
+ int maxSize = 1;
+ String retval = eol + "Encountered \"";
+
+ retval += super.getMessage();
+ retval += "\"" + eol;
+ retval += "at : " + eol;
+ retval += node.rootOriginalString() + eol;
+
+ for (int i = 0; i < node.firstToken.beginColumn - 1; i++) {
+ retval += " ";
+ }
+
+ for (int i = 0; i
+ < node.lastToken.endColumn
+ - (node.firstToken.beginColumn - 1); i++) {
+ retval += "^";
+ }
+
+ retval += eol;
+ retval += "beginning at column " + node.firstToken.beginColumn + "."
+ + eol;
+ retval += "ending at column " + node.lastToken.endColumn + "." + eol;
+
+ return retval;
+ }
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ *
+ * @param str
+ *
+ * @return
+ */
+ protected String add_escapes(String str) {
+
+ StringBuffer retval = new StringBuffer();
+ char ch;
+
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i)) {
+
+ case 0 :
+ continue;
+ case '\b' :
+ retval.append("\\b");
+
+ continue;
+ case '\t' :
+ retval.append("\\t");
+
+ continue;
+ case '\n' :
+ retval.append("\\n");
+
+ continue;
+ case '\f' :
+ retval.append("\\f");
+
+ continue;
+ case '\r' :
+ retval.append("\\r");
+
+ continue;
+ case '\"' :
+ retval.append("\\\"");
+
+ continue;
+ case '\'' :
+ retval.append("\\\'");
+
+ continue;
+ case '\\' :
+ retval.append("\\\\");
+
+ continue;
+ default :
+ if ((ch = str.charAt(i)) < 0x20 || (ch > 0x7e)) {
+ String s = "0000" + Integer.toString(ch, 16);
+
+ retval.append("\\u"
+ + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+
+ continue;
+ }
+ }
+
+ return retval.toString();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.java
new file mode 100644
index 0000000..fa1ef88
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.java
@@ -0,0 +1,193 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The Expression class is typically the top class in the expression
+ * tree. It serves as a common interface into the expression for
+ * evaluation purposes.
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class Expression extends SimpleNode {
+
+ /**
+ * Used to create an instance of the Expression class
+ *
+ *
+ * @param id
+ *
+ */
+ public Expression(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the Expression class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public Expression(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = jjtGetChild(0).toNormalizedString();
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return jjtGetChild(0).evaluate(pageContext, icontext);
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.jj b/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.jj
new file mode 100644
index 0000000..8d62609
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.jj
@@ -0,0 +1,1811 @@
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. Expression.jj */
+/*@egen*/options {
+ STATIC=false;
+}
+
+PARSER_BEGIN(Parser)
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+import java.io.StringReader;
+
+public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
+ protected JJTParserState jjtree = new JJTParserState();
+
+/*@egen*/
+ public static Expression parse(String expressionText)
+ throws ParseException {
+ Parser parser;
+ Expression expression;
+ parser = new Parser(new StringReader(expressionText));
+ parser.Expression();
+ expression = (Expression)parser.jjtree.rootNode();
+ return expression;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode)n).firstToken = getToken(0);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode)n).lastToken = getToken(0);
+ }
+
+}
+
+PARSER_END(Parser)
+
+
+/*----------------------------*/
+/* Skip Whitespace everywhere */
+/*----------------------------*/
+SKIP :
+{
+ " "
+|
+ "\t"
+|
+ "\r"
+|
+ "\n"
+|
+ "\f"
+}
+
+
+/*-----------------*/
+/* Operator Tokens */
+/*-----------------*/
+
+
+TOKEN:
+{
+ <DIV:"/">
+|
+ <MULT:"*">
+|
+ <MOD:"%">
+|
+ <PLUS:"+">
+|
+ <MINUS:"-">
+|
+ <EQ:"=">
+|
+ <NEQ:"!=">
+|
+ <LT:"<">
+|
+ <LTE:"<=">
+|
+ <GT:">">
+|
+ <GTE:">=">
+|
+ <INTROSPECT:".">
+|
+ <UNION:"|">
+|
+ <SCOPE_LIMIT:":">
+|
+ <AND:"and">
+|
+ <OR:"or">
+|
+ <LIST_BEGIN:"{">
+|
+ <LIST_END:"}">
+|
+ <SEPARATOR:",">
+|
+ <FUNCTION_BEGIN:"(">
+|
+ <FUNCTION_END:")">
+|
+ <PREDICATE_BEGIN:"[">
+|
+ <PREDICATE_END:"]">
+}
+
+/*
+ * Expression syntax follows.
+ */
+
+void Expression() :
+{/*@bgen(jjtree) #Expression( 1) */
+ Expression jjtn000 = new Expression(JJTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) #Expression( 1) */
+ try {
+/*@egen*/
+ Expr() <EOF>/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, 1);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/* [1] Expr ::= OrExpr */
+void Expr() :
+{}
+{
+ OrExpr()
+}
+
+
+/* [2] OrExpr ::= AndExpr ( 'or' AndExpr )* */
+void OrExpr() :
+{}
+{
+ AndExpr()
+ ( <OR>/*@bgen(jjtree) #OrOperator( 2) */
+ {
+ OrOperator jjtn001 = new OrOperator(JJTOROPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ AndExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/ )*
+}
+
+/* [3] AndExpr ::= EqualityExpr ( 'and' EqualityExpr )* */
+void AndExpr() :
+{}
+{
+ EqualityExpr()
+ ( <AND>/*@bgen(jjtree) #AndOperator( 2) */
+ {
+ AndOperator jjtn001 = new AndOperator(JJTANDOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ EqualityExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/ )*
+}
+
+/* [4] EqualityExpr ::= RelationalExpr ( ( '=' | '!-' ) RelationExpr )* */
+void EqualityExpr() :
+{}
+{
+ RelationalExpr()
+ (
+ <EQ>/*@bgen(jjtree) #EqualsOperator( 2) */
+ {
+ EqualsOperator jjtn001 = new EqualsOperator(JJTEQUALSOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ RelationalExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ |
+ <NEQ>/*@bgen(jjtree) #NotEqualsOperator( 2) */
+ {
+ NotEqualsOperator jjtn002 = new NotEqualsOperator(JJTNOTEQUALSOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ }
+ try {
+/*@egen*/ RelationalExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ throw (RuntimeException)jjte002;
+ }
+ if (jjte002 instanceof ParseException) {
+ throw (ParseException)jjte002;
+ }
+ throw (Error)jjte002;
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+/*@egen*/
+ )*
+}
+
+/* [5] RelationalExpr ::= AdditiveExpr ( ( '<' | '>' | '<=' | '>=' ) AdditiveExpr )* */
+void RelationalExpr() :
+{}
+{
+ AdditiveExpr()
+ (
+ <LT>/*@bgen(jjtree) #LessThanOperator( 2) */
+ {
+ LessThanOperator jjtn001 = new LessThanOperator(JJTLESSTHANOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ AdditiveExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ |
+ <GT>/*@bgen(jjtree) #GreaterThanOperator( 2) */
+ {
+ GreaterThanOperator jjtn002 = new GreaterThanOperator(JJTGREATERTHANOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ }
+ try {
+/*@egen*/ AdditiveExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ throw (RuntimeException)jjte002;
+ }
+ if (jjte002 instanceof ParseException) {
+ throw (ParseException)jjte002;
+ }
+ throw (Error)jjte002;
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+/*@egen*/
+ |
+ <LTE>/*@bgen(jjtree) #LessThanEqualOperator( 2) */
+ {
+ LessThanEqualOperator jjtn003 = new LessThanEqualOperator(JJTLESSTHANEQUALOPERATOR);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ }
+ try {
+/*@egen*/ AdditiveExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte003) {
+ if (jjtc003) {
+ jjtree.clearNodeScope(jjtn003);
+ jjtc003 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte003 instanceof RuntimeException) {
+ throw (RuntimeException)jjte003;
+ }
+ if (jjte003 instanceof ParseException) {
+ throw (ParseException)jjte003;
+ }
+ throw (Error)jjte003;
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, 2);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+/*@egen*/
+ |
+ <GTE>/*@bgen(jjtree) #GreaterThanEqualOperator( 2) */
+ {
+ GreaterThanEqualOperator jjtn004 = new GreaterThanEqualOperator(JJTGREATERTHANEQUALOPERATOR);
+ boolean jjtc004 = true;
+ jjtree.openNodeScope(jjtn004);
+ jjtreeOpenNodeScope(jjtn004);
+ }
+ try {
+/*@egen*/ AdditiveExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte004) {
+ if (jjtc004) {
+ jjtree.clearNodeScope(jjtn004);
+ jjtc004 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte004 instanceof RuntimeException) {
+ throw (RuntimeException)jjte004;
+ }
+ if (jjte004 instanceof ParseException) {
+ throw (ParseException)jjte004;
+ }
+ throw (Error)jjte004;
+ } finally {
+ if (jjtc004) {
+ jjtree.closeNodeScope(jjtn004, 2);
+ jjtreeCloseNodeScope(jjtn004);
+ }
+ }
+/*@egen*/
+ )*
+}
+
+/* [6] AdditiveExpr ::= MultiplicitiveExpr ( ( '+' | '-' ) MultiplicitiveExpr )* */
+void AdditiveExpr() :
+{}
+{
+ MultiplicativeExpr()
+ (
+ <PLUS>/*@bgen(jjtree) #AdditionOperator( 2) */
+ {
+ AdditionOperator jjtn001 = new AdditionOperator(JJTADDITIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ MultiplicativeExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ |
+ <MINUS>/*@bgen(jjtree) #SubtractionOperator( 2) */
+ {
+ SubtractionOperator jjtn002 = new SubtractionOperator(JJTSUBTRACTIONOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ }
+ try {
+/*@egen*/ MultiplicativeExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ throw (RuntimeException)jjte002;
+ }
+ if (jjte002 instanceof ParseException) {
+ throw (ParseException)jjte002;
+ }
+ throw (Error)jjte002;
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+/*@egen*/
+ )*
+}
+
+/* [7] MultiplicitiveExpr ::= UnaryExpr ( ( '*' | '/' | '%' ) UnaryExpr )* */
+void MultiplicativeExpr() :
+{}
+{
+ UnaryExpr()
+ (
+ <MULT>/*@bgen(jjtree) #MultiplicationOperator( 2) */
+ {
+ MultiplicationOperator jjtn001 = new MultiplicationOperator(JJTMULTIPLICATIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ UnaryExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ |
+ <DIV>/*@bgen(jjtree) #DivisionOperator( 2) */
+ {
+ DivisionOperator jjtn002 = new DivisionOperator(JJTDIVISIONOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ }
+ try {
+/*@egen*/ UnaryExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ throw (RuntimeException)jjte002;
+ }
+ if (jjte002 instanceof ParseException) {
+ throw (ParseException)jjte002;
+ }
+ throw (Error)jjte002;
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+/*@egen*/
+ |
+ <MOD>/*@bgen(jjtree) #ModulusOperator( 2) */
+ {
+ ModulusOperator jjtn003 = new ModulusOperator(JJTMODULUSOPERATOR);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ }
+ try {
+/*@egen*/ UnaryExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte003) {
+ if (jjtc003) {
+ jjtree.clearNodeScope(jjtn003);
+ jjtc003 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte003 instanceof RuntimeException) {
+ throw (RuntimeException)jjte003;
+ }
+ if (jjte003 instanceof ParseException) {
+ throw (ParseException)jjte003;
+ }
+ throw (Error)jjte003;
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, 2);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+/*@egen*/
+ )*
+}
+
+/* [7] UnaryExpr ::= UnionExpr | '-' UnaryExpr */
+void UnaryExpr() :
+{}
+{
+ UnionExpr()
+ | <MINUS> UnaryExpr()
+}
+
+/* [7] UnionExpr ::= IntrospectiveExpr ( '|' IntrospectiveExpr )* */
+void UnionExpr() :
+{}
+{
+ IntrospectiveExpr() ( <UNION>/*@bgen(jjtree) #UnionOperator( 2) */
+ {
+ UnionOperator jjtn001 = new UnionOperator(JJTUNIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ IntrospectiveExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/ )*
+}
+
+/* [7] IntrospectiveExpr ::= PathExpr ( '.' PathExpr )* */
+void IntrospectiveExpr() :
+{}
+{
+ PathExpr()
+ (
+ <INTROSPECT>/*@bgen(jjtree) #IntrospectionOperator( 2) */
+ {
+ IntrospectionOperator jjtn001 = new IntrospectionOperator(JJTINTROSPECTIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ PathExpr()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ )*
+}
+
+/* [7] PathExpr ::= FilterExpr */
+void PathExpr() :
+{}
+{
+ FilterExpr()
+}
+
+/* [7] FilterExpr ::= PrimaryExpr ( Predicate )* */
+void FilterExpr() :
+{}
+{
+PrimaryExpr() (/*@bgen(jjtree) #FilterOperator( 2) */
+ {
+ FilterOperator jjtn001 = new FilterOperator(JJTFILTEROPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ Predicate()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/ )*
+}
+
+
+/* [] Predicate ::= '[' PredicateExpr ']' */
+void Predicate() :
+{/*@bgen(jjtree) #Predicate( 1) */
+ Predicate jjtn000 = new Predicate(JJTPREDICATE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) #Predicate( 1) */
+ try {
+/*@egen*/
+ <PREDICATE_BEGIN> PredicateExpr() <PREDICATE_END>/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, 1);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/* [] PredicateExpr ::= Expr */
+void PredicateExpr() :
+{}
+{
+ Expr()
+}
+
+
+/* [7] PrimaryExpr ::= Literal | '(' Expr ')' | FunctionCall | ScopeLimitExpr | Identifier */
+void PrimaryExpr() :
+{}
+{
+ Literal()
+|
+ "(" Expr() ")"
+|
+ LOOKAHEAD(2) Function()
+|
+ ScopeLimitExpr()
+|
+ LOOKAHEAD(2) Identifier()
+}
+
+/* FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' */
+/* FunctionName ::= 'boolean' | 'number' | 'string' | 'not' | ... */
+void Function() :
+{
+}
+{
+ "boolean(" Argument()/*@bgen(jjtree) #BooleanFunction( 1) */
+ {
+ BooleanFunction jjtn001 = new BooleanFunction(JJTBOOLEANFUNCTION);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 1);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ |
+ "number(" Argument()/*@bgen(jjtree) #NumberFunction( 1) */
+ {
+ NumberFunction jjtn002 = new NumberFunction(JJTNUMBERFUNCTION);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 1);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+/*@egen*/
+ |
+ "string(" Argument()/*@bgen(jjtree) #StringFunction( 1) */
+ {
+ StringFunction jjtn003 = new StringFunction(JJTSTRINGFUNCTION);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, 1);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+/*@egen*/
+ |
+ "not(" Argument()/*@bgen(jjtree) #NotFunction( 1) */
+ {
+ NotFunction jjtn004 = new NotFunction(JJTNOTFUNCTION);
+ boolean jjtc004 = true;
+ jjtree.openNodeScope(jjtn004);
+ jjtreeOpenNodeScope(jjtn004);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc004) {
+ jjtree.closeNodeScope(jjtn004, 1);
+ jjtreeCloseNodeScope(jjtn004);
+ }
+ }
+/*@egen*/
+ |
+ "floor(" Argument()/*@bgen(jjtree) #FloorFunction( 1) */
+ {
+ FloorFunction jjtn005 = new FloorFunction(JJTFLOORFUNCTION);
+ boolean jjtc005 = true;
+ jjtree.openNodeScope(jjtn005);
+ jjtreeOpenNodeScope(jjtn005);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc005) {
+ jjtree.closeNodeScope(jjtn005, 1);
+ jjtreeCloseNodeScope(jjtn005);
+ }
+ }
+/*@egen*/
+ |
+ "ceiling(" Argument()/*@bgen(jjtree) #CeilingFunction( 1) */
+ {
+ CeilingFunction jjtn006 = new CeilingFunction(JJTCEILINGFUNCTION);
+ boolean jjtc006 = true;
+ jjtree.openNodeScope(jjtn006);
+ jjtreeOpenNodeScope(jjtn006);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc006) {
+ jjtree.closeNodeScope(jjtn006, 1);
+ jjtreeCloseNodeScope(jjtn006);
+ }
+ }
+/*@egen*/
+ |
+ "round(" Argument()/*@bgen(jjtree) #RoundFunction( 1) */
+ {
+ RoundFunction jjtn007 = new RoundFunction(JJTROUNDFUNCTION);
+ boolean jjtc007 = true;
+ jjtree.openNodeScope(jjtn007);
+ jjtreeOpenNodeScope(jjtn007);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc007) {
+ jjtree.closeNodeScope(jjtn007, 1);
+ jjtreeCloseNodeScope(jjtn007);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #FormatNumberFunction(> 1) */
+ {
+ FormatNumberFunction jjtn008 = new FormatNumberFunction(JJTFORMATNUMBERFUNCTION);
+ boolean jjtc008 = true;
+ jjtree.openNodeScope(jjtn008);
+ jjtreeOpenNodeScope(jjtn008);
+ }
+ try {
+/*@egen*/
+ ( "format-number(" Argument() <SEPARATOR> Argument() ( <SEPARATOR> Argument() )? <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte008) {
+ if (jjtc008) {
+ jjtree.clearNodeScope(jjtn008);
+ jjtc008 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte008 instanceof RuntimeException) {
+ throw (RuntimeException)jjte008;
+ }
+ if (jjte008 instanceof ParseException) {
+ throw (ParseException)jjte008;
+ }
+ throw (Error)jjte008;
+ } finally {
+ if (jjtc008) {
+ jjtree.closeNodeScope(jjtn008, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn008);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #ConcatFunction(> 1) */
+ {
+ ConcatFunction jjtn009 = new ConcatFunction(JJTCONCATFUNCTION);
+ boolean jjtc009 = true;
+ jjtree.openNodeScope(jjtn009);
+ jjtreeOpenNodeScope(jjtn009);
+ }
+ try {
+/*@egen*/
+ ( "concat(" Argument() (<SEPARATOR> Argument())+ <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte009) {
+ if (jjtc009) {
+ jjtree.clearNodeScope(jjtn009);
+ jjtc009 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte009 instanceof RuntimeException) {
+ throw (RuntimeException)jjte009;
+ }
+ if (jjte009 instanceof ParseException) {
+ throw (ParseException)jjte009;
+ }
+ throw (Error)jjte009;
+ } finally {
+ if (jjtc009) {
+ jjtree.closeNodeScope(jjtn009, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn009);
+ }
+ }
+/*@egen*/
+ |
+ "encode-url(" Argument()/*@bgen(jjtree) #EncodeUrlFunction( 1) */
+ {
+ EncodeUrlFunction jjtn010 = new EncodeUrlFunction(JJTENCODEURLFUNCTION);
+ boolean jjtc010 = true;
+ jjtree.openNodeScope(jjtn010);
+ jjtreeOpenNodeScope(jjtn010);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc010) {
+ jjtree.closeNodeScope(jjtn010, 1);
+ jjtreeCloseNodeScope(jjtn010);
+ }
+ }
+/*@egen*/
+ |
+ "encode-html(" Argument()/*@bgen(jjtree) #EncodeHtmlFunction( 1) */
+ {
+ EncodeHtmlFunction jjtn011 = new EncodeHtmlFunction(JJTENCODEHTMLFUNCTION);
+ boolean jjtc011 = true;
+ jjtree.openNodeScope(jjtn011);
+ jjtreeOpenNodeScope(jjtn011);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc011) {
+ jjtree.closeNodeScope(jjtn011, 1);
+ jjtreeCloseNodeScope(jjtn011);
+ }
+ }
+/*@egen*/
+ |
+ "string-length(" Argument()/*@bgen(jjtree) #StringLengthFunction( 1) */
+ {
+ StringLengthFunction jjtn012 = new StringLengthFunction(JJTSTRINGLENGTHFUNCTION);
+ boolean jjtc012 = true;
+ jjtree.openNodeScope(jjtn012);
+ jjtreeOpenNodeScope(jjtn012);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc012) {
+ jjtree.closeNodeScope(jjtn012, 1);
+ jjtreeCloseNodeScope(jjtn012);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #SubstringFunction(> 1) */
+ {
+ SubstringFunction jjtn013 = new SubstringFunction(JJTSUBSTRINGFUNCTION);
+ boolean jjtc013 = true;
+ jjtree.openNodeScope(jjtn013);
+ jjtreeOpenNodeScope(jjtn013);
+ }
+ try {
+/*@egen*/
+ ( "substring(" Argument() <SEPARATOR> Argument() (<SEPARATOR> Argument() )? <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte013) {
+ if (jjtc013) {
+ jjtree.clearNodeScope(jjtn013);
+ jjtc013 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte013 instanceof RuntimeException) {
+ throw (RuntimeException)jjte013;
+ }
+ if (jjte013 instanceof ParseException) {
+ throw (ParseException)jjte013;
+ }
+ throw (Error)jjte013;
+ } finally {
+ if (jjtc013) {
+ jjtree.closeNodeScope(jjtn013, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn013);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #StartsWithFunction( 2) */
+ {
+ StartsWithFunction jjtn014 = new StartsWithFunction(JJTSTARTSWITHFUNCTION);
+ boolean jjtc014 = true;
+ jjtree.openNodeScope(jjtn014);
+ jjtreeOpenNodeScope(jjtn014);
+ }
+ try {
+/*@egen*/
+ ( "starts-with(" Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte014) {
+ if (jjtc014) {
+ jjtree.clearNodeScope(jjtn014);
+ jjtc014 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte014 instanceof RuntimeException) {
+ throw (RuntimeException)jjte014;
+ }
+ if (jjte014 instanceof ParseException) {
+ throw (ParseException)jjte014;
+ }
+ throw (Error)jjte014;
+ } finally {
+ if (jjtc014) {
+ jjtree.closeNodeScope(jjtn014, 2);
+ jjtreeCloseNodeScope(jjtn014);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #ContainsFunction( 2) */
+ {
+ ContainsFunction jjtn015 = new ContainsFunction(JJTCONTAINSFUNCTION);
+ boolean jjtc015 = true;
+ jjtree.openNodeScope(jjtn015);
+ jjtreeOpenNodeScope(jjtn015);
+ }
+ try {
+/*@egen*/
+ ( "contains(" Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte015) {
+ if (jjtc015) {
+ jjtree.clearNodeScope(jjtn015);
+ jjtc015 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte015 instanceof RuntimeException) {
+ throw (RuntimeException)jjte015;
+ }
+ if (jjte015 instanceof ParseException) {
+ throw (ParseException)jjte015;
+ }
+ throw (Error)jjte015;
+ } finally {
+ if (jjtc015) {
+ jjtree.closeNodeScope(jjtn015, 2);
+ jjtreeCloseNodeScope(jjtn015);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #SubstringBeforeFunction( 2) */
+ {
+ SubstringBeforeFunction jjtn016 = new SubstringBeforeFunction(JJTSUBSTRINGBEFOREFUNCTION);
+ boolean jjtc016 = true;
+ jjtree.openNodeScope(jjtn016);
+ jjtreeOpenNodeScope(jjtn016);
+ }
+ try {
+/*@egen*/
+ ( "substring-before(" Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte016) {
+ if (jjtc016) {
+ jjtree.clearNodeScope(jjtn016);
+ jjtc016 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte016 instanceof RuntimeException) {
+ throw (RuntimeException)jjte016;
+ }
+ if (jjte016 instanceof ParseException) {
+ throw (ParseException)jjte016;
+ }
+ throw (Error)jjte016;
+ } finally {
+ if (jjtc016) {
+ jjtree.closeNodeScope(jjtn016, 2);
+ jjtreeCloseNodeScope(jjtn016);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #SubstringAfterFunction( 2) */
+ {
+ SubstringAfterFunction jjtn017 = new SubstringAfterFunction(JJTSUBSTRINGAFTERFUNCTION);
+ boolean jjtc017 = true;
+ jjtree.openNodeScope(jjtn017);
+ jjtreeOpenNodeScope(jjtn017);
+ }
+ try {
+/*@egen*/
+ ( "substring-after(" Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte017) {
+ if (jjtc017) {
+ jjtree.clearNodeScope(jjtn017);
+ jjtc017 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte017 instanceof RuntimeException) {
+ throw (RuntimeException)jjte017;
+ }
+ if (jjte017 instanceof ParseException) {
+ throw (ParseException)jjte017;
+ }
+ throw (Error)jjte017;
+ } finally {
+ if (jjtc017) {
+ jjtree.closeNodeScope(jjtn017, 2);
+ jjtreeCloseNodeScope(jjtn017);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #TranslateFunction( 3) */
+ {
+ TranslateFunction jjtn018 = new TranslateFunction(JJTTRANSLATEFUNCTION);
+ boolean jjtc018 = true;
+ jjtree.openNodeScope(jjtn018);
+ jjtreeOpenNodeScope(jjtn018);
+ }
+ try {
+/*@egen*/
+ ( "translate(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte018) {
+ if (jjtc018) {
+ jjtree.clearNodeScope(jjtn018);
+ jjtc018 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte018 instanceof RuntimeException) {
+ throw (RuntimeException)jjte018;
+ }
+ if (jjte018 instanceof ParseException) {
+ throw (ParseException)jjte018;
+ }
+ throw (Error)jjte018;
+ } finally {
+ if (jjtc018) {
+ jjtree.closeNodeScope(jjtn018, 3);
+ jjtreeCloseNodeScope(jjtn018);
+ }
+ }
+/*@egen*/
+ |
+ "position("/*@bgen(jjtree) #PositionFunction( 0) */
+ {
+ PositionFunction jjtn019 = new PositionFunction(JJTPOSITIONFUNCTION);
+ boolean jjtc019 = true;
+ jjtree.openNodeScope(jjtn019);
+ jjtreeOpenNodeScope(jjtn019);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc019) {
+ jjtree.closeNodeScope(jjtn019, 0);
+ jjtreeCloseNodeScope(jjtn019);
+ }
+ }
+/*@egen*/
+ |
+ "current("/*@bgen(jjtree) #CurrentFunction( 0) */
+ {
+ CurrentFunction jjtn020 = new CurrentFunction(JJTCURRENTFUNCTION);
+ boolean jjtc020 = true;
+ jjtree.openNodeScope(jjtn020);
+ jjtreeOpenNodeScope(jjtn020);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc020) {
+ jjtree.closeNodeScope(jjtn020, 0);
+ jjtreeCloseNodeScope(jjtn020);
+ }
+ }
+/*@egen*/
+ |
+ "last("/*@bgen(jjtree) #LastFunction( 0) */
+ {
+ LastFunction jjtn021 = new LastFunction(JJTLASTFUNCTION);
+ boolean jjtc021 = true;
+ jjtree.openNodeScope(jjtn021);
+ jjtreeOpenNodeScope(jjtn021);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc021) {
+ jjtree.closeNodeScope(jjtn021, 0);
+ jjtreeCloseNodeScope(jjtn021);
+ }
+ }
+/*@egen*/
+ |
+ "count(" Argument()/*@bgen(jjtree) #CountFunction( 1) */
+ {
+ CountFunction jjtn022 = new CountFunction(JJTCOUNTFUNCTION);
+ boolean jjtc022 = true;
+ jjtree.openNodeScope(jjtn022);
+ jjtreeOpenNodeScope(jjtn022);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc022) {
+ jjtree.closeNodeScope(jjtn022, 1);
+ jjtreeCloseNodeScope(jjtn022);
+ }
+ }
+/*@egen*/
+ |
+ "sum(" Argument()/*@bgen(jjtree) #SumFunction( 1) */
+ {
+ SumFunction jjtn023 = new SumFunction(JJTSUMFUNCTION);
+ boolean jjtc023 = true;
+ jjtree.openNodeScope(jjtn023);
+ jjtreeOpenNodeScope(jjtn023);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc023) {
+ jjtree.closeNodeScope(jjtn023, 1);
+ jjtreeCloseNodeScope(jjtn023);
+ }
+ }
+/*@egen*/
+ |
+ "now("/*@bgen(jjtree) #NowFunction( 0) */
+ {
+ NowFunction jjtn024 = new NowFunction(JJTNOWFUNCTION);
+ boolean jjtc024 = true;
+ jjtree.openNodeScope(jjtn024);
+ jjtreeOpenNodeScope(jjtn024);
+ }
+ try {
+/*@egen*/ <FUNCTION_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc024) {
+ jjtree.closeNodeScope(jjtn024, 0);
+ jjtreeCloseNodeScope(jjtn024);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #DateFunction(> 1) */
+ {
+ DateFunction jjtn025 = new DateFunction(JJTDATEFUNCTION);
+ boolean jjtc025 = true;
+ jjtree.openNodeScope(jjtn025);
+ jjtreeOpenNodeScope(jjtn025);
+ }
+ try {
+/*@egen*/
+ ( "date(" Argument() (<SEPARATOR> Argument())+ <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte025) {
+ if (jjtc025) {
+ jjtree.clearNodeScope(jjtn025);
+ jjtc025 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte025 instanceof RuntimeException) {
+ throw (RuntimeException)jjte025;
+ }
+ if (jjte025 instanceof ParseException) {
+ throw (ParseException)jjte025;
+ }
+ throw (Error)jjte025;
+ } finally {
+ if (jjtc025) {
+ jjtree.closeNodeScope(jjtn025, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn025);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #FormatDateFunction(> 1) */
+ {
+ FormatDateFunction jjtn026 = new FormatDateFunction(JJTFORMATDATEFUNCTION);
+ boolean jjtc026 = true;
+ jjtree.openNodeScope(jjtn026);
+ jjtreeOpenNodeScope(jjtn026);
+ }
+ try {
+/*@egen*/
+ ( "format-date(" Argument() <SEPARATOR> Argument() ( <SEPARATOR> Argument() )? <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte026) {
+ if (jjtc026) {
+ jjtree.clearNodeScope(jjtn026);
+ jjtc026 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte026 instanceof RuntimeException) {
+ throw (RuntimeException)jjte026;
+ }
+ if (jjte026 instanceof ParseException) {
+ throw (ParseException)jjte026;
+ }
+ throw (Error)jjte026;
+ } finally {
+ if (jjtc026) {
+ jjtree.closeNodeScope(jjtn026, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn026);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #RollDateFunction( 3) */
+ {
+ RollDateFunction jjtn027 = new RollDateFunction(JJTROLLDATEFUNCTION);
+ boolean jjtc027 = true;
+ jjtree.openNodeScope(jjtn027);
+ jjtreeOpenNodeScope(jjtn027);
+ }
+ try {
+/*@egen*/
+ ( "roll-date(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte027) {
+ if (jjtc027) {
+ jjtree.clearNodeScope(jjtn027);
+ jjtc027 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte027 instanceof RuntimeException) {
+ throw (RuntimeException)jjte027;
+ }
+ if (jjte027 instanceof ParseException) {
+ throw (ParseException)jjte027;
+ }
+ throw (Error)jjte027;
+ } finally {
+ if (jjtc027) {
+ jjtree.closeNodeScope(jjtn027, 3);
+ jjtreeCloseNodeScope(jjtn027);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #AddDateFunction( 3) */
+ {
+ AddDateFunction jjtn028 = new AddDateFunction(JJTADDDATEFUNCTION);
+ boolean jjtc028 = true;
+ jjtree.openNodeScope(jjtn028);
+ jjtreeOpenNodeScope(jjtn028);
+ }
+ try {
+/*@egen*/
+ ( "add-date(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte028) {
+ if (jjtc028) {
+ jjtree.clearNodeScope(jjtn028);
+ jjtc028 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte028 instanceof RuntimeException) {
+ throw (RuntimeException)jjte028;
+ }
+ if (jjte028 instanceof ParseException) {
+ throw (ParseException)jjte028;
+ }
+ throw (Error)jjte028;
+ } finally {
+ if (jjtc028) {
+ jjtree.closeNodeScope(jjtn028, 3);
+ jjtreeCloseNodeScope(jjtn028);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #TokenizeFunction( 2) */
+ {
+ TokenizeFunction jjtn029 = new TokenizeFunction(JJTTOKENIZEFUNCTION);
+ boolean jjtc029 = true;
+ jjtree.openNodeScope(jjtn029);
+ jjtreeOpenNodeScope(jjtn029);
+ }
+ try {
+/*@egen*/
+ ( "tokenize(" Argument() <SEPARATOR> Argument() <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte029) {
+ if (jjtc029) {
+ jjtree.clearNodeScope(jjtn029);
+ jjtc029 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte029 instanceof RuntimeException) {
+ throw (RuntimeException)jjte029;
+ }
+ if (jjte029 instanceof ParseException) {
+ throw (ParseException)jjte029;
+ }
+ throw (Error)jjte029;
+ } finally {
+ if (jjtc029) {
+ jjtree.closeNodeScope(jjtn029, 2);
+ jjtreeCloseNodeScope(jjtn029);
+ }
+ }
+/*@egen*/
+ |/*@bgen(jjtree) #UserFunction(> 1) */
+ {
+ UserFunction jjtn030 = new UserFunction(JJTUSERFUNCTION);
+ boolean jjtc030 = true;
+ jjtree.openNodeScope(jjtn030);
+ jjtreeOpenNodeScope(jjtn030);
+ }
+ try {
+/*@egen*/
+ ( Identifier() ":" Identifier() <FUNCTION_BEGIN> [ Argument() (<SEPARATOR> Argument() )* ] <FUNCTION_END> )/*@bgen(jjtree)*/
+ } catch (Throwable jjte030) {
+ if (jjtc030) {
+ jjtree.clearNodeScope(jjtn030);
+ jjtc030 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte030 instanceof RuntimeException) {
+ throw (RuntimeException)jjte030;
+ }
+ if (jjte030 instanceof ParseException) {
+ throw (ParseException)jjte030;
+ }
+ throw (Error)jjte030;
+ } finally {
+ if (jjtc030) {
+ jjtree.closeNodeScope(jjtn030, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn030);
+ }
+ }
+/*@egen*/
+}
+
+/* [] Argument ::= Expr */
+void Argument() :
+{
+}
+{
+ Expr()
+}
+
+/* [] ScopeLimitExpr ::= ScopeLimitName Identifier */
+void ScopeLimitExpr() :
+{
+ Token t;
+}
+{
+ ScopeLimitName()
+ (/*@bgen(jjtree) #ScopeLimitOperator( 2) */
+ {
+ ScopeLimitOperator jjtn001 = new ScopeLimitOperator(JJTSCOPELIMITOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/
+ Identifier()/*@bgen(jjtree)*/
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ throw (RuntimeException)jjte001;
+ }
+ if (jjte001 instanceof ParseException) {
+ throw (ParseException)jjte001;
+ }
+ throw (Error)jjte001;
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+ )
+}
+
+
+/* [] Identifier ::= Letter ( Letter | Digit )* */
+void Identifier() :
+{/*@bgen(jjtree) Identifier */
+ Identifier jjtn000 = new Identifier(JJTIDENTIFIER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ Token t;
+}
+{/*@bgen(jjtree) Identifier */
+ try {
+/*@egen*/
+ t = <IDENTIFIER>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/
+ {
+ jjtn000.val = t.image;
+ jjtn000.image = t.image;
+ jjtn000.beginColumn = t.beginColumn;
+ jjtn000.endColumn = t.endColumn;
+ jjtn000.beginLine = t.beginLine;
+ jjtn000.endLine = t.endLine;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/* ScopeLimitName ::= 'page' | 'request' | 'session' | 'application' | ... */
+void ScopeLimitName() :
+{/*@bgen(jjtree) ScopeLimitName */
+ ScopeLimitName jjtn000 = new ScopeLimitName(JJTSCOPELIMITNAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ Token t;
+}
+{/*@bgen(jjtree) ScopeLimitName */
+ try {
+/*@egen*/
+ t = < SCOPE_LIMIT_NAME: ("page:" | "request:" | "session:" | "application:") >/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ { jjtn000.val = t.image; }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/* Literal ::= UnaryLiteral | ListLiteral */
+void Literal() :
+{}
+{
+ UnaryLiteral()
+ |
+ ListLiteral()
+}
+
+/* UnaryLiteral ::= BooleanLiteral | NumberLiteral | StringLiteral */
+void UnaryLiteral() :
+{
+ Token t;
+}
+{/*@bgen(jjtree) BooleanLiteral */
+ {
+ BooleanLiteral jjtn001 = new BooleanLiteral(JJTBOOLEANLITERAL);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/
+ (
+ t=<BOOLEAN_LITERAL>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn001, true);
+ jjtc001 = false;
+ jjtreeCloseNodeScope(jjtn001);
+ }
+/*@egen*/
+ {
+ jjtn001.val = Boolean.valueOf(t.image).booleanValue();
+ }
+ )/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, true);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*/
+|/*@bgen(jjtree) NumberLiteral */
+ {
+ NumberLiteral jjtn002 = new NumberLiteral(JJTNUMBERLITERAL);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ }
+ try {
+/*@egen*/
+ (
+ t=<NUMBER_LITERAL>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn002, true);
+ jjtc002 = false;
+ jjtreeCloseNodeScope(jjtn002);
+ }
+/*@egen*/
+ {
+ jjtn002.val = Double.parseDouble(t.image);
+ }
+ )/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, true);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+/*@egen*/
+|/*@bgen(jjtree) StringLiteral */
+ {
+ StringLiteral jjtn003 = new StringLiteral(JJTSTRINGLITERAL);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ }
+ try {
+/*@egen*/
+ (
+ t=<STRING_LITERAL>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn003, true);
+ jjtc003 = false;
+ jjtreeCloseNodeScope(jjtn003);
+ }
+/*@egen*/
+ {
+ jjtn003.val = t.image.substring(1, (t.image.length() - 1));
+ }
+ )/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, true);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+/*@egen*/
+}
+
+/* ListLiteral ::= '{' UnaryExpr ( ',' UnaryExpr )* '}' */
+void ListLiteral() :
+{/*@bgen(jjtree) ListLiteral */
+ ListLiteral jjtn000 = new ListLiteral(JJTLISTLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ListLiteral */
+ try {
+/*@egen*/
+ <LIST_BEGIN> Expr() ( <SEPARATOR> Expr() )*/*@bgen(jjtree) #ListLiteral(> 1) */
+ {
+ ListLiteral jjtn001 = new ListLiteral(JJTLISTLITERAL);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ }
+ try {
+/*@egen*/ <LIST_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+/*@egen*//*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+/*-----------------------------------------------*/
+/* Unambigious Tokens (Number, Literal) */
+/*-----------------------------------------------*/
+
+TOKEN:
+{
+
+/* [] BooleanLiteral ::= "true" | "false" */
+ <BOOLEAN_LITERAL :
+ "true"
+ |
+ "false"
+ >
+
+|
+
+/* [] StringLiteral ::= '"' [^"]* '"' | "'" [^']* "'" */
+ <STRING_LITERAL :
+ "\"" (~["\""])* "\""
+ |
+ "'" (~["'"] )* "'"
+ >
+
+|
+
+/* [] Digit ::= [0-9]+ */
+ <#DIGIT :
+ ["0"-"9"]
+ >
+
+|
+
+/* [] NumberLiteral ::= Digits ( '.' Digits? )? | '.' Digits */
+ <NUMBER_LITERAL :
+ ("-")? (<DIGIT>)+ ("." ( (<DIGIT>)+ )? )?
+|
+ ("-")? "." (<DIGIT>)+
+ >
+
+|
+ < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+/* [] Letter ::= ['a'-'z'], ['A'-'Z'] */
+ < #LETTER: [ "a"-"z", "A"-"Z" ] >
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.jjt b/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.jjt
new file mode 100644
index 0000000..e45f14a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Expression.jjt
@@ -0,0 +1,469 @@
+options {
+ MULTI=true;
+ STATIC=false;
+ NODE_PREFIX="";
+ NODE_SCOPE_HOOK=true;
+}
+
+PARSER_BEGIN(Parser)
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+import java.io.StringReader;
+
+public class Parser {
+ public static Expression parse(String expressionText)
+ throws ParseException {
+ Parser parser;
+ Expression expression;
+ parser = new Parser(new StringReader(expressionText));
+ parser.Expression();
+ expression = (Expression)parser.jjtree.rootNode();
+ return expression;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode)n).firstToken = getToken(0);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode)n).lastToken = getToken(0);
+ }
+
+}
+
+PARSER_END(Parser)
+
+
+/*----------------------------*/
+/* Skip Whitespace everywhere */
+/*----------------------------*/
+SKIP :
+{
+ " "
+|
+ "\t"
+|
+ "\r"
+|
+ "\n"
+|
+ "\f"
+}
+
+
+/*-----------------*/
+/* Operator Tokens */
+/*-----------------*/
+
+
+TOKEN:
+{
+ <DIV:"/">
+|
+ <MULT:"*">
+|
+ <MOD:"%">
+|
+ <PLUS:"+">
+|
+ <MINUS:"-">
+|
+ <EQ:"=">
+|
+ <NEQ:"!=">
+|
+ <LT:"<">
+|
+ <LTE:"<=">
+|
+ <GT:">">
+|
+ <GTE:">=">
+|
+ <INTROSPECT:".">
+|
+ <UNION:"|">
+|
+ <SCOPE_LIMIT:":">
+|
+ <AND:"and">
+|
+ <OR:"or">
+|
+ <LIST_BEGIN:"{">
+|
+ <LIST_END:"}">
+|
+ <SEPARATOR:",">
+|
+ <FUNCTION_BEGIN:"(">
+|
+ <FUNCTION_END:")">
+|
+ <PREDICATE_BEGIN:"[">
+|
+ <PREDICATE_END:"]">
+}
+
+/*
+ * Expression syntax follows.
+ */
+
+void Expression() #Expression(1):
+{}
+{
+ Expr() <EOF>
+}
+
+/* [1] Expr ::= OrExpr */
+void Expr() #void:
+{}
+{
+ OrExpr()
+}
+
+
+/* [2] OrExpr ::= AndExpr ( 'or' AndExpr )* */
+void OrExpr() #void :
+{}
+{
+ AndExpr()
+ ( <OR> AndExpr() #OrOperator(2) )*
+}
+
+/* [3] AndExpr ::= EqualityExpr ( 'and' EqualityExpr )* */
+void AndExpr() #void :
+{}
+{
+ EqualityExpr()
+ ( <AND> EqualityExpr() #AndOperator(2) )*
+}
+
+/* [4] EqualityExpr ::= RelationalExpr ( ( '=' | '!-' ) RelationExpr )* */
+void EqualityExpr() #void :
+{}
+{
+ RelationalExpr()
+ (
+ <EQ> RelationalExpr() #EqualsOperator(2)
+ |
+ <NEQ> RelationalExpr() #NotEqualsOperator(2)
+ )*
+}
+
+/* [5] RelationalExpr ::= AdditiveExpr ( ( '<' | '>' | '<=' | '>=' ) AdditiveExpr )* */
+void RelationalExpr() #void :
+{}
+{
+ AdditiveExpr()
+ (
+ <LT> AdditiveExpr() #LessThanOperator(2)
+ |
+ <GT> AdditiveExpr() #GreaterThanOperator(2)
+ |
+ <LTE> AdditiveExpr() #LessThanEqualOperator(2)
+ |
+ <GTE> AdditiveExpr() #GreaterThanEqualOperator(2)
+ )*
+}
+
+/* [6] AdditiveExpr ::= MultiplicitiveExpr ( ( '+' | '-' ) MultiplicitiveExpr )* */
+void AdditiveExpr() #void :
+{}
+{
+ MultiplicativeExpr()
+ (
+ <PLUS> MultiplicativeExpr() #AdditionOperator(2)
+ |
+ <MINUS> MultiplicativeExpr() #SubtractionOperator(2)
+ )*
+}
+
+/* [7] MultiplicitiveExpr ::= UnaryExpr ( ( '*' | '/' | '%' ) UnaryExpr )* */
+void MultiplicativeExpr() #void :
+{}
+{
+ UnaryExpr()
+ (
+ <MULT> UnaryExpr() #MultiplicationOperator(2)
+ |
+ <DIV> UnaryExpr() #DivisionOperator(2)
+ |
+ <MOD> UnaryExpr() #ModulusOperator(2)
+ )*
+}
+
+/* [7] UnaryExpr ::= UnionExpr | '-' UnaryExpr */
+void UnaryExpr() #void :
+{}
+{
+ UnionExpr()
+ | <MINUS> UnaryExpr()
+}
+
+/* [7] UnionExpr ::= IntrospectiveExpr ( '|' IntrospectiveExpr )* */
+void UnionExpr() #void :
+{}
+{
+ IntrospectiveExpr() ( <UNION> IntrospectiveExpr() #UnionOperator(2) )*
+}
+
+/* [7] IntrospectiveExpr ::= PathExpr ( '.' PathExpr )* */
+void IntrospectiveExpr() #void :
+{}
+{
+ PathExpr()
+ (
+ <INTROSPECT> PathExpr() #IntrospectionOperator(2)
+ )*
+}
+
+/* [7] PathExpr ::= FilterExpr */
+void PathExpr() #void :
+{}
+{
+ FilterExpr()
+}
+
+/* [7] FilterExpr ::= PrimaryExpr ( Predicate )* */
+void FilterExpr() #void :
+{}
+{
+PrimaryExpr() ( Predicate() #FilterOperator(2) )*
+}
+
+
+/* [] Predicate ::= '[' PredicateExpr ']' */
+void Predicate() #Predicate(1) :
+{}
+{
+ <PREDICATE_BEGIN> PredicateExpr() <PREDICATE_END>
+}
+
+/* [] PredicateExpr ::= Expr */
+void PredicateExpr() #void :
+{}
+{
+ Expr()
+}
+
+
+/* [7] PrimaryExpr ::= Literal | '(' Expr ')' | FunctionCall | ScopeLimitExpr | Identifier */
+void PrimaryExpr() #void :
+{}
+{
+ Literal()
+|
+ "(" Expr() ")"
+|
+ LOOKAHEAD(2) Function()
+|
+ ScopeLimitExpr()
+|
+ LOOKAHEAD(2) Identifier()
+}
+
+/* FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' */
+/* FunctionName ::= 'boolean' | 'number' | 'string' | 'not' | ... */
+void Function() #void :
+{
+}
+{
+ "boolean(" Argument() <FUNCTION_END> #BooleanFunction(1)
+ |
+ "number(" Argument() <FUNCTION_END> #NumberFunction(1)
+ |
+ "string(" Argument() <FUNCTION_END> #StringFunction(1)
+ |
+ "not(" Argument() <FUNCTION_END> #NotFunction(1)
+ |
+ "floor(" Argument() <FUNCTION_END> #FloorFunction(1)
+ |
+ "ceiling(" Argument() <FUNCTION_END> #CeilingFunction(1)
+ |
+ "round(" Argument() <FUNCTION_END> #RoundFunction(1)
+ |
+ ( "format-number(" Argument() <SEPARATOR> Argument() ( <SEPARATOR> Argument() )? <FUNCTION_END> ) #FormatNumberFunction(>1)
+ |
+ ( "concat(" Argument() (<SEPARATOR> Argument())+ <FUNCTION_END> ) #ConcatFunction(>1)
+ |
+ "encode-url(" Argument() <FUNCTION_END> #EncodeUrlFunction(1)
+ |
+ "encode-html(" Argument() <FUNCTION_END> #EncodeHtmlFunction(1)
+ |
+ "string-length(" Argument() <FUNCTION_END> #StringLengthFunction(1)
+ |
+ ( "substring(" Argument() <SEPARATOR> Argument() (<SEPARATOR> Argument() )? <FUNCTION_END> ) #SubstringFunction(>1)
+ |
+ ( "starts-with(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #StartsWithFunction(2)
+ |
+ ( "contains(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #ContainsFunction(2)
+ |
+ ( "substring-before(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #SubstringBeforeFunction(2)
+ |
+ ( "substring-after(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #SubstringAfterFunction(2)
+ |
+ ( "translate(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #TranslateFunction(3)
+ |
+ "position(" <FUNCTION_END> #PositionFunction(0)
+ |
+ "current(" <FUNCTION_END> #CurrentFunction(0)
+ |
+ "last(" <FUNCTION_END> #LastFunction(0)
+ |
+ "count(" Argument() <FUNCTION_END> #CountFunction(1)
+ |
+ "sum(" Argument() <FUNCTION_END> #SumFunction(1)
+ |
+ "now(" <FUNCTION_END> #NowFunction(0)
+ |
+ ( "date(" Argument() (<SEPARATOR> Argument())+ <FUNCTION_END> ) #DateFunction(>1)
+ |
+ ( "format-date(" Argument() <SEPARATOR> Argument() ( <SEPARATOR> Argument() )? <FUNCTION_END> ) #FormatDateFunction(>1)
+ |
+ ( "roll-date(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #RollDateFunction(3)
+ |
+ ( "add-date(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #AddDateFunction(3)
+ |
+ ( "tokenize(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #TokenizeFunction(2)
+ |
+ ( Identifier() ":" Identifier() <FUNCTION_BEGIN> [ Argument() (<SEPARATOR> Argument() )* ] <FUNCTION_END> ) #UserFunction(>1)
+}
+
+/* [] Argument ::= Expr */
+void Argument() #void :
+{
+}
+{
+ Expr()
+}
+
+/* [] ScopeLimitExpr ::= ScopeLimitName Identifier */
+void ScopeLimitExpr() #void :
+{
+ Token t;
+}
+{
+ ScopeLimitName()
+ (
+ Identifier() #ScopeLimitOperator(2)
+ )
+}
+
+
+/* [] Identifier ::= Letter ( Letter | Digit )* */
+void Identifier() :
+{
+ Token t;
+}
+{
+ t = <IDENTIFIER>
+ {
+ jjtThis.val = t.image;
+ jjtThis.image = t.image;
+ jjtThis.beginColumn = t.beginColumn;
+ jjtThis.endColumn = t.endColumn;
+ jjtThis.beginLine = t.beginLine;
+ jjtThis.endLine = t.endLine;
+ }
+}
+
+/* ScopeLimitName ::= 'page' | 'request' | 'session' | 'application' | ... */
+void ScopeLimitName() :
+{
+ Token t;
+}
+{
+ t = < SCOPE_LIMIT_NAME: ("page:" | "request:" | "session:" | "application:") > { jjtThis.val = t.image; }
+}
+
+/* Literal ::= UnaryLiteral | ListLiteral */
+void Literal() #void :
+{}
+{
+ UnaryLiteral()
+ |
+ ListLiteral()
+}
+
+/* UnaryLiteral ::= BooleanLiteral | NumberLiteral | StringLiteral */
+void UnaryLiteral() #void :
+{
+ Token t;
+}
+{
+ (
+ t=<BOOLEAN_LITERAL>
+ {
+ jjtThis.val = Boolean.valueOf(t.image).booleanValue();
+ }
+ )#BooleanLiteral
+|
+ (
+ t=<NUMBER_LITERAL>
+ {
+ jjtThis.val = Double.parseDouble(t.image);
+ }
+ )#NumberLiteral
+|
+ (
+ t=<STRING_LITERAL>
+ {
+ jjtThis.val = t.image.substring(1, (t.image.length() - 1));
+ }
+ )#StringLiteral
+}
+
+/* ListLiteral ::= '{' UnaryExpr ( ',' UnaryExpr )* '}' */
+void ListLiteral() :
+{}
+{
+ <LIST_BEGIN> Expr() ( <SEPARATOR> Expr() )* <LIST_END>#ListLiteral(>1)
+}
+
+
+/*-----------------------------------------------*/
+/* Unambigious Tokens (Number, Literal) */
+/*-----------------------------------------------*/
+
+TOKEN:
+{
+
+/* [] BooleanLiteral ::= "true" | "false" */
+ <BOOLEAN_LITERAL :
+ "true"
+ |
+ "false"
+ >
+
+|
+
+/* [] StringLiteral ::= '"' [^"]* '"' | "'" [^']* "'" */
+ <STRING_LITERAL :
+ "\"" (~["\""])* "\""
+ |
+ "'" (~["'"] )* "'"
+ >
+
+|
+
+/* [] Digit ::= [0-9]+ */
+ <#DIGIT :
+ ["0"-"9"]
+ >
+
+|
+
+/* [] NumberLiteral ::= Digits ( '.' Digits? )? | '.' Digits */
+ <NUMBER_LITERAL :
+ ("-")? (<DIGIT>)+ ("." ( (<DIGIT>)+ )? )?
+|
+ ("-")? "." (<DIGIT>)+
+ >
+
+|
+ < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+/* [] Letter ::= ['a'-'z'], ['A'-'Z'] */
+ < #LETTER: [ "a"-"z", "A"-"Z" ] >
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/FilterOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/FilterOperator.java
new file mode 100644
index 0000000..a85f196
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/FilterOperator.java
@@ -0,0 +1,298 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The FilterOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class FilterOperator extends SimpleNode implements Introspectable {
+
+ /**
+ * Used to create an instance of the FilterOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public FilterOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the FilterOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public FilterOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = jjtGetChild(0).toNormalizedString()
+ + jjtGetChild(1).toNormalizedString();
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Object result;
+
+ try {
+ JSPList leftSide =
+ Convert.toJSPList(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ Predicate predicate = (Predicate) jjtGetChild(1);
+ boolean oneItem = leftSide.applyPredicate(pageContext, predicate);
+
+ if (oneItem) {
+ if (leftSide.getLast() == 1) {
+ result = leftSide.next();
+ } else {
+ result = null;
+ }
+ } else {
+ result = leftSide;
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param scope
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, int scope)
+ throws EvaluationException {
+
+ Object result;
+
+ try {
+ JSPList leftSide =
+ Convert.toJSPList(((Introspectable) jjtGetChild(0))
+ .evaluate(pageContext, icontext, scope));
+ Predicate predicate = (Predicate) jjtGetChild(1);
+ boolean oneItem = leftSide.applyPredicate(pageContext, predicate);
+
+ if (oneItem) {
+ if (leftSide.getLast() == 1) {
+ result = leftSide.next();
+ } else {
+ result = null;
+ }
+ } else {
+ result = leftSide;
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param parent
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, Object parent)
+ throws EvaluationException {
+
+ Object result;
+
+ try {
+ JSPList leftSide =
+ Convert.toJSPList(((Introspectable) jjtGetChild(0))
+ .evaluate(pageContext, icontext, parent));
+ Predicate predicate = (Predicate) jjtGetChild(1);
+ boolean oneItem = leftSide.applyPredicate(pageContext, predicate);
+
+ if (oneItem) {
+ if (leftSide.getLast() == 1) {
+ result = leftSide.next();
+ } else {
+ result = null;
+ }
+ } else {
+ result = leftSide;
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/FilteredIdentifier.java b/src/org/apache/taglibs/standard/lang/jpath/expression/FilteredIdentifier.java
new file mode 100644
index 0000000..db35e98
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/FilteredIdentifier.java
@@ -0,0 +1,149 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The FilteredIdentifier class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class FilteredIdentifier extends SimpleNode {
+
+ /**
+ * Used to create an instance of the FilteredIdentifier class
+ *
+ *
+ * @param id
+ *
+ */
+ public FilteredIdentifier(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the FilteredIdentifier class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public FilteredIdentifier(Parser p, int id) {
+ super(p, id);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/FloorFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/FloorFunction.java
new file mode 100644
index 0000000..6ca9f91
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/FloorFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The FloorFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class FloorFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the FloorFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public FloorFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the FloorFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public FloorFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "floor(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ result = Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Double(Math.floor(result.doubleValue()));
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/FormatDateFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/FormatDateFunction.java
new file mode 100644
index 0000000..60ebba3
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/FormatDateFunction.java
@@ -0,0 +1,266 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.text.*;
+import java.util.*;
+
+/**
+ * The FormatDateFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class FormatDateFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the FormatDateFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public FormatDateFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the FormatDateFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public FormatDateFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "format-date(" + jjtGetChild(0).toNormalizedString()
+ + jjtGetChild(1).toNormalizedString() + "," + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String formatted;
+
+ try {
+ JSPDate arg =
+ Convert.toJSPDate(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String pattern =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ DateFormat form;
+
+ if (jjtGetNumChildren() > 2) {
+ String arg3 =
+ Convert.toString(jjtGetChild(2).evaluate(pageContext,
+ icontext));
+ Locale locale = getLocale(arg3);
+
+ form = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
+ } else {
+ form = DateFormat.getInstance();
+ }
+
+ try {
+ ((SimpleDateFormat) form).applyPattern(pattern);
+
+ formatted = form.format(new Date(arg.getTime().longValue()));
+ } catch (IllegalArgumentException iae) {
+ formatted = new String("");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return formatted;
+ }
+
+ /**
+ * The getLocale method
+ *
+ *
+ * @param arg
+ *
+ * @return
+ *
+ */
+ private Locale getLocale(String arg) {
+
+ Locale result;
+ StringTokenizer st = new StringTokenizer(arg, "_");
+ String language = null;
+ String country = null;
+ String variant = null;
+
+ if (st.hasMoreTokens()) {
+ language = st.nextToken();
+
+ if (st.hasMoreTokens()) {
+ country = st.nextToken();
+
+ if (st.hasMoreTokens()) {
+ variant = st.nextToken();
+ result = new Locale(language, country, variant);
+ } else {
+ result = new Locale(language, country);
+ }
+ } else {
+ result = new Locale(language, "");
+ }
+ } else {
+ result = Locale.getDefault();
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/FormatNumberFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/FormatNumberFunction.java
new file mode 100644
index 0000000..1f6a932
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/FormatNumberFunction.java
@@ -0,0 +1,265 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.text.*;
+import java.util.*;
+
+/**
+ * The FormatNumberFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class FormatNumberFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the FormatNumberFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public FormatNumberFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the FormatNumberFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public FormatNumberFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "format-number(" + jjtGetChild(0).toNormalizedString()
+ + jjtGetChild(1).toNormalizedString() + "," + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String formatted;
+
+ try {
+ Double arg = Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String pattern =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ NumberFormat form;
+
+ if (jjtGetNumChildren() > 2) {
+ String arg3 =
+ Convert.toString(jjtGetChild(2).evaluate(pageContext,
+ icontext));
+ Locale locale = getLocale(arg3);
+
+ form = NumberFormat.getInstance(locale);
+ } else {
+ form = NumberFormat.getInstance();
+ }
+
+ try {
+ ((DecimalFormat) form).applyPattern(pattern);
+
+ formatted = form.format(arg);
+ } catch (IllegalArgumentException iae) {
+ formatted = new String("NaN");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return formatted;
+ }
+
+ /**
+ * The getLocale method
+ *
+ *
+ * @param arg
+ *
+ * @return
+ *
+ */
+ private Locale getLocale(String arg) {
+
+ Locale result;
+ StringTokenizer st = new StringTokenizer(arg, "_");
+ String language = null;
+ String country = null;
+ String variant = null;
+
+ if (st.hasMoreTokens()) {
+ language = st.nextToken();
+
+ if (st.hasMoreTokens()) {
+ country = st.nextToken();
+
+ if (st.hasMoreTokens()) {
+ variant = st.nextToken();
+ result = new Locale(language, country, variant);
+ } else {
+ result = new Locale(language, country);
+ }
+ } else {
+ result = new Locale(language, "");
+ }
+ } else {
+ result = Locale.getDefault();
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/GreaterThanEqualOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/GreaterThanEqualOperator.java
new file mode 100644
index 0000000..22e9135
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/GreaterThanEqualOperator.java
@@ -0,0 +1,240 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The GreaterThanEqualOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class GreaterThanEqualOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the GreaterThanEqualOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public GreaterThanEqualOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the GreaterThanEqualOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public GreaterThanEqualOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.GTE) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ boolean result;
+
+ try {
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object rightSide = jjtGetChild(1).evaluate(pageContext, icontext);
+
+ if ((leftSide instanceof Boolean)
+ || (rightSide instanceof Boolean)
+ || (leftSide instanceof Double)
+ || (rightSide instanceof Double)
+ || (leftSide instanceof String)
+ || (rightSide instanceof String)) {
+ double leftResult =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).doubleValue();
+ double rightResult =
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).doubleValue();
+
+ result = leftResult >= rightResult;
+ } else if ((leftSide instanceof Comparable)
+ && (rightSide instanceof Comparable)) {
+ try {
+ int comp = ((Comparable) leftSide).compareTo(rightSide);
+
+ if (comp >= 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException cce) {
+ throw new EvaluationException(this,
+ "child nodes ["
+ + jjtGetChild(0).toNormalizedString() + "] and ["
+ + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } else {
+ throw new EvaluationException(this,
+ "child nodes [" + jjtGetChild(0).toNormalizedString()
+ + "] and [" + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/GreaterThanOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/GreaterThanOperator.java
new file mode 100644
index 0000000..d34176d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/GreaterThanOperator.java
@@ -0,0 +1,240 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The GreaterThanOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class GreaterThanOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the GreaterThanOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public GreaterThanOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the GreaterThanOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public GreaterThanOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.GT) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ boolean result;
+
+ try {
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object rightSide = jjtGetChild(1).evaluate(pageContext, icontext);
+
+ if ((leftSide instanceof Boolean)
+ || (rightSide instanceof Boolean)
+ || (leftSide instanceof Double)
+ || (rightSide instanceof Double)
+ || (leftSide instanceof String)
+ || (rightSide instanceof String)) {
+ double leftResult =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).doubleValue();
+ double rightResult =
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).doubleValue();
+
+ result = leftResult > rightResult;
+ } else if ((leftSide instanceof Comparable)
+ && (rightSide instanceof Comparable)) {
+ try {
+ int comp = ((Comparable) leftSide).compareTo(rightSide);
+
+ if (comp > 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException cce) {
+ throw new EvaluationException(this,
+ "child nodes ["
+ + jjtGetChild(0).toNormalizedString() + "] and ["
+ + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } else {
+ throw new EvaluationException(this,
+ "child nodes [" + jjtGetChild(0).toNormalizedString()
+ + "] and [" + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Identifier.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Identifier.java
new file mode 100644
index 0000000..6fe4b31
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Identifier.java
@@ -0,0 +1,390 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.http.*;
+import javax.servlet.*;
+import java.beans.*;
+import java.lang.reflect.*;
+
+/**
+ * The Identifier class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class Identifier extends SimpleNode implements Introspectable {
+
+ protected String val;
+
+ /**
+ * Used to create an instance of the Identifier class
+ *
+ *
+ * @param id
+ *
+ */
+ public Identifier(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the Identifier class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public Identifier(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+ return val;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Object result;
+
+ //try {
+ //result = Convert.toJSPType(pageContext.findAttribute(val));
+ //} catch (ConversionException ce) {
+ //throw new EvaluationException(this, ce.getMessage());
+ //}
+ result = pageContext.findAttribute(val);
+
+ return result;
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param scope
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, int scope)
+ throws EvaluationException {
+
+ Object result;
+
+ //try {
+ //result = Convert.toJSPType(pageContext.getAttribute(val, scope));
+ //} catch (ConversionException ce) {
+ //throw new EvaluationException(this, ce.getMessage());
+ //}
+ result = pageContext.getAttribute(val, scope);
+
+ return result;
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param parent
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, Object parent)
+ throws EvaluationException {
+
+ Object result = null;
+
+ //try {
+ if (parent != null) {
+ try {
+ PropertyDescriptor pd =
+ getFeatureDescriptor(parent.getClass(), val);
+
+ if (pd != null) {
+ result = getAttribute(pd, parent);
+ }
+ } catch (IntrospectionException ie) {
+ throw new EvaluationException(this,
+ "Introspection Exception:" + ie.getMessage());
+ } catch (NoSuchMethodException nsme) {
+ throw new EvaluationException(this,
+ "NoSuchMethodException:" + nsme.getMessage());
+ } catch (IllegalAccessException iae) {
+ throw new EvaluationException(this,
+ "IllegalAccessException:" + iae.toString());
+ } catch (InvocationTargetException ite) {
+ throw new EvaluationException(this,
+ "InvocationTargetException:" + ite.getMessage());
+ }
+ }
+
+ //result = Convert.toJSPType(result);
+ //} catch (ConversionException ce) {
+ //throw new EvaluationException(this, ce.getMessage());
+ //}
+ return result;
+ }
+
+ /**
+ * The getFeatureDescriptor method
+ *
+ *
+ * @param c
+ * @param key
+ *
+ * @return
+ *
+ * @throws IntrospectionException
+ *
+ */
+ private PropertyDescriptor getFeatureDescriptor(Class c, String key)
+ throws IntrospectionException {
+
+ BeanInfo beanInfo = Introspector.getBeanInfo(c);
+ PropertyDescriptor[] pda = beanInfo.getPropertyDescriptors();
+
+ for (int i = pda.length - 1; i >= 0; --i) {
+ PropertyDescriptor pd = pda[i];
+
+ if (pd.getName().equals(key)) {
+ return pd;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * The getAttribute method
+ *
+ *
+ * @param pd
+ * @param o
+ *
+ * @return
+ *
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ * @throws NoSuchMethodException
+ *
+ */
+ private Object getAttribute(PropertyDescriptor pd, Object o)
+ throws NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException {
+
+ Object result = null;
+ Method m = pd.getReadMethod();
+
+ m = getPublicMethod(m.getDeclaringClass(), m.getName(),
+ m.getParameterTypes());
+ result = m.invoke(o, null);
+
+ return result;
+ }
+
+ /**
+ * The getPublicMethod method
+ *
+ *
+ * @param c
+ * @param name
+ * @param paramTypes
+ *
+ * @return
+ *
+ * @throws NoSuchMethodException
+ *
+ */
+ private Method getPublicMethod(Class c, String name, Class[] paramTypes)
+ throws NoSuchMethodException {
+
+ Method result = null;
+
+ if ((c.getModifiers() & Modifier.PUBLIC) == 0) {
+ Class sc = c.getSuperclass();
+
+ if (sc != null) {
+ try {
+ result = getPublicMethod(sc, name, paramTypes);
+ } catch (NoSuchMethodException nsme) {
+
+ //Intentionally ignored and thrown later
+ }
+ }
+
+ if (result == null) {
+ Class[] interfaces = c.getInterfaces();
+
+ for (int i = 0; i < interfaces.length; i++) {
+ try {
+ result = getPublicMethod(interfaces[i], name,
+ paramTypes);
+ } catch (NoSuchMethodException nsme) {
+
+ //Intentionally ignored and thrown later
+ }
+ }
+ }
+ } else {
+
+ //It was public
+ result = c.getMethod(name, paramTypes);
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Introspectable.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Introspectable.java
new file mode 100644
index 0000000..32e5a51
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Introspectable.java
@@ -0,0 +1,160 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The Introspectable interface
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version 0.9
+ */
+public interface Introspectable {
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param parent
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, Object parent)
+ throws EvaluationException;
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param scope
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, int scope)
+ throws EvaluationException;
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/IntrospectionOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/IntrospectionOperator.java
new file mode 100644
index 0000000..d413329
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/IntrospectionOperator.java
@@ -0,0 +1,252 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The IntrospectionOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class IntrospectionOperator extends SimpleNode
+ implements Introspectable {
+
+ /**
+ * Used to create an instance of the IntrospectionOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public IntrospectionOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the IntrospectionOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public IntrospectionOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = jjtGetChild(0).toNormalizedString()
+ + getTokenImage(ParserConstants.INTROSPECT)
+ + jjtGetChild(1).toNormalizedString();
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object result =
+ ((Introspectable) jjtGetChild(1)).evaluate(pageContext, icontext,
+ leftSide);
+
+ return result;
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param scope
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, int scope)
+ throws EvaluationException {
+
+ Object leftSide = ((Identifier) jjtGetChild(0)).evaluate(pageContext,
+ icontext, scope);
+ Object result =
+ ((Introspectable) jjtGetChild(1)).evaluate(pageContext, icontext,
+ leftSide);
+
+ return result;
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param parent
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, Object parent)
+ throws EvaluationException {
+
+ Object leftSide =
+ ((Introspectable) jjtGetChild(0)).evaluate(pageContext, icontext,
+ parent);
+ Object result =
+ ((Introspectable) jjtGetChild(1)).evaluate(pageContext, icontext,
+ leftSide);
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/JJTParserState.java b/src/org/apache/taglibs/standard/lang/jpath/expression/JJTParserState.java
new file mode 100644
index 0000000..22187ba
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/JJTParserState.java
@@ -0,0 +1,254 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ *
+ */
+
+
+/* Generated By:JJTree: Do not edit this line. JJTParserState.java */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+class JJTParserState {
+
+ private java.util.Stack nodes;
+ private java.util.Stack marks;
+ private int sp; // number of nodes on stack
+ private int mk; // current mark
+ private boolean node_created;
+
+ JJTParserState() {
+
+ nodes = new java.util.Stack();
+ marks = new java.util.Stack();
+ sp = 0;
+ mk = 0;
+ }
+
+ /* Determines whether the current node was actually closed and
+ pushed. This should only be called in the final user action of a
+ node scope. */
+ boolean nodeCreated() {
+ return node_created;
+ }
+
+ /* Call this to reinitialize the node stack. It is called
+ automatically by the parser's ReInit() method. */
+ void reset() {
+
+ nodes.removeAllElements();
+ marks.removeAllElements();
+
+ sp = 0;
+ mk = 0;
+ }
+
+ /* Returns the root node of the AST. It only makes sense to call
+ this after a successful parse. */
+ Node rootNode() {
+ return (Node) nodes.elementAt(0);
+ }
+
+ /* Pushes a node on to the stack. */
+ void pushNode(Node n) {
+
+ nodes.push(n);
+
+ ++sp;
+ }
+
+ /* Returns the node on the top of the stack, and remove it from the
+ stack. */
+ Node popNode() {
+
+ if (--sp < mk) {
+ mk = ((Integer) marks.pop()).intValue();
+ }
+
+ return (Node) nodes.pop();
+ }
+
+ /* Returns the node currently on the top of the stack. */
+ Node peekNode() {
+ return (Node) nodes.peek();
+ }
+
+ /* Returns the number of children on the stack in the current node
+ scope. */
+ int nodeArity() {
+ return sp - mk;
+ }
+
+ void clearNodeScope(Node n) {
+
+ while (sp > mk) {
+ popNode();
+ }
+
+ mk = ((Integer) marks.pop()).intValue();
+ }
+
+ void openNodeScope(Node n) {
+
+ marks.push(new Integer(mk));
+
+ mk = sp;
+
+ n.jjtOpen();
+ }
+
+ /* A definite node is constructed from a specified number of
+ children. That number of nodes are popped from the stack and
+ made the children of the definite node. Then the definite node
+ is pushed on to the stack. */
+ void closeNodeScope(Node n, int num) {
+
+ mk = ((Integer) marks.pop()).intValue();
+
+ while (num-- > 0) {
+ Node c = popNode();
+
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, num);
+ }
+
+ n.jjtClose();
+ pushNode(n);
+
+ node_created = true;
+ }
+
+ /* A conditional node is constructed if its condition is true. All
+ the nodes that have been pushed since the node was opened are
+ made children of the the conditional node, which is then pushed
+ on to the stack. If the condition is false the node is not
+ constructed and they are left on the stack. */
+ void closeNodeScope(Node n, boolean condition) {
+
+ if (condition) {
+ int a = nodeArity();
+
+ mk = ((Integer) marks.pop()).intValue();
+
+ while (a-- > 0) {
+ Node c = popNode();
+
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, a);
+ }
+
+ n.jjtClose();
+ pushNode(n);
+
+ node_created = true;
+ } else {
+ mk = ((Integer) marks.pop()).intValue();
+ node_created = false;
+ }
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/LastFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/LastFunction.java
new file mode 100644
index 0000000..03117eb
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/LastFunction.java
@@ -0,0 +1,197 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The LastFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class LastFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the LastFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public LastFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the LastFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public LastFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "last()";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ if (icontext == null) {
+ throw new EvaluationException(this,
+ "The last() function can "
+ + "only be used in the context of a predicate");
+ }
+
+ return new Double(icontext.getLast());
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/LessThanEqualOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/LessThanEqualOperator.java
new file mode 100644
index 0000000..0029214
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/LessThanEqualOperator.java
@@ -0,0 +1,240 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The LessThanEqualOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class LessThanEqualOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the LessThanEqualOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public LessThanEqualOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the LessThanEqualOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public LessThanEqualOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.LTE) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ boolean result;
+
+ try {
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object rightSide = jjtGetChild(1).evaluate(pageContext, icontext);
+
+ if ((leftSide instanceof Boolean)
+ || (rightSide instanceof Boolean)
+ || (leftSide instanceof Double)
+ || (rightSide instanceof Double)
+ || (leftSide instanceof String)
+ || (rightSide instanceof String)) {
+ double leftResult =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).doubleValue();
+ double rightResult =
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).doubleValue();
+
+ result = leftResult <= rightResult;
+ } else if ((leftSide instanceof Comparable)
+ && (rightSide instanceof Comparable)) {
+ try {
+ int comp = ((Comparable) leftSide).compareTo(rightSide);
+
+ if (comp <= 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException cce) {
+ throw new EvaluationException(this,
+ "child nodes ["
+ + jjtGetChild(0).toNormalizedString() + "] and ["
+ + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } else {
+ throw new EvaluationException(this,
+ "child nodes [" + jjtGetChild(0).toNormalizedString()
+ + "] and [" + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/LessThanOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/LessThanOperator.java
new file mode 100644
index 0000000..9d9abd5
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/LessThanOperator.java
@@ -0,0 +1,240 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The LessThanOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class LessThanOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the LessThanOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public LessThanOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the LessThanOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public LessThanOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.LT) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ boolean result;
+
+ try {
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object rightSide = jjtGetChild(1).evaluate(pageContext, icontext);
+
+ if ((leftSide instanceof Boolean)
+ || (rightSide instanceof Boolean)
+ || (leftSide instanceof Double)
+ || (rightSide instanceof Double)
+ || (leftSide instanceof String)
+ || (rightSide instanceof String)) {
+ double leftResult =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).doubleValue();
+ double rightResult =
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).doubleValue();
+
+ result = leftResult < rightResult;
+ } else if ((leftSide instanceof Comparable)
+ && (rightSide instanceof Comparable)) {
+ try {
+ int comp = ((Comparable) leftSide).compareTo(rightSide);
+
+ if (comp < 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException cce) {
+ throw new EvaluationException(this,
+ "child nodes ["
+ + jjtGetChild(0).toNormalizedString() + "] and ["
+ + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } else {
+ throw new EvaluationException(this,
+ "child nodes [" + jjtGetChild(0).toNormalizedString()
+ + "] and [" + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ListLiteral.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ListLiteral.java
new file mode 100644
index 0000000..61cbf8e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ListLiteral.java
@@ -0,0 +1,217 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+/**
+ * The ListLiteral class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ListLiteral extends SimpleNode {
+
+ /**
+ * Used to create an instance of the ListLiteral class
+ *
+ *
+ * @param id
+ *
+ */
+ public ListLiteral(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the ListLiteral class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public ListLiteral(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "{";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + "}";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Collection c = new ArrayList();
+
+ for (int i = 0; i < jjtGetNumChildren(); i++) {
+ c.add(jjtGetChild(i).evaluate(pageContext, icontext));
+ }
+
+ return c;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/MethodCall.java b/src/org/apache/taglibs/standard/lang/jpath/expression/MethodCall.java
new file mode 100644
index 0000000..b441950
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/MethodCall.java
@@ -0,0 +1,379 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.http.*;
+import javax.servlet.*;
+import java.beans.*;
+import java.lang.reflect.*;
+
+/**
+ * The MethodCall class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class MethodCall extends SimpleNode implements Introspectable {
+
+ /**
+ * Used to create an instance of the MethodCall class
+ *
+ *
+ * @param id
+ *
+ */
+ public MethodCall(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the MethodCall class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public MethodCall(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param scope
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, int scope)
+ throws EvaluationException {
+ throw new EvaluationException(this,
+ "A MethodCall must be called on " + "another object");
+ }
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ * @param parent
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(
+ PageContext pageContext, IterationContext icontext, Object parent)
+ throws EvaluationException {
+
+ Object result = null;
+
+ //try {
+ String methodName = ((Identifier) jjtGetChild(0)).val;
+
+ if (parent != null) {
+ try {
+ MethodDescriptor md = getFeatureDescriptor(parent.getClass(),
+ methodName);
+ Object[] args = new Object[jjtGetNumChildren() - 1];
+
+ for (int i = 1; i < jjtGetNumChildren(); i++) {
+ args[i - 1] = jjtGetChild(i).evaluate(pageContext,
+ icontext);
+ }
+
+ if (md != null) {
+
+ //result = getAttribute(md, parent, args);
+ result = tempGetAttribute(parent, methodName, args);
+ }
+ } catch (IntrospectionException ie) {
+ throw new EvaluationException(this,
+ "Introspection Exception:" + ie.getMessage());
+ } catch (NoSuchMethodException nsme) {
+ throw new EvaluationException(this,
+ "NoSuchMethodException:" + nsme.getMessage());
+ } catch (IllegalAccessException iae) {
+ throw new EvaluationException(this,
+ "IllegalAccessException:" + iae.getMessage());
+ } catch (InvocationTargetException ite) {
+ throw new EvaluationException(this,
+ "InvocationTargetException:" + ite.getMessage());
+ }
+ }
+
+ //result = Convert.toJSPType(result);
+ //} catch (ConversionException ce) {
+ //throw new EvaluationException(this, ce.getMessage());
+ //}
+ return result;
+ }
+
+ /**
+ * The getFeatureDescriptor method
+ *
+ *
+ * @param c
+ * @param key
+ *
+ * @return
+ *
+ * @throws IntrospectionException
+ *
+ */
+ private MethodDescriptor getFeatureDescriptor(Class c, String key)
+ throws IntrospectionException {
+
+ BeanInfo beanInfo = Introspector.getBeanInfo(c);
+ MethodDescriptor[] mda = beanInfo.getMethodDescriptors();
+
+ for (int i = mda.length - 1; i >= 0; --i) {
+ MethodDescriptor md = mda[i];
+
+ if (md.getName().equals(key)) {
+ return md;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * The getAttribute method
+ *
+ *
+ * @param md
+ * @param o
+ * @param args
+ *
+ * @return
+ *
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ * @throws NoSuchMethodException
+ *
+ */
+ private Object getAttribute(MethodDescriptor md, Object o, Object[] args)
+ throws NoSuchMethodException, IllegalAccessException,
+ InvocationTargetException {
+
+ Object result = null;
+ Method m = md.getMethod();
+
+ result = m.invoke(o, args);
+
+ return result;
+ }
+
+ /**
+ * The tempGetAttribute method
+ *
+ *
+ * @param parent
+ * @param key
+ * @param args
+ *
+ * @return
+ *
+ * @throws IllegalAccessException
+ * @throws IntrospectionException
+ * @throws InvocationTargetException
+ * @throws NoSuchMethodException
+ *
+ */
+ private Object tempGetAttribute(Object parent, String key, Object[] args)
+ throws IntrospectionException, NoSuchMethodException,
+ IllegalAccessException, InvocationTargetException {
+
+ Object result;
+ Class c = parent.getClass();
+ Method[] methods = c.getMethods();
+ Method m = null;
+
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(key)) {
+ m = methods[i];
+ }
+ }
+
+ m = getPublicMethod(c, m.getName(), m.getParameterTypes());
+ result = m.invoke(parent, args);
+
+ return result;
+ }
+
+ /**
+ * The getPublicMethod method
+ *
+ *
+ * @param c
+ * @param name
+ * @param paramTypes
+ *
+ * @return
+ *
+ * @throws NoSuchMethodException
+ *
+ */
+ private Method getPublicMethod(Class c, String name, Class[] paramTypes)
+ throws NoSuchMethodException {
+
+ Method result = null;
+
+ if ((c.getModifiers() & Modifier.PUBLIC) == 0) {
+ Class sc = c.getSuperclass();
+
+ if (sc != null) {
+ try {
+ result = getPublicMethod(sc, name, paramTypes);
+ } catch (NoSuchMethodException nsme) {
+
+ //Intentionally ignored and thrown later
+ }
+ }
+
+ if (result == null) {
+ Class[] interfaces = c.getInterfaces();
+
+ for (int i = 0; i < interfaces.length; i++) {
+ try {
+ result = getPublicMethod(interfaces[i], name,
+ paramTypes);
+ } catch (NoSuchMethodException nsme) {
+
+ //Intentionally ignored and thrown later
+ }
+ }
+ }
+ } else {
+
+ //It was public
+ result = c.getMethod(name, paramTypes);
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/MethodCalls.jjt b/src/org/apache/taglibs/standard/lang/jpath/expression/MethodCalls.jjt
new file mode 100644
index 0000000..860560e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/MethodCalls.jjt
@@ -0,0 +1,478 @@
+options {
+ MULTI=true;
+ STATIC=false;
+ NODE_PREFIX="";
+ NODE_SCOPE_HOOK=true;
+}
+
+PARSER_BEGIN(Parser)
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+import java.io.StringReader;
+
+public class Parser {
+ public static Expression parse(String expressionText)
+ throws ParseException {
+ Parser parser;
+ Expression expression;
+ parser = new Parser(new StringReader(expressionText));
+ parser.Expression();
+ expression = (Expression)parser.jjtree.rootNode();
+ return expression;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode)n).firstToken = getToken(0);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode)n).lastToken = getToken(0);
+ }
+
+}
+
+PARSER_END(Parser)
+
+
+/*----------------------------*/
+/* Skip Whitespace everywhere */
+/*----------------------------*/
+SKIP :
+{
+ " "
+|
+ "\t"
+|
+ "\r"
+|
+ "\n"
+|
+ "\f"
+}
+
+
+/*-----------------*/
+/* Operator Tokens */
+/*-----------------*/
+
+
+TOKEN:
+{
+ <DIV:"/">
+|
+ <MULT:"*">
+|
+ <MOD:"%">
+|
+ <PLUS:"+">
+|
+ <MINUS:"-">
+|
+ <EQ:"=">
+|
+ <NEQ:"!=">
+|
+ <LT:"<">
+|
+ <LTE:"<=">
+|
+ <GT:">">
+|
+ <GTE:">=">
+|
+ <INTROSPECT:".">
+|
+ <UNION:"|">
+|
+ <SCOPE_LIMIT:":">
+|
+ <AND:"and">
+|
+ <OR:"or">
+|
+ <LIST_BEGIN:"{">
+|
+ <LIST_END:"}">
+|
+ <SEPARATOR:",">
+|
+ <FUNCTION_BEGIN:"(">
+|
+ <FUNCTION_END:")">
+|
+ <PREDICATE_BEGIN:"[">
+|
+ <PREDICATE_END:"]">
+}
+
+/*
+ * Expression syntax follows.
+ */
+
+void Expression() #Expression(1):
+{}
+{
+ Expr() <EOF>
+}
+
+/* [1] Expr ::= OrExpr */
+void Expr() #void:
+{}
+{
+ OrExpr()
+}
+
+
+/* [2] OrExpr ::= AndExpr ( 'or' AndExpr )* */
+void OrExpr() #void :
+{}
+{
+ AndExpr()
+ ( <OR> AndExpr() #OrOperator(2) )*
+}
+
+/* [3] AndExpr ::= EqualityExpr ( 'and' EqualityExpr )* */
+void AndExpr() #void :
+{}
+{
+ EqualityExpr()
+ ( <AND> EqualityExpr() #AndOperator(2) )*
+}
+
+/* [4] EqualityExpr ::= RelationalExpr ( ( '=' | '!-' ) RelationExpr )* */
+void EqualityExpr() #void :
+{}
+{
+ RelationalExpr()
+ (
+ <EQ> RelationalExpr() #EqualsOperator(2)
+ |
+ <NEQ> RelationalExpr() #NotEqualsOperator(2)
+ )*
+}
+
+/* [5] RelationalExpr ::= AdditiveExpr ( ( '<' | '>' | '<=' | '>=' ) AdditiveExpr )* */
+void RelationalExpr() #void :
+{}
+{
+ AdditiveExpr()
+ (
+ <LT> AdditiveExpr() #LessThanOperator(2)
+ |
+ <GT> AdditiveExpr() #GreaterThanOperator(2)
+ |
+ <LTE> AdditiveExpr() #LessThanEqualOperator(2)
+ |
+ <GTE> AdditiveExpr() #GreaterThanEqualOperator(2)
+ )*
+}
+
+/* [6] AdditiveExpr ::= MultiplicitiveExpr ( ( '+' | '-' ) MultiplicitiveExpr )* */
+void AdditiveExpr() #void :
+{}
+{
+ MultiplicativeExpr()
+ (
+ <PLUS> MultiplicativeExpr() #AdditionOperator(2)
+ |
+ <MINUS> MultiplicativeExpr() #SubtractionOperator(2)
+ )*
+}
+
+/* [7] MultiplicitiveExpr ::= UnaryExpr ( ( '*' | '/' | '%' ) UnaryExpr )* */
+void MultiplicativeExpr() #void :
+{}
+{
+ UnaryExpr()
+ (
+ <MULT> UnaryExpr() #MultiplicationOperator(2)
+ |
+ <DIV> UnaryExpr() #DivisionOperator(2)
+ |
+ <MOD> UnaryExpr() #ModulusOperator(2)
+ )*
+}
+
+/* [7] UnaryExpr ::= UnionExpr | '-' UnaryExpr */
+void UnaryExpr() #void :
+{}
+{
+ UnionExpr()
+ | <MINUS> UnaryExpr()
+}
+
+/* [7] UnionExpr ::= IntrospectiveExpr ( '|' IntrospectiveExpr )* */
+void UnionExpr() #void :
+{}
+{
+ IntrospectiveExpr() ( <UNION> IntrospectiveExpr() #UnionOperator(2) )*
+}
+
+/* [7] IntrospectiveExpr ::= PathExpr ( '.' PathExpr )* */
+void IntrospectiveExpr() #void :
+{}
+{
+ PathExpr()
+ (
+ <INTROSPECT> PathExpr() #IntrospectionOperator(2)
+ )*
+}
+
+/* [7] PathExpr ::= FilterExpr */
+void PathExpr() #void :
+{}
+{
+ FilterExpr()
+}
+
+/* [7] FilterExpr ::= PrimaryExpr ( Predicate )* */
+void FilterExpr() #void :
+{}
+{
+PrimaryExpr() ( Predicate() #FilterOperator(2) )*
+}
+
+
+/* [] Predicate ::= '[' PredicateExpr ']' */
+void Predicate() #Predicate(1) :
+{}
+{
+ <PREDICATE_BEGIN> PredicateExpr() <PREDICATE_END>
+}
+
+/* [] PredicateExpr ::= Expr */
+void PredicateExpr() #void :
+{}
+{
+ Expr()
+}
+
+
+/* [7] PrimaryExpr ::= Literal | '(' Expr ')' | FunctionCall | ScopeLimitExpr | Identifier */
+void PrimaryExpr() #void :
+{}
+{
+ Literal()
+|
+ "(" Expr() ")"
+|
+ LOOKAHEAD(2) Function()
+|
+ ScopeLimitExpr()
+|
+ LOOKAHEAD(2) MethodCall()
+|
+ LOOKAHEAD(2) Identifier()
+}
+
+void MethodCall() #void :
+{
+}
+{
+ ( Identifier() <FUNCTION_BEGIN> [ Argument() (<SEPARATOR> Argument() )* ] <FUNCTION_END> ) #MethodCall(>0)
+}
+
+/* FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' */
+/* FunctionName ::= 'boolean' | 'number' | 'string' | 'not' | ... */
+void Function() #void :
+{
+}
+{
+ "boolean(" Argument() <FUNCTION_END> #BooleanFunction(1)
+ |
+ "number(" Argument() <FUNCTION_END> #NumberFunction(1)
+ |
+ "string(" Argument() <FUNCTION_END> #StringFunction(1)
+ |
+ "not(" Argument() <FUNCTION_END> #NotFunction(1)
+ |
+ "floor(" Argument() <FUNCTION_END> #FloorFunction(1)
+ |
+ "ceiling(" Argument() <FUNCTION_END> #CeilingFunction(1)
+ |
+ "round(" Argument() <FUNCTION_END> #RoundFunction(1)
+ |
+ ( "format-number(" Argument() <SEPARATOR> Argument() ( <SEPARATOR> Argument() )? <FUNCTION_END> ) #FormatNumberFunction(>1)
+ |
+ ( "concat(" Argument() (<SEPARATOR> Argument())+ <FUNCTION_END> ) #ConcatFunction(>1)
+ |
+ "encode-url(" Argument() <FUNCTION_END> #EncodeUrlFunction(1)
+ |
+ "encode-html(" Argument() <FUNCTION_END> #EncodeHtmlFunction(1)
+ |
+ "string-length(" Argument() <FUNCTION_END> #StringLengthFunction(1)
+ |
+ ( "substring(" Argument() <SEPARATOR> Argument() (<SEPARATOR> Argument() )? <FUNCTION_END> ) #SubstringFunction(>1)
+ |
+ ( "starts-with(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #StartsWithFunction(2)
+ |
+ ( "contains(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #ContainsFunction(2)
+ |
+ ( "substring-before(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #SubstringBeforeFunction(2)
+ |
+ ( "substring-after(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #SubstringAfterFunction(2)
+ |
+ ( "translate(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #TranslateFunction(3)
+ |
+ "position(" <FUNCTION_END> #PositionFunction(0)
+ |
+ "current(" <FUNCTION_END> #CurrentFunction(0)
+ |
+ "last(" <FUNCTION_END> #LastFunction(0)
+ |
+ "count(" Argument() <FUNCTION_END> #CountFunction(1)
+ |
+ "sum(" Argument() <FUNCTION_END> #SumFunction(1)
+ |
+ "now(" <FUNCTION_END> #NowFunction(0)
+ |
+ ( "date(" Argument() (<SEPARATOR> Argument())+ <FUNCTION_END> ) #DateFunction(>1)
+ |
+ ( "format-date(" Argument() <SEPARATOR> Argument() ( <SEPARATOR> Argument() )? <FUNCTION_END> ) #FormatDateFunction(>1)
+ |
+ ( "roll-date(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #RollDateFunction(3)
+ |
+ ( "add-date(" Argument() <SEPARATOR> Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #AddDateFunction(3)
+ |
+ ( "tokenize(" Argument() <SEPARATOR> Argument() <FUNCTION_END> ) #TokenizeFunction(2)
+ |
+ ( Identifier() ":" Identifier() <FUNCTION_BEGIN> [ Argument() (<SEPARATOR> Argument() )* ] <FUNCTION_END> ) #UserFunction(>1)
+}
+
+/* [] Argument ::= Expr */
+void Argument() #void :
+{
+}
+{
+ Expr()
+}
+
+/* [] ScopeLimitExpr ::= ScopeLimitName Identifier */
+void ScopeLimitExpr() #void :
+{
+ Token t;
+}
+{
+ ScopeLimitName()
+ (
+ Identifier() #ScopeLimitOperator(2)
+ )
+}
+
+
+/* [] Identifier ::= Letter ( Letter | Digit )* */
+void Identifier() :
+{
+ Token t;
+}
+{
+ t = <IDENTIFIER>
+ {
+ jjtThis.val = t.image;
+ jjtThis.image = t.image;
+ jjtThis.beginColumn = t.beginColumn;
+ jjtThis.endColumn = t.endColumn;
+ jjtThis.beginLine = t.beginLine;
+ jjtThis.endLine = t.endLine;
+ }
+}
+
+/* ScopeLimitName ::= 'page' | 'request' | 'session' | 'application' | ... */
+void ScopeLimitName() :
+{
+ Token t;
+}
+{
+ t = < SCOPE_LIMIT_NAME: ("page:" | "request:" | "session:" | "application:") > { jjtThis.val = t.image; }
+}
+
+/* Literal ::= UnaryLiteral | ListLiteral */
+void Literal() #void :
+{}
+{
+ UnaryLiteral()
+ |
+ ListLiteral()
+}
+
+/* UnaryLiteral ::= BooleanLiteral | NumberLiteral | StringLiteral */
+void UnaryLiteral() #void :
+{
+ Token t;
+}
+{
+ (
+ t=<BOOLEAN_LITERAL>
+ {
+ jjtThis.val = Boolean.valueOf(t.image).booleanValue();
+ }
+ )#BooleanLiteral
+|
+ (
+ t=<NUMBER_LITERAL>
+ {
+ jjtThis.val = Double.parseDouble(t.image);
+ }
+ )#NumberLiteral
+|
+ (
+ t=<STRING_LITERAL>
+ {
+ jjtThis.val = t.image.substring(1, (t.image.length() - 1));
+ }
+ )#StringLiteral
+}
+
+/* ListLiteral ::= '{' UnaryExpr ( ',' UnaryExpr )* '}' */
+void ListLiteral() :
+{}
+{
+ <LIST_BEGIN> Expr() ( <SEPARATOR> Expr() )* <LIST_END>#ListLiteral(>1)
+}
+
+
+/*-----------------------------------------------*/
+/* Unambigious Tokens (Number, Literal) */
+/*-----------------------------------------------*/
+
+TOKEN:
+{
+
+/* [] BooleanLiteral ::= "true" | "false" */
+ <BOOLEAN_LITERAL :
+ "true"
+ |
+ "false"
+ >
+
+|
+
+/* [] StringLiteral ::= '"' [^"]* '"' | "'" [^']* "'" */
+ <STRING_LITERAL :
+ "\"" (~["\""])* "\""
+ |
+ "'" (~["'"] )* "'"
+ >
+
+|
+
+/* [] Digit ::= [0-9]+ */
+ <#DIGIT :
+ ["0"-"9"]
+ >
+
+|
+
+/* [] NumberLiteral ::= Digits ( '.' Digits? )? | '.' Digits */
+ <NUMBER_LITERAL :
+ ("-")? (<DIGIT>)+ ("." ( (<DIGIT>)+ )? )?
+|
+ ("-")? "." (<DIGIT>)+
+ >
+
+|
+ < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+/* [] Letter ::= ['a'-'z'], ['A'-'Z'] */
+ < #LETTER: [ "a"-"z", "A"-"Z" ] >
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ModulusOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ModulusOperator.java
new file mode 100644
index 0000000..91e1430
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ModulusOperator.java
@@ -0,0 +1,208 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The ModulusOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ModulusOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the ModulusOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public ModulusOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the ModulusOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public ModulusOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.MOD) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ double leftSide =
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).doubleValue();
+ double rightSide =
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).doubleValue();
+
+ result = new Double(leftSide % rightSide);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/MultiplicationOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/MultiplicationOperator.java
new file mode 100644
index 0000000..e65994e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/MultiplicationOperator.java
@@ -0,0 +1,209 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.math.*;
+
+/**
+ * The MultiplicationOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class MultiplicationOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the MultiplicationOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public MultiplicationOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the MultiplicationOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public MultiplicationOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.MULT) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ BigDecimal leftSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).toString());
+ BigDecimal rightSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).toString());
+
+ result = new Double((leftSide.multiply(rightSide)).doubleValue());
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Node.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Node.java
new file mode 100644
index 0000000..2e20ea7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Node.java
@@ -0,0 +1,229 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/* All AST nodes must implement this interface. It provides basic
+ machinery for constructing the parent and child relationships
+ between nodes. */
+
+/**
+ * The Node interface
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version 0.9
+ */
+public interface Node {
+
+ /**
+ * This method is called after the node has been made the current
+ * node. It indicates that child nodes can now be added to it.
+ */
+ public void jjtOpen();
+
+ /**
+ * This method is called after all the child nodes have been
+ * added.
+ */
+ public void jjtClose();
+
+ /**
+ * This pair of methods are used to inform the node of its
+ * parent.
+ *
+ * @param n
+ */
+ public void jjtSetParent(Node n);
+
+ /**
+ * The jjtGetParent method
+ *
+ *
+ * @return
+ *
+ */
+ public Node jjtGetParent();
+
+ /**
+ * This method tells the node to add its argument to the node's
+ * list of children.
+ *
+ * @param n
+ * @param i
+ */
+ public void jjtAddChild(Node n, int i);
+
+ /**
+ * This method returns a child node. The children are numbered
+ * from zero, left to right.
+ *
+ * @param i
+ *
+ * @return
+ */
+ public Node jjtGetChild(int i);
+
+ /**
+ * Return the number of children the node has.
+ *
+ * @return
+ */
+ public int jjtGetNumChildren();
+
+ /* Added by Scott Hasse */
+
+ /**
+ * The toNormalizedString method
+ *
+ *
+ * @return
+ *
+ */
+ public String toNormalizedString();
+
+ /**
+ * The evaluate method
+ *
+ *
+ * @param pageContext
+ * @param icontext
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException;
+
+ /**
+ * The validate method
+ *
+ *
+ * @throws ValidationException
+ *
+ */
+ public void validate() throws ValidationException;
+
+ /**
+ * The simplify method
+ *
+ *
+ * @return
+ *
+ */
+ public Node simplify();
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/NotEqualsOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/NotEqualsOperator.java
new file mode 100644
index 0000000..fc23cdf
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/NotEqualsOperator.java
@@ -0,0 +1,239 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The NotEqualsOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class NotEqualsOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the NotEqualsOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public NotEqualsOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the NotEqualsOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public NotEqualsOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.NEQ) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ boolean result;
+
+ try {
+ Object leftSide = jjtGetChild(0).evaluate(pageContext, icontext);
+ Object rightSide = jjtGetChild(1).evaluate(pageContext, icontext);
+
+ if ((leftSide instanceof Boolean)
+ || (rightSide instanceof Boolean)) {
+ result = (Convert.toBoolean(leftSide).booleanValue()
+ != Convert.toBoolean(rightSide).booleanValue());
+ } else if ((leftSide instanceof Double)
+ || (rightSide instanceof Double)) {
+ result = (Convert.toDouble(leftSide).doubleValue()
+ != Convert.toDouble(rightSide).doubleValue());
+ } else if ((leftSide instanceof String)
+ || (rightSide instanceof String)) {
+ result =
+ !Convert.toString(leftSide)
+ .equals(Convert.toString(rightSide));
+ } else if ((leftSide instanceof Comparable)
+ && (rightSide instanceof Comparable)) {
+ try {
+ int comp = ((Comparable) leftSide).compareTo(rightSide);
+
+ if (comp != 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException cce) {
+ throw new EvaluationException(this,
+ "child nodes ["
+ + jjtGetChild(0).toNormalizedString() + "] and ["
+ + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } else {
+ throw new EvaluationException(this,
+ "child nodes [" + jjtGetChild(0).toNormalizedString()
+ + "] and [" + jjtGetChild(1).toNormalizedString()
+ + "] cannot be compared");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/NotFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/NotFunction.java
new file mode 100644
index 0000000..0f16de1
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/NotFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The NotFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class NotFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the NotFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public NotFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the NotFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public NotFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "not(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Boolean result;
+
+ try {
+ result = Convert.toBoolean(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Boolean(result.booleanValue() == false);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/NotOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/NotOperator.java
new file mode 100644
index 0000000..c5767ee
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/NotOperator.java
@@ -0,0 +1,149 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The NotOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class NotOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the NotOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public NotOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the NotOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public NotOperator(Parser p, int id) {
+ super(p, id);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/NowFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/NowFunction.java
new file mode 100644
index 0000000..94f9ed5
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/NowFunction.java
@@ -0,0 +1,191 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+/**
+ * The NowFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class NowFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the NowFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public NowFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the NowFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public NowFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "now()";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return GregorianCalendarAdapter.adapt(new GregorianCalendar());
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/NumberFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/NumberFunction.java
new file mode 100644
index 0000000..441c466
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/NumberFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The NumberFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class NumberFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the NumberFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public NumberFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the NumberFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public NumberFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "string(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ result = Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/NumberLiteral.java b/src/org/apache/taglibs/standard/lang/jpath/expression/NumberLiteral.java
new file mode 100644
index 0000000..e2bf10d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/NumberLiteral.java
@@ -0,0 +1,187 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The NumberLiteral class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class NumberLiteral extends SimpleNode {
+
+ protected double val;
+
+ /**
+ * Used to create an instance of the NumberLiteral class
+ *
+ *
+ * @param id
+ *
+ */
+ public NumberLiteral(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the NumberLiteral class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public NumberLiteral(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+ return String.valueOf(val);
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return new Double(val);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/OrOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/OrOperator.java
new file mode 100644
index 0000000..1ff9c70
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/OrOperator.java
@@ -0,0 +1,208 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The OrOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class OrOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the OrOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public OrOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the OrOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public OrOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.OR) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Boolean result;
+
+ try {
+ boolean leftSide =
+ Convert.toBoolean(jjtGetChild(0).evaluate(pageContext,
+ icontext)).booleanValue();
+ boolean rightSide =
+ Convert.toBoolean(jjtGetChild(1).evaluate(pageContext,
+ icontext)).booleanValue();
+
+ result = new Boolean(leftSide || rightSide);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ParseException.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ParseException.java
new file mode 100644
index 0000000..98f7b21
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ParseException.java
@@ -0,0 +1,246 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Parser.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Parser.java
new file mode 100644
index 0000000..84de1ed
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Parser.java
@@ -0,0 +1,2759 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+import java.io.StringReader;
+
+public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
+ protected JJTParserState jjtree = new JJTParserState();public static Expression parse(String expressionText)
+ throws ParseException {
+ Parser parser;
+ Expression expression;
+ parser = new Parser(new StringReader(expressionText));
+ parser.Expression();
+ expression = (Expression)parser.jjtree.rootNode();
+ return expression;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode)n).firstToken = getToken(0);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode)n).lastToken = getToken(0);
+ }
+
+/*
+ * Expression syntax follows.
+ */
+ final public void Expression() throws ParseException {
+ /*@bgen(jjtree) #Expression( 1) */
+ Expression jjtn000 = new Expression(JJTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Expr();
+ jj_consume_token(0);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, 1);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+/* [1] Expr ::= OrExpr */
+ final public void Expr() throws ParseException {
+ OrExpr();
+ }
+
+/* [2] OrExpr ::= AndExpr ( 'or' AndExpr )* */
+ final public void OrExpr() throws ParseException {
+ AndExpr();
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OR:
+ ;
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ break label_1;
+ }
+ jj_consume_token(OR);
+ OrOperator jjtn001 = new OrOperator(JJTOROPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ AndExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ }
+ }
+
+/* [3] AndExpr ::= EqualityExpr ( 'and' EqualityExpr )* */
+ final public void AndExpr() throws ParseException {
+ EqualityExpr();
+ label_2:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case AND:
+ ;
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ break label_2;
+ }
+ jj_consume_token(AND);
+ AndOperator jjtn001 = new AndOperator(JJTANDOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ EqualityExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ }
+ }
+
+/* [4] EqualityExpr ::= RelationalExpr ( ( '=' | '!-' ) RelationExpr )* */
+ final public void EqualityExpr() throws ParseException {
+ RelationalExpr();
+ label_3:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EQ:
+ case NEQ:
+ ;
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ break label_3;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EQ:
+ jj_consume_token(EQ);
+ EqualsOperator jjtn001 = new EqualsOperator(JJTEQUALSOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ RelationalExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ break;
+ case NEQ:
+ jj_consume_token(NEQ);
+ NotEqualsOperator jjtn002 = new NotEqualsOperator(JJTNOTEQUALSOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ try {
+ RelationalExpr();
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte002;}
+ }
+ if (jjte002 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte002;}
+ }
+ {if (true) throw (Error)jjte002;}
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+/* [5] RelationalExpr ::= AdditiveExpr ( ( '<' | '>' | '<=' | '>=' ) AdditiveExpr )* */
+ final public void RelationalExpr() throws ParseException {
+ AdditiveExpr();
+ label_4:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LT:
+ case LTE:
+ case GT:
+ case GTE:
+ ;
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ break label_4;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LT:
+ jj_consume_token(LT);
+ LessThanOperator jjtn001 = new LessThanOperator(JJTLESSTHANOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ AdditiveExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ break;
+ case GT:
+ jj_consume_token(GT);
+ GreaterThanOperator jjtn002 = new GreaterThanOperator(JJTGREATERTHANOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ try {
+ AdditiveExpr();
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte002;}
+ }
+ if (jjte002 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte002;}
+ }
+ {if (true) throw (Error)jjte002;}
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+ break;
+ case LTE:
+ jj_consume_token(LTE);
+ LessThanEqualOperator jjtn003 = new LessThanEqualOperator(JJTLESSTHANEQUALOPERATOR);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ try {
+ AdditiveExpr();
+ } catch (Throwable jjte003) {
+ if (jjtc003) {
+ jjtree.clearNodeScope(jjtn003);
+ jjtc003 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte003 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte003;}
+ }
+ if (jjte003 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte003;}
+ }
+ {if (true) throw (Error)jjte003;}
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, 2);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+ break;
+ case GTE:
+ jj_consume_token(GTE);
+ GreaterThanEqualOperator jjtn004 = new GreaterThanEqualOperator(JJTGREATERTHANEQUALOPERATOR);
+ boolean jjtc004 = true;
+ jjtree.openNodeScope(jjtn004);
+ jjtreeOpenNodeScope(jjtn004);
+ try {
+ AdditiveExpr();
+ } catch (Throwable jjte004) {
+ if (jjtc004) {
+ jjtree.clearNodeScope(jjtn004);
+ jjtc004 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte004 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte004;}
+ }
+ if (jjte004 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte004;}
+ }
+ {if (true) throw (Error)jjte004;}
+ } finally {
+ if (jjtc004) {
+ jjtree.closeNodeScope(jjtn004, 2);
+ jjtreeCloseNodeScope(jjtn004);
+ }
+ }
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+/* [6] AdditiveExpr ::= MultiplicitiveExpr ( ( '+' | '-' ) MultiplicitiveExpr )* */
+ final public void AdditiveExpr() throws ParseException {
+ MultiplicativeExpr();
+ label_5:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ ;
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ break label_5;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ AdditionOperator jjtn001 = new AdditionOperator(JJTADDITIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ MultiplicativeExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ SubtractionOperator jjtn002 = new SubtractionOperator(JJTSUBTRACTIONOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ try {
+ MultiplicativeExpr();
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte002;}
+ }
+ if (jjte002 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte002;}
+ }
+ {if (true) throw (Error)jjte002;}
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+/* [7] MultiplicitiveExpr ::= UnaryExpr ( ( '*' | '/' | '%' ) UnaryExpr )* */
+ final public void MultiplicativeExpr() throws ParseException {
+ UnaryExpr();
+ label_6:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DIV:
+ case MULT:
+ case MOD:
+ ;
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ break label_6;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MULT:
+ jj_consume_token(MULT);
+ MultiplicationOperator jjtn001 = new MultiplicationOperator(JJTMULTIPLICATIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ UnaryExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ break;
+ case DIV:
+ jj_consume_token(DIV);
+ DivisionOperator jjtn002 = new DivisionOperator(JJTDIVISIONOPERATOR);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ try {
+ UnaryExpr();
+ } catch (Throwable jjte002) {
+ if (jjtc002) {
+ jjtree.clearNodeScope(jjtn002);
+ jjtc002 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte002 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte002;}
+ }
+ if (jjte002 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte002;}
+ }
+ {if (true) throw (Error)jjte002;}
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 2);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+ break;
+ case MOD:
+ jj_consume_token(MOD);
+ ModulusOperator jjtn003 = new ModulusOperator(JJTMODULUSOPERATOR);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ try {
+ UnaryExpr();
+ } catch (Throwable jjte003) {
+ if (jjtc003) {
+ jjtree.clearNodeScope(jjtn003);
+ jjtc003 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte003 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte003;}
+ }
+ if (jjte003 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte003;}
+ }
+ {if (true) throw (Error)jjte003;}
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, 2);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+/* [7] UnaryExpr ::= UnionExpr | '-' UnaryExpr */
+ final public void UnaryExpr() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LIST_BEGIN:
+ case FUNCTION_BEGIN:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case SCOPE_LIMIT_NAME:
+ case BOOLEAN_LITERAL:
+ case STRING_LITERAL:
+ case NUMBER_LITERAL:
+ case IDENTIFIER:
+ UnionExpr();
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ UnaryExpr();
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/* [7] UnionExpr ::= IntrospectiveExpr ( '|' IntrospectiveExpr )* */
+ final public void UnionExpr() throws ParseException {
+ IntrospectiveExpr();
+ label_7:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case UNION:
+ ;
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ break label_7;
+ }
+ jj_consume_token(UNION);
+ UnionOperator jjtn001 = new UnionOperator(JJTUNIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ IntrospectiveExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ }
+ }
+
+/* [7] IntrospectiveExpr ::= PathExpr ( '.' PathExpr )* */
+ final public void IntrospectiveExpr() throws ParseException {
+ PathExpr();
+ label_8:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTROSPECT:
+ ;
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ break label_8;
+ }
+ jj_consume_token(INTROSPECT);
+ IntrospectionOperator jjtn001 = new IntrospectionOperator(JJTINTROSPECTIONOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ PathExpr();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ }
+ }
+
+/* [7] PathExpr ::= FilterExpr */
+ final public void PathExpr() throws ParseException {
+ FilterExpr();
+ }
+
+/* [7] FilterExpr ::= PrimaryExpr ( Predicate )* */
+ final public void FilterExpr() throws ParseException {
+ PrimaryExpr();
+ label_9:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PREDICATE_BEGIN:
+ ;
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ break label_9;
+ }
+ FilterOperator jjtn001 = new FilterOperator(JJTFILTEROPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ Predicate();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ }
+ }
+
+/* [] Predicate ::= '[' PredicateExpr ']' */
+ final public void Predicate() throws ParseException {
+ /*@bgen(jjtree) #Predicate( 1) */
+ Predicate jjtn000 = new Predicate(JJTPREDICATE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(PREDICATE_BEGIN);
+ PredicateExpr();
+ jj_consume_token(PREDICATE_END);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, 1);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+/* [] PredicateExpr ::= Expr */
+ final public void PredicateExpr() throws ParseException {
+ Expr();
+ }
+
+/* [7] PrimaryExpr ::= Literal | '(' Expr ')' | FunctionCall | ScopeLimitExpr | Identifier */
+ final public void PrimaryExpr() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LIST_BEGIN:
+ case BOOLEAN_LITERAL:
+ case STRING_LITERAL:
+ case NUMBER_LITERAL:
+ Literal();
+ break;
+ case FUNCTION_BEGIN:
+ jj_consume_token(FUNCTION_BEGIN);
+ Expr();
+ jj_consume_token(FUNCTION_END);
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ if (jj_2_1(2)) {
+ Function();
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SCOPE_LIMIT_NAME:
+ ScopeLimitExpr();
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ if (jj_2_2(2)) {
+ Identifier();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+
+/* FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' */
+/* FunctionName ::= 'boolean' | 'number' | 'string' | 'not' | ... */
+ final public void Function() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case 29:
+ jj_consume_token(29);
+ Argument();
+ BooleanFunction jjtn001 = new BooleanFunction(JJTBOOLEANFUNCTION);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 1);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ break;
+ case 30:
+ jj_consume_token(30);
+ Argument();
+ NumberFunction jjtn002 = new NumberFunction(JJTNUMBERFUNCTION);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, 1);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+ break;
+ case 31:
+ jj_consume_token(31);
+ Argument();
+ StringFunction jjtn003 = new StringFunction(JJTSTRINGFUNCTION);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, 1);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+ break;
+ case 32:
+ jj_consume_token(32);
+ Argument();
+ NotFunction jjtn004 = new NotFunction(JJTNOTFUNCTION);
+ boolean jjtc004 = true;
+ jjtree.openNodeScope(jjtn004);
+ jjtreeOpenNodeScope(jjtn004);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc004) {
+ jjtree.closeNodeScope(jjtn004, 1);
+ jjtreeCloseNodeScope(jjtn004);
+ }
+ }
+ break;
+ case 33:
+ jj_consume_token(33);
+ Argument();
+ FloorFunction jjtn005 = new FloorFunction(JJTFLOORFUNCTION);
+ boolean jjtc005 = true;
+ jjtree.openNodeScope(jjtn005);
+ jjtreeOpenNodeScope(jjtn005);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc005) {
+ jjtree.closeNodeScope(jjtn005, 1);
+ jjtreeCloseNodeScope(jjtn005);
+ }
+ }
+ break;
+ case 34:
+ jj_consume_token(34);
+ Argument();
+ CeilingFunction jjtn006 = new CeilingFunction(JJTCEILINGFUNCTION);
+ boolean jjtc006 = true;
+ jjtree.openNodeScope(jjtn006);
+ jjtreeOpenNodeScope(jjtn006);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc006) {
+ jjtree.closeNodeScope(jjtn006, 1);
+ jjtreeCloseNodeScope(jjtn006);
+ }
+ }
+ break;
+ case 35:
+ jj_consume_token(35);
+ Argument();
+ RoundFunction jjtn007 = new RoundFunction(JJTROUNDFUNCTION);
+ boolean jjtc007 = true;
+ jjtree.openNodeScope(jjtn007);
+ jjtreeOpenNodeScope(jjtn007);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc007) {
+ jjtree.closeNodeScope(jjtn007, 1);
+ jjtreeCloseNodeScope(jjtn007);
+ }
+ }
+ break;
+ case 36:
+ FormatNumberFunction jjtn008 = new FormatNumberFunction(JJTFORMATNUMBERFUNCTION);
+ boolean jjtc008 = true;
+ jjtree.openNodeScope(jjtn008);
+ jjtreeOpenNodeScope(jjtn008);
+ try {
+ jj_consume_token(36);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ jj_consume_token(SEPARATOR);
+ Argument();
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ ;
+ }
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte008) {
+ if (jjtc008) {
+ jjtree.clearNodeScope(jjtn008);
+ jjtc008 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte008 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte008;}
+ }
+ if (jjte008 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte008;}
+ }
+ {if (true) throw (Error)jjte008;}
+ } finally {
+ if (jjtc008) {
+ jjtree.closeNodeScope(jjtn008, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn008);
+ }
+ }
+ break;
+ case 37:
+ ConcatFunction jjtn009 = new ConcatFunction(JJTCONCATFUNCTION);
+ boolean jjtc009 = true;
+ jjtree.openNodeScope(jjtn009);
+ jjtreeOpenNodeScope(jjtn009);
+ try {
+ jj_consume_token(37);
+ Argument();
+ label_10:
+ while (true) {
+ jj_consume_token(SEPARATOR);
+ Argument();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ ;
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ break label_10;
+ }
+ }
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte009) {
+ if (jjtc009) {
+ jjtree.clearNodeScope(jjtn009);
+ jjtc009 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte009 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte009;}
+ }
+ if (jjte009 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte009;}
+ }
+ {if (true) throw (Error)jjte009;}
+ } finally {
+ if (jjtc009) {
+ jjtree.closeNodeScope(jjtn009, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn009);
+ }
+ }
+ break;
+ case 38:
+ jj_consume_token(38);
+ Argument();
+ EncodeUrlFunction jjtn010 = new EncodeUrlFunction(JJTENCODEURLFUNCTION);
+ boolean jjtc010 = true;
+ jjtree.openNodeScope(jjtn010);
+ jjtreeOpenNodeScope(jjtn010);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc010) {
+ jjtree.closeNodeScope(jjtn010, 1);
+ jjtreeCloseNodeScope(jjtn010);
+ }
+ }
+ break;
+ case 39:
+ jj_consume_token(39);
+ Argument();
+ EncodeHtmlFunction jjtn011 = new EncodeHtmlFunction(JJTENCODEHTMLFUNCTION);
+ boolean jjtc011 = true;
+ jjtree.openNodeScope(jjtn011);
+ jjtreeOpenNodeScope(jjtn011);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc011) {
+ jjtree.closeNodeScope(jjtn011, 1);
+ jjtreeCloseNodeScope(jjtn011);
+ }
+ }
+ break;
+ case 40:
+ jj_consume_token(40);
+ Argument();
+ StringLengthFunction jjtn012 = new StringLengthFunction(JJTSTRINGLENGTHFUNCTION);
+ boolean jjtc012 = true;
+ jjtree.openNodeScope(jjtn012);
+ jjtreeOpenNodeScope(jjtn012);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc012) {
+ jjtree.closeNodeScope(jjtn012, 1);
+ jjtreeCloseNodeScope(jjtn012);
+ }
+ }
+ break;
+ case 41:
+ SubstringFunction jjtn013 = new SubstringFunction(JJTSUBSTRINGFUNCTION);
+ boolean jjtc013 = true;
+ jjtree.openNodeScope(jjtn013);
+ jjtreeOpenNodeScope(jjtn013);
+ try {
+ jj_consume_token(41);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ jj_consume_token(SEPARATOR);
+ Argument();
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ ;
+ }
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte013) {
+ if (jjtc013) {
+ jjtree.clearNodeScope(jjtn013);
+ jjtc013 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte013 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte013;}
+ }
+ if (jjte013 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte013;}
+ }
+ {if (true) throw (Error)jjte013;}
+ } finally {
+ if (jjtc013) {
+ jjtree.closeNodeScope(jjtn013, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn013);
+ }
+ }
+ break;
+ case 42:
+ StartsWithFunction jjtn014 = new StartsWithFunction(JJTSTARTSWITHFUNCTION);
+ boolean jjtc014 = true;
+ jjtree.openNodeScope(jjtn014);
+ jjtreeOpenNodeScope(jjtn014);
+ try {
+ jj_consume_token(42);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte014) {
+ if (jjtc014) {
+ jjtree.clearNodeScope(jjtn014);
+ jjtc014 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte014 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte014;}
+ }
+ if (jjte014 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte014;}
+ }
+ {if (true) throw (Error)jjte014;}
+ } finally {
+ if (jjtc014) {
+ jjtree.closeNodeScope(jjtn014, 2);
+ jjtreeCloseNodeScope(jjtn014);
+ }
+ }
+ break;
+ case 43:
+ ContainsFunction jjtn015 = new ContainsFunction(JJTCONTAINSFUNCTION);
+ boolean jjtc015 = true;
+ jjtree.openNodeScope(jjtn015);
+ jjtreeOpenNodeScope(jjtn015);
+ try {
+ jj_consume_token(43);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte015) {
+ if (jjtc015) {
+ jjtree.clearNodeScope(jjtn015);
+ jjtc015 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte015 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte015;}
+ }
+ if (jjte015 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte015;}
+ }
+ {if (true) throw (Error)jjte015;}
+ } finally {
+ if (jjtc015) {
+ jjtree.closeNodeScope(jjtn015, 2);
+ jjtreeCloseNodeScope(jjtn015);
+ }
+ }
+ break;
+ case 44:
+ SubstringBeforeFunction jjtn016 = new SubstringBeforeFunction(JJTSUBSTRINGBEFOREFUNCTION);
+ boolean jjtc016 = true;
+ jjtree.openNodeScope(jjtn016);
+ jjtreeOpenNodeScope(jjtn016);
+ try {
+ jj_consume_token(44);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte016) {
+ if (jjtc016) {
+ jjtree.clearNodeScope(jjtn016);
+ jjtc016 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte016 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte016;}
+ }
+ if (jjte016 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte016;}
+ }
+ {if (true) throw (Error)jjte016;}
+ } finally {
+ if (jjtc016) {
+ jjtree.closeNodeScope(jjtn016, 2);
+ jjtreeCloseNodeScope(jjtn016);
+ }
+ }
+ break;
+ case 45:
+ SubstringAfterFunction jjtn017 = new SubstringAfterFunction(JJTSUBSTRINGAFTERFUNCTION);
+ boolean jjtc017 = true;
+ jjtree.openNodeScope(jjtn017);
+ jjtreeOpenNodeScope(jjtn017);
+ try {
+ jj_consume_token(45);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte017) {
+ if (jjtc017) {
+ jjtree.clearNodeScope(jjtn017);
+ jjtc017 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte017 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte017;}
+ }
+ if (jjte017 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte017;}
+ }
+ {if (true) throw (Error)jjte017;}
+ } finally {
+ if (jjtc017) {
+ jjtree.closeNodeScope(jjtn017, 2);
+ jjtreeCloseNodeScope(jjtn017);
+ }
+ }
+ break;
+ case 46:
+ TranslateFunction jjtn018 = new TranslateFunction(JJTTRANSLATEFUNCTION);
+ boolean jjtc018 = true;
+ jjtree.openNodeScope(jjtn018);
+ jjtreeOpenNodeScope(jjtn018);
+ try {
+ jj_consume_token(46);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte018) {
+ if (jjtc018) {
+ jjtree.clearNodeScope(jjtn018);
+ jjtc018 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte018 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte018;}
+ }
+ if (jjte018 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte018;}
+ }
+ {if (true) throw (Error)jjte018;}
+ } finally {
+ if (jjtc018) {
+ jjtree.closeNodeScope(jjtn018, 3);
+ jjtreeCloseNodeScope(jjtn018);
+ }
+ }
+ break;
+ case 47:
+ jj_consume_token(47);
+ PositionFunction jjtn019 = new PositionFunction(JJTPOSITIONFUNCTION);
+ boolean jjtc019 = true;
+ jjtree.openNodeScope(jjtn019);
+ jjtreeOpenNodeScope(jjtn019);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc019) {
+ jjtree.closeNodeScope(jjtn019, 0);
+ jjtreeCloseNodeScope(jjtn019);
+ }
+ }
+ break;
+ case 48:
+ jj_consume_token(48);
+ CurrentFunction jjtn020 = new CurrentFunction(JJTCURRENTFUNCTION);
+ boolean jjtc020 = true;
+ jjtree.openNodeScope(jjtn020);
+ jjtreeOpenNodeScope(jjtn020);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc020) {
+ jjtree.closeNodeScope(jjtn020, 0);
+ jjtreeCloseNodeScope(jjtn020);
+ }
+ }
+ break;
+ case 49:
+ jj_consume_token(49);
+ LastFunction jjtn021 = new LastFunction(JJTLASTFUNCTION);
+ boolean jjtc021 = true;
+ jjtree.openNodeScope(jjtn021);
+ jjtreeOpenNodeScope(jjtn021);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc021) {
+ jjtree.closeNodeScope(jjtn021, 0);
+ jjtreeCloseNodeScope(jjtn021);
+ }
+ }
+ break;
+ case 50:
+ jj_consume_token(50);
+ Argument();
+ CountFunction jjtn022 = new CountFunction(JJTCOUNTFUNCTION);
+ boolean jjtc022 = true;
+ jjtree.openNodeScope(jjtn022);
+ jjtreeOpenNodeScope(jjtn022);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc022) {
+ jjtree.closeNodeScope(jjtn022, 1);
+ jjtreeCloseNodeScope(jjtn022);
+ }
+ }
+ break;
+ case 51:
+ jj_consume_token(51);
+ Argument();
+ SumFunction jjtn023 = new SumFunction(JJTSUMFUNCTION);
+ boolean jjtc023 = true;
+ jjtree.openNodeScope(jjtn023);
+ jjtreeOpenNodeScope(jjtn023);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc023) {
+ jjtree.closeNodeScope(jjtn023, 1);
+ jjtreeCloseNodeScope(jjtn023);
+ }
+ }
+ break;
+ case 52:
+ jj_consume_token(52);
+ NowFunction jjtn024 = new NowFunction(JJTNOWFUNCTION);
+ boolean jjtc024 = true;
+ jjtree.openNodeScope(jjtn024);
+ jjtreeOpenNodeScope(jjtn024);
+ try {
+ jj_consume_token(FUNCTION_END);
+ } finally {
+ if (jjtc024) {
+ jjtree.closeNodeScope(jjtn024, 0);
+ jjtreeCloseNodeScope(jjtn024);
+ }
+ }
+ break;
+ case 53:
+ DateFunction jjtn025 = new DateFunction(JJTDATEFUNCTION);
+ boolean jjtc025 = true;
+ jjtree.openNodeScope(jjtn025);
+ jjtreeOpenNodeScope(jjtn025);
+ try {
+ jj_consume_token(53);
+ Argument();
+ label_11:
+ while (true) {
+ jj_consume_token(SEPARATOR);
+ Argument();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ ;
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ break label_11;
+ }
+ }
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte025) {
+ if (jjtc025) {
+ jjtree.clearNodeScope(jjtn025);
+ jjtc025 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte025 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte025;}
+ }
+ if (jjte025 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte025;}
+ }
+ {if (true) throw (Error)jjte025;}
+ } finally {
+ if (jjtc025) {
+ jjtree.closeNodeScope(jjtn025, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn025);
+ }
+ }
+ break;
+ case 54:
+ FormatDateFunction jjtn026 = new FormatDateFunction(JJTFORMATDATEFUNCTION);
+ boolean jjtc026 = true;
+ jjtree.openNodeScope(jjtn026);
+ jjtreeOpenNodeScope(jjtn026);
+ try {
+ jj_consume_token(54);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ jj_consume_token(SEPARATOR);
+ Argument();
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ ;
+ }
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte026) {
+ if (jjtc026) {
+ jjtree.clearNodeScope(jjtn026);
+ jjtc026 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte026 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte026;}
+ }
+ if (jjte026 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte026;}
+ }
+ {if (true) throw (Error)jjte026;}
+ } finally {
+ if (jjtc026) {
+ jjtree.closeNodeScope(jjtn026, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn026);
+ }
+ }
+ break;
+ case 55:
+ RollDateFunction jjtn027 = new RollDateFunction(JJTROLLDATEFUNCTION);
+ boolean jjtc027 = true;
+ jjtree.openNodeScope(jjtn027);
+ jjtreeOpenNodeScope(jjtn027);
+ try {
+ jj_consume_token(55);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte027) {
+ if (jjtc027) {
+ jjtree.clearNodeScope(jjtn027);
+ jjtc027 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte027 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte027;}
+ }
+ if (jjte027 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte027;}
+ }
+ {if (true) throw (Error)jjte027;}
+ } finally {
+ if (jjtc027) {
+ jjtree.closeNodeScope(jjtn027, 3);
+ jjtreeCloseNodeScope(jjtn027);
+ }
+ }
+ break;
+ case 56:
+ AddDateFunction jjtn028 = new AddDateFunction(JJTADDDATEFUNCTION);
+ boolean jjtc028 = true;
+ jjtree.openNodeScope(jjtn028);
+ jjtreeOpenNodeScope(jjtn028);
+ try {
+ jj_consume_token(56);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte028) {
+ if (jjtc028) {
+ jjtree.clearNodeScope(jjtn028);
+ jjtc028 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte028 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte028;}
+ }
+ if (jjte028 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte028;}
+ }
+ {if (true) throw (Error)jjte028;}
+ } finally {
+ if (jjtc028) {
+ jjtree.closeNodeScope(jjtn028, 3);
+ jjtreeCloseNodeScope(jjtn028);
+ }
+ }
+ break;
+ case 57:
+ TokenizeFunction jjtn029 = new TokenizeFunction(JJTTOKENIZEFUNCTION);
+ boolean jjtc029 = true;
+ jjtree.openNodeScope(jjtn029);
+ jjtreeOpenNodeScope(jjtn029);
+ try {
+ jj_consume_token(57);
+ Argument();
+ jj_consume_token(SEPARATOR);
+ Argument();
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte029) {
+ if (jjtc029) {
+ jjtree.clearNodeScope(jjtn029);
+ jjtc029 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte029 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte029;}
+ }
+ if (jjte029 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte029;}
+ }
+ {if (true) throw (Error)jjte029;}
+ } finally {
+ if (jjtc029) {
+ jjtree.closeNodeScope(jjtn029, 2);
+ jjtreeCloseNodeScope(jjtn029);
+ }
+ }
+ break;
+ case IDENTIFIER:
+ UserFunction jjtn030 = new UserFunction(JJTUSERFUNCTION);
+ boolean jjtc030 = true;
+ jjtree.openNodeScope(jjtn030);
+ jjtreeOpenNodeScope(jjtn030);
+ try {
+ Identifier();
+ jj_consume_token(SCOPE_LIMIT);
+ Identifier();
+ jj_consume_token(FUNCTION_BEGIN);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MINUS:
+ case LIST_BEGIN:
+ case FUNCTION_BEGIN:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case SCOPE_LIMIT_NAME:
+ case BOOLEAN_LITERAL:
+ case STRING_LITERAL:
+ case NUMBER_LITERAL:
+ case IDENTIFIER:
+ Argument();
+ label_12:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ ;
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ break label_12;
+ }
+ jj_consume_token(SEPARATOR);
+ Argument();
+ }
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ ;
+ }
+ jj_consume_token(FUNCTION_END);
+ } catch (Throwable jjte030) {
+ if (jjtc030) {
+ jjtree.clearNodeScope(jjtn030);
+ jjtc030 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte030 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte030;}
+ }
+ if (jjte030 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte030;}
+ }
+ {if (true) throw (Error)jjte030;}
+ } finally {
+ if (jjtc030) {
+ jjtree.closeNodeScope(jjtn030, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn030);
+ }
+ }
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/* [] Argument ::= Expr */
+ final public void Argument() throws ParseException {
+ Expr();
+ }
+
+/* [] ScopeLimitExpr ::= ScopeLimitName Identifier */
+ final public void ScopeLimitExpr() throws ParseException {
+ Token t;
+ ScopeLimitName();
+ ScopeLimitOperator jjtn001 = new ScopeLimitOperator(JJTSCOPELIMITOPERATOR);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ Identifier();
+ } catch (Throwable jjte001) {
+ if (jjtc001) {
+ jjtree.clearNodeScope(jjtn001);
+ jjtc001 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte001 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte001;}
+ }
+ if (jjte001 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte001;}
+ }
+ {if (true) throw (Error)jjte001;}
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, 2);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ }
+
+/* [] Identifier ::= Letter ( Letter | Digit )* */
+ final public void Identifier() throws ParseException {
+ /*@bgen(jjtree) Identifier */
+ Identifier jjtn000 = new Identifier(JJTIDENTIFIER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);Token t;
+ try {
+ t = jj_consume_token(IDENTIFIER);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ jjtn000.val = t.image;
+ jjtn000.image = t.image;
+ jjtn000.beginColumn = t.beginColumn;
+ jjtn000.endColumn = t.endColumn;
+ jjtn000.beginLine = t.beginLine;
+ jjtn000.endLine = t.endLine;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+/* ScopeLimitName ::= 'page' | 'request' | 'session' | 'application' | ... */
+ final public void ScopeLimitName() throws ParseException {
+ /*@bgen(jjtree) ScopeLimitName */
+ ScopeLimitName jjtn000 = new ScopeLimitName(JJTSCOPELIMITNAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);Token t;
+ try {
+ t = jj_consume_token(SCOPE_LIMIT_NAME);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ jjtn000.val = t.image;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+/* Literal ::= UnaryLiteral | ListLiteral */
+ final public void Literal() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case BOOLEAN_LITERAL:
+ case STRING_LITERAL:
+ case NUMBER_LITERAL:
+ UnaryLiteral();
+ break;
+ case LIST_BEGIN:
+ ListLiteral();
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/* UnaryLiteral ::= BooleanLiteral | NumberLiteral | StringLiteral */
+ final public void UnaryLiteral() throws ParseException {
+ Token t;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case BOOLEAN_LITERAL:
+ BooleanLiteral jjtn001 = new BooleanLiteral(JJTBOOLEANLITERAL);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ t = jj_consume_token(BOOLEAN_LITERAL);
+ jjtree.closeNodeScope(jjtn001, true);
+ jjtc001 = false;
+ jjtreeCloseNodeScope(jjtn001);
+ jjtn001.val = Boolean.valueOf(t.image).booleanValue();
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, true);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ break;
+ case NUMBER_LITERAL:
+ NumberLiteral jjtn002 = new NumberLiteral(JJTNUMBERLITERAL);
+ boolean jjtc002 = true;
+ jjtree.openNodeScope(jjtn002);
+ jjtreeOpenNodeScope(jjtn002);
+ try {
+ t = jj_consume_token(NUMBER_LITERAL);
+ jjtree.closeNodeScope(jjtn002, true);
+ jjtc002 = false;
+ jjtreeCloseNodeScope(jjtn002);
+ jjtn002.val = Double.parseDouble(t.image);
+ } finally {
+ if (jjtc002) {
+ jjtree.closeNodeScope(jjtn002, true);
+ jjtreeCloseNodeScope(jjtn002);
+ }
+ }
+ break;
+ case STRING_LITERAL:
+ StringLiteral jjtn003 = new StringLiteral(JJTSTRINGLITERAL);
+ boolean jjtc003 = true;
+ jjtree.openNodeScope(jjtn003);
+ jjtreeOpenNodeScope(jjtn003);
+ try {
+ t = jj_consume_token(STRING_LITERAL);
+ jjtree.closeNodeScope(jjtn003, true);
+ jjtc003 = false;
+ jjtreeCloseNodeScope(jjtn003);
+ jjtn003.val = t.image.substring(1, (t.image.length() - 1));
+ } finally {
+ if (jjtc003) {
+ jjtree.closeNodeScope(jjtn003, true);
+ jjtreeCloseNodeScope(jjtn003);
+ }
+ }
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/* ListLiteral ::= '{' UnaryExpr ( ',' UnaryExpr )* '}' */
+ final public void ListLiteral() throws ParseException {
+ /*@bgen(jjtree) ListLiteral */
+ ListLiteral jjtn000 = new ListLiteral(JJTLISTLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LIST_BEGIN);
+ Expr();
+ label_13:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEPARATOR:
+ ;
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ break label_13;
+ }
+ jj_consume_token(SEPARATOR);
+ Expr();
+ }
+ ListLiteral jjtn001 = new ListLiteral(JJTLISTLITERAL);
+ boolean jjtc001 = true;
+ jjtree.openNodeScope(jjtn001);
+ jjtreeOpenNodeScope(jjtn001);
+ try {
+ jj_consume_token(LIST_END);
+ } finally {
+ if (jjtc001) {
+ jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1);
+ jjtreeCloseNodeScope(jjtn001);
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {if (true) throw (RuntimeException)jjte000;}
+ }
+ if (jjte000 instanceof ParseException) {
+ {if (true) throw (ParseException)jjte000;}
+ }
+ {if (true) throw (Error)jjte000;}
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_1();
+ jj_save(0, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_2(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_2();
+ jj_save(1, xla);
+ return retval;
+ }
+
+ final private boolean jj_3R_21() {
+ if (jj_scan_token(34)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_69() {
+ if (jj_scan_token(SCOPE_LIMIT_NAME)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_53() {
+ if (jj_3R_54()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_20() {
+ if (jj_scan_token(33)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_19() {
+ if (jj_scan_token(32)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_18() {
+ if (jj_scan_token(31)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_17() {
+ if (jj_scan_token(30)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_14() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_16()) {
+ jj_scanpos = xsp;
+ if (jj_3R_17()) {
+ jj_scanpos = xsp;
+ if (jj_3R_18()) {
+ jj_scanpos = xsp;
+ if (jj_3R_19()) {
+ jj_scanpos = xsp;
+ if (jj_3R_20()) {
+ jj_scanpos = xsp;
+ if (jj_3R_21()) {
+ jj_scanpos = xsp;
+ if (jj_3R_22()) {
+ jj_scanpos = xsp;
+ if (jj_3R_23()) {
+ jj_scanpos = xsp;
+ if (jj_3R_24()) {
+ jj_scanpos = xsp;
+ if (jj_3R_25()) {
+ jj_scanpos = xsp;
+ if (jj_3R_26()) {
+ jj_scanpos = xsp;
+ if (jj_3R_27()) {
+ jj_scanpos = xsp;
+ if (jj_3R_28()) {
+ jj_scanpos = xsp;
+ if (jj_3R_29()) {
+ jj_scanpos = xsp;
+ if (jj_3R_30()) {
+ jj_scanpos = xsp;
+ if (jj_3R_31()) {
+ jj_scanpos = xsp;
+ if (jj_3R_32()) {
+ jj_scanpos = xsp;
+ if (jj_3R_33()) {
+ jj_scanpos = xsp;
+ if (jj_3R_34()) {
+ jj_scanpos = xsp;
+ if (jj_3R_35()) {
+ jj_scanpos = xsp;
+ if (jj_3R_36()) {
+ jj_scanpos = xsp;
+ if (jj_3R_37()) {
+ jj_scanpos = xsp;
+ if (jj_3R_38()) {
+ jj_scanpos = xsp;
+ if (jj_3R_39()) {
+ jj_scanpos = xsp;
+ if (jj_3R_40()) {
+ jj_scanpos = xsp;
+ if (jj_3R_41()) {
+ jj_scanpos = xsp;
+ if (jj_3R_42()) {
+ jj_scanpos = xsp;
+ if (jj_3R_43()) {
+ jj_scanpos = xsp;
+ if (jj_3R_44()) {
+ jj_scanpos = xsp;
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_16() {
+ if (jj_scan_token(29)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_52() {
+ if (jj_3R_53()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_15() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_2() {
+ if (jj_3R_15()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_64() {
+ if (jj_3R_66()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_14()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_63() {
+ if (jj_scan_token(FUNCTION_BEGIN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_62() {
+ if (jj_3R_65()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_61() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_62()) {
+ jj_scanpos = xsp;
+ if (jj_3R_63()) {
+ jj_scanpos = xsp;
+ if (jj_3_1()) {
+ jj_scanpos = xsp;
+ if (jj_3R_64()) {
+ jj_scanpos = xsp;
+ if (jj_3_2()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_51() {
+ if (jj_3R_52()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_66() {
+ if (jj_3R_69()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_46() {
+ if (jj_3R_47()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_50() {
+ if (jj_3R_51()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_45() {
+ if (jj_3R_15()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(SCOPE_LIMIT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_44() {
+ if (jj_scan_token(57)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_71() {
+ if (jj_scan_token(LIST_BEGIN)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_49() {
+ if (jj_3R_50()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_43() {
+ if (jj_scan_token(56)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_60() {
+ if (jj_3R_61()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_42() {
+ if (jj_scan_token(55)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_41() {
+ if (jj_scan_token(54)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_59() {
+ if (jj_3R_60()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_40() {
+ if (jj_scan_token(53)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_48() {
+ if (jj_3R_49()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_39() {
+ if (jj_scan_token(52)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(FUNCTION_END)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_38() {
+ if (jj_scan_token(51)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_37() {
+ if (jj_scan_token(50)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_74() {
+ if (jj_scan_token(STRING_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_36() {
+ if (jj_scan_token(49)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(FUNCTION_END)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_47() {
+ if (jj_3R_48()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_35() {
+ if (jj_scan_token(48)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(FUNCTION_END)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_58() {
+ if (jj_3R_59()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_34() {
+ if (jj_scan_token(47)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(FUNCTION_END)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_33() {
+ if (jj_scan_token(46)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_73() {
+ if (jj_scan_token(NUMBER_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_32() {
+ if (jj_scan_token(45)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_57() {
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_31() {
+ if (jj_scan_token(44)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_30() {
+ if (jj_scan_token(43)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_72() {
+ if (jj_scan_token(BOOLEAN_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_70() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_72()) {
+ jj_scanpos = xsp;
+ if (jj_3R_73()) {
+ jj_scanpos = xsp;
+ if (jj_3R_74()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_29() {
+ if (jj_scan_token(42)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_56() {
+ if (jj_scan_token(MINUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_28() {
+ if (jj_scan_token(41)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_55() {
+ if (jj_3R_57()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_54() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_55()) {
+ jj_scanpos = xsp;
+ if (jj_3R_56()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_27() {
+ if (jj_scan_token(40)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_26() {
+ if (jj_scan_token(39)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_68() {
+ if (jj_3R_71()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_25() {
+ if (jj_scan_token(38)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_67() {
+ if (jj_3R_70()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_65() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_67()) {
+ jj_scanpos = xsp;
+ if (jj_3R_68()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_24() {
+ if (jj_scan_token(37)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_23() {
+ if (jj_scan_token(36)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_22() {
+ if (jj_scan_token(35)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_46()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ public ParserTokenManager token_source;
+ ASCII_CharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[27];
+ final private int[] jj_la1_0 = {0x200000,0x100000,0x1800,0x1800,0x1e000,0x1e000,0x600,0x600,0x1c0,0x1c0,0xe2400400,0x40000,0x20000,0x8000000,0x2400000,0x0,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0xe2400400,0xe0000000,0x400000,0x0,0x1000000,};
+ final private int[] jj_la1_1 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdfffffff,0x0,0x0,0x0,0x58000000,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0xdfffffff,0x83ffffff,0x58000000,0x58000000,0x0,};
+ final private int[] jj_la1_2 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ final private JJCalls[] jj_2_rtns = new JJCalls[2];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ public Parser(java.io.InputStream stream) {
+ jj_input_stream = new ASCII_CharStream(stream, 1, 1);
+ token_source = new ParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 27; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 27; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public Parser(java.io.Reader stream) {
+ jj_input_stream = new ASCII_CharStream(stream, 1, 1);
+ token_source = new ParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 27; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 27; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public Parser(ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 27; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 27; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.Vector jj_expentries = new java.util.Vector();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
+ int[] oldentry = (int[])(enum.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ final public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[65];
+ for (int i = 0; i < 65; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 27; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ if ((jj_la1_2[i] & (1<<j)) != 0) {
+ la1tokens[64+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 65; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+ final private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 2; i++) {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ case 1: jj_3_2(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ }
+ jj_rescan = false;
+ }
+
+ final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ParserConstants.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ParserConstants.java
new file mode 100644
index 0000000..1932348
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ParserConstants.java
@@ -0,0 +1,163 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JJTree&JavaCC: Do not edit this line. ParserConstants.java */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+public interface ParserConstants {
+
+ int EOF = 0;
+ int DIV = 6;
+ int MULT = 7;
+ int MOD = 8;
+ int PLUS = 9;
+ int MINUS = 10;
+ int EQ = 11;
+ int NEQ = 12;
+ int LT = 13;
+ int LTE = 14;
+ int GT = 15;
+ int GTE = 16;
+ int INTROSPECT = 17;
+ int UNION = 18;
+ int SCOPE_LIMIT = 19;
+ int AND = 20;
+ int OR = 21;
+ int LIST_BEGIN = 22;
+ int LIST_END = 23;
+ int SEPARATOR = 24;
+ int FUNCTION_BEGIN = 25;
+ int FUNCTION_END = 26;
+ int PREDICATE_BEGIN = 27;
+ int PREDICATE_END = 28;
+ int SCOPE_LIMIT_NAME = 58;
+ int BOOLEAN_LITERAL = 59;
+ int STRING_LITERAL = 60;
+ int DIGIT = 61;
+ int NUMBER_LITERAL = 62;
+ int IDENTIFIER = 63;
+ int LETTER = 64;
+
+ int DEFAULT = 0;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\t\"",
+ "\"\\r\"",
+ "\"\\n\"",
+ "\"\\f\"",
+ "\"/\"",
+ "\"*\"",
+ "\"%\"",
+ "\"+\"",
+ "\"-\"",
+ "\"=\"",
+ "\"!=\"",
+ "\"<\"",
+ "\"<=\"",
+ "\">\"",
+ "\">=\"",
+ "\".\"",
+ "\"|\"",
+ "\":\"",
+ "\"and\"",
+ "\"or\"",
+ "\"{\"",
+ "\"}\"",
+ "\",\"",
+ "\"(\"",
+ "\")\"",
+ "\"[\"",
+ "\"]\"",
+ "\"boolean(\"",
+ "\"number(\"",
+ "\"string(\"",
+ "\"not(\"",
+ "\"floor(\"",
+ "\"ceiling(\"",
+ "\"round(\"",
+ "\"format-number(\"",
+ "\"concat(\"",
+ "\"encode-url(\"",
+ "\"encode-html(\"",
+ "\"string-length(\"",
+ "\"substring(\"",
+ "\"starts-with(\"",
+ "\"contains(\"",
+ "\"substring-before(\"",
+ "\"substring-after(\"",
+ "\"translate(\"",
+ "\"position(\"",
+ "\"current(\"",
+ "\"last(\"",
+ "\"count(\"",
+ "\"sum(\"",
+ "\"now(\"",
+ "\"date(\"",
+ "\"format-date(\"",
+ "\"roll-date(\"",
+ "\"add-date(\"",
+ "\"tokenize(\"",
+ "<SCOPE_LIMIT_NAME>",
+ "<BOOLEAN_LITERAL>",
+ "<STRING_LITERAL>",
+ "<DIGIT>",
+ "<NUMBER_LITERAL>",
+ "<IDENTIFIER>",
+ "<LETTER>",
+ };
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ParserTokenManager.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ParserTokenManager.java
new file mode 100644
index 0000000..59dd3fa
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ParserTokenManager.java
@@ -0,0 +1,1704 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JJTree&JavaCC: Do not edit this line. ParserTokenManager.java */
+package org.apache.taglibs.standard.lang.jpath.expression;
+import java.io.StringReader;
+
+public class ParserTokenManager implements ParserConstants
+{
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x20000L) != 0L)
+ return 48;
+ if ((active0 & 0x400L) != 0L)
+ return 52;
+ if ((active0 & 0x800000000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 3;
+ }
+ if ((active0 & 0x40001200000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 36;
+ }
+ if ((active0 & 0x200400000000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 32;
+ }
+ if ((active0 & 0x100000000100000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 28;
+ }
+ if ((active0 & 0x80000800000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 10;
+ }
+ if ((active0 & 0x8370080000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 17;
+ }
+ if ((active0 & 0x3708e560200000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ return 50;
+ }
+ return -1;
+ case 1:
+ if ((active0 & 0x3ffbfffe0100000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 1;
+ return 50;
+ }
+ if ((active0 & 0x200000L) != 0L)
+ return 50;
+ if ((active0 & 0x400000000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 1;
+ return 31;
+ }
+ return -1;
+ case 2:
+ if ((active0 & 0x3ffffffe0000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ return 50;
+ }
+ if ((active0 & 0x100000L) != 0L)
+ return 50;
+ return -1;
+ case 3:
+ if ((active0 & 0x100000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 2)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ }
+ return -1;
+ }
+ if ((active0 & 0x2e7fffee0000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ return 50;
+ }
+ return -1;
+ case 4:
+ if ((active0 & 0x245fffee0000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 4;
+ return 50;
+ }
+ if ((active0 & 0x100000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 2)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ }
+ return -1;
+ }
+ if ((active0 & 0x80000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 3)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ }
+ return -1;
+ }
+ return -1;
+ case 5:
+ if ((active0 & 0x241fff4e0000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ return 50;
+ }
+ if ((active0 & 0x100000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 2)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ }
+ return -1;
+ }
+ if ((active0 & 0x80000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 3)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ }
+ return -1;
+ }
+ return -1;
+ case 6:
+ if ((active0 & 0x100000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 2)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ }
+ return -1;
+ }
+ if ((active0 & 0x80000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 3)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ }
+ return -1;
+ }
+ if ((active0 & 0x4005d000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ if ((active0 & 0x201fa0420000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 6;
+ return 50;
+ }
+ return -1;
+ case 7:
+ if ((active0 & 0x200fa0000000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 7;
+ return 50;
+ }
+ if ((active0 & 0x100000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 2)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ }
+ return -1;
+ }
+ if ((active0 & 0x80000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 3)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ }
+ return -1;
+ }
+ if ((active0 & 0x4005d000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 8:
+ if ((active0 & 0x720000000000L) != 0L)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ return 50;
+ }
+ if ((active0 & 0x100000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 2)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 2;
+ }
+ return -1;
+ }
+ if ((active0 & 0x80000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 3)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ }
+ return -1;
+ }
+ if ((active0 & 0x4005d000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 9:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ if ((active0 & 0x80000000000000L) != 0L)
+ {
+ if (jjmatchedPos < 3)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 3;
+ }
+ return -1;
+ }
+ if ((active0 & 0x4005d000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 10:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ if ((active0 & 0x4005d000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 11:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ if ((active0 & 0x40059000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 12:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ if ((active0 & 0x11000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 13:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ if ((active0 & 0x11000000000L) != 0L)
+ {
+ if (jjmatchedPos < 5)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 5;
+ }
+ return -1;
+ }
+ return -1;
+ case 14:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ return -1;
+ case 15:
+ if ((active0 & 0x300000000000L) != 0L)
+ {
+ if (jjmatchedPos < 8)
+ {
+ jjmatchedKind = 63;
+ jjmatchedPos = 8;
+ }
+ return -1;
+ }
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 33:
+ return jjMoveStringLiteralDfa1_0(0x1000L);
+ case 37:
+ return jjStopAtPos(0, 8);
+ case 40:
+ return jjStopAtPos(0, 25);
+ case 41:
+ return jjStopAtPos(0, 26);
+ case 42:
+ return jjStopAtPos(0, 7);
+ case 43:
+ return jjStopAtPos(0, 9);
+ case 44:
+ return jjStopAtPos(0, 24);
+ case 45:
+ return jjStartNfaWithStates_0(0, 10, 52);
+ case 46:
+ return jjStartNfaWithStates_0(0, 17, 48);
+ case 47:
+ return jjStopAtPos(0, 6);
+ case 58:
+ return jjStopAtPos(0, 19);
+ case 60:
+ jjmatchedKind = 13;
+ return jjMoveStringLiteralDfa1_0(0x4000L);
+ case 61:
+ return jjStopAtPos(0, 11);
+ case 62:
+ jjmatchedKind = 15;
+ return jjMoveStringLiteralDfa1_0(0x10000L);
+ case 91:
+ return jjStopAtPos(0, 27);
+ case 93:
+ return jjStopAtPos(0, 28);
+ case 97:
+ return jjMoveStringLiteralDfa1_0(0x100000000100000L);
+ case 98:
+ return jjMoveStringLiteralDfa1_0(0x20000000L);
+ case 99:
+ return jjMoveStringLiteralDfa1_0(0x5082400000000L);
+ case 100:
+ return jjMoveStringLiteralDfa1_0(0x20000000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa1_0(0xc000000000L);
+ case 102:
+ return jjMoveStringLiteralDfa1_0(0x40001200000000L);
+ case 108:
+ return jjMoveStringLiteralDfa1_0(0x2000000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x10000140000000L);
+ case 111:
+ return jjMoveStringLiteralDfa1_0(0x200000L);
+ case 112:
+ return jjMoveStringLiteralDfa1_0(0x800000000000L);
+ case 114:
+ return jjMoveStringLiteralDfa1_0(0x80000800000000L);
+ case 115:
+ return jjMoveStringLiteralDfa1_0(0x8370080000000L);
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x200400000000000L);
+ case 123:
+ return jjStopAtPos(0, 22);
+ case 124:
+ return jjStopAtPos(0, 18);
+ case 125:
+ return jjStopAtPos(0, 23);
+ default :
+ return jjMoveNfa_0(4, 0);
+ }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 61:
+ if ((active0 & 0x1000L) != 0L)
+ return jjStopAtPos(1, 12);
+ else if ((active0 & 0x4000L) != 0L)
+ return jjStopAtPos(1, 14);
+ else if ((active0 & 0x10000L) != 0L)
+ return jjStopAtPos(1, 16);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa2_0(active0, 0x22000000000000L);
+ case 100:
+ return jjMoveStringLiteralDfa2_0(active0, 0x100000000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000000L);
+ case 108:
+ return jjMoveStringLiteralDfa2_0(active0, 0x200000000L);
+ case 110:
+ return jjMoveStringLiteralDfa2_0(active0, 0xc000100000L);
+ case 111:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2d4883920000000L);
+ case 114:
+ if ((active0 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(1, 21, 50);
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa2_0(active0, 0x50080000000L);
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x9320040000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x440000000000L);
+ case 98:
+ return jjMoveStringLiteralDfa3_0(active0, 0x320000000000L);
+ case 99:
+ return jjMoveStringLiteralDfa3_0(active0, 0xc000000000L);
+ case 100:
+ if ((active0 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(2, 20, 50);
+ return jjMoveStringLiteralDfa3_0(active0, 0x100000000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400000000L);
+ case 107:
+ return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0x80000000000000L);
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0x8000040000000L);
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0x82000000000L);
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0x220000000L);
+ case 114:
+ return jjMoveStringLiteralDfa3_0(active0, 0x41011080000000L);
+ case 115:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2800000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000100000000L);
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000800000000L);
+ case 119:
+ return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x100000000L) != 0L)
+ return jjStopAtPos(3, 32);
+ else if ((active0 & 0x8000000000000L) != 0L)
+ return jjStopAtPos(3, 51);
+ else if ((active0 & 0x10000000000000L) != 0L)
+ return jjStopAtPos(3, 52);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa4_0(active0, 0x100000000000000L);
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000L);
+ case 99:
+ return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa4_0(active0, 0x220000000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa4_0(active0, 0x810080000000L);
+ case 108:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80000420000000L);
+ case 109:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40001000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x4400800000000L);
+ case 111:
+ return jjMoveStringLiteralDfa4_0(active0, 0xc200000000L);
+ case 114:
+ return jjMoveStringLiteralDfa4_0(active0, 0x1040000000000L);
+ case 115:
+ return jjMoveStringLiteralDfa4_0(active0, 0x320000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active0, 0x2080000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x2000000000000L) != 0L)
+ return jjStopAtPos(4, 49);
+ else if ((active0 & 0x20000000000000L) != 0L)
+ return jjStopAtPos(4, 53);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L);
+ case 97:
+ return jjMoveStringLiteralDfa5_0(active0, 0x40083000000000L);
+ case 100:
+ return jjMoveStringLiteralDfa5_0(active0, 0x10000c800000000L);
+ case 101:
+ return jjMoveStringLiteralDfa5_0(active0, 0x1000060000000L);
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x400000000L);
+ case 110:
+ return jjMoveStringLiteralDfa5_0(active0, 0x200010080000000L);
+ case 114:
+ return jjMoveStringLiteralDfa5_0(active0, 0x200000000L);
+ case 115:
+ return jjMoveStringLiteralDfa5_0(active0, 0x400000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa5_0(active0, 0x4b60000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x200000000L) != 0L)
+ return jjStopAtPos(5, 33);
+ else if ((active0 & 0x800000000L) != 0L)
+ return jjStopAtPos(5, 35);
+ else if ((active0 & 0x4000000000000L) != 0L)
+ return jjStopAtPos(5, 50);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa6_0(active0, 0x100000020000000L);
+ case 100:
+ return jjMoveStringLiteralDfa6_0(active0, 0x80000000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa6_0(active0, 0xc000000000L);
+ case 103:
+ return jjMoveStringLiteralDfa6_0(active0, 0x10080000000L);
+ case 105:
+ return jjMoveStringLiteralDfa6_0(active0, 0x200880000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa6_0(active0, 0x400000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa6_0(active0, 0x1000400000000L);
+ case 114:
+ return jjMoveStringLiteralDfa6_0(active0, 0x320040000000L);
+ case 115:
+ return jjMoveStringLiteralDfa6_0(active0, 0x40000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa6_0(active0, 0x40003000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x40000000L) != 0L)
+ return jjStopAtPos(6, 30);
+ else if ((active0 & 0x80000000L) != 0L)
+ return jjStopAtPos(6, 31);
+ else if ((active0 & 0x2000000000L) != 0L)
+ return jjStopAtPos(6, 37);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa7_0(active0, 0x4005d000000000L);
+ case 97:
+ return jjMoveStringLiteralDfa7_0(active0, 0x80400000000000L);
+ case 103:
+ return jjMoveStringLiteralDfa7_0(active0, 0x400000000L);
+ case 105:
+ return jjMoveStringLiteralDfa7_0(active0, 0x320000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa7_0(active0, 0x80020000000L);
+ case 111:
+ return jjMoveStringLiteralDfa7_0(active0, 0x800000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa7_0(active0, 0x101000000000000L);
+ case 122:
+ return jjMoveStringLiteralDfa7_0(active0, 0x200000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0);
+}
+private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x20000000L) != 0L)
+ return jjStopAtPos(7, 29);
+ else if ((active0 & 0x400000000L) != 0L)
+ return jjStopAtPos(7, 34);
+ else if ((active0 & 0x1000000000000L) != 0L)
+ return jjStopAtPos(7, 48);
+ break;
+ case 100:
+ return jjMoveStringLiteralDfa8_0(active0, 0x40000000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa8_0(active0, 0x300000000000000L);
+ case 104:
+ return jjMoveStringLiteralDfa8_0(active0, 0x8000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa8_0(active0, 0x10000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa8_0(active0, 0xb21000000000L);
+ case 115:
+ return jjMoveStringLiteralDfa8_0(active0, 0x80000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa8_0(active0, 0x80400000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa8_0(active0, 0x4000000000L);
+ case 119:
+ return jjMoveStringLiteralDfa8_0(active0, 0x40000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0);
+}
+private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x80000000000L) != 0L)
+ return jjStopAtPos(8, 43);
+ else if ((active0 & 0x800000000000L) != 0L)
+ return jjStopAtPos(8, 47);
+ else if ((active0 & 0x100000000000000L) != 0L)
+ return jjStopAtPos(8, 56);
+ else if ((active0 & 0x200000000000000L) != 0L)
+ return jjStopAtPos(8, 57);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa9_0(active0, 0x40000000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa9_0(active0, 0x80410000000000L);
+ case 103:
+ return jjMoveStringLiteralDfa9_0(active0, 0x320000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa9_0(active0, 0x40000000000L);
+ case 114:
+ return jjMoveStringLiteralDfa9_0(active0, 0x4000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa9_0(active0, 0x8000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa9_0(active0, 0x1000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, active0);
+}
+private final int jjMoveStringLiteralDfa9_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStopAtPos(9, 41);
+ else if ((active0 & 0x400000000000L) != 0L)
+ return jjStopAtPos(9, 46);
+ else if ((active0 & 0x80000000000000L) != 0L)
+ return jjStopAtPos(9, 55);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa10_0(active0, 0x300000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa10_0(active0, 0x4000000000L);
+ case 109:
+ return jjMoveStringLiteralDfa10_0(active0, 0x9000000000L);
+ case 110:
+ return jjMoveStringLiteralDfa10_0(active0, 0x10000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa10_0(active0, 0x40040000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, active0);
+}
+private final int jjMoveStringLiteralDfa10_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(8, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(9, active0);
+ return 10;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x4000000000L) != 0L)
+ return jjStopAtPos(10, 38);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa11_0(active0, 0x200000000000L);
+ case 98:
+ return jjMoveStringLiteralDfa11_0(active0, 0x101000000000L);
+ case 101:
+ return jjMoveStringLiteralDfa11_0(active0, 0x40000000000000L);
+ case 103:
+ return jjMoveStringLiteralDfa11_0(active0, 0x10000000000L);
+ case 104:
+ return jjMoveStringLiteralDfa11_0(active0, 0x40000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa11_0(active0, 0x8000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(9, active0);
+}
+private final int jjMoveStringLiteralDfa11_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(9, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(10, active0);
+ return 11;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStopAtPos(11, 39);
+ else if ((active0 & 0x40000000000L) != 0L)
+ return jjStopAtPos(11, 42);
+ else if ((active0 & 0x40000000000000L) != 0L)
+ return jjStopAtPos(11, 54);
+ break;
+ case 101:
+ return jjMoveStringLiteralDfa12_0(active0, 0x101000000000L);
+ case 102:
+ return jjMoveStringLiteralDfa12_0(active0, 0x200000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa12_0(active0, 0x10000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(10, active0);
+}
+private final int jjMoveStringLiteralDfa12_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(10, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(11, active0);
+ return 12;
+ }
+ switch(curChar)
+ {
+ case 102:
+ return jjMoveStringLiteralDfa13_0(active0, 0x100000000000L);
+ case 104:
+ return jjMoveStringLiteralDfa13_0(active0, 0x10000000000L);
+ case 114:
+ return jjMoveStringLiteralDfa13_0(active0, 0x1000000000L);
+ case 116:
+ return jjMoveStringLiteralDfa13_0(active0, 0x200000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(11, active0);
+}
+private final int jjMoveStringLiteralDfa13_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(11, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(12, active0);
+ return 13;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x1000000000L) != 0L)
+ return jjStopAtPos(13, 36);
+ else if ((active0 & 0x10000000000L) != 0L)
+ return jjStopAtPos(13, 40);
+ break;
+ case 101:
+ return jjMoveStringLiteralDfa14_0(active0, 0x200000000000L);
+ case 111:
+ return jjMoveStringLiteralDfa14_0(active0, 0x100000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(12, active0);
+}
+private final int jjMoveStringLiteralDfa14_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(12, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(13, active0);
+ return 14;
+ }
+ switch(curChar)
+ {
+ case 114:
+ return jjMoveStringLiteralDfa15_0(active0, 0x300000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(13, active0);
+}
+private final int jjMoveStringLiteralDfa15_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(13, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(14, active0);
+ return 15;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x200000000000L) != 0L)
+ return jjStopAtPos(15, 45);
+ break;
+ case 101:
+ return jjMoveStringLiteralDfa16_0(active0, 0x100000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(14, active0);
+}
+private final int jjMoveStringLiteralDfa16_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(14, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(15, active0);
+ return 16;
+ }
+ switch(curChar)
+ {
+ case 40:
+ if ((active0 & 0x100000000000L) != 0L)
+ return jjStopAtPos(16, 44);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(15, active0);
+}
+private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private final void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 52;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 28:
+ case 50:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 52:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(44, 45);
+ }
+ else if (curChar == 46)
+ jjCheckNAdd(48);
+ break;
+ case 17:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 10:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 31:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 4:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(44, 45);
+ }
+ else if (curChar == 45)
+ jjCheckNAddTwoStates(44, 47);
+ else if (curChar == 46)
+ jjCheckNAdd(48);
+ else if (curChar == 39)
+ jjCheckNAddTwoStates(42, 43);
+ else if (curChar == 34)
+ jjCheckNAddTwoStates(39, 40);
+ break;
+ case 3:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 36:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 32:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 0:
+ if (curChar == 58 && kind > 58)
+ kind = 58;
+ break;
+ case 38:
+ if (curChar == 34)
+ jjCheckNAddTwoStates(39, 40);
+ break;
+ case 39:
+ if ((0xfffffffbffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(39, 40);
+ break;
+ case 40:
+ if (curChar == 34 && kind > 60)
+ kind = 60;
+ break;
+ case 41:
+ if (curChar == 39)
+ jjCheckNAddTwoStates(42, 43);
+ break;
+ case 42:
+ if ((0xffffff7fffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(42, 43);
+ break;
+ case 43:
+ if (curChar == 39 && kind > 60)
+ kind = 60;
+ break;
+ case 44:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(44, 45);
+ break;
+ case 45:
+ if (curChar != 46)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAdd(46);
+ break;
+ case 46:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAdd(46);
+ break;
+ case 47:
+ if (curChar == 46)
+ jjCheckNAdd(48);
+ break;
+ case 48:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAdd(48);
+ break;
+ case 51:
+ if (curChar == 45)
+ jjCheckNAddTwoStates(44, 47);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 28:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 112)
+ jjstateSet[jjnewStateCnt++] = 27;
+ break;
+ case 17:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 16;
+ break;
+ case 10:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 9;
+ break;
+ case 31:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 117)
+ jjCheckNAdd(30);
+ break;
+ case 4:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 102)
+ jjstateSet[jjnewStateCnt++] = 36;
+ else if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 32;
+ else if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 28;
+ else if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 17;
+ else if (curChar == 114)
+ jjstateSet[jjnewStateCnt++] = 10;
+ else if (curChar == 112)
+ jjstateSet[jjnewStateCnt++] = 3;
+ break;
+ case 3:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 2;
+ break;
+ case 36:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 35;
+ break;
+ case 32:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ }
+ if (curChar == 114)
+ jjstateSet[jjnewStateCnt++] = 31;
+ break;
+ case 1:
+ if (curChar == 101)
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if (curChar == 103)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 5:
+ if (curChar == 116)
+ jjCheckNAdd(0);
+ break;
+ case 6:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 5;
+ break;
+ case 7:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 6;
+ break;
+ case 8:
+ if (curChar == 117)
+ jjstateSet[jjnewStateCnt++] = 7;
+ break;
+ case 9:
+ if (curChar == 113)
+ jjstateSet[jjnewStateCnt++] = 8;
+ break;
+ case 11:
+ if (curChar == 114)
+ jjstateSet[jjnewStateCnt++] = 10;
+ break;
+ case 12:
+ case 19:
+ if (curChar == 110)
+ jjCheckNAdd(0);
+ break;
+ case 13:
+ if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 12;
+ break;
+ case 14:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 13;
+ break;
+ case 15:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 14;
+ break;
+ case 16:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 15;
+ break;
+ case 18:
+ if (curChar == 115)
+ jjstateSet[jjnewStateCnt++] = 17;
+ break;
+ case 20:
+ if (curChar == 111)
+ jjstateSet[jjnewStateCnt++] = 19;
+ break;
+ case 21:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 20;
+ break;
+ case 22:
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 21;
+ break;
+ case 23:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 22;
+ break;
+ case 24:
+ if (curChar == 99)
+ jjstateSet[jjnewStateCnt++] = 23;
+ break;
+ case 25:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 24;
+ break;
+ case 26:
+ if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 25;
+ break;
+ case 27:
+ if (curChar == 112)
+ jjstateSet[jjnewStateCnt++] = 26;
+ break;
+ case 29:
+ if (curChar == 97)
+ jjstateSet[jjnewStateCnt++] = 28;
+ break;
+ case 30:
+ if (curChar == 101 && kind > 59)
+ kind = 59;
+ break;
+ case 33:
+ if (curChar == 116)
+ jjstateSet[jjnewStateCnt++] = 32;
+ break;
+ case 34:
+ if (curChar == 115)
+ jjCheckNAdd(30);
+ break;
+ case 35:
+ if (curChar == 108)
+ jjstateSet[jjnewStateCnt++] = 34;
+ break;
+ case 37:
+ if (curChar == 102)
+ jjstateSet[jjnewStateCnt++] = 36;
+ break;
+ case 39:
+ jjAddStates(0, 1);
+ break;
+ case 42:
+ jjAddStates(2, 3);
+ break;
+ case 49:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ case 50:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 63)
+ kind = 63;
+ jjCheckNAdd(50);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 39:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(0, 1);
+ break;
+ case 42:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(2, 3);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 52 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static final int[] jjnextStates = {
+ 39, 40, 42, 43,
+};
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, "\57", "\52", "\45", "\53", "\55", "\75",
+"\41\75", "\74", "\74\75", "\76", "\76\75", "\56", "\174", "\72", "\141\156\144",
+"\157\162", "\173", "\175", "\54", "\50", "\51", "\133", "\135",
+"\142\157\157\154\145\141\156\50", "\156\165\155\142\145\162\50", "\163\164\162\151\156\147\50",
+"\156\157\164\50", "\146\154\157\157\162\50", "\143\145\151\154\151\156\147\50",
+"\162\157\165\156\144\50", "\146\157\162\155\141\164\55\156\165\155\142\145\162\50",
+"\143\157\156\143\141\164\50", "\145\156\143\157\144\145\55\165\162\154\50",
+"\145\156\143\157\144\145\55\150\164\155\154\50", "\163\164\162\151\156\147\55\154\145\156\147\164\150\50",
+"\163\165\142\163\164\162\151\156\147\50", "\163\164\141\162\164\163\55\167\151\164\150\50",
+"\143\157\156\164\141\151\156\163\50", "\163\165\142\163\164\162\151\156\147\55\142\145\146\157\162\145\50",
+"\163\165\142\163\164\162\151\156\147\55\141\146\164\145\162\50", "\164\162\141\156\163\154\141\164\145\50",
+"\160\157\163\151\164\151\157\156\50", "\143\165\162\162\145\156\164\50", "\154\141\163\164\50",
+"\143\157\165\156\164\50", "\163\165\155\50", "\156\157\167\50", "\144\141\164\145\50",
+"\146\157\162\155\141\164\55\144\141\164\145\50", "\162\157\154\154\55\144\141\164\145\50",
+"\141\144\144\55\144\141\164\145\50", "\164\157\153\145\156\151\172\145\50", null, null, null, null, null, null,
+null, };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+};
+static final long[] jjtoToken = {
+ 0xdfffffffffffffc1L, 0x0L,
+};
+static final long[] jjtoSkip = {
+ 0x3eL, 0x0L,
+};
+private ASCII_CharStream input_stream;
+private final int[] jjrounds = new int[52];
+private final int[] jjstateSet = new int[104];
+protected char curChar;
+public ParserTokenManager(ASCII_CharStream stream)
+{
+ if (ASCII_CharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+}
+public ParserTokenManager(ASCII_CharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+public void ReInit(ASCII_CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 52; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+public void ReInit(ASCII_CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 1 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+private final Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ t.image = (im == null) ? input_stream.GetImage() : im;
+ t.beginLine = input_stream.getBeginLine();
+ t.beginColumn = input_stream.getBeginColumn();
+ t.endLine = input_stream.getEndLine();
+ t.endColumn = input_stream.getEndColumn();
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public final Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ else
+ {
+ continue EOFLoop;
+ }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+}
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ParserTreeConstants.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ParserTreeConstants.java
new file mode 100644
index 0000000..adf11b7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ParserTreeConstants.java
@@ -0,0 +1,178 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JJTree: Do not edit this line. ParserTreeConstants.java */
+
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+public interface ParserTreeConstants
+{
+ public int JJTEXPRESSION = 0;
+ public int JJTVOID = 1;
+ public int JJTOROPERATOR = 2;
+ public int JJTANDOPERATOR = 3;
+ public int JJTEQUALSOPERATOR = 4;
+ public int JJTNOTEQUALSOPERATOR = 5;
+ public int JJTLESSTHANOPERATOR = 6;
+ public int JJTGREATERTHANOPERATOR = 7;
+ public int JJTLESSTHANEQUALOPERATOR = 8;
+ public int JJTGREATERTHANEQUALOPERATOR = 9;
+ public int JJTADDITIONOPERATOR = 10;
+ public int JJTSUBTRACTIONOPERATOR = 11;
+ public int JJTMULTIPLICATIONOPERATOR = 12;
+ public int JJTDIVISIONOPERATOR = 13;
+ public int JJTMODULUSOPERATOR = 14;
+ public int JJTUNIONOPERATOR = 15;
+ public int JJTINTROSPECTIONOPERATOR = 16;
+ public int JJTFILTEROPERATOR = 17;
+ public int JJTPREDICATE = 18;
+ public int JJTBOOLEANFUNCTION = 19;
+ public int JJTNUMBERFUNCTION = 20;
+ public int JJTSTRINGFUNCTION = 21;
+ public int JJTNOTFUNCTION = 22;
+ public int JJTFLOORFUNCTION = 23;
+ public int JJTCEILINGFUNCTION = 24;
+ public int JJTROUNDFUNCTION = 25;
+ public int JJTFORMATNUMBERFUNCTION = 26;
+ public int JJTCONCATFUNCTION = 27;
+ public int JJTENCODEURLFUNCTION = 28;
+ public int JJTENCODEHTMLFUNCTION = 29;
+ public int JJTSTRINGLENGTHFUNCTION = 30;
+ public int JJTSUBSTRINGFUNCTION = 31;
+ public int JJTSTARTSWITHFUNCTION = 32;
+ public int JJTCONTAINSFUNCTION = 33;
+ public int JJTSUBSTRINGBEFOREFUNCTION = 34;
+ public int JJTSUBSTRINGAFTERFUNCTION = 35;
+ public int JJTTRANSLATEFUNCTION = 36;
+ public int JJTPOSITIONFUNCTION = 37;
+ public int JJTCURRENTFUNCTION = 38;
+ public int JJTLASTFUNCTION = 39;
+ public int JJTCOUNTFUNCTION = 40;
+ public int JJTSUMFUNCTION = 41;
+ public int JJTNOWFUNCTION = 42;
+ public int JJTDATEFUNCTION = 43;
+ public int JJTFORMATDATEFUNCTION = 44;
+ public int JJTROLLDATEFUNCTION = 45;
+ public int JJTADDDATEFUNCTION = 46;
+ public int JJTTOKENIZEFUNCTION = 47;
+ public int JJTUSERFUNCTION = 48;
+ public int JJTSCOPELIMITOPERATOR = 49;
+ public int JJTIDENTIFIER = 50;
+ public int JJTSCOPELIMITNAME = 51;
+ public int JJTBOOLEANLITERAL = 52;
+ public int JJTNUMBERLITERAL = 53;
+ public int JJTSTRINGLITERAL = 54;
+ public int JJTLISTLITERAL = 55;
+
+
+ public String[] jjtNodeName = {
+ "Expression",
+ "void",
+ "OrOperator",
+ "AndOperator",
+ "EqualsOperator",
+ "NotEqualsOperator",
+ "LessThanOperator",
+ "GreaterThanOperator",
+ "LessThanEqualOperator",
+ "GreaterThanEqualOperator",
+ "AdditionOperator",
+ "SubtractionOperator",
+ "MultiplicationOperator",
+ "DivisionOperator",
+ "ModulusOperator",
+ "UnionOperator",
+ "IntrospectionOperator",
+ "FilterOperator",
+ "Predicate",
+ "BooleanFunction",
+ "NumberFunction",
+ "StringFunction",
+ "NotFunction",
+ "FloorFunction",
+ "CeilingFunction",
+ "RoundFunction",
+ "FormatNumberFunction",
+ "ConcatFunction",
+ "EncodeUrlFunction",
+ "EncodeHtmlFunction",
+ "StringLengthFunction",
+ "SubstringFunction",
+ "StartsWithFunction",
+ "ContainsFunction",
+ "SubstringBeforeFunction",
+ "SubstringAfterFunction",
+ "TranslateFunction",
+ "PositionFunction",
+ "CurrentFunction",
+ "LastFunction",
+ "CountFunction",
+ "SumFunction",
+ "NowFunction",
+ "DateFunction",
+ "FormatDateFunction",
+ "RollDateFunction",
+ "AddDateFunction",
+ "TokenizeFunction",
+ "UserFunction",
+ "ScopeLimitOperator",
+ "Identifier",
+ "ScopeLimitName",
+ "BooleanLiteral",
+ "NumberLiteral",
+ "StringLiteral",
+ "ListLiteral",
+ };
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/PositionFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/PositionFunction.java
new file mode 100644
index 0000000..4f7d982
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/PositionFunction.java
@@ -0,0 +1,196 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The PositionFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class PositionFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the PositionFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public PositionFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the PositionFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public PositionFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "position()";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ if (icontext == null) {
+ throw new EvaluationException("The position() function can "
+ + "only be used in the context of a predicate");
+ }
+
+ return new Double(icontext.getPosition());
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Predicate.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Predicate.java
new file mode 100644
index 0000000..a48d45d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Predicate.java
@@ -0,0 +1,190 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The Predicate class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class Predicate extends SimpleNode {
+
+ /**
+ * Used to create an instance of the Predicate class
+ *
+ *
+ * @param id
+ *
+ */
+ public Predicate(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the Predicate class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public Predicate(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "[" + jjtGetChild(0).toNormalizedString() + "]";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return jjtGetChild(0).evaluate(pageContext, icontext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/RollDateFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/RollDateFunction.java
new file mode 100644
index 0000000..9da844c
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/RollDateFunction.java
@@ -0,0 +1,282 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+/**
+ * The RollDateFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class RollDateFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the RollDateFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public RollDateFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the RollDateFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public RollDateFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "date-roll(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ JSPDate result;
+
+ try {
+ result = Convert.toJSPDate(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ int arg3 = Convert.toDouble(jjtGetChild(2).evaluate(pageContext,
+ icontext)).intValue();
+ int field = getCalendarConstant(arg2);
+
+ result.roll(field, arg3);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+
+ /**
+ * The getCalendarConstant method
+ *
+ *
+ * @param field
+ *
+ * @return
+ *
+ * @throws EvaluationException
+ *
+ */
+ private int getCalendarConstant(String field) throws EvaluationException {
+
+ int result;
+
+ if (field.equals("era")) {
+ result = Calendar.ERA;
+ } else if (field.equals("year")) {
+ result = Calendar.YEAR;
+ } else if (field.equals("month")) {
+ result = Calendar.MONTH;
+ } else if (field.equals("weekOfYear")) {
+ result = Calendar.WEEK_OF_YEAR;
+ } else if (field.equals("date")) {
+ result = Calendar.DATE;
+ } else if (field.equals("dayOfMonth")) {
+ result = Calendar.DAY_OF_MONTH;
+ } else if (field.equals("dayOfYear")) {
+ result = Calendar.DAY_OF_YEAR;
+ } else if (field.equals("dayOfWeek")) {
+ result = Calendar.DAY_OF_WEEK;
+ } else if (field.equals("dayOfWeekInMonth")) {
+ result = Calendar.DAY_OF_WEEK_IN_MONTH;
+ } else if (field.equals("amPm")) {
+ result = Calendar.AM_PM;
+ } else if (field.equals("hour")) {
+ result = Calendar.HOUR;
+ } else if (field.equals("hourOfDay")) {
+ result = Calendar.HOUR_OF_DAY;
+ } else if (field.equals("minute")) {
+ result = Calendar.MINUTE;
+ } else if (field.equals("second")) {
+ result = Calendar.SECOND;
+ } else if (field.equals("millisecond")) {
+ result = Calendar.MILLISECOND;
+ } else {
+ throw new EvaluationException(this,
+ "An invalid date field was supplied");
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/RoundFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/RoundFunction.java
new file mode 100644
index 0000000..1988729
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/RoundFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The RoundFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class RoundFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the RoundFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public RoundFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the RoundFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public RoundFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "round(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ result = Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Double(Math.round(result.doubleValue()));
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ScopeLimitName.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ScopeLimitName.java
new file mode 100644
index 0000000..00f5fb8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ScopeLimitName.java
@@ -0,0 +1,187 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The ScopeLimitName class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ScopeLimitName extends SimpleNode {
+
+ protected String val;
+
+ /**
+ * Used to create an instance of the ScopeLimitName class
+ *
+ *
+ * @param id
+ *
+ */
+ public ScopeLimitName(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the ScopeLimitName class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public ScopeLimitName(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+ return val;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return val;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ScopeLimitOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ScopeLimitOperator.java
new file mode 100644
index 0000000..6cfff69
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ScopeLimitOperator.java
@@ -0,0 +1,231 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The ScopeLimitOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ScopeLimitOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the ScopeLimitOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public ScopeLimitOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the ScopeLimitOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public ScopeLimitOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = jjtGetChild(0).toNormalizedString()
+ + jjtGetChild(1).toNormalizedString();
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Object result;
+ boolean properScope = false;
+ int scope;
+
+ try {
+ String scopeLimit =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+
+ //Map scopes to scope constants
+ if (scopeLimit.equals("page:")) {
+ properScope = true;
+ scope = PageContext.PAGE_SCOPE;
+ } else if (scopeLimit.equals("request:")) {
+ properScope = true;
+ scope = PageContext.REQUEST_SCOPE;
+ } else if (scopeLimit.equals("session:")) {
+ properScope = true;
+ scope = PageContext.SESSION_SCOPE;
+ } else if (scopeLimit.equals("application:")) {
+ properScope = true;
+ scope = PageContext.APPLICATION_SCOPE;
+ } else {
+ throw new EvaluationException("invalid scope operator ["
+ + scopeLimit + "]");
+ }
+
+ if (properScope) {
+ result =
+ ((Introspectable) jjtGetChild(1)).evaluate(pageContext,
+ icontext, scope);
+ } else {
+ throw new EvaluationException("invalid scope operator ["
+ + scopeLimit + "]");
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/SimpleNode.java b/src/org/apache/taglibs/standard/lang/jpath/expression/SimpleNode.java
new file mode 100644
index 0000000..537c117
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/SimpleNode.java
@@ -0,0 +1,533 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * This class provides an abstract implementation of the <tt>Node</tt>
+ * iterface. All actual nodes should extend this class to take advantage
+ * of the default implementations of many of the methods.
+ */
+public abstract class SimpleNode implements Node {
+
+ protected Node parent;
+ protected Node[] children;
+ protected int id;
+ protected Parser parser;
+ protected String image;
+ protected int beginColumn;
+ protected int endColumn;
+ protected int beginLine;
+ protected int endLine;
+ protected Token firstToken;
+ protected Token lastToken;
+ protected Object val;
+
+ /**
+ * Used to create an instance of the SimpleNode class
+ *
+ *
+ * @param i
+ *
+ */
+ public SimpleNode(int i) {
+ id = i;
+ }
+
+ /**
+ * Used to create an instance of the SimpleNode class
+ *
+ *
+ * @param p
+ * @param i
+ *
+ */
+ public SimpleNode(Parser p, int i) {
+
+ this(i);
+
+ parser = p;
+ }
+
+ /**
+ * The jjtOpen method
+ *
+ *
+ */
+ public void jjtOpen() {}
+
+ /**
+ * The jjtClose method
+ *
+ *
+ */
+ public void jjtClose() {}
+
+ /**
+ * The jjtSetParent method
+ *
+ *
+ * @param n
+ *
+ */
+ public void jjtSetParent(Node n) {
+ parent = n;
+ }
+
+ /**
+ * The jjtGetParent method
+ *
+ *
+ * @return
+ *
+ */
+ public Node jjtGetParent() {
+ return parent;
+ }
+
+ /**
+ * The jjtAddChild method
+ *
+ *
+ * @param n
+ * @param i
+ *
+ */
+ public void jjtAddChild(Node n, int i) {
+
+ if (children == null) {
+ children = new Node[i + 1];
+ } else if (i >= children.length) {
+ Node c[] = new Node[i + 1];
+
+ System.arraycopy(children, 0, c, 0, children.length);
+
+ children = c;
+ }
+
+ children[i] = n;
+ }
+
+ /**
+ * The jjtGetChild method
+ *
+ *
+ * @param i
+ *
+ * @return
+ *
+ */
+ public Node jjtGetChild(int i) {
+ return children[i];
+ }
+
+ /**
+ * The jjtGetNumChildren method
+ *
+ *
+ * @return
+ *
+ */
+ public int jjtGetNumChildren() {
+ return (children == null) ? 0 : children.length;
+ }
+
+ /**
+ * Provides a method to print the name of the node. You can override
+ * this method in subclasses of SimpleNode to
+ * customize the way the node appears when the tree is dumped. If
+ * your output uses more than one line you should override
+ * toString(String), otherwise overriding toString() is probably all
+ * you need to do.
+ *
+ * @return
+ */
+ public String toString() {
+ return ParserTreeConstants.jjtNodeName[id];
+ }
+
+ /**
+ * Provides a method to print the name of the node with a prefix string.
+ * You can override
+ * this method in subclasses of SimpleNode to
+ * customize the way the node appears when the tree is dumped. If
+ * your output uses more than one line you should override
+ * toString(String), otherwise overriding toString() is probably all
+ * you need to do.
+ *
+ * @param prefix
+ *
+ * @return
+ */
+ public String toString(String prefix) {
+ return prefix + toString();
+ }
+
+ /**
+ * Provides a method to dump the entire subtree of nodes to
+ * <tt>System.out</tt>. You should
+ * override this method if you want to customize how the node dumps
+ * out its children.
+ *
+ * @param prefix
+ */
+ public void dump(String prefix) {
+
+ System.out.println(toString(prefix));
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ n.dump(prefix + " ");
+ }
+ }
+ }
+ }
+
+ /**
+ * Provides a method to dump the entire subtree of nodes to
+ * <tt>System.out</tt> with a prefix string. You should
+ * override this method if you want to customize how the node dumps
+ * out its children.
+ *
+ * @param prefix
+ *
+ * @return
+ */
+ public String stringDump(String prefix) {
+
+ String result = prefix + toString() + "\n";
+
+ System.out.println(toString(prefix));
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ result = result + n.stringDump(prefix + " ");
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ * @returns The normalized version of the original expression
+ *
+ * @return
+ */
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "toNormalizedString() not implemented in ["
+ + ParserTreeConstants.jjtNodeName[id] + "]";
+
+ return normalized;
+ }
+
+ /**
+ * Provides a method to print the original version of the
+ * expression from this node downward in the tree.
+ * The original version is an accurate representation
+ * of the original expression as it was received. This can be useful
+ * when formatting error messages.
+ *
+ * @returns The original version of the expression, from this node downward
+ *
+ * @return
+ */
+ public String toOriginalString() {
+
+ String result = "";
+ Token t = firstToken;
+ boolean finished = false;
+
+ while (!finished) {
+ result += getSpecialTokenString(t);
+
+ if (t.image != null) {
+ while (result.length() < t.beginColumn - 1) {
+ result += " ";
+ }
+
+ result += (t.image);
+ }
+
+ if (t == lastToken) {
+ finished = true;
+ } else {
+ t = t.next;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Provides a method to print the original version of the
+ * entire expression.
+ * The original version is an accurate representation
+ * of the original expression as it was received. This can be useful
+ * when formatting error messages.
+ *
+ * @returns The original version of the entire expression
+ *
+ * @return
+ */
+ public String rootOriginalString() {
+
+ SimpleNode current = this;
+
+ while (current.parent != null) {
+ current = (SimpleNode) current.parent;
+ }
+
+ return current.toOriginalString();
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @returns the result of the expression evaluation as an object
+ *
+ *
+ * @return
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ throw new EvaluationException(this,
+ "evaluate not supported in ["
+ + ParserTreeConstants.jjtNodeName[id] + "]");
+ }
+
+ /**
+ * The getTokenImage method
+ *
+ *
+ * @param tokenNumber
+ *
+ * @return
+ *
+ */
+ public String getTokenImage(int tokenNumber) {
+
+ String tokenImage = ParserConstants.tokenImage[tokenNumber];
+
+ return tokenImage.substring(1, tokenImage.length() - 1);
+ }
+
+ /**
+ * The getSpecialTokenString method
+ *
+ *
+ * @param t
+ *
+ * @return
+ *
+ */
+ private String getSpecialTokenString(Token t) {
+
+ String result;
+
+ if (t.specialToken == null) {
+ result = "";
+ } else {
+ result = getSpecialTokenString(t) + t.image;
+ }
+
+ return result;
+ }
+
+ /**
+ * Provides a mechanism to validate an expression. This method
+ * validates this node and all child nodes. The validation is done
+ * without any knowldege of the PageContext, and therefore
+ * even after validation, problems may still be encountered during
+ * evaluation. However, many problems, such as invalid literals,
+ * can be caught during validation.
+ *
+ * @throws ValidationException if a problem is encountered during the
+ */
+ public void validate() throws ValidationException {
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ n.validate();
+ }
+ }
+ }
+ }
+
+ /**
+ * Provides a mechanism for simplication of the expression. For instance,
+ * large mathematical expressions with number literals can be simplified
+ * for faster subsequent evaluation. Other simplification may be possible
+ * with certain boolean logic expressions. This mechansim may be used in
+ * conjunction with an expression caching strategy.
+ *
+ * @returns the simplified node
+ *
+ *
+ * @return
+ */
+ public Node simplify() {
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ n = (SimpleNode) n.simplify();
+ }
+ }
+ }
+
+ // Any custom simplification should be done here
+ return this;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/StartsWithFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/StartsWithFunction.java
new file mode 100644
index 0000000..c9f60a7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/StartsWithFunction.java
@@ -0,0 +1,225 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The StartsWithFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class StartsWithFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the StartsWithFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public StartsWithFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the StartsWithFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public StartsWithFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "substring(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Boolean result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+
+ result = new Boolean(arg1.startsWith(arg2));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/StringFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/StringFunction.java
new file mode 100644
index 0000000..4ba71bc
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/StringFunction.java
@@ -0,0 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The StringFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class StringFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the StringFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public StringFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the StringFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public StringFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "string(" + jjtGetChild(0).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ result = Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/StringLengthFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/StringLengthFunction.java
new file mode 100644
index 0000000..42990f9
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/StringLengthFunction.java
@@ -0,0 +1,201 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The StringLengthFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class StringLengthFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the StringLengthFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public StringLengthFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the StringLengthFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public StringLengthFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "string-length(" + jjtGetChild(0).toNormalizedString()
+ + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ result = Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Double(result.length());
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/StringLiteral.java b/src/org/apache/taglibs/standard/lang/jpath/expression/StringLiteral.java
new file mode 100644
index 0000000..2afd646
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/StringLiteral.java
@@ -0,0 +1,187 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The StringLiteral class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class StringLiteral extends SimpleNode {
+
+ protected String val;
+
+ /**
+ * Used to create an instance of the StringLiteral class
+ *
+ *
+ * @param id
+ *
+ */
+ public StringLiteral(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the StringLiteral class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public StringLiteral(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+ return "\"" + val + "\"";
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+ return val;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringAfterFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringAfterFunction.java
new file mode 100644
index 0000000..7b0e5c3
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringAfterFunction.java
@@ -0,0 +1,230 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The SubstringAfterFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class SubstringAfterFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the SubstringAfterFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public SubstringAfterFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the SubstringAfterFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public SubstringAfterFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "substring(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ int index = arg1.indexOf(arg2);
+
+ if (index != -1) {
+ result = arg1.substring(index + arg2.length(), arg1.length());
+ } else {
+ result = "";
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringBeforeFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringBeforeFunction.java
new file mode 100644
index 0000000..4b2790e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringBeforeFunction.java
@@ -0,0 +1,230 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The SubstringBeforeFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class SubstringBeforeFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the SubstringBeforeFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public SubstringBeforeFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the SubstringBeforeFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public SubstringBeforeFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "substring(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ int index = arg1.indexOf(arg2);
+
+ if (index != -1) {
+ result = arg1.substring(0, index);
+ } else {
+ result = "";
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringFunction.java
new file mode 100644
index 0000000..cab065f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/SubstringFunction.java
@@ -0,0 +1,232 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The SubstringFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class SubstringFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the SubstringFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public SubstringFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the SubstringFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public SubstringFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "substring(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ int arg2 = Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).intValue();
+
+ if (jjtGetNumChildren() > 2) {
+ int arg3 =
+ Convert.toDouble(jjtGetChild(2).evaluate(pageContext,
+ icontext)).intValue();
+
+ result = arg1.substring(arg2, arg3);
+ } else {
+ result = arg1.substring(arg2);
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/SubtractionOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/SubtractionOperator.java
new file mode 100644
index 0000000..b7eba50
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/SubtractionOperator.java
@@ -0,0 +1,209 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.math.*;
+
+/**
+ * The SubtractionOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class SubtractionOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the SubtractionOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public SubtractionOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the SubtractionOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public SubtractionOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.MINUS) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Double result;
+
+ try {
+ BigDecimal leftSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(0).evaluate(pageContext,
+ icontext)).toString());
+ BigDecimal rightSide = new BigDecimal(
+ Convert.toDouble(jjtGetChild(1).evaluate(pageContext,
+ icontext)).toString());
+
+ result = new Double((leftSide.subtract(rightSide)).doubleValue());
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/SumFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/SumFunction.java
new file mode 100644
index 0000000..11d714f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/SumFunction.java
@@ -0,0 +1,206 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The SumFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class SumFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the SumFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public SumFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the SumFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public SumFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "string-length(" + jjtGetChild(0).toNormalizedString()
+ + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ double result = 0;
+
+ try {
+ JSPList arg =
+ Convert.toJSPList(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+
+ for (int i = 0; i < arg.getLast(); i++) {
+ result = result + Convert.toDouble(arg.next()).doubleValue();
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return new Double(result);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/Token.java b/src/org/apache/taglibs/standard/lang/jpath/expression/Token.java
new file mode 100644
index 0000000..0794e93
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/Token.java
@@ -0,0 +1,136 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public final String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/TokenMgrError.java b/src/org/apache/taglibs/standard/lang/jpath/expression/TokenMgrError.java
new file mode 100644
index 0000000..070ada8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/TokenMgrError.java
@@ -0,0 +1,188 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/TokenizeFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/TokenizeFunction.java
new file mode 100644
index 0000000..ac9237d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/TokenizeFunction.java
@@ -0,0 +1,232 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+import java.util.*;
+
+/**
+ * The TokenizeFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class TokenizeFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the TokenizeFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public TokenizeFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the TokenizeFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public TokenizeFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "tokenize(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ Object result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ StringTokenizer st = new StringTokenizer(arg1, arg2);
+ ArrayList a = new ArrayList();
+
+ while (st.hasMoreTokens()) {
+ a.add(st.nextToken());
+ }
+
+ result = CollectionAdapter.adapt(a);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/TranslateFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/TranslateFunction.java
new file mode 100644
index 0000000..50a21aa
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/TranslateFunction.java
@@ -0,0 +1,240 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The TranslateFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class TranslateFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the TranslateFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public TranslateFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the TranslateFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public TranslateFunction(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ boolean first = true;
+ String normalized;
+
+ normalized = "substring(";
+
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ if (!first) {
+ normalized = normalized + ",";
+ }
+
+ first = false;
+
+ SimpleNode n = (SimpleNode) children[i];
+
+ if (n != null) {
+ normalized = normalized + n.toNormalizedString();
+ }
+ }
+ }
+
+ normalized = normalized + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ String result;
+
+ try {
+ String arg1 =
+ Convert.toString(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ String arg2 =
+ Convert.toString(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+ String arg3 =
+ Convert.toString(jjtGetChild(2).evaluate(pageContext,
+ icontext));
+
+ result = arg1;
+
+ char replacement;
+
+ for (int i = 0; i < arg2.length(); i++) {
+ if (i < arg3.length()) {
+ replacement = arg3.charAt(i);
+ } else {
+ replacement = 0;
+ }
+
+ result = result.replace(arg2.charAt(i), replacement);
+ }
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/UnionOperator.java b/src/org/apache/taglibs/standard/lang/jpath/expression/UnionOperator.java
new file mode 100644
index 0000000..9577bd8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/UnionOperator.java
@@ -0,0 +1,208 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The UnionOperator class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class UnionOperator extends SimpleNode {
+
+ /**
+ * Used to create an instance of the UnionOperator class
+ *
+ *
+ * @param id
+ *
+ */
+ public UnionOperator(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the UnionOperator class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public UnionOperator(Parser p, int id) {
+ super(p, id);
+ }
+
+ /**
+ * Provides a method to print a normalized version of the original
+ * expression. The normalized version has standardized spacing and
+ * parenthesis, and can be used to compare expressions formatted
+ * in different ways to see if they are actually the same expression.
+ *
+ *
+ * @return The normalized version of the original expression
+ *
+ */
+ public String toNormalizedString() {
+
+ String normalized = "";
+
+ normalized = "(" + jjtGetChild(0).toNormalizedString() + " "
+ + getTokenImage(ParserConstants.UNION) + " "
+ + jjtGetChild(1).toNormalizedString() + ")";
+
+ return normalized;
+ }
+
+ /**
+ * This method evaluates this node of the expression and all child nodes.
+ * It returns the result of the
+ * evaluation as an <tt>Object</tt>. If any problems are encountered
+ * during the evaluation, an <tt>EvaluationException</tt> is thrown.
+ *
+ *
+ * @param pageContext the current JSP PageContext
+ *
+ * @param icontext the Iteration Context of the expression. If there is
+ * no interation context, this should be null.
+ *
+ * @return the result of the expression evaluation as an object
+ *
+ * @throws EvaluationException if a problem is encountered during the
+ * evaluation
+ */
+ public Object evaluate(PageContext pageContext, IterationContext icontext)
+ throws EvaluationException {
+
+ JSPList result;
+
+ try {
+ JSPList leftSide =
+ Convert.toJSPList(jjtGetChild(0).evaluate(pageContext,
+ icontext));
+ JSPList rightSide =
+ Convert.toJSPList(jjtGetChild(1).evaluate(pageContext,
+ icontext));
+
+ result = new JSPListUnion(leftSide, rightSide);
+ } catch (ConversionException ce) {
+ throw new EvaluationException(this, ce.getMessage());
+ }
+
+ return result;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/UserFunction.java b/src/org/apache/taglibs/standard/lang/jpath/expression/UserFunction.java
new file mode 100644
index 0000000..6d57a61
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/UserFunction.java
@@ -0,0 +1,148 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ *
+ */
+
+
+/* Generated By:JJTree: Do not edit this line. UserFunction.java */
+package org.apache.taglibs.standard.lang.jpath.expression;
+
+/**
+ * The UserFunction class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class UserFunction extends SimpleNode {
+
+ /**
+ * Used to create an instance of the UserFunction class
+ *
+ *
+ * @param id
+ *
+ */
+ public UserFunction(int id) {
+ super(id);
+ }
+
+ /**
+ * Used to create an instance of the UserFunction class
+ *
+ *
+ * @param p
+ * @param id
+ *
+ */
+ public UserFunction(Parser p, int id) {
+ super(p, id);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/ValidationException.java b/src/org/apache/taglibs/standard/lang/jpath/expression/ValidationException.java
new file mode 100644
index 0000000..d1d8268
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/ValidationException.java
@@ -0,0 +1,291 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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/>.
+ *
+ */
+
+/* +===================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jpath.expression;
+
+import org.apache.taglibs.standard.lang.jpath.adapter.*;
+import javax.servlet.jsp.*;
+
+/**
+ * The ValidationException class
+ *
+ *
+ * @author <a href='mailto:scott.hasse@isthmusgroup.com'>Scott Hasse</a>
+ * @version
+ */
+public class ValidationException extends Exception {
+
+ protected boolean specialConstructor;
+ public String image;
+ protected SimpleNode node;
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable".
+ */
+ public ValidationException() {
+
+ super();
+
+ specialConstructor = false;
+ }
+
+ /**
+ * Used to create an instance of the ValidationException class
+ *
+ *
+ * @param message
+ *
+ */
+ public ValidationException(String message) {
+
+ super(message);
+
+ specialConstructor = false;
+ }
+
+ /**
+ * Used to create an instance of the ValidationException class
+ *
+ *
+ * @param currentNode
+ * @param message
+ *
+ */
+ public ValidationException(SimpleNode currentNode, String message) {
+
+ super(message);
+
+ specialConstructor = true;
+ node = currentNode;
+ }
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" to generate an evaluation
+ * error message and returns it. If this object has been created
+ * due to an evaluation error, and you do not catch it (it gets thrown
+ * during the evaluation), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ *
+ * @return
+ */
+ public String getMessage() {
+
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+
+ String expected = "";
+ int maxSize = 1;
+ String retval = eol + "Encountered \"";
+
+ retval += super.getMessage();
+ retval += "\"" + eol;
+ retval += "at : " + eol;
+ retval += node.rootOriginalString() + eol;
+
+ for (int i = 0; i < node.firstToken.beginColumn - 1; i++) {
+ retval += " ";
+ }
+
+ for (int i = 0; i
+ < node.lastToken.endColumn
+ - (node.firstToken.beginColumn - 1); i++) {
+ retval += "^";
+ }
+
+ retval += eol;
+ retval += "beginning at column " + node.firstToken.beginColumn + "."
+ + eol;
+ retval += "ending at column " + node.lastToken.endColumn + "." + eol;
+
+ return retval;
+ }
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ *
+ * @param str
+ *
+ * @return
+ */
+ protected String add_escapes(String str) {
+
+ StringBuffer retval = new StringBuffer();
+ char ch;
+
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i)) {
+
+ case 0 :
+ continue;
+ case '\b' :
+ retval.append("\\b");
+
+ continue;
+ case '\t' :
+ retval.append("\\t");
+
+ continue;
+ case '\n' :
+ retval.append("\\n");
+
+ continue;
+ case '\f' :
+ retval.append("\\f");
+
+ continue;
+ case '\r' :
+ retval.append("\\r");
+
+ continue;
+ case '\"' :
+ retval.append("\\\"");
+
+ continue;
+ case '\'' :
+ retval.append("\\\'");
+
+ continue;
+ case '\\' :
+ retval.append("\\\\");
+
+ continue;
+ default :
+ if ((ch = str.charAt(i)) < 0x20 || (ch > 0x7e)) {
+ String s = "0000" + Integer.toString(ch, 16);
+
+ retval.append("\\u"
+ + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+
+ continue;
+ }
+ }
+
+ return retval.toString();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/jpath/expression/package.html b/src/org/apache/taglibs/standard/lang/jpath/expression/package.html
new file mode 100644
index 0000000..8ef61f1
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/expression/package.html
@@ -0,0 +1,10 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Doug Cutting">
+</head>
+<body>
+Provides implementations of the expression functions, operators and literals.
+</body>
+</html>
diff --git a/src/org/apache/taglibs/standard/lang/jpath/readme.txt b/src/org/apache/taglibs/standard/lang/jpath/readme.txt
new file mode 100644
index 0000000..52fac12
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jpath/readme.txt
@@ -0,0 +1,2 @@
+The JPath expression language was written by Scott Hasse of the Isthmus
+Group.
diff --git a/src/org/apache/taglibs/standard/lang/jxpath/JXPathExpressionEvaluator.java b/src/org/apache/taglibs/standard/lang/jxpath/JXPathExpressionEvaluator.java
new file mode 100644
index 0000000..a6d6c09
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/jxpath/JXPathExpressionEvaluator.java
@@ -0,0 +1,122 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.jxpath;
+
+import org.apache.commons.jxpath.JXPathContext;
+import org.apache.commons.jxpath.servlet.JXPathServletContexts;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.lang.support.*;
+import javax.servlet.jsp.jstl.core.IteratorTag;
+import java.util.*;
+
+/**
+ * <p>An ExpressionEvaluation that evaluates expressions against the JXPath
+ * implementation of the XPath language. JXPath is found in Jakarta
+ * Commons.</p>
+ *
+ * <p>NOTE: The current version of this expression-language interpreter
+ * does not support translation-time validation of requests.</p>
+ *
+ * @author Dmitri Plotnikov
+ * @author Shawn Bayern
+ */
+public class JXPathExpressionEvaluator implements ExpressionEvaluator {
+
+ /**
+ * Translation time validation of an expression.
+ * This method will return a null String if the expression
+ * is valid; otherwise an error message.
+ */
+ public String validate(String attributeName,
+ String expression) {
+ String result = null;
+ // TBD
+ return result;
+ }
+
+ /**
+ * Evaluates the expression at request time.
+ */
+ public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException {
+ try {
+ // System.err.println("TAG: " + tag + " " + attributeName);
+ JXPathContext context =
+ JXPathServletContexts.getPageContext(pageContext);
+ Object result = null;
+ if ((tag instanceof IteratorTag) && attributeName.equals("items")) {
+ List list = context.eval(expression);
+ if (list.size() == 1)
+ if (list.get(0) instanceof Map)
+ result = list.get(0);
+ if (result == null)
+ result = list;
+ }
+ else
+ result = context.getValue(expression, expectedType);
+ return ((result != null) ? result : "");
+ }
+ catch (Exception ex) {
+ // ex.printStackTrace();
+ throw new JspException(ex.getMessage());
+ }
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/BeanInfoManager.java b/src/org/apache/taglibs/standard/lang/spel/BeanInfoManager.java
new file mode 100644
index 0000000..742ab88
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/BeanInfoManager.java
@@ -0,0 +1,359 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.jsp.JspException;
+
+/**
+ *
+ * <p>Manages the BeanInfo for one class - contains the BeanInfo, and
+ * also a mapping from property name to BeanInfoProperty. There are
+ * also static methods for accessing the BeanInfoManager for a class -
+ * those mappings are cached permanently so that once the
+ * BeanInfoManager is calculated, it doesn't have to be calculated
+ * again.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class BeanInfoManager
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property beanClass
+
+ Class mBeanClass;
+ public Class getBeanClass ()
+ { return mBeanClass; }
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ // The BeanInfo
+ BeanInfo mBeanInfo;
+
+ // Mapping from property name to BeanInfoProperty
+ Map mPropertyByName;
+
+ // Mapping from event set name to event set descriptor
+ Map mEventSetByName;
+
+ // Flag if this is initialized
+ boolean mInitialized;
+
+ // The global mapping from class to BeanInfoManager
+ static Map mBeanInfoManagerByClass = new HashMap ();
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ BeanInfoManager (Class pBeanClass)
+ {
+ mBeanClass = pBeanClass;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the BeanInfoManager for the specified class
+ **/
+ public static BeanInfoManager getBeanInfoManager (Class pClass)
+ {
+ BeanInfoManager ret = (BeanInfoManager)
+ mBeanInfoManagerByClass.get (pClass);
+ if (ret == null) {
+ ret = createBeanInfoManager (pClass);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Creates and registers the BeanInfoManager for the given class if
+ * it isn't already registered.
+ **/
+ static synchronized BeanInfoManager createBeanInfoManager (Class pClass)
+ {
+ // Because this method is synchronized statically, the
+ // BeanInfoManager is not initialized at this time (otherwise it
+ // could end up being a bottleneck for the entire system). It is
+ // put into the map in an uninitialized state. The first time
+ // someone tries to use it, it will be initialized (with proper
+ // synchronizations in place to make sure it is only initialized
+ // once).
+
+ BeanInfoManager ret = (BeanInfoManager)
+ mBeanInfoManagerByClass.get (pClass);
+ if (ret == null) {
+ ret = new BeanInfoManager (pClass);
+ mBeanInfoManagerByClass.put (pClass, ret);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the BeanInfoProperty for the specified property in the
+ * given class, or null if not found.
+ **/
+ public static BeanInfoProperty getBeanInfoProperty
+ (Class pClass,
+ String pPropertyName)
+ throws JspException
+ {
+ return getBeanInfoManager (pClass).getProperty (pPropertyName);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Makes sure that this class has been initialized, and synchronizes
+ * the initialization if it's required.
+ **/
+ void checkInitialized ()
+ throws JspException
+ {
+ if (!mInitialized) {
+ synchronized (this) {
+ if (!mInitialized) {
+ initialize ();
+ mInitialized = true;
+ }
+ }
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Initializes by mapping property names to BeanInfoProperties
+ **/
+ void initialize ()
+ throws JspException
+ {
+ try {
+ mBeanInfo = Introspector.getBeanInfo (mBeanClass);
+
+ mPropertyByName = new HashMap ();
+ PropertyDescriptor [] pds = mBeanInfo.getPropertyDescriptors ();
+ for (int i = 0; i < pds.length; i++) {
+ PropertyDescriptor pd = pds [i];
+ Method readMethod = getPublicMethod (pd.getReadMethod ());
+ Method writeMethod = getPublicMethod (pd.getWriteMethod ());
+ BeanInfoProperty property = new BeanInfoProperty
+ (readMethod,
+ writeMethod,
+ pd);
+
+ mPropertyByName.put (pd.getName (), property);
+ }
+
+ mEventSetByName = new HashMap ();
+ EventSetDescriptor [] esds = mBeanInfo.getEventSetDescriptors ();
+ for (int i = 0; i < esds.length; i++) {
+ EventSetDescriptor esd = esds [i];
+ mEventSetByName.put (esd.getName (), esd);
+ }
+ }
+ catch (IntrospectionException exc) {
+ throw new SpelException
+ (Constants.EXCEPTION_GETTING_BEANINFO,
+ mBeanClass.getName (),
+ exc);
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the BeanInfo for the class
+ **/
+ BeanInfo getBeanInfo ()
+ throws JspException
+ {
+ checkInitialized ();
+ return mBeanInfo;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the BeanInfoProperty for the given property name, or null
+ * if not found.
+ **/
+ public BeanInfoProperty getProperty (String pPropertyName)
+ throws JspException
+ {
+ checkInitialized ();
+ return (BeanInfoProperty) mPropertyByName.get (pPropertyName);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the EventSetDescriptor for the given event set name, or
+ * null if not found.
+ **/
+ public EventSetDescriptor getEventSet (String pEventSetName)
+ throws JspException
+ {
+ checkInitialized ();
+ return (EventSetDescriptor) mEventSetByName.get (pEventSetName);
+ }
+
+ //-------------------------------------
+ // Finding the public version of a method - if a PropertyDescriptor
+ // is obtained for a non-public class that implements a public
+ // interface, the read/write methods will be for the class, and
+ // therefore inaccessible. To correct this, a version of the same
+ // method must be found in a superclass or interface.
+ //-------------------------------------
+ /**
+ *
+ * Returns a publicly-accessible version of the given method, by
+ * searching for a public declaring class.
+ **/
+ static Method getPublicMethod (Method pMethod)
+ {
+ if (pMethod == null) {
+ return null;
+ }
+
+ // See if the method is already available from a public class
+ Class cl = pMethod.getDeclaringClass ();
+ if (Modifier.isPublic (cl.getModifiers ())) {
+ return pMethod;
+ }
+
+ // Otherwise, try to find a public class that declares the method
+ Method ret = getPublicMethod (cl, pMethod);
+ if (ret != null) {
+ return ret;
+ }
+ else {
+ return pMethod;
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * If the given class is public and has a Method that declares the
+ * same name and arguments as the given method, then that method is
+ * returned. Otherwise the superclass and interfaces are searched
+ * recursively.
+ **/
+ static Method getPublicMethod (Class pClass,
+ Method pMethod)
+ {
+ // See if this is a public class declaring the method
+ if (Modifier.isPublic (pClass.getModifiers ())) {
+ try {
+ Method m = pClass.getDeclaredMethod (pMethod.getName (),
+ pMethod.getParameterTypes ());
+ if (Modifier.isPublic (m.getModifiers ())) {
+ return m;
+ }
+ }
+ catch (NoSuchMethodException exc) {}
+ }
+
+ // Search the interfaces
+ {
+ Class [] interfaces = pClass.getInterfaces ();
+ if (interfaces != null) {
+ for (int i = 0; i < interfaces.length; i++) {
+ Method m = getPublicMethod (interfaces [i], pMethod);
+ if (m != null) {
+ return m;
+ }
+ }
+ }
+ }
+
+ // Search the superclass
+ {
+ Class superclass = pClass.getSuperclass ();
+ if (superclass != null) {
+ Method m = getPublicMethod (superclass, pMethod);
+ if (m != null) {
+ return m;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/BeanInfoProperty.java b/src/org/apache/taglibs/standard/lang/spel/BeanInfoProperty.java
new file mode 100644
index 0000000..42898d1
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/BeanInfoProperty.java
@@ -0,0 +1,116 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+
+/**
+ *
+ * <p>This contains the information for one property in a BeanInfo -
+ * PropertyDescriptor, read method, and write method. This class is
+ * necessary because the read/write methods in the PropertyDescriptor
+ * may not be accessible if the bean given to the introspector is not
+ * a public class. In this case, a publicly accessible version of the
+ * method must be found by searching for a public superclass/interface
+ * that declares the method (this searching is done by the
+ * BeanInfoManager).
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class BeanInfoProperty
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property readMethod
+
+ Method mReadMethod;
+ public Method getReadMethod ()
+ { return mReadMethod; }
+
+ //-------------------------------------
+ // property writeMethod
+
+ Method mWriteMethod;
+ public Method getWriteMethod ()
+ { return mWriteMethod; }
+
+ //-------------------------------------
+ // property propertyDescriptor
+
+ PropertyDescriptor mPropertyDescriptor;
+ public PropertyDescriptor getPropertyDescriptor ()
+ { return mPropertyDescriptor; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public BeanInfoProperty (Method pReadMethod,
+ Method pWriteMethod,
+ PropertyDescriptor pPropertyDescriptor)
+ {
+ mReadMethod = pReadMethod;
+ mWriteMethod = pWriteMethod;
+ mPropertyDescriptor = pPropertyDescriptor;
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/BooleanLiteral.java b/src/org/apache/taglibs/standard/lang/spel/BooleanLiteral.java
new file mode 100644
index 0000000..aef41ae
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/BooleanLiteral.java
@@ -0,0 +1,112 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+/**
+ *
+ * <p>An expression representing a boolean literal value
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class BooleanLiteral
+ extends Literal
+{
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ public static final BooleanLiteral TRUE = new BooleanLiteral ("true");
+ public static final BooleanLiteral FALSE = new BooleanLiteral ("false");
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public BooleanLiteral (String pToken)
+ {
+ super (getValueFromToken (pToken));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Parses the given token into the literal value
+ **/
+ static Object getValueFromToken (String pToken)
+ {
+ return
+ ("true".equals (pToken)) ?
+ Boolean.TRUE :
+ Boolean.FALSE;
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ return (getValue () == Boolean.TRUE) ? "true" : "false";
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/Constants.java b/src/org/apache/taglibs/standard/lang/spel/Constants.java
new file mode 100644
index 0000000..2726dff
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/Constants.java
@@ -0,0 +1,158 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+
+/**
+ *
+ * <p>This contains all of the non-public constants, including
+ * messsage strings read from the resource file.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class Constants
+{
+ //-------------------------------------
+ // Resources
+
+ static ResourceBundle sResources =
+ ResourceBundle.getBundle ("org.apache.taglibs.standard.lang.spel.Resources");
+
+ //-------------------------------------
+ // Messages from the resource bundle
+ //-------------------------------------
+
+ public static final String EXCEPTION_GETTING_BEANINFO =
+ getStringResource ("EXCEPTION_GETTING_BEANINFO");
+
+ public static final String CANT_GET_PROPERTY_OF_NULL =
+ getStringResource ("CANT_GET_PROPERTY_OF_NULL");
+
+ public static final String NO_SUCH_PROPERTY =
+ getStringResource ("NO_SUCH_PROPERTY");
+
+ public static final String NO_GETTER_METHOD =
+ getStringResource ("NO_GETTER_METHOD");
+
+ public static final String ERROR_GETTING_PROPERTY =
+ getStringResource ("ERROR_GETTING_PROPERTY");
+
+ public static final String COMPARISON_OF_NULL =
+ getStringResource ("COMPARISON_OF_NULL");
+
+ public static final String ILLEGAL_COMPARISON =
+ getStringResource ("ILLEGAL_COMPARISON");
+
+ public static final String NULL_TO_PRIMITIVE =
+ getStringResource ("NULL_TO_PRIMITIVE");
+
+ public static final String ILLEGAL_CONVERSION =
+ getStringResource ("ILLEGAL_CONVERSION");
+
+ public static final String NULL_EXPRESSION =
+ getStringResource ("NULL_EXPRESSION");
+
+ public static final String PARSE_EXCEPTION =
+ getStringResource ("PARSE_EXCEPTION");
+
+ public static final String NO_PROPERTY_EDITOR =
+ getStringResource ("NO_PROPERTY_EDITOR");
+
+ public static final String CANT_PARSE_LITERAL =
+ getStringResource ("CANT_PARSE_LITERAL");
+
+ public static final String CANT_FIND_ATTRIBUTE =
+ getStringResource ("CANT_FIND_ATTRIBUTE");
+
+ //-------------------------------------
+ // Getting resources
+ //-------------------------------------
+ /**
+ *
+ *
+ **/
+ public static String getStringResource (String pResourceName)
+ throws MissingResourceException
+ {
+ try {
+ String ret = sResources.getString (pResourceName);
+ if (ret == null) {
+ String str = "ERROR: Unable to load resource " + pResourceName;
+ System.err.println (str);
+ throw new MissingResourceException
+ (str,
+ "org.apache.taglibs.standard.lang.spel.Constants",
+ pResourceName);
+ }
+ else {
+ return ret;
+ }
+ }
+ catch (MissingResourceException exc) {
+ System.err.println ("ERROR: Unable to load resource " +
+ pResourceName +
+ ": " +
+ exc);
+ throw exc;
+ }
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/Evaluator.java b/src/org/apache/taglibs/standard/lang/spel/Evaluator.java
new file mode 100644
index 0000000..2742927
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/Evaluator.java
@@ -0,0 +1,381 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.Tag;
+import org.apache.taglibs.standard.lang.spel.parser.ParseException;
+import org.apache.taglibs.standard.lang.spel.parser.SpelParser;
+import org.apache.taglibs.standard.lang.spel.parser.TokenMgrError;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluator;
+
+/**
+ *
+ * <p>This is the main class for evaluating expressions. If the
+ * expression starts with "$", then it is evaluated as an SPEL
+ * expression. Otherwise, it is parsed into its expected type using
+ * the PropertyEditor mechanism.
+ *
+ * <p>The evaluator maintains a cache mapping expression strings to
+ * ParsedExpressions. It also maintains a cache mapping
+ * ExpectedType/LiteralString to parsed literal values.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class Evaluator
+ implements ExpressionEvaluator
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ // The mapping from expression to ParsedExpression
+ static Map mCachedExpressions =
+ Collections.synchronizedMap (new HashMap ());
+
+ // The mapping from ExpectedType to Maps mapping literal String to
+ // parsed value
+ static Map mCachedExpectedTypes = new HashMap ();
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public Evaluator ()
+ {
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates the given expression as either an SPEL expression (if
+ * it starts with $) or a literal value converted to the specified
+ * expected type
+ **/
+ public Object evaluate (String pExpression,
+ PageContext pPageContext,
+ Class pExpectedType)
+ throws JspException
+ {
+ // Check for null expression
+ if (pExpression == null) {
+ throw new SpelException
+ (Constants.NULL_EXPRESSION);
+ }
+
+ // See if the expression starts with $
+ if (pExpression.startsWith ("$")) {
+ return evaluateExpression (pExpression,
+ pPageContext,
+ pExpectedType);
+ }
+ else {
+ return evaluateLiteral (pExpression,
+ pPageContext,
+ pExpectedType);
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates the given expression as an SPEL expression.
+ **/
+ Object evaluateExpression (String pExpression,
+ PageContext pPageContext,
+ Class pExpectedType)
+ throws JspException
+ {
+ ParsedExpression exp = getOrParseExpression (pExpression);
+ return
+ exp.evaluate (pPageContext,
+ pExpectedType);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Gets the parsed form of the given expression. If the parsed form
+ * is cached, return the cached form, otherwise parse and cache the
+ * expression.
+ **/
+ public static ParsedExpression getOrParseExpression (String pExpression)
+ throws JspException
+ {
+ // See if it's in the cache
+ ParsedExpression ret = (ParsedExpression)
+ mCachedExpressions.get (pExpression);
+
+ if (ret == null) {
+ // Parse the expression
+ Reader r = new StringReader (pExpression);
+
+ // Read past the '$'
+ try {
+ r.read ();
+ }
+ catch (IOException exc) {
+ // This should never occur
+ }
+
+ SpelParser parser = new SpelParser (r);
+ try {
+ Expression exp = parser.Expression ();
+ ret = new ParsedExpression (pExpression, exp);
+ mCachedExpressions.put (pExpression, ret);
+ }
+ catch (ParseException exc) {
+ throw new SpelException
+ (Constants.PARSE_EXCEPTION,
+ exc);
+ }
+ catch (TokenMgrError exc) {
+ throw new SpelException
+ (Constants.PARSE_EXCEPTION,
+ exc);
+ }
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates the given expression as a literal value converted to
+ * the given expected type
+ **/
+ public Object evaluateLiteral (String pExpression,
+ PageContext pPageContext,
+ Class pExpectedType)
+ throws JspException
+ {
+ if (pExpectedType == null) {
+ return pExpression;
+ }
+
+ // Get the expectedType's mapping from value to parsed value
+ Map values = getOrCreateExpectedTypeMap (pExpectedType);
+
+ // See if the parsed value is already in there
+ if (values.containsKey (pExpression)) {
+ return values.get (pExpression);
+ }
+
+ // If the value starts with "\$", remove the leading "\"
+ String valStr = pExpression;
+ if (valStr.startsWith ("\\$")) {
+ valStr = valStr.substring (1);
+ }
+ Object val;
+
+ // See if we're parsing to a String or Object type
+ if (pExpectedType == String.class ||
+ pExpectedType == Object.class) {
+ val = valStr;
+ }
+
+ // Otherwise, use the PropertyEditor mechanism to parse the
+ // property type.
+ else {
+ val = parseToExpectedType (pExpression, pExpectedType);
+ }
+
+ values.put (valStr, val);
+ return val;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Parses the specified value to the expected type using the
+ * primitive valueOf mechanism, or the PropertyEditor mechanism.
+ **/
+ Object parseToExpectedType (String pValue,
+ Class pExpectedType)
+ throws JspException
+ {
+ // Special-case the primitives
+ if (pExpectedType == Boolean.TYPE ||
+ pExpectedType == Boolean.class) {
+ return Boolean.valueOf (pValue);
+ }
+ else if (pExpectedType == Byte.TYPE ||
+ pExpectedType == Byte.class) {
+ return Byte.valueOf (pValue);
+ }
+ else if (pExpectedType == Short.TYPE ||
+ pExpectedType == Short.class) {
+ return Short.valueOf (pValue);
+ }
+ else if (pExpectedType == Integer.TYPE ||
+ pExpectedType == Integer.class) {
+ return Integer.valueOf (pValue);
+ }
+ else if (pExpectedType == Long.TYPE ||
+ pExpectedType == Long.class) {
+ return Long.valueOf (pValue);
+ }
+ else if (pExpectedType == Float.TYPE ||
+ pExpectedType == Float.class) {
+ return Float.valueOf (pValue);
+ }
+ else if (pExpectedType == Double.TYPE ||
+ pExpectedType == Double.class) {
+ return Double.valueOf (pValue);
+ }
+ else {
+ // Use the PropertyEditor mechanism
+ PropertyEditor pe = PropertyEditorManager.findEditor (pExpectedType);
+ if (pe == null) {
+ throw new SpelException
+ (Constants.NO_PROPERTY_EDITOR,
+ pValue,
+ pExpectedType.getName ());
+ }
+
+ try {
+ pe.setAsText (pValue);
+ return pe.getValue ();
+ }
+ catch (IllegalArgumentException exc) {
+ throw new SpelException
+ (Constants.CANT_PARSE_LITERAL,
+ pValue,
+ pExpectedType.getName (),
+ exc);
+ }
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Creates or returns the Map that maps string literals to parsed
+ * values for the specified expected type.
+ **/
+ static Map getOrCreateExpectedTypeMap (Class pExpectedType)
+ {
+ synchronized (mCachedExpectedTypes) {
+ Map ret = (Map) mCachedExpectedTypes.get (pExpectedType);
+ if (ret == null) {
+ ret = Collections.synchronizedMap (new HashMap ());
+ mCachedExpectedTypes.put (pExpectedType, ret);
+ }
+ return ret;
+ }
+ }
+
+ //-------------------------------------
+ // ExpressionEvaluator methods
+ //-------------------------------------
+ /**
+ *
+ * Translation time validation of an expression. This method will
+ * return a null String if the expression is valid; otherwise an
+ * error message.
+ **/
+ public String validate (String pAttributeName,
+ String pExpression)
+ {
+ // If the expression starts with "$", try to parse it
+ if (pExpression.startsWith ("$")) {
+ try {
+ getOrParseExpression (pExpression);
+ return null;
+ }
+ catch (JspException exc) {
+ return exc.toString ();
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates the expression at request time
+ **/
+ public Object evaluate (String pAttributeName,
+ String pExpression,
+ Class pExpectedType,
+ Tag pTag,
+ PageContext pPageContext)
+ throws JspException
+ {
+ return evaluate (pExpression, pPageContext, pExpectedType);
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/Expression.java b/src/org/apache/taglibs/standard/lang/spel/Expression.java
new file mode 100644
index 0000000..218c7cf
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/Expression.java
@@ -0,0 +1,93 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>The abstract class from which all expression types
+ * derive.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public abstract class Expression
+{
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public abstract String getExpressionString ();
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public abstract Object evaluate (PageContext pContext)
+ throws JspException;
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/FloatingPointLiteral.java b/src/org/apache/taglibs/standard/lang/spel/FloatingPointLiteral.java
new file mode 100644
index 0000000..d0aa7d2
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/FloatingPointLiteral.java
@@ -0,0 +1,103 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+/**
+ *
+ * <p>An expression representing a floating point literal value. The
+ * value is stored internally as a double.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class FloatingPointLiteral
+ extends Literal
+{
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public FloatingPointLiteral (String pToken)
+ {
+ super (getValueFromToken (pToken));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Parses the given token into the literal value
+ **/
+ static Object getValueFromToken (String pToken)
+ {
+ return new Double (pToken);
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ return getValue ().toString ();
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/IntegerLiteral.java b/src/org/apache/taglibs/standard/lang/spel/IntegerLiteral.java
new file mode 100644
index 0000000..1a59a0d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/IntegerLiteral.java
@@ -0,0 +1,103 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+/**
+ *
+ * <p>An expression representing an integer literal value. The value
+ * is stored internally as a long.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class IntegerLiteral
+ extends Literal
+{
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public IntegerLiteral (String pToken)
+ {
+ super (getValueFromToken (pToken));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Parses the given token into the literal value
+ **/
+ static Object getValueFromToken (String pToken)
+ {
+ return new Long (pToken);
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ return getValue ().toString ();
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/Literal.java b/src/org/apache/taglibs/standard/lang/spel/Literal.java
new file mode 100644
index 0000000..e70371c
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/Literal.java
@@ -0,0 +1,107 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>An expression representing a literal value
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public abstract class Literal
+ extends Expression
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property value
+
+ Object mValue;
+ public Object getValue ()
+ { return mValue; }
+ public void setValue (Object pValue)
+ { mValue = pValue; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public Literal (Object pValue)
+ {
+ mValue = pValue;
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Evaluates to the literal value
+ **/
+ public Object evaluate (PageContext pContext)
+ throws JspException
+ {
+ return mValue;
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/NamedValue.java b/src/org/apache/taglibs/standard/lang/spel/NamedValue.java
new file mode 100644
index 0000000..876dc92
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/NamedValue.java
@@ -0,0 +1,139 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>Represents a name/scope combination
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class NamedValue
+ extends Expression
+{
+ //-------------------------------------
+ // Constants
+ //-------------------------------------
+
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property scope
+
+ Scope mScope;
+ public Scope getScope ()
+ { return mScope; }
+
+ //-------------------------------------
+ // property name
+
+ String mName;
+ public String getName ()
+ { return mName; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public NamedValue (Scope pScope,
+ String pName)
+ {
+ mScope = pScope;
+ mName = pName;
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ return
+ mScope.toString () +
+ StringLiteral.toIdentifierToken (mName);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates by looking up the name in the appropriate context
+ **/
+ public Object evaluate (PageContext pContext)
+ throws JspException
+ {
+ Object ret = mScope.getAttributeValue (mName, pContext);
+ if (ret == null) {
+ throw new SpelExpressionException
+ (Constants.CANT_FIND_ATTRIBUTE,
+ mName,
+ mScope.getScopeName ());
+ }
+ else {
+ return ret;
+ }
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/NullLiteral.java b/src/org/apache/taglibs/standard/lang/spel/NullLiteral.java
new file mode 100644
index 0000000..8e292ea
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/NullLiteral.java
@@ -0,0 +1,98 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+/**
+ *
+ * <p>An expression representing a null literal value
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class NullLiteral
+ extends Literal
+{
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ public static final NullLiteral SINGLETON = new NullLiteral ();
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public NullLiteral ()
+ {
+ super (null);
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ return "null";
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/ParsedExpression.java b/src/org/apache/taglibs/standard/lang/spel/ParsedExpression.java
new file mode 100644
index 0000000..d7a0d59
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/ParsedExpression.java
@@ -0,0 +1,229 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>This represents the result of parsing an expression. It
+ * contains the Expression object representing the parsed result, and
+ * the original expression string.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class ParsedExpression
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property expressionString
+
+ String mExpressionString;
+ public String getExpressionString ()
+ { return mExpressionString; }
+
+ //-------------------------------------
+ // property expression
+
+ Expression mExpression;
+ public Expression getExpression ()
+ { return mExpression; }
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public ParsedExpression (String pExpressionString,
+ Expression pExpression)
+ {
+ mExpressionString = pExpressionString;
+ mExpression = pExpression;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates the expression within the context of the given
+ * PageContext, casting the result to the given expected type.
+ **/
+ public Object evaluate (PageContext pPageContext,
+ Class pExpectedType)
+ throws JspException
+ {
+ Object ret = mExpression.evaluate (pPageContext);
+
+ // If assignable to the expected type, return
+ if (ret != null &&
+ pExpectedType.isAssignableFrom (ret.getClass ())) {
+ return ret;
+ }
+
+ // If value is null, return if expected type is not a primitive,
+ // error if it is a primitive
+ if (ret == null) {
+ if (pExpectedType.isPrimitive ()) {
+ throw new SpelException
+ (Constants.NULL_TO_PRIMITIVE,
+ pExpectedType.getName ());
+ }
+ else {
+ return ret;
+ }
+ }
+
+ Class cl = ret.getClass ();
+ Class et = getObjectPrimitiveType (pExpectedType);
+
+ // If the non-primitive version of the expected type matches,
+ // return
+ if (cl == et) {
+ return ret;
+ }
+
+ // If both types are numeric, cast to the expected type
+ if (et == Byte.class) {
+ if (ret instanceof Number) {
+ return PrimitiveObjects.getByte
+ (((Number) ret).byteValue ());
+ }
+ }
+ else if (et == Short.class) {
+ if (ret instanceof Number) {
+ return PrimitiveObjects.getShort
+ (((Number) ret).shortValue ());
+ }
+ }
+ else if (et == Integer.class) {
+ if (ret instanceof Number) {
+ return PrimitiveObjects.getInteger
+ (((Number) ret).intValue ());
+ }
+ }
+ else if (et == Long.class) {
+ if (ret instanceof Number) {
+ return PrimitiveObjects.getLong
+ (((Number) ret).longValue ());
+ }
+ }
+ else if (et == Float.class) {
+ if (ret instanceof Number) {
+ return PrimitiveObjects.getFloat
+ (((Number) ret).floatValue ());
+ }
+ }
+ else if (et == Double.class) {
+ if (ret instanceof Number) {
+ return PrimitiveObjects.getDouble
+ (((Number) ret).doubleValue ());
+ }
+ }
+
+ // All other cases are errors
+ throw new SpelException
+ (Constants.ILLEGAL_CONVERSION,
+ cl.getName (),
+ pExpectedType.getName ());
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * If the class is a primitive type, returns the object type of that
+ * class. Otherwise, returns the class.
+ **/
+ Class getObjectPrimitiveType (Class pClass)
+ {
+ if (pClass == Boolean.TYPE) {
+ return Boolean.class;
+ }
+ else if (pClass == Byte.TYPE) {
+ return Byte.class;
+ }
+ else if (pClass == Character.TYPE) {
+ return Character.class;
+ }
+ else if (pClass == Short.TYPE) {
+ return Short.class;
+ }
+ else if (pClass == Integer.TYPE) {
+ return Integer.class;
+ }
+ else if (pClass == Long.TYPE) {
+ return Long.class;
+ }
+ else if (pClass == Float.TYPE) {
+ return Float.class;
+ }
+ else if (pClass == Double.TYPE) {
+ return Double.class;
+ }
+ else {
+ return pClass;
+ }
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/PrimitiveObjects.java b/src/org/apache/taglibs/standard/lang/spel/PrimitiveObjects.java
new file mode 100644
index 0000000..9c01c89
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/PrimitiveObjects.java
@@ -0,0 +1,244 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>This converts primitive values to their Object counterparts.
+ * For bytes and chars, values from 0 to 255 are cached. For shorts,
+ * ints, and longs, values -1000 to 1000 are cached.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+class PrimitiveObjects
+{
+ //-------------------------------------
+ // Constants
+ //-------------------------------------
+
+ static int BYTE_LOWER_BOUND = 0;
+ static int BYTE_UPPER_BOUND = 255;
+ static int CHARACTER_LOWER_BOUND = 0;
+ static int CHARACTER_UPPER_BOUND = 255;
+ static int SHORT_LOWER_BOUND = -1000;
+ static int SHORT_UPPER_BOUND = 1000;
+ static int INTEGER_LOWER_BOUND = -1000;
+ static int INTEGER_UPPER_BOUND = 1000;
+ static int LONG_LOWER_BOUND = -1000;
+ static int LONG_UPPER_BOUND = 1000;
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ static Byte [] mBytes = createBytes ();
+ static Character [] mCharacters = createCharacters ();
+ static Short [] mShorts = createShorts ();
+ static Integer [] mIntegers = createIntegers ();
+ static Long [] mLongs = createLongs ();
+
+ //-------------------------------------
+ // Getting primitive values
+ //-------------------------------------
+ public static Boolean getBoolean (boolean pValue)
+ {
+ return
+ pValue ?
+ Boolean.TRUE :
+ Boolean.FALSE;
+ }
+
+ //-------------------------------------
+ public static Byte getByte (byte pValue)
+ {
+ if (pValue >= BYTE_LOWER_BOUND &&
+ pValue <= BYTE_UPPER_BOUND) {
+ return mBytes [((int) pValue) - BYTE_LOWER_BOUND];
+ }
+ else {
+ return new Byte (pValue);
+ }
+ }
+
+ //-------------------------------------
+ public static Character getCharacter (char pValue)
+ {
+ if (pValue >= CHARACTER_LOWER_BOUND &&
+ pValue <= CHARACTER_UPPER_BOUND) {
+ return mCharacters [((int) pValue) - CHARACTER_LOWER_BOUND];
+ }
+ else {
+ return new Character (pValue);
+ }
+ }
+
+ //-------------------------------------
+ public static Short getShort (short pValue)
+ {
+ if (pValue >= SHORT_LOWER_BOUND &&
+ pValue <= SHORT_UPPER_BOUND) {
+ return mShorts [((int) pValue) - SHORT_LOWER_BOUND];
+ }
+ else {
+ return new Short (pValue);
+ }
+ }
+
+ //-------------------------------------
+ public static Integer getInteger (int pValue)
+ {
+ if (pValue >= INTEGER_LOWER_BOUND &&
+ pValue <= INTEGER_UPPER_BOUND) {
+ return mIntegers [((int) pValue) - INTEGER_LOWER_BOUND];
+ }
+ else {
+ return new Integer (pValue);
+ }
+ }
+
+ //-------------------------------------
+ public static Long getLong (long pValue)
+ {
+ if (pValue >= LONG_LOWER_BOUND &&
+ pValue <= LONG_UPPER_BOUND) {
+ return mLongs [((int) pValue) - LONG_LOWER_BOUND];
+ }
+ else {
+ return new Long (pValue);
+ }
+ }
+
+ //-------------------------------------
+ public static Float getFloat (float pValue)
+ {
+ return new Float (pValue);
+ }
+
+ //-------------------------------------
+ public static Double getDouble (double pValue)
+ {
+ return new Double (pValue);
+ }
+
+ //-------------------------------------
+ // Initializing the cached values
+ //-------------------------------------
+ static Byte [] createBytes ()
+ {
+ int len = BYTE_UPPER_BOUND - BYTE_LOWER_BOUND + 1;
+ Byte [] ret = new Byte [len];
+ byte val = (byte) BYTE_LOWER_BOUND;
+ for (int i = 0; i < len; i++, val++) {
+ ret [i] = new Byte (val);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ static Character [] createCharacters ()
+ {
+ int len = CHARACTER_UPPER_BOUND - CHARACTER_LOWER_BOUND + 1;
+ Character [] ret = new Character [len];
+ char val = (char) CHARACTER_LOWER_BOUND;
+ for (int i = 0; i < len; i++, val++) {
+ ret [i] = new Character (val);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ static Short [] createShorts ()
+ {
+ int len = SHORT_UPPER_BOUND - SHORT_LOWER_BOUND + 1;
+ Short [] ret = new Short [len];
+ short val = (short) SHORT_LOWER_BOUND;
+ for (int i = 0; i < len; i++, val++) {
+ ret [i] = new Short (val);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ static Integer [] createIntegers ()
+ {
+ int len = INTEGER_UPPER_BOUND - INTEGER_LOWER_BOUND + 1;
+ Integer [] ret = new Integer [len];
+ int val = (int) INTEGER_LOWER_BOUND;
+ for (int i = 0; i < len; i++, val++) {
+ ret [i] = new Integer (val);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+ static Long [] createLongs ()
+ {
+ int len = LONG_UPPER_BOUND - LONG_LOWER_BOUND + 1;
+ Long [] ret = new Long [len];
+ long val = (long) LONG_LOWER_BOUND;
+ for (int i = 0; i < len; i++, val++) {
+ ret [i] = new Long (val);
+ }
+ return ret;
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/PropertyExpression.java b/src/org/apache/taglibs/standard/lang/spel/PropertyExpression.java
new file mode 100644
index 0000000..f96fabb
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/PropertyExpression.java
@@ -0,0 +1,201 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>Represents an expression of the form
+ * {expression}.{property0}.{property1}...
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class PropertyExpression
+ extends Expression
+{
+ //-------------------------------------
+ // Constants
+ //-------------------------------------
+
+ static Object [] sNoArgs = new Object [0];
+
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property base
+
+ Expression mBase;
+ public Expression getBase ()
+ { return mBase; }
+
+ //-------------------------------------
+ // property propertyNames
+
+ String [] mPropertyNames;
+ public String [] getPropertyNames ()
+ { return mPropertyNames; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public PropertyExpression (Expression pBase,
+ String [] pPropertyNames)
+ {
+ mBase = pBase;
+ mPropertyNames = pPropertyNames;
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ StringBuffer buf = new StringBuffer ();
+ buf.append (mBase.getExpressionString ());
+ for (int i = 0; i < mPropertyNames.length; i++) {
+ buf.append ('.');
+ buf.append (StringLiteral.toIdentifierToken (mPropertyNames [i]));
+ }
+ return buf.toString ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates by traversing the list of properties
+ **/
+ public Object evaluate (PageContext pContext)
+ throws JspException
+ {
+ // Evaluate the base first
+ Object baseVal = mBase.evaluate (pContext);
+
+ // Now evaluate each property
+ Object ret = baseVal;
+ for (int i = 0; i < mPropertyNames.length; i++) {
+ String propertyName = mPropertyNames [i];
+
+ // Check for null value
+ if (ret == null) {
+ throw new SpelExpressionException
+ (Constants.CANT_GET_PROPERTY_OF_NULL,
+ propertyName);
+ }
+
+ // Get the BeanInfoProperty
+ BeanInfoProperty bip =
+ BeanInfoManager.getBeanInfoProperty (ret.getClass (), propertyName);
+ if (bip == null) {
+ throw new SpelExpressionException
+ (Constants.NO_SUCH_PROPERTY,
+ ret.getClass ().getName (),
+ propertyName);
+ }
+
+ // Get the method
+ Method m = bip.getReadMethod ();
+ if (m == null) {
+ throw new SpelExpressionException
+ (Constants.NO_GETTER_METHOD,
+ propertyName,
+ ret.getClass ().getName ());
+ }
+
+ // Invoke the method
+ try {
+ ret = m.invoke (ret, sNoArgs);
+ }
+ catch (IllegalAccessException exc) {
+ throw new SpelExpressionException
+ (Constants.ERROR_GETTING_PROPERTY,
+ propertyName,
+ ret.getClass ().getName (),
+ exc);
+ }
+ catch (IllegalArgumentException exc) {
+ throw new SpelExpressionException
+ (Constants.ERROR_GETTING_PROPERTY,
+ propertyName,
+ ret.getClass ().getName (),
+ exc);
+ }
+ catch (InvocationTargetException exc) {
+ throw new SpelExpressionException
+ (Constants.ERROR_GETTING_PROPERTY,
+ propertyName,
+ ret.getClass ().getName (),
+ exc.getTargetException ());
+ }
+ }
+
+ return ret;
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/RelationalExpression.java b/src/org/apache/taglibs/standard/lang/spel/RelationalExpression.java
new file mode 100644
index 0000000..047a242
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/RelationalExpression.java
@@ -0,0 +1,687 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>Represents a relational comparison expression
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class RelationalExpression
+ extends Expression
+{
+ //-------------------------------------
+ // Constants
+ //-------------------------------------
+
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property value1
+
+ Expression mValue1;
+ public Expression getValue1 ()
+ { return mValue1; }
+
+ //-------------------------------------
+ // property value2
+
+ Expression mValue2;
+ public Expression getValue2 ()
+ { return mValue2; }
+
+ //-------------------------------------
+ // property op
+
+ RelationalOperator mOp;
+ public RelationalOperator getOp ()
+ { return mOp; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public RelationalExpression (Expression pValue1,
+ Expression pValue2,
+ RelationalOperator pOp)
+ {
+ mValue1 = pValue1;
+ mValue2 = pValue2;
+ mOp = pOp;
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ StringBuffer buf = new StringBuffer ();
+ buf.append (mValue1.getExpressionString ());
+ buf.append (' ');
+ buf.append (mOp.toString ());
+ buf.append (' ');
+ buf.append (mValue2.getExpressionString ());
+ return buf.toString ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Evaluates by traversing the list of properties
+ **/
+ public Object evaluate (PageContext pContext)
+ throws JspException
+ {
+ // Evaluate the two values first
+ Object val1 = mValue1.evaluate (pContext);
+ Object val2 = mValue2.evaluate (pContext);
+
+ // See if the rules for equality or ordering should be applied
+ if (mOp.isEqualityOperator ()) {
+ return mOp.getResult (testEquality (val1, val2));
+ }
+ else {
+ return mOp.getResult (testOrdering (val1, val2));
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Applies the rules for testing equality of two values, returning
+ * true if they are equal, false if not.
+ **/
+ boolean testEquality (Object pVal1,
+ Object pVal2)
+ {
+ // Two null values are equal
+ if (pVal1 == null &&
+ pVal2 == null) {
+ return true;
+ }
+
+ // One null value is not equal
+ if (pVal1 == null ||
+ pVal2 == null) {
+ return false;
+ }
+
+ // Equality by identity
+ if (pVal1 == pVal2) {
+ return true;
+ }
+
+ // Test numeric equality by casting both classes "up" to the same
+ // precision level and testing equality that way
+ Class cl1 = pVal1.getClass ();
+ Class cl2 = pVal2.getClass ();
+
+ // If first class is Byte
+ if (cl1 == Byte.class) {
+ if (cl2 == Byte.class) {
+ return
+ ((Byte) pVal1).intValue () ==
+ ((Byte) pVal2).intValue ();
+ }
+ else if (cl2 == Short.class) {
+ return
+ ((Byte) pVal1).intValue () ==
+ ((Short) pVal2).intValue ();
+ }
+ else if (cl2 == Integer.class) {
+ return
+ ((Byte) pVal1).intValue () ==
+ ((Integer) pVal2).intValue ();
+ }
+ else if (cl2 == Long.class) {
+ return
+ ((Byte) pVal1).longValue () ==
+ ((Long) pVal2).longValue ();
+ }
+ else if (cl2 == Float.class) {
+ return
+ ((Byte) pVal1).floatValue () ==
+ ((Float) pVal2).floatValue ();
+ }
+ else if (cl2 == Double.class) {
+ return
+ ((Byte) pVal1).floatValue () ==
+ ((Double) pVal2).doubleValue ();
+ }
+ }
+
+ // If first class is Short
+ else if (cl1 == Short.class) {
+ if (cl2 == Byte.class) {
+ return
+ ((Short) pVal1).intValue () ==
+ ((Byte) pVal2).intValue ();
+ }
+ else if (cl2 == Short.class) {
+ return
+ ((Short) pVal1).intValue () ==
+ ((Short) pVal2).intValue ();
+ }
+ else if (cl2 == Integer.class) {
+ return
+ ((Short) pVal1).intValue () ==
+ ((Integer) pVal2).intValue ();
+ }
+ else if (cl2 == Long.class) {
+ return
+ ((Short) pVal1).longValue () ==
+ ((Long) pVal2).longValue ();
+ }
+ else if (cl2 == Float.class) {
+ return
+ ((Short) pVal1).floatValue () ==
+ ((Float) pVal2).floatValue ();
+ }
+ else if (cl2 == Double.class) {
+ return
+ ((Short) pVal1).doubleValue () ==
+ ((Double) pVal2).doubleValue ();
+ }
+ }
+
+ // If first class is Integer
+ else if (cl1 == Integer.class) {
+ if (cl2 == Byte.class) {
+ return
+ ((Integer) pVal1).intValue () ==
+ ((Byte) pVal2).intValue ();
+ }
+ else if (cl2 == Short.class) {
+ return
+ ((Integer) pVal1).intValue () ==
+ ((Short) pVal2).intValue ();
+ }
+ else if (cl2 == Integer.class) {
+ return
+ ((Integer) pVal1).intValue () ==
+ ((Integer) pVal2).intValue ();
+ }
+ else if (cl2 == Long.class) {
+ return
+ ((Integer) pVal1).longValue () ==
+ ((Long) pVal2).longValue ();
+ }
+ else if (cl2 == Float.class) {
+ return
+ ((Integer) pVal1).floatValue () ==
+ ((Float) pVal2).floatValue ();
+ }
+ else if (cl2 == Double.class) {
+ return
+ ((Integer) pVal1).doubleValue () ==
+ ((Double) pVal2).doubleValue ();
+ }
+ }
+
+ // If first class is Long
+ else if (cl1 == Long.class) {
+ if (cl2 == Byte.class) {
+ return
+ ((Long) pVal1).longValue () ==
+ ((Byte) pVal2).longValue ();
+ }
+ else if (cl2 == Short.class) {
+ return
+ ((Long) pVal1).longValue () ==
+ ((Short) pVal2).longValue ();
+ }
+ else if (cl2 == Integer.class) {
+ return
+ ((Long) pVal1).longValue () ==
+ ((Integer) pVal2).longValue ();
+ }
+ else if (cl2 == Long.class) {
+ return
+ ((Long) pVal1).longValue () ==
+ ((Long) pVal2).longValue ();
+ }
+ else if (cl2 == Float.class) {
+ return
+ ((Long) pVal1).floatValue () ==
+ ((Float) pVal2).floatValue ();
+ }
+ else if (cl2 == Double.class) {
+ return
+ ((Long) pVal1).doubleValue () ==
+ ((Double) pVal2).doubleValue ();
+ }
+ }
+
+ // If first class is float
+ else if (cl1 == Float.class) {
+ if (cl2 == Byte.class) {
+ return
+ ((Float) pVal1).floatValue () ==
+ ((Byte) pVal2).floatValue ();
+ }
+ else if (cl2 == Short.class) {
+ return
+ ((Float) pVal1).floatValue () ==
+ ((Short) pVal2).floatValue ();
+ }
+ else if (cl2 == Integer.class) {
+ return
+ ((Float) pVal1).floatValue () ==
+ ((Integer) pVal2).floatValue ();
+ }
+ else if (cl2 == Long.class) {
+ return
+ ((Float) pVal1).floatValue () ==
+ ((Long) pVal2).floatValue ();
+ }
+ else if (cl2 == Float.class) {
+ return
+ ((Float) pVal1).floatValue () ==
+ ((Float) pVal2).floatValue ();
+ }
+ else if (cl2 == Double.class) {
+ return
+ ((Float) pVal1).doubleValue () ==
+ ((Double) pVal2).doubleValue ();
+ }
+ }
+
+ // If first class is double
+ else if (cl1 == Double.class) {
+ if (cl2 == Byte.class) {
+ return
+ ((Double) pVal1).doubleValue () ==
+ ((Byte) pVal2).doubleValue ();
+ }
+ else if (cl2 == Short.class) {
+ return
+ ((Double) pVal1).doubleValue () ==
+ ((Short) pVal2).doubleValue ();
+ }
+ else if (cl2 == Integer.class) {
+ return
+ ((Double) pVal1).doubleValue () ==
+ ((Integer) pVal2).doubleValue ();
+ }
+ else if (cl2 == Long.class) {
+ return
+ ((Double) pVal1).doubleValue () ==
+ ((Long) pVal2).doubleValue ();
+ }
+ else if (cl2 == Float.class) {
+ return
+ ((Double) pVal1).doubleValue () ==
+ ((Float) pVal2).doubleValue ();
+ }
+ else if (cl2 == Double.class) {
+ return
+ ((Double) pVal1).doubleValue () ==
+ ((Double) pVal2).doubleValue ();
+ }
+ }
+
+ // Equality by value
+ if (pVal1.equals (pVal2)) {
+ return true;
+ }
+
+ // All other cases are not equal
+ return false;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Applies the rules for testing ordering of two values, returning <
+ * 0 if pVal1 < pVal2, > 0 if pVal1 > pVal2, and 0 if pVal1 ==
+ * pVal2.
+ **/
+ int testOrdering (Object pVal1,
+ Object pVal2)
+ throws JspException
+ {
+ // Make sure neither value is null
+ if (pVal1 == null ||
+ pVal2 == null) {
+ throw new SpelException
+ (Constants.COMPARISON_OF_NULL,
+ mOp.toString ());
+ }
+
+ // Test Strings
+ if (pVal1 instanceof String &&
+ pVal2 instanceof String) {
+ return ((String) pVal1).compareTo ((String) pVal2);
+ }
+
+ // Test numeric ordering by casting both classes "up" to the same
+ // precision level and testing ordering that way
+ Class cl1 = pVal1.getClass ();
+ Class cl2 = pVal2.getClass ();
+
+ // If first class is Byte
+ if (cl1 == Byte.class) {
+ if (cl2 == Byte.class) {
+ return compareValues
+ (((Byte) pVal1).intValue (),
+ ((Byte) pVal2).intValue ());
+ }
+ else if (cl2 == Short.class) {
+ return compareValues
+ (((Byte) pVal1).intValue (),
+ ((Short) pVal2).intValue ());
+ }
+ else if (cl2 == Integer.class) {
+ return compareValues
+ (((Byte) pVal1).intValue (),
+ ((Integer) pVal2).intValue ());
+ }
+ else if (cl2 == Long.class) {
+ return compareValues
+ (((Byte) pVal1).longValue (),
+ ((Long) pVal2).longValue ());
+ }
+ else if (cl2 == Float.class) {
+ return compareValues
+ (((Byte) pVal1).floatValue (),
+ ((Float) pVal2).floatValue ());
+ }
+ else if (cl2 == Double.class) {
+ return compareValues
+ (((Byte) pVal1).floatValue (),
+ ((Double) pVal2).doubleValue ());
+ }
+ }
+
+ // If first class is Short
+ else if (cl1 == Short.class) {
+ if (cl2 == Byte.class) {
+ return compareValues
+ (((Short) pVal1).intValue (),
+ ((Byte) pVal2).intValue ());
+ }
+ else if (cl2 == Short.class) {
+ return compareValues
+ (((Short) pVal1).intValue (),
+ ((Short) pVal2).intValue ());
+ }
+ else if (cl2 == Integer.class) {
+ return compareValues
+ (((Short) pVal1).intValue (),
+ ((Integer) pVal2).intValue ());
+ }
+ else if (cl2 == Long.class) {
+ return compareValues
+ (((Short) pVal1).longValue (),
+ ((Long) pVal2).longValue ());
+ }
+ else if (cl2 == Float.class) {
+ return compareValues
+ (((Short) pVal1).floatValue (),
+ ((Float) pVal2).floatValue ());
+ }
+ else if (cl2 == Double.class) {
+ return compareValues
+ (((Short) pVal1).doubleValue (),
+ ((Double) pVal2).doubleValue ());
+ }
+ }
+
+ // If first class is Integer
+ else if (cl1 == Integer.class) {
+ if (cl2 == Byte.class) {
+ return compareValues
+ (((Integer) pVal1).intValue (),
+ ((Byte) pVal2).intValue ());
+ }
+ else if (cl2 == Short.class) {
+ return compareValues
+ (((Integer) pVal1).intValue (),
+ ((Short) pVal2).intValue ());
+ }
+ else if (cl2 == Integer.class) {
+ return compareValues
+ (((Integer) pVal1).intValue (),
+ ((Integer) pVal2).intValue ());
+ }
+ else if (cl2 == Long.class) {
+ return compareValues
+ (((Integer) pVal1).longValue (),
+ ((Long) pVal2).longValue ());
+ }
+ else if (cl2 == Float.class) {
+ return compareValues
+ (((Integer) pVal1).floatValue (),
+ ((Float) pVal2).floatValue ());
+ }
+ else if (cl2 == Double.class) {
+ return compareValues
+ (((Integer) pVal1).doubleValue (),
+ ((Double) pVal2).doubleValue ());
+ }
+ }
+
+ // If first class is Long
+ else if (cl1 == Long.class) {
+ if (cl2 == Byte.class) {
+ return compareValues
+ (((Long) pVal1).longValue (),
+ ((Byte) pVal2).longValue ());
+ }
+ else if (cl2 == Short.class) {
+ return compareValues
+ (((Long) pVal1).longValue (),
+ ((Short) pVal2).longValue ());
+ }
+ else if (cl2 == Integer.class) {
+ return compareValues
+ (((Long) pVal1).longValue (),
+ ((Integer) pVal2).longValue ());
+ }
+ else if (cl2 == Long.class) {
+ return compareValues
+ (((Long) pVal1).longValue (),
+ ((Long) pVal2).longValue ());
+ }
+ else if (cl2 == Float.class) {
+ return compareValues
+ (((Long) pVal1).floatValue (),
+ ((Float) pVal2).floatValue ());
+ }
+ else if (cl2 == Double.class) {
+ return compareValues
+ (((Long) pVal1).doubleValue (),
+ ((Double) pVal2).doubleValue ());
+ }
+ }
+
+ // If first class is float
+ else if (cl1 == Float.class) {
+ if (cl2 == Byte.class) {
+ return compareValues
+ (((Float) pVal1).floatValue (),
+ ((Byte) pVal2).floatValue ());
+ }
+ else if (cl2 == Short.class) {
+ return compareValues
+ (((Float) pVal1).floatValue (),
+ ((Short) pVal2).floatValue ());
+ }
+ else if (cl2 == Integer.class) {
+ return compareValues
+ (((Float) pVal1).floatValue (),
+ ((Integer) pVal2).floatValue ());
+ }
+ else if (cl2 == Long.class) {
+ return compareValues
+ (((Float) pVal1).floatValue (),
+ ((Long) pVal2).floatValue ());
+ }
+ else if (cl2 == Float.class) {
+ return compareValues
+ (((Float) pVal1).floatValue (),
+ ((Float) pVal2).floatValue ());
+ }
+ else if (cl2 == Double.class) {
+ return compareValues
+ (((Float) pVal1).doubleValue (),
+ ((Double) pVal2).doubleValue ());
+ }
+ }
+
+ // If first class is double
+ else if (cl1 == Double.class) {
+ if (cl2 == Byte.class) {
+ return compareValues
+ (((Double) pVal1).doubleValue (),
+ ((Byte) pVal2).doubleValue ());
+ }
+ else if (cl2 == Short.class) {
+ return compareValues
+ (((Double) pVal1).doubleValue (),
+ ((Short) pVal2).doubleValue ());
+ }
+ else if (cl2 == Integer.class) {
+ return compareValues
+ (((Double) pVal1).doubleValue (),
+ ((Integer) pVal2).doubleValue ());
+ }
+ else if (cl2 == Long.class) {
+ return compareValues
+ (((Double) pVal1).doubleValue (),
+ ((Long) pVal2).doubleValue ());
+ }
+ else if (cl2 == Float.class) {
+ return compareValues
+ (((Double) pVal1).doubleValue (),
+ ((Float) pVal2).doubleValue ());
+ }
+ else if (cl2 == Double.class) {
+ return compareValues
+ (((Double) pVal1).doubleValue (),
+ ((Double) pVal2).doubleValue ());
+ }
+ }
+
+ // All other cases result in error
+ throw new SpelException
+ (Constants.ILLEGAL_COMPARISON,
+ cl1.getName (),
+ cl2.getName (),
+ mOp.toString ());
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Compares two values
+ **/
+ static int compareValues (int pVal1, int pVal2)
+ {
+ if (pVal1 < pVal2) return -1;
+ if (pVal1 > pVal2) return 1;
+ return 0;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Compares two values
+ **/
+ static int compareValues (long pVal1, long pVal2)
+ {
+ if (pVal1 < pVal2) return -1;
+ if (pVal1 > pVal2) return 1;
+ return 0;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Compares two values
+ **/
+ static int compareValues (float pVal1, float pVal2)
+ {
+ if (pVal1 < pVal2) return -1;
+ if (pVal1 > pVal2) return 1;
+ return 0;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Compares two values
+ **/
+ static int compareValues (double pVal1, double pVal2)
+ {
+ if (pVal1 < pVal2) return -1;
+ if (pVal1 > pVal2) return 1;
+ return 0;
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/RelationalOperator.java b/src/org/apache/taglibs/standard/lang/spel/RelationalOperator.java
new file mode 100644
index 0000000..58452bd
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/RelationalOperator.java
@@ -0,0 +1,204 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+/**
+ *
+ * <p>Represents the various relational operators
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class RelationalOperator
+{
+ //-------------------------------------
+ // Constants
+ //-------------------------------------
+
+ static final int EQ_VALUE = 1;
+ static final int NE_VALUE = 2;
+ static final int GT_VALUE = 3;
+ static final int LT_VALUE = 4;
+ static final int GE_VALUE = 5;
+ static final int LE_VALUE = 6;
+
+ public static final RelationalOperator EQ =
+ new RelationalOperator (EQ_VALUE);
+ public static final RelationalOperator NE =
+ new RelationalOperator (NE_VALUE);
+ public static final RelationalOperator GT =
+ new RelationalOperator (GT_VALUE);
+ public static final RelationalOperator LT =
+ new RelationalOperator (LT_VALUE);
+ public static final RelationalOperator GE =
+ new RelationalOperator (GE_VALUE);
+ public static final RelationalOperator LE =
+ new RelationalOperator (LE_VALUE);
+
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property op
+
+ int mOp;
+ public int getOp ()
+ { return mOp; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ RelationalOperator (int pOp)
+ {
+ mOp = pOp;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * String representation
+ **/
+ public String toString ()
+ {
+ switch (mOp) {
+ case EQ_VALUE:
+ return "==";
+ case NE_VALUE:
+ return "!=";
+ case GT_VALUE:
+ return ">";
+ case LT_VALUE:
+ return "<";
+ case GE_VALUE:
+ return ">=";
+ case LE_VALUE:
+ return "<=";
+ default:
+ return "??";
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns true if this is == or !=
+ **/
+ public boolean isEqualityOperator ()
+ {
+ return
+ mOp == EQ_VALUE ||
+ mOp == NE_VALUE;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the Boolean object for the given boolean value
+ **/
+ static Boolean getBooleanValue (boolean pValue)
+ {
+ return (pValue) ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the result based on the flag indicating if the two values
+ * are equal
+ **/
+ public Boolean getResult (boolean pEquals)
+ {
+ if (mOp == EQ_VALUE) {
+ return getBooleanValue (pEquals);
+ }
+ else if (mOp == NE_VALUE) {
+ return getBooleanValue (!pEquals);
+ }
+ else {
+ return getBooleanValue (false);
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns the result based on the flag indicating the ordering of
+ * the two values (< 0 means a < b, > 0 means a > b, 0 means a == b)
+ **/
+ public Boolean getResult (int pOrdering)
+ {
+ switch (mOp) {
+ case EQ_VALUE:
+ return getBooleanValue (pOrdering == 0);
+ case NE_VALUE:
+ return getBooleanValue (pOrdering != 0);
+ case GT_VALUE:
+ return getBooleanValue (pOrdering > 0);
+ case LT_VALUE:
+ return getBooleanValue (pOrdering < 0);
+ case GE_VALUE:
+ return getBooleanValue (pOrdering >= 0);
+ case LE_VALUE:
+ return getBooleanValue (pOrdering <= 0);
+ default:
+ return getBooleanValue (false);
+ }
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/Resources.properties b/src/org/apache/taglibs/standard/lang/spel/Resources.properties
new file mode 100644
index 0000000..33f8ad7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/Resources.properties
@@ -0,0 +1,45 @@
+EXCEPTION_GETTING_BEANINFO=\
+ An Exception occurred getting the BeanInfo for class {0}
+
+CANT_GET_PROPERTY_OF_NULL=\
+ Attempt to get property "{0}" from a null value
+
+NO_SUCH_PROPERTY=\
+ Class {0} does not have a property "{1}"
+
+NO_GETTER_METHOD=\
+ Property "{0}" of class {1} does not have a public getter method
+
+ERROR_GETTING_PROPERTY=\
+ An error occurred while getting property "{0}" from an instance \
+ of class {1}
+
+COMPARISON_OF_NULL=\
+ Attempt to compare a null value using the "{0}" operator
+
+ILLEGAL_COMPARISON=\
+ Illegal attempt to compare an instance of {0} with an instance of \
+ {1} using the "{2}" operator
+
+NULL_TO_PRIMITIVE=\
+ Cannot cast a null value to primitive expected type "{0}"
+
+ILLEGAL_CONVERSION=\
+ Illegal attempt to convert a value of type "{0}" to \
+ expected type "{1}"
+
+NULL_EXPRESSION=\
+ A null string may not be passed to the expression evaluator
+
+PARSE_EXCEPTION=\
+ Unable to parse the expression
+
+NO_PROPERTY_EDITOR=\
+ Unable to parse literal value "{0}" into expected type "{1}" because \
+ no PropertyEditor for that type could be found
+
+CANT_PARSE_LITERAL=\
+ Unable to parse literal value "{0}" into expected type "{1}"
+
+CANT_FIND_ATTRIBUTE=\
+ Unable to find attribute "{0}" in {1} scope.
diff --git a/src/org/apache/taglibs/standard/lang/spel/Scope.java b/src/org/apache/taglibs/standard/lang/spel/Scope.java
new file mode 100644
index 0000000..17a6e22
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/Scope.java
@@ -0,0 +1,202 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * <p>Represents the various scopes
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181991 $$DateTime: 2001/07/02 16:12:52 $$Author$
+ **/
+
+public class Scope
+{
+ //-------------------------------------
+ // Constants
+ //-------------------------------------
+
+ static final int UNSCOPED_VALUE = 1;
+ static final int PAGE_VALUE = 2;
+ static final int REQUEST_VALUE = 3;
+ static final int SESSION_VALUE = 4;
+ static final int APP_VALUE = 5;
+ static final int HEADER_VALUE = 6;
+ static final int PARAM_VALUE = 7;
+ static final int PARAMVALUES_VALUE = 8;
+
+ public static final Scope UNSCOPED = new Scope (UNSCOPED_VALUE);
+ public static final Scope PAGE = new Scope (PAGE_VALUE);
+ public static final Scope REQUEST = new Scope (REQUEST_VALUE);
+ public static final Scope SESSION = new Scope (SESSION_VALUE);
+ public static final Scope APP = new Scope (APP_VALUE);
+ public static final Scope HEADER = new Scope (HEADER_VALUE);
+ public static final Scope PARAM = new Scope (PARAM_VALUE);
+ public static final Scope PARAMVALUES = new Scope (PARAMVALUES_VALUE);
+
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property scope
+
+ int mScope;
+ public int getScope ()
+ { return mScope; }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ Scope (int pScope)
+ {
+ mScope = pScope;
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Looks up the attribute value in the specified page context, using
+ * the appropriate scope, returning null if not found
+ **/
+ Object getAttributeValue (String pName,
+ PageContext pContext)
+ {
+ switch (mScope) {
+ case UNSCOPED_VALUE:
+ return pContext.findAttribute (pName);
+ case PAGE_VALUE:
+ return pContext.getAttribute (pName, pContext.PAGE_SCOPE);
+ case REQUEST_VALUE:
+ return pContext.getAttribute (pName, pContext.REQUEST_SCOPE);
+ case SESSION_VALUE:
+ return pContext.getAttribute (pName, pContext.SESSION_SCOPE);
+ case APP_VALUE:
+ return pContext.getAttribute (pName, pContext.APPLICATION_SCOPE);
+ case HEADER_VALUE:
+ return ((HttpServletRequest) (pContext.getRequest ())).getHeader (pName);
+ case PARAM_VALUE:
+ return pContext.getRequest ().getParameter (pName);
+ case PARAMVALUES_VALUE:
+ return pContext.getRequest ().getParameterValues (pName);
+ default:
+ return null;
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns a form of the scope name suitable for error messages
+ **/
+ public String getScopeName ()
+ {
+ switch (mScope) {
+ case UNSCOPED_VALUE:
+ return "page/request/session/app";
+ case PAGE_VALUE:
+ return "page";
+ case REQUEST_VALUE:
+ return "request";
+ case SESSION_VALUE:
+ return "session";
+ case APP_VALUE:
+ return "app";
+ case HEADER_VALUE:
+ return "header";
+ case PARAM_VALUE:
+ return "param";
+ case PARAMVALUES_VALUE:
+ return "paramvalues";
+ default:
+ return "??";
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * String representation
+ **/
+ public String toString ()
+ {
+ switch (mScope) {
+ case UNSCOPED_VALUE:
+ return ":";
+ case PAGE_VALUE:
+ return "page:";
+ case REQUEST_VALUE:
+ return "request:";
+ case SESSION_VALUE:
+ return "session:";
+ case APP_VALUE:
+ return "app:";
+ case HEADER_VALUE:
+ return "header:";
+ case PARAM_VALUE:
+ return "param:";
+ case PARAMVALUES_VALUE:
+ return "paramvalues:";
+ default:
+ return ":";
+ }
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/SpelException.java b/src/org/apache/taglibs/standard/lang/spel/SpelException.java
new file mode 100644
index 0000000..fd9a37f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/SpelException.java
@@ -0,0 +1,376 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.text.MessageFormat;
+import javax.servlet.jsp.JspException;
+
+/**
+ *
+ * Represents any of the exception conditions that arise during the
+ * operation evaluation of the SPEL.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class SpelException
+ extends JspException
+{
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException ()
+ {
+ super ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage)
+ {
+ super (pMessage);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (Throwable pRootCause)
+ {
+ /*
+ // FIXME - for Servet 2.3, use this constructor
+ super (pRootCause);
+ */
+ super (pRootCause.getMessage ());
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pRootCause)
+ {
+ /*
+ // FIXME - for Servet 2.3, use this constructor
+ super (pMessage,
+ pRootCause);
+ */
+ super (pMessage + ": " + pRootCause.getMessage ());
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Object pArg0)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Object pArg0,
+ Object pArg1)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4,
+ Object pArg5)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ "" + pArg5,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4,
+ Object pArg5)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ "" + pArg5,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/SpelExpressionException.java b/src/org/apache/taglibs/standard/lang/spel/SpelExpressionException.java
new file mode 100644
index 0000000..6ad77ee
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/SpelExpressionException.java
@@ -0,0 +1,379 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+import java.text.MessageFormat;
+import javax.servlet.jsp.jstl.core.ExpressionException;
+
+/**
+ *
+ * Represents an ExpressionException condition - thrown when an
+ * expression is unable to navigate the path specified by an
+ * expression. The purpose of this exception is to indicate to the
+ * user of the expression language that it is safe to replace this
+ * condition with a default value.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class SpelExpressionException
+ extends ExpressionException
+{
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException ()
+ {
+ super ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage)
+ {
+ super (pMessage);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (Throwable pRootCause)
+ {
+ /*
+ // FIXME - for Servet 2.3, use this constructor
+ super (pRootCause);
+ */
+ super (pRootCause.getMessage ());
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pRootCause)
+ {
+ /*
+ // FIXME - for Servet 2.3, use this constructor
+ super (pMessage,
+ pRootCause);
+ */
+ super (pMessage + ": " + pRootCause.getMessage ());
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Object pArg0)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Object pArg0,
+ Object pArg1)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4,
+ Object pArg5)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ "" + pArg5,
+ }));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public SpelExpressionException (String pMessage,
+ Throwable pThrowable,
+ Object pArg0,
+ Object pArg1,
+ Object pArg2,
+ Object pArg3,
+ Object pArg4,
+ Object pArg5)
+ {
+ this (MessageFormat.format
+ (pMessage,
+ new Object [] {
+ "" + pArg0,
+ "" + pArg1,
+ "" + pArg2,
+ "" + pArg3,
+ "" + pArg4,
+ "" + pArg5,
+ }),
+ pThrowable);
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/SpelParser.jj b/src/org/apache/taglibs/standard/lang/spel/SpelParser.jj
new file mode 100644
index 0000000..55d1238
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/SpelParser.jj
@@ -0,0 +1,350 @@
+options {
+ JAVA_UNICODE_ESCAPE = true;
+ STATIC = false;
+}
+
+PARSER_BEGIN(SpelParser)
+
+package org.apache.taglibs.standard.lang.spel.parser;
+
+import org.apache.taglibs.standard.lang.spel.*;
+import java.util.ArrayList;
+
+public class SpelParser {
+
+ public static void main(String args[])
+ throws ParseException
+ {
+ SpelParser parser = new SpelParser (System.in);
+ parser.Expression ();
+ }
+
+}
+
+PARSER_END(SpelParser)
+
+
+/* WHITE SPACE */
+
+SKIP :
+{
+ " "
+| "\t"
+| "\n"
+| "\r"
+| "\f"
+}
+
+
+/* LITERALS */
+
+TOKEN :
+{
+ < INTEGER_LITERAL: (<SIGN>)? ["0"-"9"] (["0"-"9"])* >
+|
+ < FLOATING_POINT_LITERAL:
+ (<SIGN>)? (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)?
+ | (<SIGN>)? "." (["0"-"9"])+ (<EXPONENT>)?
+ | (<SIGN>)? (["0"-"9"])+ <EXPONENT>
+ >
+|
+ < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+|
+ < #SIGN: ["+","-"] >
+|
+ < STRING_LITERAL:
+ ("\"" ((~["\"","\\"]) | ("\\" ( ["\\","\""] )))* "\"") |
+ ("\'" ((~["\'","\\"]) | ("\\" ( ["\\","\'"] )))* "\'")
+ >
+}
+
+/* RESERVED WORDS */
+
+TOKEN :
+{
+< TRUE: "true" >
+| < FALSE: "false" >
+| < NULL: "null" >
+| < PAGE: "page" >
+| < REQUEST: "request" >
+| < SESSION: "session" >
+| < APP: "app" >
+| < HEADER: "header" >
+| < PARAM: "param" >
+| < PARAMVALUES: "paramvalues" >
+
+| < AND: "and" >
+| < OR: "or" >
+| < NOT: "not" >
+| < EQ_VALUE: "eq" >
+| < NE_VALUE: "ne" >
+| < LT_VALUE: "lt" >
+| < GT_VALUE: "gt" >
+| < LE_VALUE: "le" >
+| < GE_VALUE: "ge" >
+| < INSTANCEOF: "instanceof" >
+}
+
+/* IDENTIFIERS */
+
+TOKEN :
+{
+ < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+ < #LETTER:
+ [
+ "\u0024",
+ "\u0041"-"\u005a",
+ "\u005f",
+ "\u0061"-"\u007a",
+ "\u00c0"-"\u00d6",
+ "\u00d8"-"\u00f6",
+ "\u00f8"-"\u00ff",
+ "\u0100"-"\u1fff",
+ "\u3040"-"\u318f",
+ "\u3300"-"\u337f",
+ "\u3400"-"\u3d2d",
+ "\u4e00"-"\u9fff",
+ "\uf900"-"\ufaff"
+ ]
+ >
+|
+ < #DIGIT:
+ [
+ "\u0030"-"\u0039",
+ "\u0660"-"\u0669",
+ "\u06f0"-"\u06f9",
+ "\u0966"-"\u096f",
+ "\u09e6"-"\u09ef",
+ "\u0a66"-"\u0a6f",
+ "\u0ae6"-"\u0aef",
+ "\u0b66"-"\u0b6f",
+ "\u0be7"-"\u0bef",
+ "\u0c66"-"\u0c6f",
+ "\u0ce6"-"\u0cef",
+ "\u0d66"-"\u0d6f",
+ "\u0e50"-"\u0e59",
+ "\u0ed0"-"\u0ed9",
+ "\u1040"-"\u1049"
+ ]
+ >
+}
+
+/* SEPARATORS */
+
+TOKEN :
+{
+ < COLON: ":" >
+| < DOT: "." >
+| < GT: ">" >
+| < LT: "<" >
+| < EQ: "==" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "!=" >
+}
+
+
+/*****************************************
+ * THE SPEL GRAMMAR STARTS HERE *
+ *****************************************/
+
+Expression Expression () :
+{
+ Expression ret;
+}
+{
+ (
+ LOOKAHEAD (RelationalExpression ()) (ret = RelationalExpression () <EOF>)
+ | LOOKAHEAD (4) (ret = Value () <EOF>)
+ )
+ { return ret; }
+}
+
+
+Expression RelationalExpression () :
+{
+ Expression val1;
+ Expression val2;
+ RelationalOperator op;
+}
+{
+ (
+ val1 = Value ()
+ op = RelOp ()
+ val2 = Value ()
+ )
+ { return new RelationalExpression (val1, val2, op); }
+}
+
+
+RelationalOperator RelOp () :
+{
+}
+{
+ <EQ> { return RelationalOperator.EQ; }
+ | <NE> { return RelationalOperator.NE; }
+ | <LT> { return RelationalOperator.LT; }
+ | <GT> { return RelationalOperator.GT; }
+ | <LE> { return RelationalOperator.LE; }
+ | <GE> { return RelationalOperator.GE; }
+}
+
+
+Expression Value () :
+{
+ Expression ret;
+}
+{
+ (
+ ret = PropertyValue ()
+ | ret = Literal ()
+ )
+ { return ret; }
+}
+
+
+Expression PropertyValue () :
+{
+ Expression base;
+ ArrayList l = null;
+ StringLiteral pname;
+}
+{
+ (
+ base = NamedValue ()
+ (<DOT>
+ (pname = Identifier ()
+ | pname = StringLiteral ())
+ {
+ if (l == null) l = new ArrayList ();
+ l.add (pname.getValue ());
+ }
+ )*
+ )
+
+ {
+ if (l == null) {
+ return base;
+ }
+ else {
+ String [] pnames = (String []) l.toArray (new String [l.size ()]);
+ return new PropertyExpression (base, pnames);
+ }
+ }
+}
+
+
+NamedValue NamedValue () :
+{
+ Scope scope = Scope.UNSCOPED;
+ StringLiteral name;
+}
+{
+ (
+ LOOKAHEAD (3) (scope = ScopeName () <COLON> name = Identifier ())
+ | LOOKAHEAD (3) (scope = ScopeName () <COLON> name = StringLiteral ())
+ | LOOKAHEAD (3) (<COLON> name = Identifier ())
+ | LOOKAHEAD (3) (<COLON> name = StringLiteral ())
+ | LOOKAHEAD (3) (name = Identifier ())
+ )
+ { return new NamedValue (scope, (String) name.getValue ()); }
+}
+
+
+Scope ScopeName () :
+{
+}
+{
+ <PAGE> { return Scope.PAGE; }
+ | <REQUEST> { return Scope.REQUEST; }
+ | <SESSION> { return Scope.SESSION; }
+ | <APP> { return Scope.APP; }
+ | <HEADER> { return Scope.HEADER; }
+ | <PARAM> { return Scope.PARAM; }
+ | <PARAMVALUES> { return Scope.PARAMVALUES; }
+}
+
+
+StringLiteral Identifier () :
+{
+ Token t;
+}
+{
+ (
+ t = <IDENTIFIER>
+ | t = <PAGE>
+ | t = <REQUEST>
+ | t = <SESSION>
+ | t = <APP>
+ | t = <HEADER>
+ | t = <PARAM>
+ | t = <PARAMVALUES>
+ )
+ { return StringLiteral.fromLiteralValue (t.image); }
+}
+
+
+Literal Literal () :
+{
+ Literal ret;
+}
+{
+ (
+ ret = BooleanLiteral ()
+ | ret = IntegerLiteral ()
+ | ret = FloatingPointLiteral ()
+ | ret = StringLiteral ()
+ | ret = NullLiteral ()
+ )
+ { return ret; }
+}
+
+
+BooleanLiteral BooleanLiteral () :
+{
+}
+{
+ <TRUE> { return BooleanLiteral.TRUE; }
+ | <FALSE> { return BooleanLiteral.FALSE; }
+}
+
+
+StringLiteral StringLiteral () :
+{
+ Token t;
+}
+{
+ t = <STRING_LITERAL>
+ { return StringLiteral.fromToken (t.image); }
+}
+
+
+IntegerLiteral IntegerLiteral () :
+{
+ Token t;
+}
+{
+ t = <INTEGER_LITERAL>
+ { return new IntegerLiteral (t.image); }
+}
+
+
+FloatingPointLiteral FloatingPointLiteral () :
+{
+ Token t;
+}
+{
+ t = <FLOATING_POINT_LITERAL>
+ { return new FloatingPointLiteral (t.image); }
+}
+
+
+NullLiteral NullLiteral () :
+{
+}
+{
+ <NULL>
+ { return NullLiteral.SINGLETON; }
+}
+
diff --git a/src/org/apache/taglibs/standard/lang/spel/StringLiteral.java b/src/org/apache/taglibs/standard/lang/spel/StringLiteral.java
new file mode 100644
index 0000000..dc6a82d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/StringLiteral.java
@@ -0,0 +1,222 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel;
+
+/**
+ *
+ * <p>An expression representing a String literal value.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class StringLiteral
+ extends Literal
+{
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ StringLiteral (Object pValue)
+ {
+ super (pValue);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns a StringLiteral parsed from the given token (enclosed by
+ * single or double quotes)
+ **/
+ public static StringLiteral fromToken (String pToken)
+ {
+ return new StringLiteral (getValueFromToken (pToken));
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns a StringLiteral with the given string value
+ **/
+ public static StringLiteral fromLiteralValue (String pValue)
+ {
+ return new StringLiteral (pValue);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Parses the given token into the literal value
+ **/
+ static Object getValueFromToken (String pToken)
+ {
+ StringBuffer buf = new StringBuffer ();
+ int len = pToken.length () - 1;
+ boolean escaping = false;
+ for (int i = 1; i < len; i++) {
+ char ch = pToken.charAt (i);
+ if (escaping) {
+ buf.append (ch);
+ escaping = false;
+ }
+ else if (ch == '\\') {
+ escaping = true;
+ }
+ else {
+ buf.append (ch);
+ }
+ }
+ return buf.toString ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Converts the specified value to a String token, using " as the
+ * enclosing quotes and escaping any characters that need escaping.
+ **/
+ public static String toStringToken (String pValue)
+ {
+ // See if any escaping is needed
+ if (pValue.indexOf ('\"') < 0 &&
+ pValue.indexOf ('\\') < 0) {
+ return "\"" + pValue + "\"";
+ }
+
+ // Escaping is needed
+ else {
+ StringBuffer buf = new StringBuffer ();
+ buf.append ('\"');
+ int len = pValue.length ();
+ for (int i = 0; i < len; i++) {
+ char ch = pValue.charAt (i);
+ if (ch == '\\') {
+ buf.append ('\\');
+ buf.append ('\\');
+ }
+ else if (ch == '\"') {
+ buf.append ('\\');
+ buf.append ('\"');
+ }
+ else {
+ buf.append (ch);
+ }
+ }
+ buf.append ('\"');
+ return buf.toString ();
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Converts the specified value to an identifier token, escaping it
+ * as a string literal if necessary.
+ **/
+ public static String toIdentifierToken (String pValue)
+ {
+ // See if it's a valid java identifier
+ if (isJavaIdentifier (pValue)) {
+ return pValue;
+ }
+
+ // Return as a String literal
+ else {
+ return toStringToken (pValue);
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Returns true if the specified value is a legal java identifier
+ **/
+ static boolean isJavaIdentifier (String pValue)
+ {
+ int len = pValue.length ();
+ if (len == 0) {
+ return false;
+ }
+ else {
+ if (!Character.isJavaIdentifierStart (pValue.charAt (0))) {
+ return false;
+ }
+ else {
+ for (int i = 1; i < len; i++) {
+ if (!Character.isJavaIdentifierPart (pValue.charAt (i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+
+ //-------------------------------------
+ // Expression methods
+ //-------------------------------------
+ /**
+ *
+ * Returns the expression in the expression language syntax
+ **/
+ public String getExpressionString ()
+ {
+ return toStringToken ((String) getValue ());
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/ASCII_UCodeESC_CharStream.java b/src/org/apache/taglibs/standard/lang/spel/parser/ASCII_UCodeESC_CharStream.java
new file mode 100644
index 0000000..999e845
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/ASCII_UCodeESC_CharStream.java
@@ -0,0 +1,520 @@
+/* Generated By:JavaCC: Do not edit this line. ASCII_UCodeESC_CharStream.java Version 0.7pre6 */
+package org.apache.taglibs.standard.lang.spel.parser;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (with java-like unicode escape processing).
+ */
+
+public final class ASCII_UCodeESC_CharStream
+{
+ public static final boolean staticFlag = false;
+ static final int hexval(char c) throws java.io.IOException {
+ switch(c)
+ {
+ case '0' :
+ return 0;
+ case '1' :
+ return 1;
+ case '2' :
+ return 2;
+ case '3' :
+ return 3;
+ case '4' :
+ return 4;
+ case '5' :
+ return 5;
+ case '6' :
+ return 6;
+ case '7' :
+ return 7;
+ case '8' :
+ return 8;
+ case '9' :
+ return 9;
+
+ case 'a' :
+ case 'A' :
+ return 10;
+ case 'b' :
+ case 'B' :
+ return 11;
+ case 'c' :
+ case 'C' :
+ return 12;
+ case 'd' :
+ case 'D' :
+ return 13;
+ case 'e' :
+ case 'E' :
+ return 14;
+ case 'f' :
+ case 'F' :
+ return 15;
+ }
+
+ throw new java.io.IOException(); // Should never come here
+ }
+
+ public int bufpos = -1;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private java.io.Reader inputStream;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private char[] nextCharBuf;
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int nextCharInd = -1;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ bufpos += (bufsize - tokenBegin);
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ bufpos -= tokenBegin;
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+ available = (bufsize += 2048);
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ int i;
+ if (maxNextCharInd == 4096)
+ maxNextCharInd = nextCharInd = 0;
+
+ try {
+ if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
+ 4096 - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ if (bufpos != 0)
+ {
+ --bufpos;
+ backup(0);
+ }
+ else
+ {
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+ throw e;
+ }
+ }
+
+ private final char ReadByte() throws java.io.IOException
+ {
+ if (++nextCharInd >= maxNextCharInd)
+ FillBuff();
+
+ return nextCharBuf[nextCharInd];
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0)
+ : ++bufpos];
+ }
+
+ tokenBegin = 0;
+ bufpos = -1;
+
+ return readChar();
+ }
+
+ private final void AdjustBuffSize()
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = 0;
+ available = tokenBegin;
+ }
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+ }
+
+ char c;
+
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\'))
+ {
+ UpdateLineColumn(c);
+
+ int backSlashCnt = 1;
+
+ for (;;) // Read all the backslashes
+ {
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ try
+ {
+ if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\')
+ {
+ UpdateLineColumn(c);
+ // found a non-backslash char.
+ if ((c == 'u') && ((backSlashCnt & 1) == 1))
+ {
+ if (--bufpos < 0)
+ bufpos = bufsize - 1;
+
+ break;
+ }
+
+ backup(backSlashCnt);
+ return '\\';
+ }
+ }
+ catch(java.io.IOException e)
+ {
+ if (backSlashCnt > 1)
+ backup(backSlashCnt);
+
+ return '\\';
+ }
+
+ UpdateLineColumn(c);
+ backSlashCnt++;
+ }
+
+ // Here, we have seen an odd number of backslash's followed by a 'u'
+ try
+ {
+ while ((c = (char)((char)0xff & ReadByte())) == 'u')
+ ++column;
+
+ buffer[bufpos] = c = (char)(hexval(c) << 12 |
+ hexval((char)((char)0xff & ReadByte())) << 8 |
+ hexval((char)((char)0xff & ReadByte())) << 4 |
+ hexval((char)((char)0xff & ReadByte())));
+
+ column += 4;
+ }
+ catch(java.io.IOException e)
+ {
+ throw new Error("Invalid escape character at line " + line +
+ " column " + column + ".");
+ }
+
+ if (backSlashCnt == 1)
+ return c;
+ else
+ {
+ backup(backSlashCnt - 1);
+ return '\\';
+ }
+ }
+ else
+ {
+ UpdateLineColumn(c);
+ return (c);
+ }
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
+ int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ nextCharBuf = new char[4096];
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
+ int startline, int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream,
+ int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ nextCharBuf = new char[4096];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ nextCharInd = bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream,
+ int startline, int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ nextCharBuf = null;
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/ParseException.java b/src/org/apache/taglibs/standard/lang/spel/parser/ParseException.java
new file mode 100644
index 0000000..ca4faa7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/ParseException.java
@@ -0,0 +1,191 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+package org.apache.taglibs.standard.lang.spel.parser;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/SpelParser.java b/src/org/apache/taglibs/standard/lang/spel/parser/SpelParser.java
new file mode 100644
index 0000000..c86d1ee
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/SpelParser.java
@@ -0,0 +1,1088 @@
+/* Generated By:JavaCC: Do not edit this line. SpelParser.java */
+package org.apache.taglibs.standard.lang.spel.parser;
+
+import org.apache.taglibs.standard.lang.spel.*;
+import java.util.ArrayList;
+
+public class SpelParser implements SpelParserConstants {
+
+ public static void main(String args[])
+ throws ParseException
+ {
+ SpelParser parser = new SpelParser (System.in);
+ parser.Expression ();
+ }
+
+/*****************************************
+ * THE SPEL GRAMMAR STARTS HERE *
+ *****************************************/
+ final public Expression Expression() throws ParseException {
+ Expression ret;
+ if (jj_2_1(2147483647)) {
+ ret = RelationalExpression();
+ jj_consume_token(0);
+ } else if (jj_2_2(4)) {
+ ret = Value();
+ jj_consume_token(0);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return ret;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Expression RelationalExpression() throws ParseException {
+ Expression val1;
+ Expression val2;
+ RelationalOperator op;
+ val1 = Value();
+ op = RelOp();
+ val2 = Value();
+ {if (true) return new RelationalExpression (val1, val2, op);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public RelationalOperator RelOp() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EQ:
+ jj_consume_token(EQ);
+ {if (true) return RelationalOperator.EQ;}
+ break;
+ case NE:
+ jj_consume_token(NE);
+ {if (true) return RelationalOperator.NE;}
+ break;
+ case LT:
+ jj_consume_token(LT);
+ {if (true) return RelationalOperator.LT;}
+ break;
+ case GT:
+ jj_consume_token(GT);
+ {if (true) return RelationalOperator.GT;}
+ break;
+ case LE:
+ jj_consume_token(LE);
+ {if (true) return RelationalOperator.LE;}
+ break;
+ case GE:
+ jj_consume_token(GE);
+ {if (true) return RelationalOperator.GE;}
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Expression Value() throws ParseException {
+ Expression ret;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PAGE:
+ case REQUEST:
+ case SESSION:
+ case APP:
+ case HEADER:
+ case PARAM:
+ case PARAMVALUES:
+ case IDENTIFIER:
+ case COLON:
+ ret = PropertyValue();
+ break;
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case STRING_LITERAL:
+ case TRUE:
+ case FALSE:
+ case NULL:
+ ret = Literal();
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return ret;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Expression PropertyValue() throws ParseException {
+ Expression base;
+ ArrayList l = null;
+ StringLiteral pname;
+ base = NamedValue();
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOT:
+ ;
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ break label_1;
+ }
+ jj_consume_token(DOT);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PAGE:
+ case REQUEST:
+ case SESSION:
+ case APP:
+ case HEADER:
+ case PARAM:
+ case PARAMVALUES:
+ case IDENTIFIER:
+ pname = Identifier();
+ break;
+ case STRING_LITERAL:
+ pname = StringLiteral();
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ if (l == null) l = new ArrayList ();
+ l.add (pname.getValue ());
+ }
+ if (l == null) {
+ {if (true) return base;}
+ }
+ else {
+ String [] pnames = (String []) l.toArray (new String [l.size ()]);
+ {if (true) return new PropertyExpression (base, pnames);}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public NamedValue NamedValue() throws ParseException {
+ Scope scope = Scope.UNSCOPED;
+ StringLiteral name;
+ if (jj_2_3(3)) {
+ scope = ScopeName();
+ jj_consume_token(COLON);
+ name = Identifier();
+ } else if (jj_2_4(3)) {
+ scope = ScopeName();
+ jj_consume_token(COLON);
+ name = StringLiteral();
+ } else if (jj_2_5(3)) {
+ jj_consume_token(COLON);
+ name = Identifier();
+ } else if (jj_2_6(3)) {
+ jj_consume_token(COLON);
+ name = StringLiteral();
+ } else if (jj_2_7(3)) {
+ name = Identifier();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return new NamedValue (scope, (String) name.getValue ());}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Scope ScopeName() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PAGE:
+ jj_consume_token(PAGE);
+ {if (true) return Scope.PAGE;}
+ break;
+ case REQUEST:
+ jj_consume_token(REQUEST);
+ {if (true) return Scope.REQUEST;}
+ break;
+ case SESSION:
+ jj_consume_token(SESSION);
+ {if (true) return Scope.SESSION;}
+ break;
+ case APP:
+ jj_consume_token(APP);
+ {if (true) return Scope.APP;}
+ break;
+ case HEADER:
+ jj_consume_token(HEADER);
+ {if (true) return Scope.HEADER;}
+ break;
+ case PARAM:
+ jj_consume_token(PARAM);
+ {if (true) return Scope.PARAM;}
+ break;
+ case PARAMVALUES:
+ jj_consume_token(PARAMVALUES);
+ {if (true) return Scope.PARAMVALUES;}
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public StringLiteral Identifier() throws ParseException {
+ Token t;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENTIFIER:
+ t = jj_consume_token(IDENTIFIER);
+ break;
+ case PAGE:
+ t = jj_consume_token(PAGE);
+ break;
+ case REQUEST:
+ t = jj_consume_token(REQUEST);
+ break;
+ case SESSION:
+ t = jj_consume_token(SESSION);
+ break;
+ case APP:
+ t = jj_consume_token(APP);
+ break;
+ case HEADER:
+ t = jj_consume_token(HEADER);
+ break;
+ case PARAM:
+ t = jj_consume_token(PARAM);
+ break;
+ case PARAMVALUES:
+ t = jj_consume_token(PARAMVALUES);
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return StringLiteral.fromLiteralValue (t.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Literal Literal() throws ParseException {
+ Literal ret;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TRUE:
+ case FALSE:
+ ret = BooleanLiteral();
+ break;
+ case INTEGER_LITERAL:
+ ret = IntegerLiteral();
+ break;
+ case FLOATING_POINT_LITERAL:
+ ret = FloatingPointLiteral();
+ break;
+ case STRING_LITERAL:
+ ret = StringLiteral();
+ break;
+ case NULL:
+ ret = NullLiteral();
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return ret;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public BooleanLiteral BooleanLiteral() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case TRUE:
+ jj_consume_token(TRUE);
+ {if (true) return BooleanLiteral.TRUE;}
+ break;
+ case FALSE:
+ jj_consume_token(FALSE);
+ {if (true) return BooleanLiteral.FALSE;}
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public StringLiteral StringLiteral() throws ParseException {
+ Token t;
+ t = jj_consume_token(STRING_LITERAL);
+ {if (true) return StringLiteral.fromToken (t.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public IntegerLiteral IntegerLiteral() throws ParseException {
+ Token t;
+ t = jj_consume_token(INTEGER_LITERAL);
+ {if (true) return new IntegerLiteral (t.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public FloatingPointLiteral FloatingPointLiteral() throws ParseException {
+ Token t;
+ t = jj_consume_token(FLOATING_POINT_LITERAL);
+ {if (true) return new FloatingPointLiteral (t.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public NullLiteral NullLiteral() throws ParseException {
+ jj_consume_token(NULL);
+ {if (true) return NullLiteral.SINGLETON;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_1();
+ jj_save(0, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_2(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_2();
+ jj_save(1, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_3(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_3();
+ jj_save(2, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_4(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_4();
+ jj_save(3, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_5(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_5();
+ jj_save(4, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_6(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_6();
+ jj_save(5, xla);
+ return retval;
+ }
+
+ final private boolean jj_2_7(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_7();
+ jj_save(6, xla);
+ return retval;
+ }
+
+ final private boolean jj_3R_20() {
+ if (jj_scan_token(SESSION)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_7() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_25()) {
+ jj_scanpos = xsp;
+ if (jj_3R_26()) {
+ jj_scanpos = xsp;
+ if (jj_3R_27()) {
+ jj_scanpos = xsp;
+ if (jj_3R_28()) {
+ jj_scanpos = xsp;
+ if (jj_3R_29()) {
+ jj_scanpos = xsp;
+ if (jj_3R_30()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_25() {
+ if (jj_scan_token(EQ)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_19() {
+ if (jj_scan_token(REQUEST)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_18() {
+ if (jj_scan_token(PAGE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_17() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_5() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_17()) {
+ jj_scanpos = xsp;
+ if (jj_3R_18()) {
+ jj_scanpos = xsp;
+ if (jj_3R_19()) {
+ jj_scanpos = xsp;
+ if (jj_3R_20()) {
+ jj_scanpos = xsp;
+ if (jj_3R_21()) {
+ jj_scanpos = xsp;
+ if (jj_3R_22()) {
+ jj_scanpos = xsp;
+ if (jj_3R_23()) {
+ jj_scanpos = xsp;
+ if (jj_3R_24()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_2() {
+ if (jj_3R_3()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_7()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_3()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_16() {
+ if (jj_scan_token(PARAMVALUES)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_15() {
+ if (jj_scan_token(PARAM)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_2()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_14() {
+ if (jj_scan_token(HEADER)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_13() {
+ if (jj_scan_token(APP)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_12() {
+ if (jj_scan_token(SESSION)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_11() {
+ if (jj_scan_token(REQUEST)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_10() {
+ if (jj_scan_token(PAGE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_4() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_10()) {
+ jj_scanpos = xsp;
+ if (jj_3R_11()) {
+ jj_scanpos = xsp;
+ if (jj_3R_12()) {
+ jj_scanpos = xsp;
+ if (jj_3R_13()) {
+ jj_scanpos = xsp;
+ if (jj_3R_14()) {
+ jj_scanpos = xsp;
+ if (jj_3R_15()) {
+ jj_scanpos = xsp;
+ if (jj_3R_16()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_2() {
+ if (jj_3R_3()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(0)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_45() {
+ if (jj_scan_token(NULL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_7() {
+ if (jj_3R_5()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_6() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_6()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_5() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_5()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_4() {
+ if (jj_3R_4()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_6()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_3() {
+ if (jj_3R_4()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_5()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_33() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_3()) {
+ jj_scanpos = xsp;
+ if (jj_3_4()) {
+ jj_scanpos = xsp;
+ if (jj_3_5()) {
+ jj_scanpos = xsp;
+ if (jj_3_6()) {
+ jj_scanpos = xsp;
+ if (jj_3_7()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_44() {
+ if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_43() {
+ if (jj_scan_token(INTEGER_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_6() {
+ if (jj_scan_token(STRING_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_41() {
+ if (jj_3R_6()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_40() {
+ if (jj_3R_5()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_34() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_40()) {
+ jj_scanpos = xsp;
+ if (jj_3R_41()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_47() {
+ if (jj_scan_token(FALSE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_31() {
+ if (jj_3R_33()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_34()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_46() {
+ if (jj_scan_token(TRUE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_42() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_46()) {
+ jj_scanpos = xsp;
+ if (jj_3R_47()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_39() {
+ if (jj_3R_45()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_38() {
+ if (jj_3R_6()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_37() {
+ if (jj_3R_44()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_9() {
+ if (jj_3R_32()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_36() {
+ if (jj_3R_43()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_8() {
+ if (jj_3R_31()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_35() {
+ if (jj_3R_42()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_3() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_8()) {
+ jj_scanpos = xsp;
+ if (jj_3R_9()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_32() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_35()) {
+ jj_scanpos = xsp;
+ if (jj_3R_36()) {
+ jj_scanpos = xsp;
+ if (jj_3R_37()) {
+ jj_scanpos = xsp;
+ if (jj_3R_38()) {
+ jj_scanpos = xsp;
+ if (jj_3R_39()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_30() {
+ if (jj_scan_token(GE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_29() {
+ if (jj_scan_token(LE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_28() {
+ if (jj_scan_token(GT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_24() {
+ if (jj_scan_token(PARAMVALUES)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_27() {
+ if (jj_scan_token(LT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_23() {
+ if (jj_scan_token(PARAM)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_26() {
+ if (jj_scan_token(NE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_22() {
+ if (jj_scan_token(HEADER)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_21() {
+ if (jj_scan_token(APP)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ public SpelParserTokenManager token_source;
+ ASCII_UCodeESC_CharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[8];
+ final private int[] jj_la1_0 = {0x0,0x801ffcc0,0x0,0x801fc400,0x1fc000,0x801fc000,0x3cc0,0x1800,};
+ final private int[] jj_la1_1 = {0x3f0,0x4,0x8,0x0,0x0,0x0,0x0,0x0,};
+ final private JJCalls[] jj_2_rtns = new JJCalls[7];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ public SpelParser(java.io.InputStream stream) {
+ jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+ token_source = new SpelParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public SpelParser(java.io.Reader stream) {
+ jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+ token_source = new SpelParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public SpelParser(SpelParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(SpelParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.Vector jj_expentries = new java.util.Vector();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
+ int[] oldentry = (int[])(enum.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ final public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[42];
+ for (int i = 0; i < 42; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 8; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 42; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+ final private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 7; i++) {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ case 1: jj_3_2(); break;
+ case 2: jj_3_3(); break;
+ case 3: jj_3_4(); break;
+ case 4: jj_3_5(); break;
+ case 5: jj_3_6(); break;
+ case 6: jj_3_7(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ }
+ jj_rescan = false;
+ }
+
+ final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/SpelParserConstants.java b/src/org/apache/taglibs/standard/lang/spel/parser/SpelParserConstants.java
new file mode 100644
index 0000000..c6f84e8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/SpelParserConstants.java
@@ -0,0 +1,91 @@
+/* Generated By:JavaCC: Do not edit this line. SpelParserConstants.java */
+package org.apache.taglibs.standard.lang.spel.parser;
+
+public interface SpelParserConstants {
+
+ int EOF = 0;
+ int INTEGER_LITERAL = 6;
+ int FLOATING_POINT_LITERAL = 7;
+ int EXPONENT = 8;
+ int SIGN = 9;
+ int STRING_LITERAL = 10;
+ int TRUE = 11;
+ int FALSE = 12;
+ int NULL = 13;
+ int PAGE = 14;
+ int REQUEST = 15;
+ int SESSION = 16;
+ int APP = 17;
+ int HEADER = 18;
+ int PARAM = 19;
+ int PARAMVALUES = 20;
+ int AND = 21;
+ int OR = 22;
+ int NOT = 23;
+ int EQ_VALUE = 24;
+ int NE_VALUE = 25;
+ int LT_VALUE = 26;
+ int GT_VALUE = 27;
+ int LE_VALUE = 28;
+ int GE_VALUE = 29;
+ int INSTANCEOF = 30;
+ int IDENTIFIER = 31;
+ int LETTER = 32;
+ int DIGIT = 33;
+ int COLON = 34;
+ int DOT = 35;
+ int GT = 36;
+ int LT = 37;
+ int EQ = 38;
+ int LE = 39;
+ int GE = 40;
+ int NE = 41;
+
+ int DEFAULT = 0;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\t\"",
+ "\"\\n\"",
+ "\"\\r\"",
+ "\"\\f\"",
+ "<INTEGER_LITERAL>",
+ "<FLOATING_POINT_LITERAL>",
+ "<EXPONENT>",
+ "<SIGN>",
+ "<STRING_LITERAL>",
+ "\"true\"",
+ "\"false\"",
+ "\"null\"",
+ "\"page\"",
+ "\"request\"",
+ "\"session\"",
+ "\"app\"",
+ "\"header\"",
+ "\"param\"",
+ "\"paramvalues\"",
+ "\"and\"",
+ "\"or\"",
+ "\"not\"",
+ "\"eq\"",
+ "\"ne\"",
+ "\"lt\"",
+ "\"gt\"",
+ "\"le\"",
+ "\"ge\"",
+ "\"instanceof\"",
+ "<IDENTIFIER>",
+ "<LETTER>",
+ "<DIGIT>",
+ "\":\"",
+ "\".\"",
+ "\">\"",
+ "\"<\"",
+ "\"==\"",
+ "\"<=\"",
+ "\">=\"",
+ "\"!=\"",
+ };
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/SpelParserTokenManager.java b/src/org/apache/taglibs/standard/lang/spel/parser/SpelParserTokenManager.java
new file mode 100644
index 0000000..8c67540
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/SpelParserTokenManager.java
@@ -0,0 +1,985 @@
+/* Generated By:JavaCC: Do not edit this line. SpelParserTokenManager.java */
+package org.apache.taglibs.standard.lang.spel.parser;
+import org.apache.taglibs.standard.lang.spel.*;
+import java.util.ArrayList;
+
+public class SpelParserTokenManager implements SpelParserConstants
+{
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x800000000L) != 0L)
+ return 1;
+ if ((active0 & 0x7ffff800L) != 0L)
+ {
+ jjmatchedKind = 31;
+ return 16;
+ }
+ return -1;
+ case 1:
+ if ((active0 & 0x3f400000L) != 0L)
+ return 16;
+ if ((active0 & 0x40bff800L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 1;
+ return 16;
+ }
+ return -1;
+ case 2:
+ if ((active0 & 0xa20000L) != 0L)
+ return 16;
+ if ((active0 & 0x401df800L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 2;
+ return 16;
+ }
+ return -1;
+ case 3:
+ if ((active0 & 0x6800L) != 0L)
+ return 16;
+ if ((active0 & 0x401d9000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 3;
+ return 16;
+ }
+ return -1;
+ case 4:
+ if ((active0 & 0x181000L) != 0L)
+ return 16;
+ if ((active0 & 0x40058000L) != 0L)
+ {
+ if (jjmatchedPos != 4)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 4;
+ }
+ return 16;
+ }
+ return -1;
+ case 5:
+ if ((active0 & 0x40118000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 5;
+ return 16;
+ }
+ if ((active0 & 0x40000L) != 0L)
+ return 16;
+ return -1;
+ case 6:
+ if ((active0 & 0x18000L) != 0L)
+ return 16;
+ if ((active0 & 0x40100000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 6;
+ return 16;
+ }
+ return -1;
+ case 7:
+ if ((active0 & 0x40100000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 7;
+ return 16;
+ }
+ return -1;
+ case 8:
+ if ((active0 & 0x40100000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 8;
+ return 16;
+ }
+ return -1;
+ case 9:
+ if ((active0 & 0x40000000L) != 0L)
+ return 16;
+ if ((active0 & 0x100000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 9;
+ return 16;
+ }
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 33:
+ return jjMoveStringLiteralDfa1_0(0x20000000000L);
+ case 46:
+ return jjStartNfaWithStates_0(0, 35, 1);
+ case 58:
+ return jjStopAtPos(0, 34);
+ case 60:
+ jjmatchedKind = 37;
+ return jjMoveStringLiteralDfa1_0(0x8000000000L);
+ case 61:
+ return jjMoveStringLiteralDfa1_0(0x4000000000L);
+ case 62:
+ jjmatchedKind = 36;
+ return jjMoveStringLiteralDfa1_0(0x10000000000L);
+ case 97:
+ return jjMoveStringLiteralDfa1_0(0x220000L);
+ case 101:
+ return jjMoveStringLiteralDfa1_0(0x1000000L);
+ case 102:
+ return jjMoveStringLiteralDfa1_0(0x1000L);
+ case 103:
+ return jjMoveStringLiteralDfa1_0(0x28000000L);
+ case 104:
+ return jjMoveStringLiteralDfa1_0(0x40000L);
+ case 105:
+ return jjMoveStringLiteralDfa1_0(0x40000000L);
+ case 108:
+ return jjMoveStringLiteralDfa1_0(0x14000000L);
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x2802000L);
+ case 111:
+ return jjMoveStringLiteralDfa1_0(0x400000L);
+ case 112:
+ return jjMoveStringLiteralDfa1_0(0x184000L);
+ case 114:
+ return jjMoveStringLiteralDfa1_0(0x8000L);
+ case 115:
+ return jjMoveStringLiteralDfa1_0(0x10000L);
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x800L);
+ default :
+ return jjMoveNfa_0(5, 0);
+ }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 61:
+ if ((active0 & 0x4000000000L) != 0L)
+ return jjStopAtPos(1, 38);
+ else if ((active0 & 0x8000000000L) != 0L)
+ return jjStopAtPos(1, 39);
+ else if ((active0 & 0x10000000000L) != 0L)
+ return jjStopAtPos(1, 40);
+ else if ((active0 & 0x20000000000L) != 0L)
+ return jjStopAtPos(1, 41);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa2_0(active0, 0x185000L);
+ case 101:
+ if ((active0 & 0x2000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 25, 16);
+ else if ((active0 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 28, 16);
+ else if ((active0 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 29, 16);
+ return jjMoveStringLiteralDfa2_0(active0, 0x58000L);
+ case 110:
+ return jjMoveStringLiteralDfa2_0(active0, 0x40200000L);
+ case 111:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
+ case 112:
+ return jjMoveStringLiteralDfa2_0(active0, 0x20000L);
+ case 113:
+ if ((active0 & 0x1000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 24, 16);
+ break;
+ case 114:
+ if ((active0 & 0x400000L) != 0L)
+ return jjStartNfaWithStates_0(1, 22, 16);
+ return jjMoveStringLiteralDfa2_0(active0, 0x800L);
+ case 116:
+ if ((active0 & 0x4000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 26, 16);
+ else if ((active0 & 0x8000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 27, 16);
+ break;
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x40000L);
+ case 100:
+ if ((active0 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(2, 21, 16);
+ break;
+ case 103:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000L);
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0x3000L);
+ case 112:
+ if ((active0 & 0x20000L) != 0L)
+ return jjStartNfaWithStates_0(2, 17, 16);
+ break;
+ case 113:
+ return jjMoveStringLiteralDfa3_0(active0, 0x8000L);
+ case 114:
+ return jjMoveStringLiteralDfa3_0(active0, 0x180000L);
+ case 115:
+ return jjMoveStringLiteralDfa3_0(active0, 0x40010000L);
+ case 116:
+ if ((active0 & 0x800000L) != 0L)
+ return jjStartNfaWithStates_0(2, 23, 16);
+ break;
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0x180000L);
+ case 100:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000L);
+ case 101:
+ if ((active0 & 0x800L) != 0L)
+ return jjStartNfaWithStates_0(3, 11, 16);
+ else if ((active0 & 0x4000L) != 0L)
+ return jjStartNfaWithStates_0(3, 14, 16);
+ break;
+ case 108:
+ if ((active0 & 0x2000L) != 0L)
+ return jjStartNfaWithStates_0(3, 13, 16);
+ break;
+ case 115:
+ return jjMoveStringLiteralDfa4_0(active0, 0x11000L);
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000L);
+ case 117:
+ return jjMoveStringLiteralDfa4_0(active0, 0x8000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa5_0(active0, 0x40000000L);
+ case 101:
+ if ((active0 & 0x1000L) != 0L)
+ return jjStartNfaWithStates_0(4, 12, 16);
+ return jjMoveStringLiteralDfa5_0(active0, 0x48000L);
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x10000L);
+ case 109:
+ if ((active0 & 0x80000L) != 0L)
+ {
+ jjmatchedKind = 19;
+ jjmatchedPos = 4;
+ }
+ return jjMoveStringLiteralDfa5_0(active0, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 110:
+ return jjMoveStringLiteralDfa6_0(active0, 0x40000000L);
+ case 111:
+ return jjMoveStringLiteralDfa6_0(active0, 0x10000L);
+ case 114:
+ if ((active0 & 0x40000L) != 0L)
+ return jjStartNfaWithStates_0(5, 18, 16);
+ break;
+ case 115:
+ return jjMoveStringLiteralDfa6_0(active0, 0x8000L);
+ case 118:
+ return jjMoveStringLiteralDfa6_0(active0, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa7_0(active0, 0x100000L);
+ case 99:
+ return jjMoveStringLiteralDfa7_0(active0, 0x40000000L);
+ case 110:
+ if ((active0 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(6, 16, 16);
+ break;
+ case 116:
+ if ((active0 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(6, 15, 16);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0);
+}
+private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 101:
+ return jjMoveStringLiteralDfa8_0(active0, 0x40000000L);
+ case 108:
+ return jjMoveStringLiteralDfa8_0(active0, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0);
+}
+private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 111:
+ return jjMoveStringLiteralDfa9_0(active0, 0x40000000L);
+ case 117:
+ return jjMoveStringLiteralDfa9_0(active0, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, active0);
+}
+private final int jjMoveStringLiteralDfa9_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 101:
+ return jjMoveStringLiteralDfa10_0(active0, 0x100000L);
+ case 102:
+ if ((active0 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 30, 16);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, active0);
+}
+private final int jjMoveStringLiteralDfa10_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(8, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(9, active0);
+ return 10;
+ }
+ switch(curChar)
+ {
+ case 115:
+ if ((active0 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(10, 20, 16);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(9, active0);
+}
+private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private final void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+ 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec2 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec3 = {
+ 0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L
+};
+static final long[] jjbitVec4 = {
+ 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
+};
+static final long[] jjbitVec5 = {
+ 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec6 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
+};
+static final long[] jjbitVec7 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L
+};
+static final long[] jjbitVec8 = {
+ 0x3fffffffffffL, 0x0L, 0x0L, 0x0L
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 30;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 5:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 6)
+ kind = 6;
+ jjCheckNAddStates(0, 4);
+ }
+ else if ((0x280000000000L & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ else if (curChar == 36)
+ {
+ if (kind > 31)
+ kind = 31;
+ jjCheckNAdd(16);
+ }
+ else if (curChar == 39)
+ jjCheckNAddStates(9, 11);
+ else if (curChar == 34)
+ jjCheckNAddStates(12, 14);
+ else if (curChar == 46)
+ jjCheckNAdd(1);
+ break;
+ case 0:
+ if (curChar == 46)
+ jjCheckNAdd(1);
+ break;
+ case 1:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(1, 2);
+ break;
+ case 3:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(4);
+ break;
+ case 4:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(4);
+ break;
+ case 6:
+ if ((0xfffffffbffffffffL & l) != 0L)
+ jjCheckNAddStates(12, 14);
+ break;
+ case 8:
+ if (curChar == 34)
+ jjCheckNAddStates(12, 14);
+ break;
+ case 9:
+ if (curChar == 34 && kind > 10)
+ kind = 10;
+ break;
+ case 10:
+ case 13:
+ if (curChar == 39)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 11:
+ if ((0xffffff7fffffffffL & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 14:
+ if (curChar == 39 && kind > 10)
+ kind = 10;
+ break;
+ case 15:
+ if (curChar != 36)
+ break;
+ if (kind > 31)
+ kind = 31;
+ jjCheckNAdd(16);
+ break;
+ case 16:
+ if ((0x3ff001000000000L & l) == 0L)
+ break;
+ if (kind > 31)
+ kind = 31;
+ jjCheckNAdd(16);
+ break;
+ case 17:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAddStates(5, 8);
+ break;
+ case 18:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 6)
+ kind = 6;
+ jjCheckNAdd(18);
+ break;
+ case 19:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(19, 20);
+ break;
+ case 20:
+ if (curChar != 46)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(21, 22);
+ break;
+ case 21:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(21, 22);
+ break;
+ case 23:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(24);
+ break;
+ case 24:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(24);
+ break;
+ case 25:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(25, 26);
+ break;
+ case 27:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(28);
+ break;
+ case 28:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(28);
+ break;
+ case 29:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 6)
+ kind = 6;
+ jjCheckNAddStates(0, 4);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 5:
+ case 16:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 31)
+ kind = 31;
+ jjCheckNAdd(16);
+ break;
+ case 2:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(15, 16);
+ break;
+ case 6:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(12, 14);
+ break;
+ case 7:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 8;
+ break;
+ case 8:
+ if (curChar == 92)
+ jjCheckNAddStates(12, 14);
+ break;
+ case 11:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 12:
+ if (curChar == 92)
+ jjstateSet[jjnewStateCnt++] = 13;
+ break;
+ case 13:
+ if (curChar == 92)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 22:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(17, 18);
+ break;
+ case 26:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(19, 20);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int hiByte = (int)(curChar >> 8);
+ int i1 = hiByte >> 6;
+ long l1 = 1L << (hiByte & 077);
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 5:
+ case 16:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 31)
+ kind = 31;
+ jjCheckNAdd(16);
+ break;
+ case 6:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjAddStates(12, 14);
+ break;
+ case 11:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjAddStates(9, 11);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 30 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static final int[] jjnextStates = {
+ 18, 19, 20, 25, 26, 18, 19, 0, 25, 11, 12, 14, 6, 7, 9, 3,
+ 4, 23, 24, 27, 28,
+};
+private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec2[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec0[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec4[i2] & l2) != 0L);
+ case 48:
+ return ((jjbitVec5[i2] & l2) != 0L);
+ case 49:
+ return ((jjbitVec6[i2] & l2) != 0L);
+ case 51:
+ return ((jjbitVec7[i2] & l2) != 0L);
+ case 61:
+ return ((jjbitVec8[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec3[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, null, null, null, null,
+"\164\162\165\145", "\146\141\154\163\145", "\156\165\154\154", "\160\141\147\145",
+"\162\145\161\165\145\163\164", "\163\145\163\163\151\157\156", "\141\160\160", "\150\145\141\144\145\162",
+"\160\141\162\141\155", "\160\141\162\141\155\166\141\154\165\145\163", "\141\156\144", "\157\162",
+"\156\157\164", "\145\161", "\156\145", "\154\164", "\147\164", "\154\145", "\147\145",
+"\151\156\163\164\141\156\143\145\157\146", null, null, null, "\72", "\56", "\76", "\74", "\75\75", "\74\75", "\76\75",
+"\41\75", };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+};
+static final long[] jjtoToken = {
+ 0x3fcfffffcc1L,
+};
+static final long[] jjtoSkip = {
+ 0x3eL,
+};
+private ASCII_UCodeESC_CharStream input_stream;
+private final int[] jjrounds = new int[30];
+private final int[] jjstateSet = new int[60];
+protected char curChar;
+public SpelParserTokenManager(ASCII_UCodeESC_CharStream stream)
+{
+ if (ASCII_UCodeESC_CharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+}
+public SpelParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+public void ReInit(ASCII_UCodeESC_CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 30; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 1 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+private final Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ t.image = (im == null) ? input_stream.GetImage() : im;
+ t.beginLine = input_stream.getBeginLine();
+ t.beginColumn = input_stream.getBeginColumn();
+ t.endLine = input_stream.getEndLine();
+ t.endColumn = input_stream.getEndColumn();
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public final Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ else
+ {
+ continue EOFLoop;
+ }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+}
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/Token.java b/src/org/apache/taglibs/standard/lang/spel/parser/Token.java
new file mode 100644
index 0000000..4b69330
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/Token.java
@@ -0,0 +1,81 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+package org.apache.taglibs.standard.lang.spel.parser;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public final String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/parser/TokenMgrError.java b/src/org/apache/taglibs/standard/lang/spel/parser/TokenMgrError.java
new file mode 100644
index 0000000..53c64ee
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/parser/TokenMgrError.java
@@ -0,0 +1,133 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+package org.apache.taglibs.standard.lang.spel.parser;
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/Bean1.java b/src/org/apache/taglibs/standard/lang/spel/test/Bean1.java
new file mode 100644
index 0000000..1fee0f4
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/Bean1.java
@@ -0,0 +1,279 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+/**
+ *
+ * <p>This is a test bean with a set of properties
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class Bean1
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property boolean1
+
+ boolean mBoolean1;
+ public boolean getBoolean1 ()
+ { return mBoolean1; }
+ public void setBoolean1 (boolean pBoolean1)
+ { mBoolean1 = pBoolean1; }
+
+ //-------------------------------------
+ // property byte1
+
+ byte mByte1;
+ public byte getByte1 ()
+ { return mByte1; }
+ public void setByte1 (byte pByte1)
+ { mByte1 = pByte1; }
+
+ //-------------------------------------
+ // property char1
+
+ char mChar1;
+ public char getChar1 ()
+ { return mChar1; }
+ public void setChar1 (char pChar1)
+ { mChar1 = pChar1; }
+
+ //-------------------------------------
+ // property short1
+
+ short mShort1;
+ public short getShort1 ()
+ { return mShort1; }
+ public void setShort1 (short pShort1)
+ { mShort1 = pShort1; }
+
+ //-------------------------------------
+ // property int1
+
+ int mInt1;
+ public int getInt1 ()
+ { return mInt1; }
+ public void setInt1 (int pInt1)
+ { mInt1 = pInt1; }
+
+ //-------------------------------------
+ // property long1
+
+ long mLong1;
+ public long getLong1 ()
+ { return mLong1; }
+ public void setLong1 (long pLong1)
+ { mLong1 = pLong1; }
+
+ //-------------------------------------
+ // property float1
+
+ float mFloat1;
+ public float getFloat1 ()
+ { return mFloat1; }
+ public void setFloat1 (float pFloat1)
+ { mFloat1 = pFloat1; }
+
+ //-------------------------------------
+ // property double1
+
+ double mDouble1;
+ public double getDouble1 ()
+ { return mDouble1; }
+ public void setDouble1 (double pDouble1)
+ { mDouble1 = pDouble1; }
+
+ //-------------------------------------
+ // property boolean2
+
+ Boolean mBoolean2;
+ public Boolean getBoolean2 ()
+ { return mBoolean2; }
+ public void setBoolean2 (Boolean pBoolean2)
+ { mBoolean2 = pBoolean2; }
+
+ //-------------------------------------
+ // property byte2
+
+ Byte mByte2;
+ public Byte getByte2 ()
+ { return mByte2; }
+ public void setByte2 (Byte pByte2)
+ { mByte2 = pByte2; }
+
+ //-------------------------------------
+ // property char2
+
+ Character mChar2;
+ public Character getChar2 ()
+ { return mChar2; }
+ public void setChar2 (Character pChar2)
+ { mChar2 = pChar2; }
+
+ //-------------------------------------
+ // property short2
+
+ Short mShort2;
+ public Short getShort2 ()
+ { return mShort2; }
+ public void setShort2 (Short pShort2)
+ { mShort2 = pShort2; }
+
+ //-------------------------------------
+ // property int2
+
+ Integer mInt2;
+ public Integer getInt2 ()
+ { return mInt2; }
+ public void setInt2 (Integer pInt2)
+ { mInt2 = pInt2; }
+
+ //-------------------------------------
+ // property long2
+
+ Long mLong2;
+ public Long getLong2 ()
+ { return mLong2; }
+ public void setLong2 (Long pLong2)
+ { mLong2 = pLong2; }
+
+ //-------------------------------------
+ // property float2
+
+ Float mFloat2;
+ public Float getFloat2 ()
+ { return mFloat2; }
+ public void setFloat2 (Float pFloat2)
+ { mFloat2 = pFloat2; }
+
+ //-------------------------------------
+ // property double2
+
+ Double mDouble2;
+ public Double getDouble2 ()
+ { return mDouble2; }
+ public void setDouble2 (Double pDouble2)
+ { mDouble2 = pDouble2; }
+
+ //-------------------------------------
+ // property string1
+
+ String mString1;
+ public String getString1 ()
+ { return mString1; }
+ public void setString1 (String pString1)
+ { mString1 = pString1; }
+
+ //-------------------------------------
+ // property string2
+
+ String mString2;
+ public String getString2 ()
+ { return mString2; }
+ public void setString2 (String pString2)
+ { mString2 = pString2; }
+
+ //-------------------------------------
+ // property bean1
+
+ Bean1 mBean1;
+ public Bean1 getBean1 ()
+ { return mBean1; }
+ public void setBean1 (Bean1 pBean1)
+ { mBean1 = pBean1; }
+
+ //-------------------------------------
+ // property bean2
+
+ Bean1 mBean2;
+ public Bean1 getBean2 ()
+ { return mBean2; }
+ public void setBean2 (Bean1 pBean2)
+ { mBean2 = pBean2; }
+
+ //-------------------------------------
+ // property noGetter
+
+ String mNoGetter;
+ public void setNoGetter (String pNoGetter)
+ { mNoGetter = pNoGetter; }
+
+ //-------------------------------------
+ // property errorInGetter
+
+ String mErrorInGetter;
+ public String getErrorInGetter ()
+ { throw new NullPointerException ("Error!"); }
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public Bean1 ()
+ {
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/Bean2.java b/src/org/apache/taglibs/standard/lang/spel/test/Bean2.java
new file mode 100644
index 0000000..acfea9f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/Bean2.java
@@ -0,0 +1,101 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+/**
+ *
+ * <p>This is a test bean that holds a single String
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class Bean2
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+ // property value
+
+ String mValue;
+ public String getValue ()
+ { return mValue; }
+ public void setValue (String pValue)
+ { mValue = pValue; }
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public Bean2 (String pValue)
+ {
+ mValue = pValue;
+ }
+
+ //-------------------------------------
+ public String toString ()
+ {
+ return ("Bean2[" + mValue + "]");
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/Bean2Editor.java b/src/org/apache/taglibs/standard/lang/spel/test/Bean2Editor.java
new file mode 100644
index 0000000..1a798d1
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/Bean2Editor.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ *
+ * PropertyEditor for parsing Bean2
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class Bean2Editor
+ extends PropertyEditorSupport
+{
+ //-------------------------------------
+ public void setAsText (String pText)
+ throws IllegalArgumentException
+ {
+ if ("badvalue".equals (pText)) {
+ throw new IllegalArgumentException ("Bad value " + pText);
+ }
+ else {
+ setValue (new Bean2 (pText));
+ }
+ }
+
+ //-------------------------------------
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/EvaluationTest.java b/src/org/apache/taglibs/standard/lang/spel/test/EvaluationTest.java
new file mode 100644
index 0000000..cf4f842
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/EvaluationTest.java
@@ -0,0 +1,399 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import org.apache.taglibs.standard.lang.spel.Evaluator;
+import org.apache.taglibs.standard.lang.spel.ParsedExpression;
+import org.apache.taglibs.standard.lang.spel.SpelException;
+import org.apache.taglibs.standard.lang.spel.test.beans.Factory;
+
+/**
+ *
+ * <p>This runs a series of tests specifically for the evaluator. It
+ * parses and evaluates various expressions in the context of a test
+ * PageContext containing preset data, and prints out the results of
+ * the evaluations.
+ *
+ * <p>The expressions are stored in an input text file, where one line
+ * contains the expression and the next line contains the expected
+ * type. Blank lines and lines that start with # are ignored. The
+ * results are written to an output file (blank lines and # lines are
+ * included in the output file). The output file may be compared
+ * against an existing output file to do regression testing.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class EvaluationTest
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public EvaluationTest ()
+ {
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Runs the tests, reading expressions from pIn and writing the
+ * results to pOut.
+ **/
+ public static void runTests (DataInput pIn,
+ PrintStream pOut)
+ throws IOException
+ {
+ PageContext context = createTestContext ();
+
+ while (true) {
+ String str = pIn.readLine ();
+ if (str == null) break;
+ if (str.startsWith ("#") ||
+ "".equals (str.trim ())) {
+ pOut.println (str);
+ }
+ else {
+ String typeStr = pIn.readLine ();
+ pOut.println ("Expression: " + str);
+
+ try {
+ Class cl = parseClassName (typeStr);
+ pOut.println ("ExpectedType: " + cl);
+ Evaluator e = new Evaluator ();
+ Object val = e.evaluate (str, context, cl);
+ pOut.println ("Parses to: " + val);
+ if (val != null) {
+ pOut.println ("With type: " + val.getClass ().getName ());
+ }
+ pOut.println ();
+ }
+ catch (JspException exc) {
+ pOut.println ("Causes an error: " + exc);
+ }
+ catch (ClassNotFoundException exc) {
+ pOut.println ("Causes an error: " + exc);
+ }
+ }
+ }
+
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Finds the class for a class name, including primitive names
+ **/
+ static Class parseClassName (String pClassName)
+ throws ClassNotFoundException
+ {
+ String c = pClassName.trim ();
+ if ("boolean".equals (c)) {
+ return Boolean.TYPE;
+ }
+ else if ("byte".equals (c)) {
+ return Byte.TYPE;
+ }
+ else if ("char".equals (c)) {
+ return Character.TYPE;
+ }
+ else if ("short".equals (c)) {
+ return Short.TYPE;
+ }
+ else if ("int".equals (c)) {
+ return Integer.TYPE;
+ }
+ else if ("long".equals (c)) {
+ return Long.TYPE;
+ }
+ else if ("float".equals (c)) {
+ return Float.TYPE;
+ }
+ else if ("double".equals (c)) {
+ return Double.TYPE;
+ }
+ else {
+ return Class.forName (pClassName);
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Runs the tests, reading from the given input file and writing to
+ * the given output file.
+ **/
+ public static void runTests (File pInputFile,
+ File pOutputFile)
+ throws IOException
+ {
+ FileInputStream fin = null;
+ FileOutputStream fout = null;
+ try {
+ fin = new FileInputStream (pInputFile);
+ BufferedInputStream bin = new BufferedInputStream (fin);
+ DataInputStream din = new DataInputStream (bin);
+
+ try {
+ fout = new FileOutputStream (pOutputFile);
+ BufferedOutputStream bout = new BufferedOutputStream (fout);
+ PrintStream pout = new PrintStream (bout);
+
+ runTests (din, pout);
+
+ pout.flush ();
+ }
+ finally {
+ if (fout != null) {
+ fout.close ();
+ }
+ }
+ }
+ finally {
+ if (fin != null) {
+ fin.close ();
+ }
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Performs a line-by-line comparison of the two files, returning
+ * true if the files are different, false if not.
+ **/
+ public static boolean isDifferentFiles (DataInput pIn1,
+ DataInput pIn2)
+ throws IOException
+ {
+ while (true) {
+ String str1 = pIn1.readLine ();
+ String str2 = pIn2.readLine ();
+ if (str1 == null &&
+ str2 == null) {
+ return false;
+ }
+ else if (str1 == null ||
+ str2 == null) {
+ return true;
+ }
+ else {
+ if (!str1.equals (str2)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Performs a line-by-line comparison of the two files, returning
+ * true if the files are different, false if not.
+ **/
+ public static boolean isDifferentFiles (File pFile1,
+ File pFile2)
+ throws IOException
+ {
+ FileInputStream fin1 = null;
+ try {
+ fin1 = new FileInputStream (pFile1);
+ BufferedInputStream bin1 = new BufferedInputStream (fin1);
+ DataInputStream din1 = new DataInputStream (bin1);
+
+ FileInputStream fin2 = null;
+ try {
+ fin2 = new FileInputStream (pFile2);
+ BufferedInputStream bin2 = new BufferedInputStream (fin2);
+ DataInputStream din2 = new DataInputStream (bin2);
+
+ return isDifferentFiles (din1, din2);
+ }
+ finally {
+ if (fin2 != null) {
+ fin2.close ();
+ }
+ }
+ }
+ finally {
+ if (fin1 != null) {
+ fin1.close ();
+ }
+ }
+ }
+
+ //-------------------------------------
+ // Test data
+ //-------------------------------------
+ /**
+ *
+ * Creates and returns the test PageContext that will be used for
+ * the tests.
+ **/
+ static PageContext createTestContext ()
+ {
+ PageContext ret = new PageContextImpl ();
+
+ // Create some basic values for lookups
+ ret.setAttribute ("val1a", "page-scoped1", ret.PAGE_SCOPE);
+ ret.setAttribute ("val1b", "request-scoped1", ret.REQUEST_SCOPE);
+ ret.setAttribute ("val1c", "session-scoped1", ret.SESSION_SCOPE);
+ ret.setAttribute ("val1d", "app-scoped1", ret.APPLICATION_SCOPE);
+
+ // Create a bean
+ {
+ Bean1 b1 = new Bean1 ();
+ b1.setBoolean1 (true);
+ b1.setByte1 ((byte) 12);
+ b1.setShort1 ((short) -124);
+ b1.setChar1 ('b');
+ b1.setInt1 (4);
+ b1.setLong1 (222423);
+ b1.setFloat1 ((float) 12.4);
+ b1.setDouble1 (89.224);
+ b1.setString1 ("hello");
+ ret.setAttribute ("bean1a", b1);
+
+ Bean1 b2 = new Bean1 ();
+ b2.setInt2 (new Integer (-224));
+ b2.setString2 ("bean2's string");
+ b1.setBean1 (b2);
+
+ Bean1 b3 = new Bean1 ();
+ b3.setDouble1 (1422.332);
+ b3.setString2 ("bean3's string");
+ b2.setBean2 (b3);
+ }
+
+ // Create the public/private beans
+ {
+ ret.setAttribute ("pbean1", Factory.createBean1 ());
+ ret.setAttribute ("pbean2", Factory.createBean2 ());
+ ret.setAttribute ("pbean3", Factory.createBean3 ());
+ ret.setAttribute ("pbean4", Factory.createBean4 ());
+ ret.setAttribute ("pbean5", Factory.createBean5 ());
+ ret.setAttribute ("pbean6", Factory.createBean6 ());
+ ret.setAttribute ("pbean7", Factory.createBean7 ());
+ }
+
+ return ret;
+ }
+
+ //-------------------------------------
+ // Main method
+ //-------------------------------------
+ /**
+ *
+ * Runs the evaluation test
+ **/
+ public static void main (String [] pArgs)
+ throws IOException
+ {
+ if (pArgs.length != 2 &&
+ pArgs.length != 3) {
+ usage ();
+ System.exit (1);
+ }
+
+ File in = new File (pArgs [0]);
+ File out = new File (pArgs [1]);
+
+ runTests (in, out);
+
+ if (pArgs.length > 2) {
+ File compare = new File (pArgs [2]);
+ if (isDifferentFiles (out, compare)) {
+ System.out.println ("Test failure - output file " +
+ out +
+ " differs from expected output file " +
+ compare);
+ }
+ else {
+ System.out.println ("tests passed");
+ }
+ }
+ }
+
+ //-------------------------------------
+ static void usage ()
+ {
+ System.err.println ("usage: java org.apache.taglibs.standard.lang.spel.test.EvaluationTest {input file} {output file} [{compare file}]");
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/PageContextImpl.java b/src/org/apache/taglibs/standard/lang/spel/test/PageContextImpl.java
new file mode 100644
index 0000000..343f80b
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/PageContextImpl.java
@@ -0,0 +1,332 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.jsp.PageContext;
+import java.util.Enumeration;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletRequest;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.http.HttpSession;
+import java.util.Collections;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.Servlet;
+
+/**
+ *
+ * <p>This is a "dummy" implementation of PageContext whose only
+ * purpose is to serve the attribute getter/setter API's.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class PageContextImpl
+ extends PageContext
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ Map mPage = Collections.synchronizedMap (new HashMap ());
+ Map mRequest = Collections.synchronizedMap (new HashMap ());
+ Map mSession = Collections.synchronizedMap (new HashMap ());
+ Map mApp = Collections.synchronizedMap (new HashMap ());
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public PageContextImpl ()
+ {
+ }
+
+ //-------------------------------------
+ // PageContext methods
+ //-------------------------------------
+ public void initialize (Servlet servlet,
+ ServletRequest request,
+ ServletResponse response,
+ String errorPageURL,
+ boolean needSession,
+ int bufferSize,
+ boolean autoFlush)
+ {
+ }
+
+ //-------------------------------------
+ public void release ()
+ {
+ }
+
+ //-------------------------------------
+ public void setAttribute (String name,
+ Object attribute)
+ {
+ mPage.put (name, attribute);
+ }
+
+ //-------------------------------------
+ public void setAttribute (String name,
+ Object attribute,
+ int scope)
+ {
+ switch (scope) {
+ case PAGE_SCOPE:
+ mPage.put (name, attribute);
+ break;
+ case REQUEST_SCOPE:
+ mRequest.put (name, attribute);
+ break;
+ case SESSION_SCOPE:
+ mSession.put (name, attribute);
+ break;
+ case APPLICATION_SCOPE:
+ mApp.put (name, attribute);
+ break;
+ default:
+ throw new IllegalArgumentException ("Bad scope " + scope);
+ }
+ }
+
+ //-------------------------------------
+ public Object getAttribute (String name)
+ {
+ return mPage.get (name);
+ }
+
+ //-------------------------------------
+ public Object getAttribute (String name,
+ int scope)
+ {
+ switch (scope) {
+ case PAGE_SCOPE:
+ return mPage.get (name);
+ case REQUEST_SCOPE:
+ return mRequest.get (name);
+ case SESSION_SCOPE:
+ return mSession.get (name);
+ case APPLICATION_SCOPE:
+ return mApp.get (name);
+ default:
+ throw new IllegalArgumentException ("Bad scope " + scope);
+ }
+ }
+
+ //-------------------------------------
+ public Object findAttribute (String name)
+ {
+ if (mPage.containsKey (name)) {
+ return mPage.get (name);
+ }
+ else if (mRequest.containsKey (name)) {
+ return mRequest.get (name);
+ }
+ else if (mSession.containsKey (name)) {
+ return mSession.get (name);
+ }
+ else if (mApp.containsKey (name)) {
+ return mApp.get (name);
+ }
+ else {
+ return null;
+ }
+ }
+
+ //-------------------------------------
+ public void removeAttribute (String name)
+ {
+ if (mPage.containsKey (name)) {
+ mPage.remove (name);
+ }
+ else if (mRequest.containsKey (name)) {
+ mRequest.remove (name);
+ }
+ else if (mSession.containsKey (name)) {
+ mSession.remove (name);
+ }
+ else if (mApp.containsKey (name)) {
+ mApp.remove (name);
+ }
+ }
+
+ //-------------------------------------
+ public void removeAttribute (String name,
+ int scope)
+ {
+ switch (scope) {
+ case PAGE_SCOPE:
+ mPage.remove (name);
+ break;
+ case REQUEST_SCOPE:
+ mRequest.remove (name);
+ break;
+ case SESSION_SCOPE:
+ mSession.remove (name);
+ break;
+ case APPLICATION_SCOPE:
+ mApp.remove (name);
+ break;
+ default:
+ throw new IllegalArgumentException ("Bad scope " + scope);
+ }
+ }
+
+ //-------------------------------------
+ public int getAttributesScope (String name)
+ {
+ if (mPage.containsKey (name)) {
+ return PAGE_SCOPE;
+ }
+ else if (mRequest.containsKey (name)) {
+ return REQUEST_SCOPE;
+ }
+ else if (mSession.containsKey (name)) {
+ return SESSION_SCOPE;
+ }
+ else if (mApp.containsKey (name)) {
+ return APPLICATION_SCOPE;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ //-------------------------------------
+ public Enumeration getAttributeNamesInScope (int scope)
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public JspWriter getOut ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public HttpSession getSession ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public Object getPage ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public ServletRequest getRequest ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public ServletResponse getResponse ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public Exception getException ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public ServletConfig getServletConfig ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public ServletContext getServletContext ()
+ {
+ return null;
+ }
+
+ //-------------------------------------
+ public void forward (String path)
+ {
+ }
+
+ //-------------------------------------
+ public void include (String path)
+ {
+ }
+
+ //-------------------------------------
+ public void handlePageException (Exception exc)
+ {
+ }
+
+ //-------------------------------------
+ public void handlePageException (Throwable exc)
+ {
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/ParserTest.java b/src/org/apache/taglibs/standard/lang/spel/test/ParserTest.java
new file mode 100644
index 0000000..67d342e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/ParserTest.java
@@ -0,0 +1,288 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import javax.servlet.jsp.JspException;
+import org.apache.taglibs.standard.lang.spel.Evaluator;
+import org.apache.taglibs.standard.lang.spel.ParsedExpression;
+import org.apache.taglibs.standard.lang.spel.SpelException;
+
+/**
+ *
+ * <p>This runs a series of tests specifically for the parser. It
+ * parses various expressions and prints out the canonical
+ * representation of those parsed expressions.
+ *
+ * <p>The expressions are stored in an input text file, with one line
+ * per expression. Blank lines and lines that start with # are
+ * ignored. The results are written to an output file (blank lines
+ * and # lines are included in the output file). The output file may
+ * be compared against an existing output file to do regression
+ * testing.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class ParserTest
+{
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public ParserTest ()
+ {
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Runs the tests, reading expressions from pIn and writing the
+ * results to pOut.
+ **/
+ public static void runTests (DataInput pIn,
+ PrintStream pOut)
+ throws IOException
+ {
+ while (true) {
+ String str = pIn.readLine ();
+ if (str == null) break;
+ if (str.startsWith ("#") ||
+ "".equals (str.trim ())) {
+ pOut.println (str);
+ }
+ else {
+ pOut.println ("Expression: " + str);
+ try {
+ ParsedExpression exp = Evaluator.getOrParseExpression (str);
+ pOut.println ("Parses to: " +
+ exp.getExpression ().getExpressionString ());
+ }
+ catch (JspException exc) {
+ pOut.println ("Causes an error: " + exc);
+ }
+ }
+ }
+
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Runs the tests, reading from the given input file and writing to
+ * the given output file.
+ **/
+ public static void runTests (File pInputFile,
+ File pOutputFile)
+ throws IOException
+ {
+ FileInputStream fin = null;
+ FileOutputStream fout = null;
+ try {
+ fin = new FileInputStream (pInputFile);
+ BufferedInputStream bin = new BufferedInputStream (fin);
+ DataInputStream din = new DataInputStream (bin);
+
+ try {
+ fout = new FileOutputStream (pOutputFile);
+ BufferedOutputStream bout = new BufferedOutputStream (fout);
+ PrintStream pout = new PrintStream (bout);
+
+ runTests (din, pout);
+
+ pout.flush ();
+ }
+ finally {
+ if (fout != null) {
+ fout.close ();
+ }
+ }
+ }
+ finally {
+ if (fin != null) {
+ fin.close ();
+ }
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Performs a line-by-line comparison of the two files, returning
+ * true if the files are different, false if not.
+ **/
+ public static boolean isDifferentFiles (DataInput pIn1,
+ DataInput pIn2)
+ throws IOException
+ {
+ while (true) {
+ String str1 = pIn1.readLine ();
+ String str2 = pIn2.readLine ();
+ if (str1 == null &&
+ str2 == null) {
+ return false;
+ }
+ else if (str1 == null ||
+ str2 == null) {
+ return true;
+ }
+ else {
+ if (!str1.equals (str2)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Performs a line-by-line comparison of the two files, returning
+ * true if the files are different, false if not.
+ **/
+ public static boolean isDifferentFiles (File pFile1,
+ File pFile2)
+ throws IOException
+ {
+ FileInputStream fin1 = null;
+ try {
+ fin1 = new FileInputStream (pFile1);
+ BufferedInputStream bin1 = new BufferedInputStream (fin1);
+ DataInputStream din1 = new DataInputStream (bin1);
+
+ FileInputStream fin2 = null;
+ try {
+ fin2 = new FileInputStream (pFile2);
+ BufferedInputStream bin2 = new BufferedInputStream (fin2);
+ DataInputStream din2 = new DataInputStream (bin2);
+
+ return isDifferentFiles (din1, din2);
+ }
+ finally {
+ if (fin2 != null) {
+ fin2.close ();
+ }
+ }
+ }
+ finally {
+ if (fin1 != null) {
+ fin1.close ();
+ }
+ }
+ }
+
+ //-------------------------------------
+ // Main method
+ //-------------------------------------
+ /**
+ *
+ * Runs the parser test
+ **/
+ public static void main (String [] pArgs)
+ throws IOException
+ {
+ if (pArgs.length != 2 &&
+ pArgs.length != 3) {
+ usage ();
+ System.exit (1);
+ }
+
+ File in = new File (pArgs [0]);
+ File out = new File (pArgs [1]);
+
+ runTests (in, out);
+
+ if (pArgs.length > 2) {
+ File compare = new File (pArgs [2]);
+ if (isDifferentFiles (out, compare)) {
+ System.out.println ("Test failure - output file " +
+ out +
+ " differs from expected output file " +
+ compare);
+ }
+ else {
+ System.out.println ("tests passed");
+ }
+ }
+ }
+
+ //-------------------------------------
+ static void usage ()
+ {
+ System.err.println ("usage: java org.apache.taglibs.standard.lang.spel.test.ParserTest {input file} {output file} [{compare file}]");
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/PerformanceTest.java b/src/org/apache/taglibs/standard/lang/spel/test/PerformanceTest.java
new file mode 100644
index 0000000..519f6ec
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/PerformanceTest.java
@@ -0,0 +1,347 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import org.apache.taglibs.standard.lang.spel.Evaluator;
+import org.apache.taglibs.standard.lang.spel.ParsedExpression;
+import org.apache.taglibs.standard.lang.spel.SpelException;
+
+/**
+ *
+ * <p>This evaluates a single expression many times to gauge the
+ * performance characteristics of the evaluator. This can also be
+ * performed from multiple threads to see if there are any
+ * synchronization issues.
+ *
+ * <p>The expression evaluated is "session:bean1a.bean1.int1 < 24".
+ *
+ * <p>The test can also be run using pure API calls to do the above
+ * functionality, which should show how much slower it is to use the
+ * expression language to perform the function.
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ **/
+
+public class PerformanceTest
+{
+ //-------------------------------------
+ // Inner classes
+ //-------------------------------------
+
+ static class Runner
+ implements Runnable
+ {
+ int mIterations;
+ Evaluator mEvaluator;
+ PageContext mPageContext;
+ PerformanceTest mTest;
+ boolean mUseEvaluator;
+
+ public Runner (int pIterations,
+ Evaluator pEvaluator,
+ PageContext pPageContext,
+ PerformanceTest pTest,
+ boolean pUseEvaluator)
+ {
+ mIterations = pIterations;
+ mEvaluator = pEvaluator;
+ mPageContext = pPageContext;
+ mTest = pTest;
+ mUseEvaluator = pUseEvaluator;
+ }
+
+ public void run ()
+ {
+ mTest.incrementRunningThreadCount ();
+ mTest.waitForStartRunning ();
+
+ // Use the evaluator
+ if (mUseEvaluator) {
+ for (int i = 0; i < mIterations; i++) {
+ try {
+ Object ret =
+ mEvaluator.evaluate ("session:bean1a.bean1.int1 < 24",
+ mPageContext,
+ Boolean.class);
+ }
+ catch (JspException exc) {
+ exc.printStackTrace ();
+ }
+ }
+ }
+
+ // Use direct API calls
+ else {
+ for (int i = 0; i < mIterations; i++) {
+ Bean1 b1 = (Bean1)
+ mPageContext.getAttribute ("bean1a", mPageContext.SESSION_SCOPE);
+ Bean1 b2 = b1.getBean1 ();
+ int val = b2.getInt1 ();
+ boolean b = val < 24;
+ Boolean bobj = b ? Boolean.TRUE : Boolean.FALSE;
+ }
+ }
+
+ mTest.decrementRunningThreadCount ();
+ }
+ }
+
+ //-------------------------------------
+ // Properties
+ //-------------------------------------
+
+ //-------------------------------------
+ // Member variables
+ //-------------------------------------
+
+ boolean mStartRunning;
+ int mRunningThreadCount;
+
+ //-------------------------------------
+ /**
+ *
+ * Constructor
+ **/
+ public PerformanceTest ()
+ {
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Runs the tests
+ **/
+ public void runTests (int pThreadCount,
+ int pIterationCount)
+ {
+ runTests (pThreadCount,
+ pIterationCount,
+ true);
+ runTests (pThreadCount,
+ pIterationCount,
+ false);
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Runs the tests
+ **/
+ public void runTests (int pThreadCount,
+ int pIterationCount,
+ boolean pUseEvaluator)
+ {
+ Evaluator e = new Evaluator ();
+ PageContext p = createTestContext ();
+
+ // Start the threads
+ for (int i = 0; i < pThreadCount; i++) {
+ Runner r = new Runner (pIterationCount,
+ e,
+ p,
+ this,
+ pUseEvaluator);
+ new Thread (r).start ();
+ }
+
+ // Wait for all the threads to check in
+ waitForThreadCount (pThreadCount);
+
+ long startTime = System.currentTimeMillis ();
+
+ // Start the threads
+ startRunning ();
+
+ // Wait for all the threads to finish
+ waitForThreadCount (0);
+ mStartRunning = false;
+
+ int iterations = pThreadCount * pIterationCount;
+ long elapsed = System.currentTimeMillis () - startTime;
+ double rate = ((double) iterations / (double) elapsed) * 1000.0;
+
+ System.out.println ("Running " +
+ (pUseEvaluator ? "with" : "without") +
+ " the evaluator yields " +
+ iterations +
+ " iterations in " +
+ ((double) elapsed / 1000.0) +
+ " seconds (" +
+ rate +
+ " iters/second)");
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Waits for the startRunning flag to be set
+ **/
+ public synchronized void waitForStartRunning ()
+ {
+ while (!mStartRunning) {
+ try {
+ wait ();
+ }
+ catch (InterruptedException exc) {}
+ }
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Start the threads running
+ **/
+ public synchronized void startRunning ()
+ {
+ mStartRunning = true;
+ notifyAll ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Called by the thread to indicate that it is ready to start running
+ **/
+ public synchronized void incrementRunningThreadCount ()
+ {
+ mRunningThreadCount++;
+ notifyAll ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Called by the thread to indicate that it is done running
+ **/
+ public synchronized void decrementRunningThreadCount ()
+ {
+ mRunningThreadCount--;
+ notifyAll ();
+ }
+
+ //-------------------------------------
+ /**
+ *
+ * Waits for the thread count to reach the specified number
+ **/
+ public synchronized void waitForThreadCount (int pCount)
+ {
+ while (mRunningThreadCount != pCount) {
+ try {
+ wait ();
+ }
+ catch (InterruptedException exc) {}
+ }
+ }
+
+ //-------------------------------------
+ // Test data
+ //-------------------------------------
+ /**
+ *
+ * Creates and returns the test PageContext that will be used for
+ * the tests.
+ **/
+ static PageContext createTestContext ()
+ {
+ PageContext ret = new PageContextImpl ();
+
+ // Create a bean
+ {
+ Bean1 b1 = new Bean1 ();
+ Bean1 b2 = new Bean1 ();
+
+ b1.setBean1 (b2);
+ b2.setInt1 (14);
+
+ ret.setAttribute ("bean1a", b1, ret.SESSION_SCOPE);
+ }
+
+ return ret;
+ }
+
+ //-------------------------------------
+ // Main method
+ //-------------------------------------
+ /**
+ *
+ * Runs the evaluation test
+ **/
+ public static void main (String [] pArgs)
+ {
+ if (pArgs.length != 2) {
+ usage ();
+ System.exit (1);
+ }
+
+ int threadCount = Integer.valueOf (pArgs [0]).intValue ();
+ int iterationCount = Integer.valueOf (pArgs [1]).intValue ();
+ PerformanceTest test = new PerformanceTest ();
+ test.runTests (threadCount, iterationCount);
+ }
+
+ //-------------------------------------
+ static void usage ()
+ {
+ System.err.println ("usage: java org.apache.taglibs.standard.lang.spel.test.PerformanceTest {thread count} {#iterations}");
+ }
+
+ //-------------------------------------
+
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/Factory.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/Factory.java
new file mode 100644
index 0000000..0fb2de0
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/Factory.java
@@ -0,0 +1,102 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A factory for generating the various beans
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class Factory
+{
+ public static PublicBean1 createBean1 ()
+ {
+ return new PublicBean1 ();
+ }
+
+ public static PublicBean1 createBean2 ()
+ {
+ return new PrivateBean1a ();
+ }
+
+ public static PublicBean1 createBean3 ()
+ {
+ return new PublicBean1b ();
+ }
+
+ public static PublicInterface2 createBean4 ()
+ {
+ return new PublicBean2a ();
+ }
+
+ public static PublicInterface2 createBean5 ()
+ {
+ return new PrivateBean2b ();
+ }
+
+ public static PublicInterface2 createBean6 ()
+ {
+ return new PrivateBean2c ();
+ }
+
+ public static PublicInterface2 createBean7 ()
+ {
+ return new PrivateBean2d ();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean1a.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean1a.java
new file mode 100644
index 0000000..13a9147
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean1a.java
@@ -0,0 +1,69 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A private bean subclassing a public bean
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+class PrivateBean1a
+ extends PublicBean1
+{
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2b.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2b.java
new file mode 100644
index 0000000..9f43091
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2b.java
@@ -0,0 +1,70 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A private implementation of a public interface
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+class PrivateBean2b
+ implements PublicInterface2
+{
+ public Object getValue () { return "got the value"; }
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2c.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2c.java
new file mode 100644
index 0000000..b9e5720
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2c.java
@@ -0,0 +1,70 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A private subclass of a public class impelementing a public
+ * interface
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+class PrivateBean2c
+ extends PublicBean2a
+{
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2d.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2d.java
new file mode 100644
index 0000000..ad5bfc9
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PrivateBean2d.java
@@ -0,0 +1,70 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A private subclass of a private class impelementing a public
+ * interface
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+class PrivateBean2d
+ extends PrivateBean2b
+{
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean1.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean1.java
new file mode 100644
index 0000000..8ff7239
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean1.java
@@ -0,0 +1,69 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A publicly-accessible bean
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class PublicBean1
+{
+ public Object getValue () { return "got the value"; }
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean1b.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean1b.java
new file mode 100644
index 0000000..ef5c2a9
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean1b.java
@@ -0,0 +1,70 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A public bean subclassing a private bean subclassing a public
+ * bean
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class PublicBean1b
+ extends PrivateBean1a
+{
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean2a.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean2a.java
new file mode 100644
index 0000000..36c6c8e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicBean2a.java
@@ -0,0 +1,70 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A publicly-accessible implementation of a public interface
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public class PublicBean2a
+ implements PublicInterface2
+{
+ public Object getValue () { return "got the value"; }
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicInterface2.java b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicInterface2.java
new file mode 100644
index 0000000..ab25029
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/beans/PublicInterface2.java
@@ -0,0 +1,69 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.spel.test.beans;
+
+/**
+ *
+ * <p>A publicly-accessible interface
+ *
+ * @author Nathan Abramson - Art Technology Group
+ * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author$
+ **/
+
+public interface PublicInterface2
+{
+ public Object getValue ();
+}
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/evaluationTests.txt b/src/org/apache/taglibs/standard/lang/spel/test/evaluationTests.txt
new file mode 100644
index 0000000..c71a696
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/evaluationTests.txt
@@ -0,0 +1,565 @@
+# The set of evaluator tests
+
+#######################################################
+# basic literals
+$1
+int
+$-12
+int
+$true
+boolean
+$false
+boolean
+$null
+java.lang.String
+$4.2
+double
+$-21.3
+float
+$4.
+float
+$.21
+float
+$3e-1
+double
+$.2222222222
+double
+
+
+#######################################################
+# basic relationals between literals
+
+$1 < 2
+boolean
+$1 > 2
+boolean
+$1 >= 2
+boolean
+$1 <= 2
+boolean
+$1 == 2
+boolean
+$1 != 2
+boolean
+$3 >= 3
+boolean
+$3 <= 3
+boolean
+$3 == 3
+boolean
+$3 < 3
+boolean
+$3 > 3
+boolean
+$3 != 3
+boolean
+
+
+#######################################################
+# looking up objects in scopes
+
+# val1a - defined in page scope
+$page:val1a
+java.lang.String
+$request:val1a
+java.lang.String
+$session:val1a
+java.lang.String
+$app:val1a
+java.lang.String
+$val1a
+java.lang.String
+
+# val1b - defined in request scope
+$page:val1b
+java.lang.String
+$request:val1b
+java.lang.String
+$session:val1b
+java.lang.String
+$app:val1b
+java.lang.String
+$val1b
+java.lang.String
+
+# val1c - defined in session scope
+$page:val1c
+java.lang.String
+$request:val1c
+java.lang.String
+$session:val1c
+java.lang.String
+$app:val1c
+java.lang.String
+$val1c
+java.lang.String
+
+# val1d - defined in application scope
+$page:val1d
+java.lang.String
+$request:val1d
+java.lang.String
+$session:val1d
+java.lang.String
+$app:val1d
+java.lang.String
+$val1d
+java.lang.String
+
+#######################################################
+# accessing properties
+
+$bean1a.int1
+int
+$bean1a.boolean1
+boolean
+$bean1a.string1
+java.lang.String
+$bean1a.bean1.int2
+int
+$bean1a.bean1.bean2.string2
+java.lang.String
+
+#######################################################
+# test the entire conversion matrix
+
+$bean1a.byte1
+byte
+$bean1a.byte1
+char
+$bean1a.byte1
+short
+$bean1a.byte1
+int
+$bean1a.byte1
+long
+$bean1a.byte1
+float
+$bean1a.byte1
+double
+
+$bean1a.char1
+byte
+$bean1a.char1
+char
+$bean1a.char1
+short
+$bean1a.char1
+int
+$bean1a.char1
+long
+$bean1a.char1
+float
+$bean1a.char1
+double
+
+$bean1a.short1
+byte
+$bean1a.short1
+char
+$bean1a.short1
+short
+$bean1a.short1
+int
+$bean1a.short1
+long
+$bean1a.short1
+float
+$bean1a.short1
+double
+
+$bean1a.int1
+byte
+$bean1a.int1
+char
+$bean1a.int1
+short
+$bean1a.int1
+int
+$bean1a.int1
+long
+$bean1a.int1
+float
+$bean1a.int1
+double
+
+$bean1a.long1
+byte
+$bean1a.long1
+char
+$bean1a.long1
+short
+$bean1a.long1
+int
+$bean1a.long1
+long
+$bean1a.long1
+float
+$bean1a.long1
+double
+
+$bean1a.float1
+byte
+$bean1a.float1
+char
+$bean1a.float1
+short
+$bean1a.float1
+int
+$bean1a.float1
+long
+$bean1a.float1
+float
+$bean1a.float1
+double
+
+$bean1a.double1
+byte
+$bean1a.double1
+char
+$bean1a.double1
+short
+$bean1a.double1
+int
+$bean1a.double1
+long
+$bean1a.double1
+float
+$bean1a.double1
+double
+
+#######################################################
+# test the entire relational comparison type promotion matrix
+
+$bean1a.byte1 < bean1a.byte1
+boolean
+$bean1a.byte1 < bean1a.char1
+boolean
+$bean1a.byte1 < bean1a.short1
+boolean
+$bean1a.byte1 < bean1a.int1
+boolean
+$bean1a.byte1 < bean1a.long1
+boolean
+$bean1a.byte1 < bean1a.float1
+boolean
+$bean1a.byte1 < bean1a.double1
+boolean
+
+$bean1a.char1 < bean1a.byte1
+boolean
+$bean1a.char1 < bean1a.char1
+boolean
+$bean1a.char1 < bean1a.short1
+boolean
+$bean1a.char1 < bean1a.int1
+boolean
+$bean1a.char1 < bean1a.long1
+boolean
+$bean1a.char1 < bean1a.float1
+boolean
+$bean1a.char1 < bean1a.double1
+boolean
+
+$bean1a.short1 < bean1a.byte1
+boolean
+$bean1a.short1 < bean1a.char1
+boolean
+$bean1a.short1 < bean1a.short1
+boolean
+$bean1a.short1 < bean1a.int1
+boolean
+$bean1a.short1 < bean1a.long1
+boolean
+$bean1a.short1 < bean1a.float1
+boolean
+$bean1a.short1 < bean1a.double1
+boolean
+
+$bean1a.int1 < bean1a.byte1
+boolean
+$bean1a.int1 < bean1a.char1
+boolean
+$bean1a.int1 < bean1a.short1
+boolean
+$bean1a.int1 < bean1a.int1
+boolean
+$bean1a.int1 < bean1a.long1
+boolean
+$bean1a.int1 < bean1a.float1
+boolean
+$bean1a.int1 < bean1a.double1
+boolean
+
+$bean1a.long1 < bean1a.byte1
+boolean
+$bean1a.long1 < bean1a.char1
+boolean
+$bean1a.long1 < bean1a.short1
+boolean
+$bean1a.long1 < bean1a.int1
+boolean
+$bean1a.long1 < bean1a.long1
+boolean
+$bean1a.long1 < bean1a.float1
+boolean
+$bean1a.long1 < bean1a.double1
+boolean
+
+$bean1a.float1 < bean1a.byte1
+boolean
+$bean1a.float1 < bean1a.char1
+boolean
+$bean1a.float1 < bean1a.short1
+boolean
+$bean1a.float1 < bean1a.int1
+boolean
+$bean1a.float1 < bean1a.long1
+boolean
+$bean1a.float1 < bean1a.float1
+boolean
+$bean1a.float1 < bean1a.double1
+boolean
+
+$bean1a.double1 < bean1a.byte1
+boolean
+$bean1a.double1 < bean1a.char1
+boolean
+$bean1a.double1 < bean1a.short1
+boolean
+$bean1a.double1 < bean1a.int1
+boolean
+$bean1a.double1 < bean1a.long1
+boolean
+$bean1a.double1 < bean1a.float1
+boolean
+$bean1a.double1 < bean1a.double1
+boolean
+
+#######################################################
+# test other relational comparison rules
+
+$null == null
+boolean
+$noSuchAttribute == noSuchAttribute
+boolean
+$noSuchAttribute == null
+boolean
+$null == noSuchAttribute
+boolean
+$bean1a == null
+boolean
+$null == bean1a
+boolean
+$bean1a == bean1a
+boolean
+$bean1a > "hello"
+boolean
+$bean1a.bean1 < 14
+boolean
+$bean1a.bean1 == "hello"
+boolean
+
+#######################################################
+# test String comparisons
+
+$bean1a.string1 == "hello"
+boolean
+$bean1a.string1 != "hello"
+boolean
+$bean1a.string1 == "goodbye"
+boolean
+$bean1a.string1 != "goodbye"
+boolean
+$bean1a.string1 > "goodbye"
+boolean
+$"hello" == bean1a.string1
+boolean
+$"goodbye" > bean1a.string1
+boolean
+
+#######################################################
+# test errors in property traversal
+
+$noSuchAttribute.abc
+java.lang.Object
+$bean1a.bean2.byte1
+java.lang.Object
+$bean1a.noProperty
+java.lang.Object
+$bean1a.noGetter
+java.lang.Object
+$bean1a.errorInGetter
+java.lang.Object
+$bean1a.bean2.string2
+java.lang.Object
+
+#######################################################
+# test accessing public properties from private classes
+
+$pbean1.value
+java.lang.Object
+$pbean2.value
+java.lang.Object
+$pbean3.value
+java.lang.Object
+$pbean4.value
+java.lang.Object
+$pbean5.value
+java.lang.Object
+$pbean6.value
+java.lang.Object
+$pbean7.value
+java.lang.Object
+
+#######################################################
+# test literal conversions
+
+true
+boolean
+false
+boolean
+12
+byte
+12
+char
+12
+short
+12
+int
+12
+long
+12
+float
+12
+double
+
+hello
+org.apache.taglibs.standard.lang.spel.test.Bean2
+badvalue
+org.apache.taglibs.standard.lang.spel.test.Bean2
+hello
+org.apache.taglibs.standard.lang.spel.test.Bean1
+
+#######################################################
+# test null values bumped up to constants
+
+$null
+boolean
+$null
+byte
+$null
+short
+$null
+char
+$null
+int
+$null
+long
+$null
+float
+$null
+double
+$null
+java.lang.Boolean
+$null
+java.lang.Byte
+$null
+java.lang.Short
+$null
+java.lang.Character
+$null
+java.lang.Integer
+$null
+java.lang.Long
+$null
+java.lang.Float
+$null
+java.lang.Double
+
+
+#######################################################
+# test escaping the initial $
+
+$bean1a.string1
+java.lang.String
+\$bean1a.string1
+java.lang.String
+
+
+#######################################################
+# test reserved words as identifiers
+
+$and
+java.lang.Object
+$or
+java.lang.Object
+$not
+java.lang.Object
+$eq
+java.lang.Object
+$ne
+java.lang.Object
+$lt
+java.lang.Object
+$gt
+java.lang.Object
+$le
+java.lang.Object
+$ge
+java.lang.Object
+$instanceof
+java.lang.Object
+$page
+java.lang.Object
+$request
+java.lang.Object
+$session
+java.lang.Object
+$app
+java.lang.Object
+$true
+java.lang.Object
+$false
+java.lang.Object
+$null
+java.lang.Object
+
+
+#######################################################
+# test reserved words as property names
+
+$bean1a.and
+java.lang.Object
+$bean1a.or
+java.lang.Object
+$bean1a.not
+java.lang.Object
+$bean1a.eq
+java.lang.Object
+$bean1a.ne
+java.lang.Object
+$bean1a.lt
+java.lang.Object
+$bean1a.gt
+java.lang.Object
+$bean1a.le
+java.lang.Object
+$bean1a.ge
+java.lang.Object
+$bean1a.instanceof
+java.lang.Object
+$bean1a.page
+java.lang.Object
+$bean1a.request
+java.lang.Object
+$bean1a.session
+java.lang.Object
+$bean1a.app
+java.lang.Object
+$bean1a.true
+java.lang.Object
+$bean1a.false
+java.lang.Object
+$bean1a.null
+java.lang.Object
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/evaluationTestsExpectedOutput.txt b/src/org/apache/taglibs/standard/lang/spel/test/evaluationTestsExpectedOutput.txt
new file mode 100644
index 0000000..d639698
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/evaluationTestsExpectedOutput.txt
@@ -0,0 +1,1603 @@
+# The set of evaluator tests
+
+#######################################################
+# basic literals
+Expression: $1
+ExpectedType: int
+Parses to: 1
+With type: java.lang.Integer
+
+Expression: $-12
+ExpectedType: int
+Parses to: -12
+With type: java.lang.Integer
+
+Expression: $true
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $false
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $null
+ExpectedType: class java.lang.String
+Parses to: null
+
+Expression: $4.2
+ExpectedType: double
+Parses to: 4.2
+With type: java.lang.Double
+
+Expression: $-21.3
+ExpectedType: float
+Parses to: -21.3
+With type: java.lang.Float
+
+Expression: $4.
+ExpectedType: float
+Parses to: 4.0
+With type: java.lang.Float
+
+Expression: $.21
+ExpectedType: float
+Parses to: 0.21
+With type: java.lang.Float
+
+Expression: $3e-1
+ExpectedType: double
+Parses to: 0.3
+With type: java.lang.Double
+
+Expression: $.2222222222
+ExpectedType: double
+Parses to: 0.2222222222
+With type: java.lang.Double
+
+
+
+#######################################################
+# basic relationals between literals
+
+Expression: $1 < 2
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $1 > 2
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $1 >= 2
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $1 <= 2
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $1 == 2
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $1 != 2
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $3 >= 3
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $3 <= 3
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $3 == 3
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $3 < 3
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $3 > 3
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $3 != 3
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+
+
+#######################################################
+# looking up objects in scopes
+
+# val1a - defined in page scope
+Expression: $page:val1a
+ExpectedType: class java.lang.String
+Parses to: page-scoped1
+With type: java.lang.String
+
+Expression: $request:val1a
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1a" in request scope.
+Expression: $session:val1a
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1a" in session scope.
+Expression: $app:val1a
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1a" in app scope.
+Expression: $val1a
+ExpectedType: class java.lang.String
+Parses to: page-scoped1
+With type: java.lang.String
+
+
+# val1b - defined in request scope
+Expression: $page:val1b
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1b" in page scope.
+Expression: $request:val1b
+ExpectedType: class java.lang.String
+Parses to: request-scoped1
+With type: java.lang.String
+
+Expression: $session:val1b
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1b" in session scope.
+Expression: $app:val1b
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1b" in app scope.
+Expression: $val1b
+ExpectedType: class java.lang.String
+Parses to: request-scoped1
+With type: java.lang.String
+
+
+# val1c - defined in session scope
+Expression: $page:val1c
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1c" in page scope.
+Expression: $request:val1c
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1c" in request scope.
+Expression: $session:val1c
+ExpectedType: class java.lang.String
+Parses to: session-scoped1
+With type: java.lang.String
+
+Expression: $app:val1c
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1c" in app scope.
+Expression: $val1c
+ExpectedType: class java.lang.String
+Parses to: session-scoped1
+With type: java.lang.String
+
+
+# val1d - defined in application scope
+Expression: $page:val1d
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1d" in page scope.
+Expression: $request:val1d
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1d" in request scope.
+Expression: $session:val1d
+ExpectedType: class java.lang.String
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "val1d" in session scope.
+Expression: $app:val1d
+ExpectedType: class java.lang.String
+Parses to: app-scoped1
+With type: java.lang.String
+
+Expression: $val1d
+ExpectedType: class java.lang.String
+Parses to: app-scoped1
+With type: java.lang.String
+
+
+#######################################################
+# accessing properties
+
+Expression: $bean1a.int1
+ExpectedType: int
+Parses to: 4
+With type: java.lang.Integer
+
+Expression: $bean1a.boolean1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.string1
+ExpectedType: class java.lang.String
+Parses to: hello
+With type: java.lang.String
+
+Expression: $bean1a.bean1.int2
+ExpectedType: int
+Parses to: -224
+With type: java.lang.Integer
+
+Expression: $bean1a.bean1.bean2.string2
+ExpectedType: class java.lang.String
+Parses to: bean3's string
+With type: java.lang.String
+
+
+#######################################################
+# test the entire conversion matrix
+
+Expression: $bean1a.byte1
+ExpectedType: byte
+Parses to: 12
+With type: java.lang.Byte
+
+Expression: $bean1a.byte1
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Byte" to expected type "char"
+Expression: $bean1a.byte1
+ExpectedType: short
+Parses to: 12
+With type: java.lang.Short
+
+Expression: $bean1a.byte1
+ExpectedType: int
+Parses to: 12
+With type: java.lang.Integer
+
+Expression: $bean1a.byte1
+ExpectedType: long
+Parses to: 12
+With type: java.lang.Long
+
+Expression: $bean1a.byte1
+ExpectedType: float
+Parses to: 12.0
+With type: java.lang.Float
+
+Expression: $bean1a.byte1
+ExpectedType: double
+Parses to: 12.0
+With type: java.lang.Double
+
+
+Expression: $bean1a.char1
+ExpectedType: byte
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Character" to expected type "byte"
+Expression: $bean1a.char1
+ExpectedType: char
+Parses to: b
+With type: java.lang.Character
+
+Expression: $bean1a.char1
+ExpectedType: short
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Character" to expected type "short"
+Expression: $bean1a.char1
+ExpectedType: int
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Character" to expected type "int"
+Expression: $bean1a.char1
+ExpectedType: long
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Character" to expected type "long"
+Expression: $bean1a.char1
+ExpectedType: float
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Character" to expected type "float"
+Expression: $bean1a.char1
+ExpectedType: double
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Character" to expected type "double"
+
+Expression: $bean1a.short1
+ExpectedType: byte
+Parses to: -124
+With type: java.lang.Byte
+
+Expression: $bean1a.short1
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Short" to expected type "char"
+Expression: $bean1a.short1
+ExpectedType: short
+Parses to: -124
+With type: java.lang.Short
+
+Expression: $bean1a.short1
+ExpectedType: int
+Parses to: -124
+With type: java.lang.Integer
+
+Expression: $bean1a.short1
+ExpectedType: long
+Parses to: -124
+With type: java.lang.Long
+
+Expression: $bean1a.short1
+ExpectedType: float
+Parses to: -124.0
+With type: java.lang.Float
+
+Expression: $bean1a.short1
+ExpectedType: double
+Parses to: -124.0
+With type: java.lang.Double
+
+
+Expression: $bean1a.int1
+ExpectedType: byte
+Parses to: 4
+With type: java.lang.Byte
+
+Expression: $bean1a.int1
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Integer" to expected type "char"
+Expression: $bean1a.int1
+ExpectedType: short
+Parses to: 4
+With type: java.lang.Short
+
+Expression: $bean1a.int1
+ExpectedType: int
+Parses to: 4
+With type: java.lang.Integer
+
+Expression: $bean1a.int1
+ExpectedType: long
+Parses to: 4
+With type: java.lang.Long
+
+Expression: $bean1a.int1
+ExpectedType: float
+Parses to: 4.0
+With type: java.lang.Float
+
+Expression: $bean1a.int1
+ExpectedType: double
+Parses to: 4.0
+With type: java.lang.Double
+
+
+Expression: $bean1a.long1
+ExpectedType: byte
+Parses to: -41
+With type: java.lang.Byte
+
+Expression: $bean1a.long1
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Long" to expected type "char"
+Expression: $bean1a.long1
+ExpectedType: short
+Parses to: 25815
+With type: java.lang.Short
+
+Expression: $bean1a.long1
+ExpectedType: int
+Parses to: 222423
+With type: java.lang.Integer
+
+Expression: $bean1a.long1
+ExpectedType: long
+Parses to: 222423
+With type: java.lang.Long
+
+Expression: $bean1a.long1
+ExpectedType: float
+Parses to: 222423.0
+With type: java.lang.Float
+
+Expression: $bean1a.long1
+ExpectedType: double
+Parses to: 222423.0
+With type: java.lang.Double
+
+
+Expression: $bean1a.float1
+ExpectedType: byte
+Parses to: 12
+With type: java.lang.Byte
+
+Expression: $bean1a.float1
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Float" to expected type "char"
+Expression: $bean1a.float1
+ExpectedType: short
+Parses to: 12
+With type: java.lang.Short
+
+Expression: $bean1a.float1
+ExpectedType: int
+Parses to: 12
+With type: java.lang.Integer
+
+Expression: $bean1a.float1
+ExpectedType: long
+Parses to: 12
+With type: java.lang.Long
+
+Expression: $bean1a.float1
+ExpectedType: float
+Parses to: 12.4
+With type: java.lang.Float
+
+Expression: $bean1a.float1
+ExpectedType: double
+Parses to: 12.399999618530273
+With type: java.lang.Double
+
+
+Expression: $bean1a.double1
+ExpectedType: byte
+Parses to: 89
+With type: java.lang.Byte
+
+Expression: $bean1a.double1
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to convert a value of type "java.lang.Double" to expected type "char"
+Expression: $bean1a.double1
+ExpectedType: short
+Parses to: 89
+With type: java.lang.Short
+
+Expression: $bean1a.double1
+ExpectedType: int
+Parses to: 89
+With type: java.lang.Integer
+
+Expression: $bean1a.double1
+ExpectedType: long
+Parses to: 89
+With type: java.lang.Long
+
+Expression: $bean1a.double1
+ExpectedType: float
+Parses to: 89.224
+With type: java.lang.Float
+
+Expression: $bean1a.double1
+ExpectedType: double
+Parses to: 89.224
+With type: java.lang.Double
+
+
+#######################################################
+# test the entire relational comparison type promotion matrix
+
+Expression: $bean1a.byte1 < bean1a.byte1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.byte1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Byte with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.byte1 < bean1a.short1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.byte1 < bean1a.int1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.byte1 < bean1a.long1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.byte1 < bean1a.float1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.byte1 < bean1a.double1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+
+Expression: $bean1a.char1 < bean1a.byte1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Byte using the "<" operator
+Expression: $bean1a.char1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.char1 < bean1a.short1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Short using the "<" operator
+Expression: $bean1a.char1 < bean1a.int1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Integer using the "<" operator
+Expression: $bean1a.char1 < bean1a.long1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Long using the "<" operator
+Expression: $bean1a.char1 < bean1a.float1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Float using the "<" operator
+Expression: $bean1a.char1 < bean1a.double1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Character with an instance of java.lang.Double using the "<" operator
+
+Expression: $bean1a.short1 < bean1a.byte1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.short1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Short with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.short1 < bean1a.short1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.short1 < bean1a.int1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.short1 < bean1a.long1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.short1 < bean1a.float1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.short1 < bean1a.double1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+
+Expression: $bean1a.int1 < bean1a.byte1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.int1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Integer with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.int1 < bean1a.short1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.int1 < bean1a.int1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.int1 < bean1a.long1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.int1 < bean1a.float1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.int1 < bean1a.double1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+
+Expression: $bean1a.long1 < bean1a.byte1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.long1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Long with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.long1 < bean1a.short1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.long1 < bean1a.int1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.long1 < bean1a.long1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.long1 < bean1a.float1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.long1 < bean1a.double1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+
+Expression: $bean1a.float1 < bean1a.byte1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.float1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Float with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.float1 < bean1a.short1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.float1 < bean1a.int1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.float1 < bean1a.long1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.float1 < bean1a.float1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.float1 < bean1a.double1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+
+Expression: $bean1a.double1 < bean1a.byte1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.double1 < bean1a.char1
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of java.lang.Double with an instance of java.lang.Character using the "<" operator
+Expression: $bean1a.double1 < bean1a.short1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.double1 < bean1a.int1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.double1 < bean1a.long1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.double1 < bean1a.float1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.double1 < bean1a.double1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+
+#######################################################
+# test other relational comparison rules
+
+Expression: $null == null
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $noSuchAttribute == noSuchAttribute
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "noSuchAttribute" in page/request/session/app scope.
+Expression: $noSuchAttribute == null
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "noSuchAttribute" in page/request/session/app scope.
+Expression: $null == noSuchAttribute
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "noSuchAttribute" in page/request/session/app scope.
+Expression: $bean1a == null
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $null == bean1a
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a == bean1a
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a > "hello"
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of org.apache.taglibs.jsptl.lang.spel.test.Bean1 with an instance of java.lang.String using the ">" operator
+Expression: $bean1a.bean1 < 14
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Illegal attempt to compare an instance of org.apache.taglibs.jsptl.lang.spel.test.Bean1 with an instance of java.lang.Long using the "<" operator
+Expression: $bean1a.bean1 == "hello"
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+
+#######################################################
+# test String comparisons
+
+Expression: $bean1a.string1 == "hello"
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.string1 != "hello"
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.string1 == "goodbye"
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $bean1a.string1 != "goodbye"
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $bean1a.string1 > "goodbye"
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $"hello" == bean1a.string1
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $"goodbye" > bean1a.string1
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+
+#######################################################
+# test errors in property traversal
+
+Expression: $noSuchAttribute.abc
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "noSuchAttribute" in page/request/session/app scope.
+Expression: $bean1a.bean2.byte1
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Attempt to get property "byte1" from a null value
+Expression: $bean1a.noProperty
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Class org.apache.taglibs.jsptl.lang.spel.test.Bean1 does not have a property "noProperty"
+Expression: $bean1a.noGetter
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Property "noGetter" of class org.apache.taglibs.jsptl.lang.spel.test.Bean1 does not have a public getter method
+Expression: $bean1a.errorInGetter
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: An error occurred while getting property "errorInGetter" from an instance of class org.apache.taglibs.jsptl.lang.spel.test.Bean1
+Expression: $bean1a.bean2.string2
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Attempt to get property "string2" from a null value
+
+#######################################################
+# test accessing public properties from private classes
+
+Expression: $pbean1.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+Expression: $pbean2.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+Expression: $pbean3.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+Expression: $pbean4.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+Expression: $pbean5.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+Expression: $pbean6.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+Expression: $pbean7.value
+ExpectedType: class java.lang.Object
+Parses to: got the value
+With type: java.lang.String
+
+
+#######################################################
+# test literal conversions
+
+Expression: true
+ExpectedType: boolean
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: false
+ExpectedType: boolean
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: 12
+ExpectedType: byte
+Parses to: 12
+With type: java.lang.Byte
+
+Expression: 12
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse literal value "12" into expected type "char" because no PropertyEditor for that type could be found
+Expression: 12
+ExpectedType: short
+Parses to: 12
+With type: java.lang.Short
+
+Expression: 12
+ExpectedType: int
+Parses to: 12
+With type: java.lang.Integer
+
+Expression: 12
+ExpectedType: long
+Parses to: 12
+With type: java.lang.Long
+
+Expression: 12
+ExpectedType: float
+Parses to: 12.0
+With type: java.lang.Float
+
+Expression: 12
+ExpectedType: double
+Parses to: 12.0
+With type: java.lang.Double
+
+
+Expression: hello
+ExpectedType: class org.apache.taglibs.standard.lang.spel.test.Bean2
+Parses to: Bean2[hello]
+With type: org.apache.taglibs.standard.lang.spel.test.Bean2
+
+Expression: badvalue
+ExpectedType: class org.apache.taglibs.standard.lang.spel.test.Bean2
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse literal value "badvalue" into expected type "org.apache.taglibs.jsptl.lang.spel.test.Bean2"
+Expression: hello
+ExpectedType: class org.apache.taglibs.standard.lang.spel.test.Bean1
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse literal value "hello" into expected type "org.apache.taglibs.jsptl.lang.spel.test.Bean1" because no PropertyEditor for that type could be found
+
+#######################################################
+# test null values bumped up to constants
+
+Expression: $null
+ExpectedType: boolean
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "boolean"
+Expression: $null
+ExpectedType: byte
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "byte"
+Expression: $null
+ExpectedType: short
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "short"
+Expression: $null
+ExpectedType: char
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "char"
+Expression: $null
+ExpectedType: int
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "int"
+Expression: $null
+ExpectedType: long
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "long"
+Expression: $null
+ExpectedType: float
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "float"
+Expression: $null
+ExpectedType: double
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Cannot cast a null value to primitive expected type "double"
+Expression: $null
+ExpectedType: class java.lang.Boolean
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Byte
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Short
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Character
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Integer
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Long
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Float
+Parses to: null
+
+Expression: $null
+ExpectedType: class java.lang.Double
+Parses to: null
+
+
+
+#######################################################
+# test escaping the initial $
+
+Expression: $bean1a.string1
+ExpectedType: class java.lang.String
+Parses to: hello
+With type: java.lang.String
+
+Expression: \$bean1a.string1
+ExpectedType: class java.lang.String
+Parses to: $bean1a.string1
+With type: java.lang.String
+
+
+
+#######################################################
+# test reserved words as identifiers
+
+Expression: $and
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "and" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $or
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "or" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $not
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "not" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $eq
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "eq" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $ne
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "ne" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $lt
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "lt" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $gt
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "gt" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $le
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "le" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $ge
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "ge" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $instanceof
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "instanceof" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> ...
+ "true" ...
+ "false" ...
+ <INTEGER_LITERAL> ...
+ <FLOATING_POINT_LITERAL> ...
+ <STRING_LITERAL> ...
+ "null" ...
+
+Expression: $page
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "page" in page/request/session/app scope.
+Expression: $request
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "request" in page/request/session/app scope.
+Expression: $session
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "session" in page/request/session/app scope.
+Expression: $app
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Unable to find attribute "app" in page/request/session/app scope.
+Expression: $true
+ExpectedType: class java.lang.Object
+Parses to: true
+With type: java.lang.Boolean
+
+Expression: $false
+ExpectedType: class java.lang.Object
+Parses to: false
+With type: java.lang.Boolean
+
+Expression: $null
+ExpectedType: class java.lang.Object
+Parses to: null
+
+
+
+#######################################################
+# test reserved words as property names
+
+Expression: $bean1a.and
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . and" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.or
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . or" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.not
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . not" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.eq
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . eq" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.ne
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . ne" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.lt
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . lt" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.gt
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . gt" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.le
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . le" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.ge
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . ge" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.instanceof
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . instanceof" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.page
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Class org.apache.taglibs.jsptl.lang.spel.test.Bean1 does not have a property "page"
+Expression: $bean1a.request
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Class org.apache.taglibs.jsptl.lang.spel.test.Bean1 does not have a property "request"
+Expression: $bean1a.session
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Class org.apache.taglibs.jsptl.lang.spel.test.Bean1 does not have a property "session"
+Expression: $bean1a.app
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelExpressionException: Class org.apache.taglibs.jsptl.lang.spel.test.Bean1 does not have a property "app"
+Expression: $bean1a.true
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . true" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.false
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . false" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $bean1a.null
+ExpectedType: class java.lang.Object
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "bean1a . null" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." <IDENTIFIER> ...
+ <IDENTIFIER> "." "page" ...
+ <IDENTIFIER> "." "request" ...
+ <IDENTIFIER> "." "session" ...
+ <IDENTIFIER> "." "app" ...
+ <IDENTIFIER> "." "header" ...
+ <IDENTIFIER> "." "param" ...
+ <IDENTIFIER> "." "paramvalues" ...
+ <IDENTIFIER> "." <STRING_LITERAL> ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/parserTests.txt b/src/org/apache/taglibs/standard/lang/spel/test/parserTests.txt
new file mode 100644
index 0000000..70606ee
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/parserTests.txt
@@ -0,0 +1,82 @@
+# The set of parser tests
+
+# literals
+$1
+$-12
+$true
+$false
+$null
+$4.2
+$-21.3
+$4.
+$.21
+$3e-1
+$.2222222222
+
+# string literals with "
+$"abc"
+$""
+$"a"
+$" "
+$" some string ''' "
+$" with escaping \\"
+$" with escaping \""
+$" with escaping \"\\\""
+$" bad \ escaping"
+$" bad \' escaping"
+
+# string literals with '
+$'abc'
+$''
+$'a'
+$' '
+$' some string """ '
+$' with escaping \\'
+$' with escaping \''
+$' with escaping \'\\\''
+$' bad \ escaping'
+$' bad \" escaping'
+
+# identifiers
+$abc
+$abc123
+$abc_123
+$bad*identifier
+
+# scoped names
+$page:abc
+$session:def
+$request:ghi
+$app:jkl
+$unknown:abc
+$page:"my long name"
+$page:'quotedName'
+$session:'Name-With@@@special !@# chars'
+$:abc
+$:"something else"
+$:'def'
+
+# property expressions
+$a.b
+$a.b.c.d.e.f.g.h
+$page:a.b.c.d.e
+$page:a."bbb".c.'###"def'
+
+# relational expressions
+$a < b
+$c == 3
+$d == "my string"
+$e > -17
+$f <= a.b.c.d
+$g >= asdfd
+$h != null
+$i != true
+
+# header, param, paramvalues expressions
+$header:sessionCcontext
+$param:'a-parameter'
+$paramvalues:morevalues
+
+# complex expressions
+$a.b.c.def <= page:no.time.like.the.present
+$14 != param:so.small
diff --git a/src/org/apache/taglibs/standard/lang/spel/test/parserTestsExpectedOutput.txt b/src/org/apache/taglibs/standard/lang/spel/test/parserTestsExpectedOutput.txt
new file mode 100644
index 0000000..e8d82b8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/spel/test/parserTestsExpectedOutput.txt
@@ -0,0 +1,163 @@
+# The set of parser tests
+
+# literals
+Expression: $1
+Parses to: 1
+Expression: $-12
+Parses to: -12
+Expression: $true
+Parses to: true
+Expression: $false
+Parses to: false
+Expression: $null
+Parses to: null
+Expression: $4.2
+Parses to: 4.2
+Expression: $-21.3
+Parses to: -21.3
+Expression: $4.
+Parses to: 4.0
+Expression: $.21
+Parses to: 0.21
+Expression: $3e-1
+Parses to: 0.3
+Expression: $.2222222222
+Parses to: 0.2222222222
+
+# string literals with "
+Expression: $"abc"
+Parses to: "abc"
+Expression: $""
+Parses to: ""
+Expression: $"a"
+Parses to: "a"
+Expression: $" "
+Parses to: " "
+Expression: $" some string ''' "
+Parses to: " some string ''' "
+Expression: $" with escaping \\"
+Parses to: " with escaping \\"
+Expression: $" with escaping \""
+Parses to: " with escaping \""
+Expression: $" with escaping \"\\\""
+Parses to: " with escaping \"\\\""
+Expression: $" bad \ escaping"
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Lexical error at line 1, column 8. Encountered: " " (32), after : "\" bad \\"
+Expression: $" bad \' escaping"
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Lexical error at line 1, column 8. Encountered: "\'" (39), after : "\" bad \\"
+
+# string literals with '
+Expression: $'abc'
+Parses to: "abc"
+Expression: $''
+Parses to: ""
+Expression: $'a'
+Parses to: "a"
+Expression: $' '
+Parses to: " "
+Expression: $' some string """ '
+Parses to: " some string \"\"\" "
+Expression: $' with escaping \\'
+Parses to: " with escaping \\"
+Expression: $' with escaping \''
+Parses to: " with escaping '"
+Expression: $' with escaping \'\\\''
+Parses to: " with escaping '\\'"
+Expression: $' bad \ escaping'
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Lexical error at line 1, column 8. Encountered: " " (32), after : "\' bad \\"
+Expression: $' bad \" escaping'
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Lexical error at line 1, column 8. Encountered: "\"" (34), after : "\' bad \\"
+
+# identifiers
+Expression: $abc
+Parses to: :abc
+Expression: $abc123
+Parses to: :abc123
+Expression: $abc_123
+Parses to: :abc_123
+Expression: $bad*identifier
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Lexical error at line 1, column 4. Encountered: "*" (42), after : ""
+
+# scoped names
+Expression: $page:abc
+Parses to: page:abc
+Expression: $session:def
+Parses to: session:def
+Expression: $request:ghi
+Parses to: request:ghi
+Expression: $app:jkl
+Parses to: app:jkl
+Expression: $unknown:abc
+Causes an error: org.apache.taglibs.standard.lang.spel.SpelException: Unable to parse the expression: Encountered "unknown :" at line 1, column 1.
+Was expecting one of:
+ "page" ...
+ "request" ...
+ "session" ...
+ "app" ...
+ "header" ...
+ "param" ...
+ "paramvalues" ...
+ ":" ...
+ <IDENTIFIER> "." ...
+ <IDENTIFIER> "==" ...
+ <IDENTIFIER> "!=" ...
+ <IDENTIFIER> "<" ...
+ <IDENTIFIER> ">" ...
+ <IDENTIFIER> "<=" ...
+ <IDENTIFIER> ">=" ...
+ <IDENTIFIER> <EOF>
+
+Expression: $page:"my long name"
+Parses to: page:"my long name"
+Expression: $page:'quotedName'
+Parses to: page:quotedName
+Expression: $session:'Name-With@@@special !@# chars'
+Parses to: session:"Name-With@@@special !@# chars"
+Expression: $:abc
+Parses to: :abc
+Expression: $:"something else"
+Parses to: :"something else"
+Expression: $:'def'
+Parses to: :def
+
+# property expressions
+Expression: $a.b
+Parses to: :a.b
+Expression: $a.b.c.d.e.f.g.h
+Parses to: :a.b.c.d.e.f.g.h
+Expression: $page:a.b.c.d.e
+Parses to: page:a.b.c.d.e
+Expression: $page:a."bbb".c.'###"def'
+Parses to: page:a.bbb.c."###\"def"
+
+# relational expressions
+Expression: $a < b
+Parses to: :a < :b
+Expression: $c == 3
+Parses to: :c == 3
+Expression: $d == "my string"
+Parses to: :d == "my string"
+Expression: $e > -17
+Parses to: :e > -17
+Expression: $f <= a.b.c.d
+Parses to: :f <= :a.b.c.d
+Expression: $g >= asdfd
+Parses to: :g >= :asdfd
+Expression: $h != null
+Parses to: :h != null
+Expression: $i != true
+Parses to: :i != true
+
+# header, param, paramvalues expressions
+Expression: $header:sessionCcontext
+Parses to: header:sessionCcontext
+Expression: $param:'a-parameter'
+Parses to: param:"a-parameter"
+Expression: $paramvalues:morevalues
+Parses to: paramvalues:morevalues
+
+# complex expressions
+Expression: $a.b.c.def <= page:no.time.like.the.present
+Parses to: :a.b.c.def <= page:no.time.like.the.present
+Expression: $14 != param:so.small
+Parses to: 14 != param:so.small
diff --git a/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java b/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java
new file mode 100644
index 0000000..834f515
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java
@@ -0,0 +1,101 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.support;
+
+import javax.servlet.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>The interface for an expression-language validator and evaluator.
+ * Classes that implement an expression language expose their functionality
+ * via this interface.</p>
+ *
+ * <p>The validate() and evaluate() methods must be thread-safe. That is,
+ * multiple threads may call these methods on the same ExpressionEvaluator
+ * object simultaneously. Implementations should synchronize access if
+ * they depend on transient state. Implementations should not, however,
+ * assume that only one object of each ExpressionEvaluator type will be
+ * instantiated; global caching should therefore be static. No release()
+ * mechanism or robust lifecycle is specified, for language-interpreter
+ * pluggability is experimental in EA2.</p>
+ *
+ * <p><b>WARNING</b>: This class supports experimentation for the EA2
+ * release of JSTL; it is not expected to be part of the final RI or
+ * specification.</p>
+ *
+ * @author Shawn Bayern (based exactly on rev1 draft)
+ */
+public interface ExpressionEvaluator {
+
+ /**
+ * Translation time validation of an expression.
+ * This method will return a null String if the expression
+ * is valid; otherwise an error message.
+ */
+ public String validate(String attributeName,
+ String expression);
+
+ /**
+ * Evaluates the expression at request time.
+ */
+ public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException;
+}
diff --git a/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java b/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java
new file mode 100644
index 0000000..2428451
--- /dev/null
+++ b/src/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java
@@ -0,0 +1,243 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.lang.support;
+
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>An implementation of the ExpressionEvaluatorManager called for by
+ * the JSTL rev1 draft. This class is responsible for delegating a
+ * request for expression evaluating to the particular, "active"
+ * ExpressionEvaluator for the given point in the PageContext object
+ * passed in.</p>
+ *
+ * <p><b>WARNING</b>: This class supports experimentation for the EA2
+ * release of JSTL; it is not expected to be part of the final RI or
+ * specification.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class ExpressionEvaluatorManager {
+
+ //*********************************************************************
+ // Implementation overview
+
+ /*
+ * We use a simple static table that indexes the currently active
+ * ExpressionEvaluator (EE) by a PageContext object. Our strategy
+ * is straightforward: we keep a java.util.Stack of
+ * ExpressionEvaluator objects for each PageContext, and if the
+ * stack is empty, we use the context parameter called for by the
+ * spec.
+ */
+
+ //*********************************************************************
+ // Constants
+
+ private static final String EVALUATOR_PARAMETER =
+ "javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass";
+ private static final String DEFAULT_EVALUATOR_CLASS =
+ "org.apache.taglibs.standard.lang.javascript.JavascriptExpressionEvaluator";
+
+ //*********************************************************************
+ // Internal, static state
+
+ /** The static table */
+ private static HashMap eeTab = new HashMap();
+
+ /** A separate static table to avoid unnecessary duplication of objects */
+ private static HashMap nameMap = new HashMap();
+
+
+ //*********************************************************************
+ // Public static methods
+
+ /**
+ * Establishes the given ExpressionEvaluator as the "active" evaluator,
+ * preserving the stack of formerly actiev evaluators underneath it.
+ */
+ public static synchronized void pushEvaluator(
+ PageContext pageContext,
+ String expressionEvaluatorName)
+ throws JspException {
+
+ // we'll use these throughout...
+ Stack s;
+ ExpressionEvaluator e;
+
+ // create a Stack if one doesn't exist for our page
+ Object oStack = eeTab.get(pageContext);
+ if (oStack == null) {
+ s = new Stack();
+ eeTab.put(pageContext, s);
+ } else
+ s = (Stack) oStack;
+
+ // "install" the evaluator
+ e = getEvaluatorByName(expressionEvaluatorName);
+ s.push(e);
+ }
+
+
+ /**
+ * Retires the most recent ExpressionEvaluator from "activity," restoring
+ * the one immediately preceding it on the stack.
+ */
+ public static synchronized void popEvaluator(PageContext pageContext) {
+
+ // sanity check
+ Object oStack = eeTab.get(pageContext);
+ if (oStack == null) {
+ throw new IllegalStateException("popEvaluator() called " +
+ "on empty stack");
+ }
+
+ // remove the most recent evaluator
+ Stack s = (Stack) oStack;
+ s.pop();
+
+ // if there are none left, forget about the stack
+ if (s.empty())
+ eeTab.remove(pageContext);
+ }
+
+
+ /**
+ * Invokes the evaluate() method on the "active" ExpressionEvaluator
+ * for the given pageContext.
+ */
+ public static Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException
+ {
+
+ // the evaluator we'll use
+ ExpressionEvaluator target;
+
+ // figure out what evaluator to use, under a static lock
+ synchronized (ExpressionEvaluatorManager.class) {
+ Object oStack = eeTab.get(pageContext);
+ if (oStack == null || ((Stack) oStack).empty()) {
+ String name = pageContext.getServletContext().
+ getInitParameter(EVALUATOR_PARAMETER);
+ if (name == null) {
+ target = getEvaluatorByName(DEFAULT_EVALUATOR_CLASS);
+ //throw new JspException("request to evaluate " +
+ // "expression but no expression language defined " +
+ // "(expression: '" + expression + "'; " +
+ // "attribute name: '" + attributeName + "')");
+ if (target == null)
+ throw new JspException(
+ "error loading default evaluator");
+ } else
+ target = getEvaluatorByName(name);
+ } else {
+ Stack s = (Stack) oStack;
+ target = (ExpressionEvaluator) s.peek();
+ }
+ }
+
+ // delegate the call
+ return (target.evaluate(
+ attributeName, expression, expectedType, tag, pageContext));
+ }
+
+
+ //*********************************************************************
+ // Public static utility method (un-spec'd, local to RI)
+
+ /**
+ * Gets an ExpressionEvaluator from the cache, or seeds the cache
+ * if we haven't seen a particular ExpressionEvaluator before.
+ */
+ public static synchronized
+ ExpressionEvaluator getEvaluatorByName(String name)
+ throws JspException {
+ try {
+
+ Object oEvaluator = nameMap.get(name);
+ if (oEvaluator == null) {
+ ExpressionEvaluator e = (ExpressionEvaluator)
+ Class.forName(name).newInstance();
+ nameMap.put(name, e);
+ return (e);
+ } else
+ return ((ExpressionEvaluator) oEvaluator);
+
+ } catch (ClassCastException ex) {
+ // just to display a better error message
+ throw new JspException("invalid ExpressionEvaluator: " +
+ ex.getMessage());
+ } catch (ClassNotFoundException ex) {
+ throw new JspException("couldn't find ExpressionEvaluator: " +
+ ex.getMessage());
+ } catch (IllegalAccessException ex) {
+ throw new JspException("couldn't access ExpressionEvaluator: " +
+ ex.getMessage());
+ } catch (InstantiationException ex) {
+ throw new JspException(
+ "couldn't instantiate ExpressionEvaluator: " +
+ ex.getMessage());
+ }
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/resources/Resources.java b/src/org/apache/taglibs/standard/resources/Resources.java
new file mode 100644
index 0000000..c3140e5
--- /dev/null
+++ b/src/org/apache/taglibs/standard/resources/Resources.java
@@ -0,0 +1,164 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.resources;
+
+import java.util.*;
+import java.text.*;
+
+/**
+ * <p>Provides locale-neutral access to string resources. Only the
+ * documentation and code are in English. :-)
+ *
+ * <p>The major goal, aside from globalization, is convenience.
+ * Access to resources with no parameters is made in the form:</p>
+ * <pre>
+ * Resources.getMessage(MESSAGE_NAME);
+ * </pre>
+ *
+ * <p>Access to resources with one parameter works like</p>
+ * <pre>
+ * Resources.getMessage(MESSAGE_NAME, arg1);
+ * </pre>
+ *
+ * <p>... and so on.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class Resources {
+
+ //*********************************************************************
+ // Static data
+
+ /** The location of our resources. */
+ private static final String RESOURCE_LOCATION
+ = "org.apache.taglibs.standard.resources.Resources";
+
+ /** Our class-wide ResourceBundle. */
+ private static ResourceBundle rb =
+ ResourceBundle.getBundle(RESOURCE_LOCATION);
+
+
+ //*********************************************************************
+ // Public static methods
+
+ /** Retrieves a message with no arguments. */
+ public static String getMessage(String name)
+ throws MissingResourceException {
+ return rb.getString(name);
+ }
+
+ /** Retrieves a message with arbitrarily many arguments. */
+ public static String getMessage(String name, Object[] a)
+ throws MissingResourceException {
+ String res = rb.getString(name);
+ return MessageFormat.format(res, a);
+ }
+
+ /** Retrieves a message with one argument. */
+ public static String getMessage(String name, Object a1)
+ throws MissingResourceException {
+ return getMessage(name, new Object[] { a1 });
+ }
+
+ /** Retrieves a message with two arguments. */
+ public static String getMessage(String name, Object a1, Object a2)
+ throws MissingResourceException {
+ return getMessage(name, new Object[] { a1, a2 });
+ }
+
+ /** Retrieves a message with three arguments. */
+ public static String getMessage(String name,
+ Object a1,
+ Object a2,
+ Object a3)
+ throws MissingResourceException {
+ return getMessage(name, new Object[] { a1, a2, a3 });
+ }
+
+ /** Retrieves a message with four arguments. */
+ public static String getMessage(String name,
+ Object a1,
+ Object a2,
+ Object a3,
+ Object a4)
+ throws MissingResourceException {
+ return getMessage(name, new Object[] { a1, a2, a3, a4 });
+ }
+
+ /** Retrieves a message with five arguments. */
+ public static String getMessage(String name,
+ Object a1,
+ Object a2,
+ Object a3,
+ Object a4,
+ Object a5)
+ throws MissingResourceException {
+ return getMessage(name, new Object[] { a1, a2, a3, a4, a5 });
+ }
+
+ /** Retrieves a message with six arguments. */
+ public static String getMessage(String name,
+ Object a1,
+ Object a2,
+ Object a3,
+ Object a4,
+ Object a5,
+ Object a6)
+ throws MissingResourceException {
+ return getMessage(name, new Object[] { a1, a2, a3, a4, a5, a6 });
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/resources/Resources.properties b/src/org/apache/taglibs/standard/resources/Resources.properties
new file mode 100644
index 0000000..948a7ba
--- /dev/null
+++ b/src/org/apache/taglibs/standard/resources/Resources.properties
@@ -0,0 +1,153 @@
+#########################################################################
+# Conventions:
+# - For error messages from particular tags, the resource should
+# - (a) have a name beginning with TAGNAME_
+# - (b) contain the name of the tag within the message
+# - Generic tag messages -- i.e., those used in more than one tag --
+# should begin with TAG_
+# - Errors for TagLibraryValidators should begin with TLV_
+#########################################################################
+
+
+#########################################################################
+# Generic tag error messages
+#########################################################################
+
+TAG_NULL_ATTRIBUTE=\
+ The "{0}" attribute illegally evaluated to "null" in <{1}>
+
+#########################################################################
+# Specific tag error messages
+#########################################################################
+
+# CORE
+
+CHOOSE_EXCLUSIVITY=\
+ Only one <choose> subtag may evaluate its body
+
+EXPR_BAD_VALUE=\
+ In <expr>, attribute value="{0}" didn't evaluate successfully, \
+ but there was no "default" attribute and no non-whitespace content \
+ for the tag.
+
+FOREACH_STEP_NO_RESULTSET=\
+ Step cannot be > 1 when iterating over a ResultSet with <forEach>
+
+FOREACH_BAD_ITEMS=\
+ Don't know how to iterate over supplied "items" in <forEach>
+
+IMPORT_BAD_RELATIVE=\
+ In <import>, when "context" attribute is specified, \
+ values of both "context" and "url" must start with "/"
+
+IMPORT_REL_WITHOUT_HTTP=\
+ Relative <import> from non-HTTP request not allowed
+
+IMPORT_IO=\
+ I/O error in <import> occurred reading "{0}"
+
+IMPORT_ILLEGAL_STREAM=\
+ Unexpected internal error during <import>: \
+ Target servlet called getWriter(), then getOutputStream()
+
+IMPORT_ILLEGAL_WRITER=\
+ Unexpected internal error during <import>: \
+ Target servlet called getOutputStream(), then getWriter()
+
+IMPORT_ILLEGAL_GETSTRING=\
+ Unexpected internal error during <import>: \
+ Target servlet called neither getOutputStream() nor getWriter()
+
+PARAM_OUTSIDE_IMPORT=\
+ <param> outside <import>
+
+PARAM_ENCODE_BOOLEAN=\
+ In <param>, "encode" must be "true" or "false". Got "{0}" instead.
+
+SET_BAD_SCOPE=\
+ Invalid "scope" attribute for <set>: "{0}"
+
+SET_NO_VALUE=\
+ Need either non-whitespace body or "value" attribute in <set>
+
+URLENCODE_NO_VALUE=\
+ Need either non-whitespace body or "value" attribute in <urlEncode>
+
+WHEN_OUTSIDE_CHOOSE=\
+ Illegal use of <when>-style tag without <choose> as its \
+ direct parent
+
+# I18N
+
+LOCALE_NO_LANGUAGE=\
+ Missing language component in "value" attribute in <locale>
+
+LOCALE_EMPTY_COUNTRY=\
+ Empty country component in "value" attribute in <locale>
+
+MESSAGEARG_OUTSIDE_MESSAGE=\
+ <messageArg> outside <message> and <messageFormat>
+
+MESSAGEARG_NO_VALUE=\
+ <messageArg> must have "value" attribute or body
+
+UNDEFINED_KEY=\
+ Undefined key "{0}" in resource bundle "{1}"
+
+MISSING_RESOURCE_BUNDLE=\
+ Resource bundle with base name "{0}" not found
+
+EXCEPTION_STACKTRACE_BOOLEAN=\
+ In <exception>, "stacktrace" must be "true" or "false". Got "{0}" instead.
+
+EXCEPTION_NOT_IN_ERROR_PAGE=\
+ <exception> not in error page
+
+# XML
+
+PARAM_NO_VALUE=\
+ <param> needs 'value' attribute or non-whitespace body
+
+PARAM_OUTSIDE_TRANSFORM=\
+ <param> outside <transform>
+
+PARSE_INVALID_SOURCE=\
+ Unrecognized object supplied as 'source' attribute to <parse>
+
+PARSE_NO_SAXTRANSFORMER=\
+ Filter supplied to <parse>, but default TransformerFactory \
+ does not support SAX.
+
+
+#########################################################################
+# JSTL core TLV messages
+#########################################################################
+
+# Parameters
+
+TLV_PARAMETER_ERROR=\
+ Invalid value for {0} validator parameter in TLD
+
+
+# Generic errors
+
+TLV_ILLEGAL_BODY=\
+ Encountered illegal body of <{0}> tag, given its attributes.
+
+TLV_MISSING_BODY=\
+ A body is necessary inside the <{0}> tag, given its attributes.
+
+TLV_ILLEGAL_CHILD_TAG=\
+ Illegal child tag in <{0}:{1}>: <{2}>.
+
+TLV_ILLEGAL_TEXT_BODY=\
+ Illegal text inside <{0}:{1}>: "{2}...".
+
+
+# Errors customized to particular tags (sort of) :-)
+
+TLV_ILLEGAL_ORDER=\
+ Illegal <{0}> after <{1}:{2}> in <{1}:{3}>.
+
+TLV_ILLEGAL_PARAM=\
+ Illegal <{0}:{1}> tag within <{0}:{2} {3}="...">.
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
new file mode 100644
index 0000000..637e621
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java
@@ -0,0 +1,342 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import javax.servlet.ServletContext;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <bundle>, the resource bundle
+ * loading tag in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class BundleSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Public constants
+
+ public static final String DEFAULT_BASENAME =
+ "javax.servlet.jsp.jsptl.i18n.basename";
+
+
+ //*********************************************************************
+ // Package-scoped constants
+
+ static final String DEFAULT_EXCEPTION_BASENAME =
+ "javax.servlet.jsp.jsptl.i18n.exception.basename";
+
+
+ //*********************************************************************
+ // Private constants
+
+ private static final String FALLBACK_LOCALE =
+ "javax.servlet.jsp.jsptl.i18n.fallbackLocale";
+
+
+ //*********************************************************************
+ // Protected state
+
+ protected String basename; // 'basename' attribute
+ protected String prefix; // 'prefix' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private static ResourceBundle emptyResourceBundle;
+
+ private int scope; // 'scope' attribute
+ private String var; // 'var' attribute
+ private Locale fallbackLocale;
+ private ResourceBundle bundle;
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ static {
+ emptyResourceBundle = new ListResourceBundle() {
+ public Object[][] getContents() {
+ return new Object[][] { { "", "" } };
+ }
+ };
+ }
+
+ public BundleSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ basename = prefix = var = null;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Collaboration with subtags
+
+ public ResourceBundle getBundle() {
+ return bundle;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doStartTag() throws JspException {
+ bundle = getBundle(pageContext, basename);
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ if (var != null) {
+ if (bundle != null)
+ pageContext.setAttribute(var, bundle, scope);
+ else
+ pageContext.setAttribute(var, emptyResourceBundle, scope);
+ } else if (getBodyContent() == null) {
+ /*
+ * If no 'var' attribute and no body, we store our base name
+ * in the javax.servlet.jsp.jsptl.i18n.basename scoped attribute
+ */
+ pageContext.setAttribute(DEFAULT_BASENAME, basename, scope);
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+
+
+ //*********************************************************************
+ // Public utility methods
+
+ /**
+ * Gets the resource bundle with the given base name.
+ *
+ * <p> The resource bundle's locale is determined as follows:
+ *
+ * <ul>
+ * <li> If the <tt>javax.servlet.jsp.jsptl.i18n.locale</tt> scoped
+ * attribute exists, use the locale stored as its value.
+ *
+ * <li> Otherwise, compare the client's preferred locales (in order of
+ * preference) against the available locales for the given base name, and
+ * use the best matching locale.
+ *
+ * <li> If no match is found, use the fallback locale given by the
+ * <tt>javax.servlet.jsp.jsptl.i18n.fallbackLocale</tt> scoped attribute,
+ * if it exists.
+ *
+ * <li> Otherwise, use the runtime's default locale.
+ * </ul>
+ *
+ * @param pageContext the page in which the resource bundle with the
+ * given base name is requested
+ * @param basename the resource bundle's base name
+ *
+ * @return the resource bundle with the given base name, or <tt>null</tt>
+ * if no such resource bundle exists
+ */
+ public static ResourceBundle getBundle(PageContext pageContext,
+ String basename) {
+ Locale loc = null;
+ ResourceBundle ret = null;
+
+ try {
+ loc = (Locale)
+ pageContext.findAttribute(LocaleSupport.LOCALE_ATTRIBUTE);
+ if (loc != null) {
+ ret = ResourceBundle.getBundle(basename, loc);
+ } else {
+ // use best matching client locale
+ ret = getBestMatch(pageContext, basename);
+ if (ret == null) {
+ // use fallback locale
+ String fallback = (String)
+ pageContext.findAttribute(FALLBACK_LOCALE);
+ if (fallback == null)
+ fallback = pageContext.getServletContext().
+ getInitParameter(FALLBACK_LOCALE);
+ if (fallback != null) {
+ loc = LocaleSupport.parseLocale(fallback, null);
+ ret = ResourceBundle.getBundle(basename, loc);
+ } else {
+ // use runtime's default locale
+ ret = ResourceBundle.getBundle(basename);
+ }
+ }
+ }
+ } catch (MissingResourceException mre) {
+ ServletContext sc = pageContext.getServletContext();
+ sc.log(Resources.getMessage("MISSING_RESOURCE_BUNDLE", basename));
+ }
+
+ return ret;
+ }
+
+ /**
+ * Gets the resource bundle whose base name is determined from the scoped
+ * attribute or initialization parameter with the given name.
+ *
+ * @param pageContext the page in which the resource bundle is requested
+ * @name the name of the scoped attribute or initialization parameter
+ *
+ * @return the requested resource bundle, or <tt>null</tt>
+ * if the scoped attribute or initialization parameter with the given name
+ * does not exist, or the requested resource bundle does not exist
+ */
+ public static ResourceBundle getDefaultBundle(PageContext pageContext,
+ String name) {
+
+ ResourceBundle ret = null;
+
+ String defaultBasename = (String) pageContext.findAttribute(name);
+ if (defaultBasename == null)
+ defaultBasename =
+ pageContext.getServletContext().getInitParameter(name);
+ if (defaultBasename != null)
+ ret = getBundle(pageContext, defaultBasename);
+
+ return ret;
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ /*
+ * Compares the client's preferred locales (in order of preference) against
+ * the available locales for the resource bundle with the given base name,
+ * and returns the resource bundle for the best matching locale.
+ *
+ * <p> The best matching locale is a client's preferred locale that matches
+ * both the language and country components of an available locale for the
+ * given base name. This is considered an exact match.
+ *
+ * <p> If no exact match exists, the first client locale that matches
+ * (just) the language component of an available locale is used.
+ *
+ * <p> If still no match is found, <tt>null</tt> is returned.
+ *
+ * @param pageContext the page in which the resource bundle with the
+ * given base name is requested
+ * @param basename the resource bundle's base name
+ *
+ * @return the resource bundle with the given base name and best matching
+ * (browser-based) locale, or <tt>null</tt> if no match was found
+ *
+ * @throws MissingResourceException if no resource bundle with the given
+ * base name exists
+ */
+ private static ResourceBundle getBestMatch(PageContext pageContext,
+ String basename)
+ throws MissingResourceException {
+
+ ResourceBundle ret = null;
+
+ // Determine locale from client's browser settings.
+ for (Enumeration enum = pageContext.getRequest().getLocales();
+ enum.hasMoreElements(); ) {
+ /*
+ * If client request doesn't provide an Accept-Language header,
+ * the returned Enumeration contains the runtime's default locale.
+ */
+ Locale pref = (Locale) enum.nextElement();
+ ResourceBundle bundle = ResourceBundle.getBundle(basename, pref);
+ Locale avail = bundle.getLocale();
+ if (avail.getLanguage().equals(pref.getLanguage())) {
+ if (avail.getCountry().equals(pref.getCountry())) {
+ // exact match
+ ret = bundle;
+ break;
+ } else {
+ if (ret == null) {
+ ret = bundle;
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/ExceptionSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/ExceptionSupport.java
new file mode 100644
index 0000000..ac6654a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/ExceptionSupport.java
@@ -0,0 +1,161 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import java.text.*;
+import java.io.*;
+import javax.servlet.ServletContext;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.fmt.LocalizableException;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <exception>, the exception formatting tag
+ * in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class ExceptionSupport extends TagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected Exception value; // 'value' attribute
+ protected ResourceBundle bundle; // 'bundle' attribute
+ protected boolean stackTrace; // 'stackTrace' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public ExceptionSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ value = null;
+ bundle = null;
+ stackTrace = false;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doStartTag() throws JspException {
+ Object[] messageArgs = null;
+
+ if (value == null) {
+ value = pageContext.getException();
+ if (value == null)
+ throw new JspTagException(
+ Resources.getMessage("EXCEPTION_NOT_IN_ERROR_PAGE"));
+ }
+
+ if (bundle == null) {
+ Tag t = findAncestorWithClass(this, BundleSupport.class);
+ if (t != null) {
+ // use resource bundle from parent <bundle> tag
+ BundleSupport parent = (BundleSupport) t;
+ bundle = parent.getBundle();
+ } else {
+ bundle = BundleSupport.getDefaultBundle(
+ pageContext, BundleSupport.DEFAULT_EXCEPTION_BASENAME);
+ }
+ }
+
+ String key = value.getClass().getName();
+ if (value instanceof LocalizableException) {
+ LocalizableException le = (LocalizableException) value;
+ if (le.getMessageKey() != null)
+ key = le.getMessageKey();
+ messageArgs = le.getMessageArgs();
+ }
+
+ String message = value.getLocalizedMessage();
+ if (bundle != null) {
+ try {
+ message = bundle.getString(key);
+ if (messageArgs != null) {
+ MessageFormat formatter = new MessageFormat("");
+ formatter.setLocale(bundle.getLocale());
+ formatter.applyPattern(message);
+ message = formatter.format(messageArgs);
+ }
+ } catch (MissingResourceException mre) {
+ }
+ }
+
+ try {
+ pageContext.getOut().print(message);
+ if (stackTrace)
+ value.printStackTrace(new PrintWriter(pageContext.getOut()));
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+
+ return SKIP_BODY;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java
new file mode 100644
index 0000000..3521fd3
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java
@@ -0,0 +1,272 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import java.text.*;
+import java.io.IOException;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <formatDate>, the date and time
+ * formatting tag in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class FormatDateSupport extends TagSupport {
+
+ //*********************************************************************
+ // Public constants
+
+ public static final String DATE_STRING = "date";
+ public static final String TIME_STRING = "time";
+ public static final String DATETIME_STRING = "both";
+
+ public static final String DEFAULT_STYLE = "default";
+ public static final String SHORT_STYLE = "short";
+ public static final String MEDIUM_STYLE = "medium";
+ public static final String LONG_STYLE = "long";
+ public static final String FULL_STYLE = "full";
+
+
+ //*********************************************************************
+ // Package-scoped constants
+
+ static final int DATE_TYPE = 0;
+ static final int TIME_TYPE = 1;
+ static final int DATETIME_TYPE = 2;
+
+
+ //*********************************************************************
+ // Protected state
+
+ protected Object value; // 'value' attribute
+ protected String pattern; // 'pattern' attribute
+ protected TimeZone timeZone; // 'timeZone' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private int type; // 'type' attribute
+ private int dateStyle; // 'dateStyle' attribute
+ private int timeStyle; // 'timeStyle' attribute
+ private String var; // 'var' attribute
+ private int scope; // 'scope' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public FormatDateSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ pattern = var = null;
+ value = null;
+ timeZone = null;
+ type = DATE_TYPE;
+ dateStyle = timeStyle = DateFormat.DEFAULT;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setType(String type) {
+ if (TIME_STRING.equalsIgnoreCase(type))
+ this.type = TIME_TYPE;
+ else if (DATETIME_STRING.equalsIgnoreCase(type))
+ this.type = DATETIME_TYPE;
+ }
+
+ public void setDateStyle(String dateStyle) {
+ this.dateStyle = getStyle(dateStyle);
+ }
+
+ public void setTimeStyle(String timeStyle) {
+ this.timeStyle = getStyle(timeStyle);
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ /*
+ * Formats the given date and time.
+ */
+ public int doEndTag() throws JspException {
+ DateFormat formatter = null;
+
+ Locale locale = LocaleSupport.getFormattingLocale(
+ pageContext,
+ this,
+ DateFormat.getAvailableLocales());
+
+ /*
+ * If no date or time is given, the current date and time are used.
+ * If the date and/or time is given as a string literal, it is first
+ * parsed into an instance of java.util.Date according to the default
+ * pattern of the page's locale.
+ */
+ if (value == null) {
+ value = new Date();
+ } else if (value instanceof String) {
+ formatter = DateFormat.getDateInstance(dateStyle, locale);
+ try {
+ value = formatter.parse((String) value);
+ } catch (ParseException pe) {
+ throw new JspTagException(pe.getMessage());
+ }
+ }
+
+ switch (type) {
+ case DATE_TYPE:
+ if (formatter == null)
+ formatter = DateFormat.getDateInstance(dateStyle, locale);
+ break;
+ case TIME_TYPE:
+ formatter = DateFormat.getTimeInstance(timeStyle, locale);
+ break;
+ case DATETIME_TYPE:
+ formatter = DateFormat.getDateTimeInstance(dateStyle, timeStyle,
+ locale);
+ break;
+ } // switch
+
+ if (pattern != null) {
+ try {
+ ((SimpleDateFormat) formatter).applyPattern(pattern);
+ } catch (ClassCastException cce) {
+ formatter = new SimpleDateFormat(pattern, locale);
+ }
+ }
+
+ if (timeZone == null) {
+ Tag t = findAncestorWithClass(this, TimeZoneSupport.class);
+ if (t != null) {
+ // use time zone from parent <timeZone> tag
+ TimeZoneSupport parent = (TimeZoneSupport) t;
+ timeZone = parent.getTimeZone();
+ } else {
+ // get time zone from scoped attribute
+ timeZone = (TimeZone) pageContext.findAttribute(
+ TimeZoneSupport.TIMEZONE_ATTRIBUTE);
+ if (timeZone == null) {
+ String tz =
+ pageContext.getServletContext().getInitParameter(
+ TimeZoneSupport.TIMEZONE_ATTRIBUTE);
+ if (tz != null)
+ timeZone = TimeZone.getTimeZone(tz);
+ }
+ }
+ }
+ if (timeZone != null)
+ formatter.setTimeZone(timeZone);
+
+ String formatted = formatter.format(value);
+ if (var != null) {
+ pageContext.setAttribute(var, formatted, scope);
+ } else {
+ try {
+ pageContext.getOut().print(formatted);
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ private int getStyle(String style) {
+ int ret = DateFormat.DEFAULT;
+
+ if (SHORT_STYLE.equalsIgnoreCase(style))
+ ret = DateFormat.SHORT;
+ else if (MEDIUM_STYLE.equalsIgnoreCase(style))
+ ret = DateFormat.MEDIUM;
+ else if (LONG_STYLE.equalsIgnoreCase(style))
+ ret = DateFormat.LONG;
+ else if (FULL_STYLE.equalsIgnoreCase(style))
+ ret = DateFormat.FULL;
+
+ return ret;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java
new file mode 100644
index 0000000..f8bd0f1
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java
@@ -0,0 +1,201 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import java.text.*;
+import java.io.IOException;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <formatNumber>, the number
+ * formatting tag in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class FormatNumberSupport extends TagSupport {
+
+ //*********************************************************************
+ // Public constants
+
+ public static final String NUMBER_STRING = "number";
+ public static final String CURRENCY_STRING = "currency";
+ public static final String PERCENT_STRING = "percent";
+
+
+ //*********************************************************************
+ // Package-scoped constants
+
+ static final int NUMBER_TYPE = 0;
+ static final int CURRENCY_TYPE = 1;
+ static final int PERCENT_TYPE = 2;
+
+
+ //*********************************************************************
+ // Protected state
+
+ protected Object value; // 'value' attribute
+ protected String pattern; // 'pattern' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private int type; // 'type' attribute
+ private String var; // 'var' attribute
+ private int scope; // 'scope' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public FormatNumberSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ pattern = var = null;
+ value = null;
+ type = NUMBER_TYPE;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setType(String type) {
+ if (CURRENCY_STRING.equalsIgnoreCase(type))
+ this.type = CURRENCY_TYPE;
+ else if (PERCENT_STRING.equalsIgnoreCase(type))
+ this.type = PERCENT_TYPE;
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doEndTag() throws JspException {
+ NumberFormat formatter = null;
+
+ Locale locale = LocaleSupport.getFormattingLocale(
+ pageContext,
+ this,
+ NumberFormat.getAvailableLocales());
+
+ /*
+ * If the value given is a string literal, it is first parsed into an
+ * instance of java.lang.Number according to the default pattern of
+ * the page's locale.
+ */
+ if (value instanceof String) {
+ formatter = NumberFormat.getNumberInstance(locale);
+ try {
+ value = formatter.parse((String) value);
+ } catch (ParseException pe) {
+ throw new JspTagException(pe.getMessage());
+ }
+ }
+
+ switch (type) {
+ case NUMBER_TYPE:
+ if (formatter == null)
+ formatter = NumberFormat.getNumberInstance(locale);
+ if (pattern != null) {
+ DecimalFormat df = (DecimalFormat) formatter;
+ df.applyPattern(pattern);
+ }
+ break;
+ case CURRENCY_TYPE:
+ formatter = NumberFormat.getCurrencyInstance(locale);
+ break;
+ case PERCENT_TYPE:
+ formatter = NumberFormat.getPercentInstance(locale);
+ break;
+ } // switch
+
+ String formatted = formatter.format(value);
+ if (var != null) {
+ pageContext.setAttribute(var, formatted, scope);
+ } else {
+ try {
+ pageContext.getOut().print(formatted);
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java
new file mode 100644
index 0000000..df5611f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java
@@ -0,0 +1,296 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <locale>, the locale setting tag in
+ * JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class LocaleSupport extends TagSupport {
+
+ //*********************************************************************
+ // Package-scoped constants
+
+ static final String LOCALE_ATTRIBUTE =
+ "javax.servlet.jsp.jsptl.i18n.locale";
+
+
+ //*********************************************************************
+ // Private constants
+
+ private static final char HYPHEN = '-';
+ private static final char UNDERSCORE = '_';
+
+
+ //*********************************************************************
+ // Protected state
+
+ protected String value; // 'value' attribute
+ protected String variant; // 'variant' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private int scope; // 'scope' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public LocaleSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ value = variant = null;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doEndTag() throws JspException {
+ pageContext.setAttribute(LOCALE_ATTRIBUTE, parseLocale(value, variant),
+ scope);
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+
+
+ //*********************************************************************
+ // Package-scoped utility methods
+
+ /*
+ * Determines the formatting locale to use with the given formatting
+ * action in the given page.
+ *
+ * <p> The formatting locale is determined as follows:
+ *
+ * <ul>
+ * <li> If the <tt>javax.servlet.jsp.jsptl.i18n.locale</tt> scoped
+ * attribute exists, use its locale.
+ *
+ * <li> If the formatting action is enclosed within a <bundle> action, use
+ * the locale of the parent bundle.
+ *
+ * <li> If the <tt>javax.servlet.jsp.jsptl.i18n.basename</tt> scoped
+ * attribute exists, retrieve the default base name from it and use the
+ * best matching locale for the resource bundle with this base name.
+ *
+ * <li> Compare the client's preferred locales (in order of preference)
+ * against the available formatting locales given in the
+ * <tt>avail</tt> parameter, and use the best matching locale.
+ *
+ * <li> If no match is found, use the runtime's default locale.
+ * </ul>
+ *
+ * @param pageContext the page containing the formatting action
+ * @param fromTag the formatting action
+ * @param avail the array of available locales
+ *
+ * @return the formatting locale to use
+ */
+ static Locale getFormattingLocale(PageContext pageContext,
+ Tag fromTag,
+ Locale[] avail) {
+
+ Locale ret = (Locale) pageContext.findAttribute(LOCALE_ATTRIBUTE);
+ if (ret == null) {
+ Tag t = findAncestorWithClass(fromTag, BundleSupport.class);
+ if (t != null) {
+ // use locale from parent <bundle> tag
+ BundleSupport parent = (BundleSupport) t;
+ ret = parent.getBundle().getLocale();
+ } else {
+ ResourceBundle bundle = BundleSupport.getDefaultBundle(
+ pageContext, BundleSupport.DEFAULT_BASENAME);
+ if (bundle != null) {
+ ret = bundle.getLocale();
+ } else {
+ ret = getBestMatch(pageContext, avail);
+ if (ret == null) {
+ // no match, use runtime's default locale
+ ret = Locale.getDefault();
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ /*
+ * Parses the given locale string into its language and (optionally)
+ * country components, and returns the corresponding
+ * <tt>java.util.Locale</tt> object.
+ *
+ * @param locale the locale string
+ * @param variant the variant
+ *
+ * @return the corresponding <tt>java.util.Locale</tt> object
+ *
+ * @throws IllegalArgumentException if the given locale does not have a
+ * language component or has an empty country component
+ */
+ static Locale parseLocale(String locale, String variant) {
+
+ Locale ret = null;
+ String language = locale;
+ String country = null;
+ int index = -1;
+
+ if (((index = locale.indexOf(HYPHEN)) > -1) ||
+ ((index = locale.indexOf(UNDERSCORE)) > -1)) {
+ language = locale.substring(0, index);
+ country = locale.substring(index+1);
+ }
+
+ if ((language == null) || (language.length() == 0))
+ throw new IllegalArgumentException(
+ Resources.getMessage("LOCALE_NO_LANGUAGE"));
+
+ if (country == null) {
+ if (variant != null)
+ ret = new Locale(language, "", variant);
+ else
+ ret = new Locale(language, "");
+ } else if (country.length() > 0) {
+ if (variant != null)
+ ret = new Locale(language, country, variant);
+ else
+ ret = new Locale(language, country);
+ } else
+ throw new IllegalArgumentException(
+ Resources.getMessage("LOCALE_EMPTY_COUNTRY"));
+
+ return ret;
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ /*
+ * Compares the client's preferred locales (in order of preference) against
+ * the available formatting locales, and returns the best matching locale.
+ *
+ * <p> The best matching locale is a client's preferred locale that matches
+ * both the language and country components of an available formatting
+ * locale. This is considered an exact match.
+ *
+ * <p> If no exact match exists, the first client locale that matches
+ * (just) the language component of an available locale is chosen.
+ *
+ * <p> If still no match is found, <tt>null</tt> is returned.
+ *
+ * @param pageContext the page in which the best matching formatting
+ * locale needs to be determined
+ * @param avail the available formatting locales
+ *
+ * @return the best matching formatting locale, or <tt>null</tt> if no
+ * match was found
+ */
+ private static Locale getBestMatch(PageContext pageContext,
+ Locale[] avail) {
+ Locale ret = null;
+
+ boolean foundExactMatch = false;
+ for (Enumeration enum = pageContext.getRequest().getLocales();
+ enum.hasMoreElements() && !foundExactMatch; ) {
+ Locale pref = (Locale) enum.nextElement();
+ for (int i=0; i<avail.length; i++) {
+ if (pref.getLanguage().equals(avail[i].getLanguage())) {
+ if (pref.getCountry().equals(avail[i].getCountry())) {
+ // exact match
+ ret = avail[i];
+ foundExactMatch = true;
+ break;
+ } else {
+ if (ret == null) {
+ ret = avail[i];
+ }
+ }
+ }
+ } // for
+ } // for
+
+ return ret;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/MessageArgSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/MessageArgSupport.java
new file mode 100644
index 0000000..d7830cc
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/MessageArgSupport.java
@@ -0,0 +1,124 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <messageArg>, the message argument
+ * subtag in JSTL 1.0 which supplies an argument for parametric replacement
+ * to its parent <message> or <messageFormat> tag.
+ *
+ * @see MessageSupport
+ * @author Jan Luehe
+ */
+
+public abstract class MessageArgSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected Object value; // 'value' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public MessageArgSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ value = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // Supply our value to our parent <message> or <messageFormat> tag
+ public int doEndTag() throws JspException {
+ Tag parent = findAncestorWithClass(this, MessageSupport.class);
+ if (parent == null) {
+ parent = findAncestorWithClass(this, MessageFormatSupport.class);
+ if (parent == null)
+ throw new JspTagException(
+ Resources.getMessage("MESSAGEARG_OUTSIDE_MESSAGE"));
+ }
+
+ // get argument from 'value' attribute or body, as appropriate
+ if (value == null)
+ value = getBodyContent().getString();
+ if (value == null)
+ throw new JspTagException(
+ Resources.getMessage("MESSAGEARG_NO_VALUE"));
+
+ if (parent instanceof MessageSupport)
+ ((MessageSupport) parent).addMessageArg(value);
+ else
+ ((MessageFormatSupport) parent).addMessageArg(value);
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/MessageFormatSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/MessageFormatSupport.java
new file mode 100644
index 0000000..476cb5a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/MessageFormatSupport.java
@@ -0,0 +1,159 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import java.text.*;
+import java.io.IOException;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <messageFormat>, the message
+ * formatting tag in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class MessageFormatSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected String value; // 'value' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private String var; // 'var' attribute
+ private int scope; // 'scope' attribute
+ private List arguments;
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public MessageFormatSupport() {
+ super();
+ arguments = new ArrayList();
+ init();
+ }
+
+ private void init() {
+ value = var = null;
+ scope = PageContext.PAGE_SCOPE;
+ arguments.clear();
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Collaboration with subtags
+
+ /**
+ * Adds an argument (for parametric replacement) to this tag's message.
+ *
+ * @see MessageArgSupport
+ */
+ public void addMessageArg(Object arg) {
+ arguments.add(arg);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doEndTag() throws JspException {
+ String message = value;
+
+ if (!arguments.isEmpty()) {
+ MessageFormat formatter = new MessageFormat("");
+ formatter.applyPattern(value);
+ message = formatter.format(arguments.toArray());
+ }
+
+ if (var != null) {
+ pageContext.setAttribute(var, message, scope);
+ } else {
+ try {
+ pageContext.getOut().print(message);
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java
new file mode 100644
index 0000000..ddc8015
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java
@@ -0,0 +1,198 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.*;
+import java.text.*;
+import java.io.IOException;
+import javax.servlet.ServletContext;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <message>, the message formatting tag
+ * in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class MessageSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Public constants
+
+ public static final String UNDEFINED_KEY = "???";
+
+
+ //*********************************************************************
+ // Protected state
+
+ protected String key; // 'key' attribute
+ protected ResourceBundle bundle; // 'bundle' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private String var; // 'var' attribute
+ private int scope; // 'scope' attribute
+ private List arguments;
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public MessageSupport() {
+ super();
+ arguments = new ArrayList();
+ init();
+ }
+
+ private void init() {
+ key = var = null;
+ bundle = null;
+ scope = PageContext.PAGE_SCOPE;
+ arguments.clear();
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Collaboration with subtags
+
+ /**
+ * Adds an argument (for parametric replacement) to this tag's message.
+ *
+ * @see MessageArgSupport
+ */
+ public void addMessageArg(Object arg) {
+ arguments.add(arg);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doEndTag() throws JspException {
+ String prefix = null;
+
+ if (bundle == null) {
+ Tag t = findAncestorWithClass(this, BundleSupport.class);
+ if (t != null) {
+ // use resource bundle from parent <bundle> tag
+ BundleSupport parent = (BundleSupport) t;
+ bundle = parent.getBundle();
+ prefix = parent.getPrefix();
+ } else {
+ bundle = BundleSupport.getDefaultBundle(
+ pageContext, BundleSupport.DEFAULT_BASENAME);
+ }
+ }
+
+ String message = null;
+ if (bundle == null) {
+ // error message already logged in BundleSupport.getBundle method
+ message = UNDEFINED_KEY + key + UNDEFINED_KEY;
+ } else {
+ try {
+ // prepend 'prefix' attribute from parent bundle
+ if (prefix != null)
+ key = prefix + key;
+ message = bundle.getString(key);
+ if (!arguments.isEmpty()) {
+ MessageFormat formatter = new MessageFormat("");
+ formatter.setLocale(bundle.getLocale());
+ formatter.applyPattern(message);
+ message = formatter.format(arguments.toArray());
+ }
+ } catch (MissingResourceException mre) {
+ ServletContext sc = pageContext.getServletContext();
+ sc.log(Resources.getMessage("UNDEFINED_KEY", key, bundle));
+ message = UNDEFINED_KEY + key + UNDEFINED_KEY;
+ }
+ }
+
+ if (var != null) {
+ pageContext.setAttribute(var, message, scope);
+ } else {
+ try {
+ pageContext.getOut().print(message);
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java
new file mode 100644
index 0000000..ff24afc
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java
@@ -0,0 +1,181 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <parseDate>, the date and time
+ * parsing tag in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class ParseDateSupport extends TagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected String value; // 'value' attribute
+ protected String pattern; // 'pattern' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private int type; // 'type' attribute
+ private String var; // 'var' attribute
+ private int scope; // 'scope' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public ParseDateSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ value = pattern = var = null;
+ type = FormatDateSupport.DATE_TYPE;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setType(String type) {
+ if (FormatDateSupport.TIME_STRING.equalsIgnoreCase(type))
+ this.type = FormatDateSupport.TIME_TYPE;
+ else if (FormatDateSupport.DATETIME_STRING.equalsIgnoreCase(type))
+ this.type = FormatDateSupport.DATETIME_TYPE;
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doEndTag() throws JspException {
+ DateFormat formatter = null;
+
+ Locale locale = LocaleSupport.getFormattingLocale(
+ pageContext,
+ this,
+ DateFormat.getAvailableLocales());
+
+ switch (type) {
+ case FormatDateSupport.DATE_TYPE:
+ formatter = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
+ break;
+ case FormatDateSupport.TIME_TYPE:
+ formatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, locale);
+ break;
+ case FormatDateSupport.DATETIME_TYPE:
+ formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
+ DateFormat.DEFAULT,
+ locale);
+ break;
+ } // switch
+
+ if (pattern != null) {
+ try {
+ ((SimpleDateFormat) formatter).applyPattern(pattern);
+ } catch (ClassCastException cce) {
+ formatter = new SimpleDateFormat(pattern, locale);
+ }
+ }
+
+ Date parsed = null;
+ try {
+ parsed = formatter.parse(value);
+ } catch (ParseException pe) {
+ throw new JspTagException(pe.getMessage());
+ }
+
+ if (var != null) {
+ pageContext.setAttribute(var, parsed, scope);
+ } else {
+ try {
+ pageContext.getOut().print(parsed);
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java
new file mode 100644
index 0000000..cffd2e0
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java
@@ -0,0 +1,175 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <parseNumber>, the number parsing tag
+ * in JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class ParseNumberSupport extends TagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected String value; // 'value' attribute
+ protected String pattern; // 'pattern' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private int type; // 'type' attribute
+ private String var; // 'var' attribute
+ private int scope; // 'scope' attribute
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public ParseNumberSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ value = pattern = var = null;
+ type = FormatNumberSupport.NUMBER_TYPE;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setType(String type) {
+ if (FormatNumberSupport.CURRENCY_STRING.equalsIgnoreCase(type))
+ this.type = FormatNumberSupport.CURRENCY_TYPE;
+ else if (FormatNumberSupport.PERCENT_STRING.equalsIgnoreCase(type))
+ this.type = FormatNumberSupport.PERCENT_TYPE;
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doEndTag() throws JspException {
+ NumberFormat formatter = null;
+
+ Locale locale = LocaleSupport.getFormattingLocale(
+ pageContext,
+ this,
+ NumberFormat.getAvailableLocales());
+
+ switch (type) {
+ case FormatNumberSupport.NUMBER_TYPE:
+ formatter = NumberFormat.getNumberInstance(locale);
+ if (pattern != null) {
+ DecimalFormat df = (DecimalFormat) formatter;
+ df.applyPattern(pattern);
+ }
+ break;
+ case FormatNumberSupport.CURRENCY_TYPE:
+ formatter = NumberFormat.getCurrencyInstance(locale);
+ break;
+ case FormatNumberSupport.PERCENT_TYPE:
+ formatter = NumberFormat.getPercentInstance(locale);
+ break;
+ } // switch
+
+ Number parsed = null;
+ try {
+ parsed = formatter.parse(value);
+ } catch (ParseException pe) {
+ throw new JspTagException(pe.getMessage());
+ }
+
+ if (var != null) {
+ pageContext.setAttribute(var, parsed, scope);
+ } else {
+ try {
+ pageContext.getOut().print(parsed);
+ } catch (IOException ioe) {
+ throw new JspTagException(ioe.getMessage());
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/fmt/TimeZoneSupport.java b/src/org/apache/taglibs/standard/tag/common/fmt/TimeZoneSupport.java
new file mode 100644
index 0000000..d6d3143
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/fmt/TimeZoneSupport.java
@@ -0,0 +1,154 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.fmt;
+
+import java.util.TimeZone;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.core.Util;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * Support for tag handlers for <timezone>, the timezone tag in
+ * JSTL 1.0.
+ *
+ * @author Jan Luehe
+ */
+
+public abstract class TimeZoneSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Package-scoped constants
+
+ static final String TIMEZONE_ATTRIBUTE =
+ "javax.servlet.jsp.jsptl.i18n.timeZone";
+
+
+ //*********************************************************************
+ // Protected state
+
+ protected String value; // 'value' attribute
+
+
+ //*********************************************************************
+ // Private state
+
+ private int scope; // 'scope' attribute
+ private String var; // 'var' attribute
+ private TimeZone timeZone;
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public TimeZoneSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ value = var = null;
+ scope = PageContext.PAGE_SCOPE;
+ }
+
+
+ //*********************************************************************
+ // Tag attributes known at translation time
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setScope(String scope) {
+ this.scope = Util.getScope(scope);
+ }
+
+
+ //*********************************************************************
+ // Collaboration with subtags
+
+ public TimeZone getTimeZone() {
+ return timeZone;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ public int doStartTag() throws JspException {
+ timeZone = TimeZone.getTimeZone(value);
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ if (var != null) {
+ pageContext.setAttribute(var, timeZone, scope);
+ } else if (getBodyContent() == null) {
+ /*
+ * If no 'var' attribute and no body, we store our time zone
+ * in the javax.servlet.jsp.jsptl.i18n.timeZone scoped attribute
+ */
+ pageContext.setAttribute(TIMEZONE_ATTRIBUTE, timeZone, scope);
+ }
+
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/ExprTag.java b/src/org/apache/taglibs/standard/tag/common/xml/ExprTag.java
new file mode 100644
index 0000000..6d0154d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/ExprTag.java
@@ -0,0 +1,123 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>Tag handler for <expr> in JSTL's XML library.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class ExprTag extends TagSupport {
+
+ //*********************************************************************
+ // Internal state
+
+ private String select; // tag attribute
+
+ //*********************************************************************
+ // Construction and initialization
+
+ /**
+ * Constructs a new handler. As with TagSupport, subclasses should
+ * not provide other constructors and are expected to call the
+ * superclass constructor.
+ */
+ public ExprTag() {
+ super();
+ init();
+ }
+
+ // resets local state
+ private void init() {
+ select = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // applies XPath expression from 'select' and prints the result
+ public int doStartTag() throws JspException {
+ try {
+ XPathUtil xu = new XPathUtil(pageContext);
+ String result = xu.valueOf(XPathUtil.getContext(this), select);
+ pageContext.getOut().print(result);
+ return SKIP_BODY;
+ } catch (java.io.IOException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (org.saxpath.SAXPathException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Attribute accessors
+
+ public void setSelect(String select) {
+ this.select = select;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java b/src/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java
new file mode 100644
index 0000000..46b5b8f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java
@@ -0,0 +1,150 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.jstl.core.IteratorTagSupport;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>Support for the XML library's <forEach> tag.</p>
+ *
+ * @see javax.servlet.jsp.jstl.core.IteratorTagSupport
+ * @author Shawn Bayern
+ */
+public class ForEachTag extends IteratorTagSupport {
+
+ //*********************************************************************
+ // Private state
+
+ private String select; // tag attribute
+ private List nodes; // XPath result
+ private int nodesIndex;
+
+ //*********************************************************************
+ // Iteration control methods
+
+ protected boolean hasNext() throws JspTagException {
+ return (nodesIndex < nodes.size());
+ }
+
+ protected Object next() throws JspTagException {
+ return (nodes.get(nodesIndex));
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ super.release();
+ }
+
+ // Establishes list of context nodes over which to iterate
+ public int doStartTag() throws JspException {
+ nodesIndex = 0;
+ try {
+ XPathUtil xu = new XPathUtil(pageContext);
+ nodes = xu.selectNodes(XPathUtil.getContext(this), select);
+ } catch (org.saxpath.SAXPathException ex) {
+ throw new JspTagException(ex.toString());
+ }
+
+ // now we're ready
+ return super.doStartTag();
+ }
+
+ // Increments internal counter
+ public int doAfterBody() throws JspException {
+ nodesIndex++; // insert ourselves & increment counter
+ return super.doAfterBody(); // chain to parent
+ }
+
+ //*********************************************************************
+ // Attribute accessors
+
+ public void setSelect(String select) {
+ this.select = select;
+ }
+
+
+ //*********************************************************************
+ // Public methods for subtags
+
+ /* Retrieves the current context. */
+ public org.w3c.dom.Node getContext() throws JspTagException {
+ // in this implementation, it's safe just to call next() to get
+ // the current node. This method's just here for abstraction
+ // and casting.
+ return ((org.w3c.dom.Node) next());
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ private void init() {
+ select = null;
+ nodes = null;
+ nodesIndex = 0;
+ }
+}
+
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/IfTag.java b/src/org/apache/taglibs/standard/tag/common/xml/IfTag.java
new file mode 100644
index 0000000..4f2ef04
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/IfTag.java
@@ -0,0 +1,121 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+
+/**
+ * <p>Tag handler for <if> in JSTL's XML library.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class IfTag extends ConditionalTagSupport {
+
+ //*********************************************************************
+ // Constructor and lifecycle management
+
+ // initialize inherited and local state
+ public IfTag() {
+ super();
+ init();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Supplied conditional logic
+
+ protected boolean condition() throws JspException {
+ try {
+ XPathUtil xu = new XPathUtil(pageContext);
+ return (xu.booleanValueOf(XPathUtil.getContext(this), select));
+ } catch (org.saxpath.SAXPathException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+
+ //*********************************************************************
+ // Private state
+
+ private String select; // the value of the 'test' attribute
+
+
+ //*********************************************************************
+ // Attribute accessors
+
+ public void setSelect(String select) {
+ this.select = select;
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ // resets internal state
+ private void init() {
+ select = null;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java b/src/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java
new file mode 100644
index 0000000..20ae875
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java
@@ -0,0 +1,118 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import java.net.URLEncoder;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>Support for tag handlers for <param>, the XML parameter
+ * subtag for <transformt<.</p>
+ *
+ * @see TransformSupport
+ * @author Shawn Bayern
+ */
+
+public abstract class ParamSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected String name; // 'name' attribute
+ protected String value; // 'value' attribute
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public ParamSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ name = value = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // simply send our name and value to our parent <transform> tag
+ public int doEndTag() throws JspException {
+ Tag t = findAncestorWithClass(this, TransformSupport.class);
+ if (t == null)
+ throw new JspTagException(
+ Resources.getMessage("PARAM_OUTSIDE_TRANSFORM"));
+ TransformSupport parent = (TransformSupport) t;
+
+ String value = this.value;
+ if (value == null) {
+ String bcs = getBodyContent().getString();
+ if (bcs == null || (value = bcs.trim()).equals(""))
+ throw new JspTagException(
+ Resources.getMessage("PARAM_NO_VALUE"));
+ }
+ parent.setParameter(name, value);
+ return EVAL_PAGE;
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java b/src/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java
new file mode 100644
index 0000000..78cc445
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java
@@ -0,0 +1,239 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import java.io.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.sax.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.xml.sax.helpers.XMLFilterImpl;
+import org.xml.sax.helpers.XMLReaderFactory;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>Support for tag handlers for <parse>, the XML parsing tag.</p>
+ *
+ * @author Shawn Bayern
+ */
+public abstract class ParseSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected Object source; // 'source' attribute
+ protected XMLFilter filter; // 'filter' attribute
+
+ //*********************************************************************
+ // Private state
+
+ private String var; // 'var' attribute
+ private String domVar; // 'domVar' attribute
+
+ // state in support of XML parsing...
+ private DocumentBuilderFactory dbf;
+ private DocumentBuilder db;
+ private TransformerFactory tf;
+ private TransformerHandler th;
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public ParseSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ source = var = null;
+ filter = null;
+ dbf = null;
+ db = null;
+ tf = null;
+ th = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // parse 'source' or body, storing result in 'var'
+ public int doEndTag() throws JspException {
+ try {
+
+ // set up our DocumentBuilder
+ if (dbf == null) {
+ dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ }
+ db = dbf.newDocumentBuilder();
+
+ // if we've gotten a filter, set up a transformer to support it
+ if (filter != null) {
+ if (tf == null)
+ tf = TransformerFactory.newInstance();
+ if (!tf.getFeature(SAXTransformerFactory.FEATURE))
+ throw new JspTagException(
+ Resources.getMessage("PARSE_NO_SAXTRANSFORMER"));
+ SAXTransformerFactory stf = (SAXTransformerFactory) tf;
+ th = stf.newTransformerHandler();
+ }
+
+ // if we haven't gotten a source, use the body (which may be empty)
+ Object source = this.source;
+ if (source == null)
+ source = bodyContent.getString();
+
+ // now, parse the document into 'd'
+ Document d;
+ if (filter == null) {
+ if (source instanceof Reader)
+ d = parseReader((Reader)source);
+ else if (source instanceof String)
+ d = parseString((String)source);
+ else
+ throw new JspTagException(
+ Resources.getMessage("PARSE_INVALID_SOURCE"));
+ } else {
+ if (source instanceof Reader)
+ d = parseReaderWithFilter((Reader)source, filter);
+ else if (source instanceof String)
+ d = parseStringWithFilter((String)source, filter);
+ else
+ throw new JspTagException(
+ Resources.getMessage("PARSE_INVALID_SOURCE"));
+ }
+
+ // we've got a Document object; store it out as appropriate
+ pageContext.setAttribute(var, d);
+ if (domVar != null)
+ pageContext.setAttribute(domVar, d);
+
+ return EVAL_PAGE;
+ } catch (SAXException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (IOException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (ParserConfigurationException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (TransformerConfigurationException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ /** Parses the given Reader into a Document. */
+ private Document parseReader(Reader r) throws SAXException, IOException {
+ return db.parse(new InputSource(r));
+ }
+
+ /** Parses the given String into a Document. */
+ private Document parseString(String s) throws SAXException, IOException {
+ StringReader r = new StringReader(s);
+ return parseReader(r);
+ }
+
+ /** Parses the given Reader after applying the given XMLFilter. */
+ private Document parseReaderWithFilter(Reader r, XMLFilter f)
+ throws SAXException, IOException {
+ // prepare an output Document
+ Document o = db.newDocument();
+
+ // use TrAX to adapt SAX events to a Document object
+ th.setResult(new DOMResult(o));
+ XMLReader xr = XMLReaderFactory.createXMLReader();
+ // (note that we overwrite the filter's parent. this seems
+ // to be expected usage. we could cache and reset the old
+ // parent, but you can't setParent(null), so this wouldn't
+ // be perfect.)
+ f.setParent(xr);
+ f.setContentHandler(th);
+ f.parse(new InputSource(r));
+ return o;
+ }
+
+ /** Parses the given String after applying the given XMLFilter. */
+ private Document parseStringWithFilter(String s, XMLFilter f)
+ throws SAXException, IOException {
+ StringReader r = new StringReader(s);
+ return parseReaderWithFilter(r, f);
+ }
+
+
+ //*********************************************************************
+ // Tag attributes
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public void setDomVar(String domVar) {
+ this.domVar = domVar;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/SetTag.java b/src/org/apache/taglibs/standard/tag/common/xml/SetTag.java
new file mode 100644
index 0000000..d98fc15
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/SetTag.java
@@ -0,0 +1,127 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>Tag handler for <set> in JSTL's XML library.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class SetTag extends TagSupport {
+
+ //*********************************************************************
+ // Internal state
+
+ private String select; // tag attribute
+ private String var; // tag attribute
+
+ //*********************************************************************
+ // Construction and initialization
+
+ /**
+ * Constructs a new handler. As with TagSupport, subclasses should
+ * not provide other constructors and are expected to call the
+ * superclass constructor.
+ */
+ public SetTag() {
+ super();
+ init();
+ }
+
+ // resets local state
+ private void init() {
+ select = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // applies XPath expression from 'select' and stores the result in 'var'
+ public int doStartTag() throws JspException {
+ try {
+ XPathUtil xu = new XPathUtil(pageContext);
+ Object result =
+ xu.selectNodes(XPathUtil.getContext(this), select);
+ pageContext.setAttribute(var, result);
+ return SKIP_BODY;
+ } catch (org.saxpath.SAXPathException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Attribute accessors
+
+ public void setSelect(String select) {
+ this.select = select;
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java b/src/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java
new file mode 100644
index 0000000..7fa9af8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java
@@ -0,0 +1,231 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import java.io.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.stream.*;
+import org.w3c.dom.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>Support for tag handlers for <transform>, the XML transformation
+ * tag.</p>
+ *
+ * @author Shawn Bayern
+ */
+public abstract class TransformSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected Object source; // 'source' attribute
+ protected Object xslt; // 'xslt attribute
+ protected Transformer transformer; // 'transformer' attribute
+ protected Result result; // 'result' attribute
+
+ //*********************************************************************
+ // Private state
+
+ private String var; // 'var' attribute
+ private Transformer t; // actual Transformer
+ private TransformerFactory tf; // reusable factory
+ private DocumentBuilder db; // reusable factory
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public TransformSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ source = null;
+ xslt = null;
+ transformer = null;
+ var = null;
+ result = null;
+ tf = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // parse 'source' or body, transform via 'xslt' or 'transformer',
+ // store as 'var' or 'result'
+ public int doEndTag() throws JspException {
+ try {
+
+ //************************************
+ // Initialize
+
+ // set up the TransformerFactory if necessary
+ if (tf == null)
+ tf = TransformerFactory.newInstance();
+
+ // set up our DocumentBuilderFactory if necessary
+ if (db == null)
+ db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+
+ //************************************
+ // Determine source XML
+
+ // if we haven't gotten a source, use the body (which may be empty)
+ Object source = this.source;
+ if (source == null)
+ source = bodyContent.getString();
+
+ // let the Source be with you
+ Source xml = getSource(source);
+
+ //************************************
+ // Determine transformer
+
+ // we can assume only one of 'xslt' or 'transformer' is specified
+ if (transformer != null)
+ t = transformer;
+ else {
+ // assume 'xslt'
+ if (xslt == null)
+ throw new JspTagException(
+ Resources.getMessage("TRANSFORM_NO_TRANSFORMER"));
+ t = tf.newTransformer(getSource(xslt));
+ }
+
+ //************************************
+ // Conduct the transformation
+
+ // we can assume at most one of 'var' or 'result' is specified
+ if (result != null)
+ // we can write directly to the Result
+ t.transform(xml, result);
+ else if (var != null) {
+ // we need a Document
+ Document d = db.newDocument();
+ Result doc = new DOMResult(d);
+ t.transform(xml, doc);
+ pageContext.setAttribute(var, d);
+ } else {
+ /*
+ * We're going to output the text directly. I'd love to
+ * construct a StreamResult directly from pageContext.getOut(),
+ * but I can't trust the transformer not to flush our writer.
+ */
+ StringWriter bufferedResult = new StringWriter();
+ Result page = new StreamResult(bufferedResult);
+ t.transform(xml, page);
+ pageContext.getOut().print(bufferedResult);
+ }
+
+ return EVAL_PAGE;
+ } catch (IOException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (ParserConfigurationException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (TransformerConfigurationException ex) {
+ throw new JspTagException(ex.toString());
+ } catch (TransformerException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+
+
+ //*********************************************************************
+ // Public methods for subtags
+
+ /** Sets a transformation parameter on our transformer. */
+ public void setParameter(String name, String value) {
+ t.setParameter(name, value);
+ }
+
+
+ //*********************************************************************
+ // Public utility methods
+
+ /**
+ * Retrieves a Source from the given Object, whether it be a String,
+ * Reader, or Source (the latter of which simply results in an identity).
+ * A null input results in a null output.
+ */
+ public static Source getSource(Object o) {
+ if (o == null || o instanceof Source)
+ return null;
+ if (o instanceof String)
+ o = new StringReader((String)o);
+ return new StreamSource((Reader)o);
+ }
+
+
+ //*********************************************************************
+ // Tag attributes
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/TransformerSupport.java b/src/org/apache/taglibs/standard/tag/common/xml/TransformerSupport.java
new file mode 100644
index 0000000..dade7e7
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/TransformerSupport.java
@@ -0,0 +1,141 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import java.io.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.transform.*;
+import javax.xml.transform.stream.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>Support for tag handlers for <transformer>, a tag that exposes
+ * a reusable transformer.</p>
+ *
+ * @author Shawn Bayern
+ */
+public abstract class TransformerSupport extends BodyTagSupport {
+
+ //*********************************************************************
+ // Protected state
+
+ protected Object xslt; // 'xslt' attribute
+
+ //*********************************************************************
+ // Private state
+
+ private String var; // 'var' attribute
+ private TransformerFactory tf; // reusable TransformerFactory
+
+
+ //*********************************************************************
+ // Constructor and initialization
+
+ public TransformerSupport() {
+ super();
+ init();
+ }
+
+ private void init() {
+ xslt = null;
+ var = null;
+ tf = null;
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // retrieves XSLT from body or attribute; exposes Transformer
+ public int doEndTag() throws JspException {
+ try {
+
+ if (tf == null)
+ tf = TransformerFactory.newInstance();
+
+
+ // if we haven't gotten an XSLT stylesheet, use the body
+ Object xslt = this.xslt;
+ if (xslt == null)
+ xslt = bodyContent.getString();
+
+ // get a Source and feed it to our factory
+ Source s = TransformSupport.getSource(xslt);
+ Transformer t = tf.newTransformer(s);
+
+ // expose the Transformer
+ pageContext.setAttribute(var, t);
+
+ return EVAL_PAGE;
+ } catch (TransformerConfigurationException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag attributes
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/WhenTag.java b/src/org/apache/taglibs/standard/tag/common/xml/WhenTag.java
new file mode 100644
index 0000000..84360a2
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/WhenTag.java
@@ -0,0 +1,121 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import org.apache.taglibs.standard.tag.common.core.*;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+
+/**
+ * <p>Tag handler for <if> in JSTL's XML library.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class WhenTag extends WhenTagSupport {
+
+ //*********************************************************************
+ // Constructor and lifecycle management
+
+ // initialize inherited and local state
+ public WhenTag() {
+ super();
+ init();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Supplied conditional logic
+
+ protected boolean condition() throws JspException {
+ try {
+ XPathUtil xu = new XPathUtil(pageContext);
+ return (xu.booleanValueOf(XPathUtil.getContext(this), select));
+ } catch (org.saxpath.SAXPathException ex) {
+ throw new JspTagException(ex.toString());
+ }
+ }
+
+
+ //*********************************************************************
+ // Private state
+
+ private String select; // the value of the 'test' attribute
+
+
+ //*********************************************************************
+ // Attribute accessors
+
+ public void setSelect(String select) {
+ this.select = select;
+ }
+
+
+ //*********************************************************************
+ // Private utility methods
+
+ // resets internal state
+ private void init() {
+ select = null;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java b/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
new file mode 100644
index 0000000..82f1c45
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
@@ -0,0 +1,244 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.common.xml;
+
+import java.io.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.servlet.http.*;
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.sax.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.jaxen.*;
+import org.jaxen.dom.*;
+import org.saxpath.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>Support for tag handlers that evaluate XPath expressions.</p>
+ *
+ * @author Shawn Bayern
+ */
+// would ideally be a base class, but some of our user handlers already
+// have their own parents
+public class XPathUtil {
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new XPathUtil object associated with the given
+ * PageContext.
+ */
+ public XPathUtil(PageContext pc) {
+ pageContext = pc;
+ }
+
+ //*********************************************************************
+ // Support for JSTL variable resolution
+
+ private static final String PAGE_NS_URL
+ = "http://java.sun.com/jstl/xpath/page";
+ private static final String REQUEST_NS_URL
+ = "http://java.sun.com/jstl/xpath/request";
+ private static final String SESSION_NS_URL
+ = "http://java.sun.com/jstl/xpath/session";
+ private static final String APP_NS_URL
+ = "http://java.sun.com/jstl/xpath/app";
+ private static final String PARAM_NS_URL
+ = "http://java.sun.com/jstl/xpath/param";
+ private static final String INITPARAM_NS_URL
+ = "http://java.sun.com/jstl/xpath/initParam";
+ private static final String COOKIE_NS_URL
+ = "http://java.sun.com/jstl/xpath/cookie";
+ private static final String HEADER_NS_URL
+ = "http://java.sun.com/jstl/xpath/header";
+
+ protected class JstlVariableContext implements VariableContext {
+ // retrieves object using JSTL's custom variable-mapping rules
+ public Object getVariableValue(String namespace, String prefix,
+ String localName) throws UnresolvableException {
+ if (namespace == null)
+ return pageContext.findAttribute(localName);
+ else if (namespace.equals(PAGE_NS_URL))
+ return pageContext.getAttribute(localName,
+ PageContext.PAGE_SCOPE);
+ else if (namespace.equals(REQUEST_NS_URL))
+ return pageContext.getAttribute(localName,
+ PageContext.REQUEST_SCOPE);
+ else if (namespace.equals(SESSION_NS_URL))
+ return pageContext.getAttribute(localName,
+ PageContext.SESSION_SCOPE);
+ else if (namespace.equals(APP_NS_URL))
+ return pageContext.getAttribute(localName,
+ PageContext.APPLICATION_SCOPE);
+ else if (namespace.equals(PARAM_NS_URL))
+ return pageContext.getRequest().getParameter(localName);
+ else if (namespace.equals(INITPARAM_NS_URL))
+ return
+ pageContext.getServletConfig().getInitParameter(localName);
+ else if (namespace.equals(HEADER_NS_URL)) {
+ HttpServletRequest hsr =
+ (HttpServletRequest) pageContext.getRequest();
+ return hsr.getHeader(localName);
+ } else if (namespace.equals(COOKIE_NS_URL)) {
+ HttpServletRequest hsr =
+ (HttpServletRequest) pageContext.getRequest();
+ Cookie[] c = hsr.getCookies();
+ for (int i = 0; i < c.length; i++)
+ if (c[i].getName().equals(localName))
+ return c[i].getValue();
+ return null;
+ } else
+ throw new UnresolvableException(prefix + ":" + localName);
+ }
+ }
+
+ //*********************************************************************
+ // Support for XPath evaluation
+
+ private PageContext pageContext;
+ private static SimpleNamespaceContext nc;
+ private static FunctionContext fc;
+ private static DocumentNavigator dn;
+
+ /** Initialize globally useful data. */
+ private synchronized static void staticInit() {
+ if (nc == null) {
+ // register supported namespaces
+ nc = new SimpleNamespaceContext();
+ SimpleNamespaceContext nc = new SimpleNamespaceContext();
+ nc.addNamespace("page", PAGE_NS_URL);
+ nc.addNamespace("request", REQUEST_NS_URL);
+ nc.addNamespace("session", SESSION_NS_URL);
+ nc.addNamespace("app", APP_NS_URL);
+ nc.addNamespace("param", PARAM_NS_URL);
+ nc.addNamespace("initParam", INITPARAM_NS_URL);
+ nc.addNamespace("header", HEADER_NS_URL);
+ nc.addNamespace("cookie", COOKIE_NS_URL);
+
+ // set up the global FunctionContext
+ fc = XPathFunctionContext.getInstance();
+
+ // set up the global DocumentNavigator
+ dn = DocumentNavigator.getInstance();
+ }
+ }
+
+ /**
+ * Returns a String given an XPath expression and a single context
+ * Node.
+ */
+ public String valueOf(Node n, String xpath) throws SAXPathException {
+ staticInit();
+ XPath xp = new XPath(xpath);
+ return xp.valueOf(getLocalContext(n));
+ }
+
+ /** Evaluates an XPath expression to a boolean value. */
+ public boolean booleanValueOf(Node n, String xpath)
+ throws SAXPathException {
+ staticInit();
+ XPath xp = new XPath(xpath);
+ return xp.booleanValueOf(getLocalContext(n));
+ }
+
+ /** Evalutes an XPath expression to a List of nodes. */
+ public List selectNodes(Node n, String xpath) throws SAXPathException {
+ staticInit();
+ XPath xp = new XPath(xpath);
+ return xp.selectNodes(getLocalContext(n));
+ }
+
+ /** Evaluates an XPath expression to a single node. */
+ public Node selectSingleNode(Node n, String xpath)
+ throws SAXPathException {
+ staticInit();
+ XPath xp = new XPath(xpath);
+ return (Node) xp.selectSingleNode(getLocalContext(n));
+ }
+
+ /** Returns a locally appropriate Jaxen context given a node. */
+ private Context getLocalContext(Node n) {
+ // set up instance-specific contexts
+ VariableContext vc = new JstlVariableContext();
+ ContextSupport cs = new ContextSupport(nc, fc, vc, dn);
+ Context c = new Context(cs);
+ List l = new ArrayList(1);
+ l.add(n);
+ c.setNodeSet(l);
+ return c;
+ }
+
+ //*********************************************************************
+ // Static support for context retrieval from parent <forEach> tag
+
+ public static Node getContext(Tag t) throws JspTagException {
+ ForEachTag xt =
+ (ForEachTag) TagSupport.findAncestorWithClass(
+ t, ForEachTag.class);
+ if (xt == null)
+ return null;
+ else
+ return (xt.getContext());
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java
new file mode 100644
index 0000000..6d83a29
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java
@@ -0,0 +1,152 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <bundle> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class BundleTag extends BundleSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String basename_; // stores EL-based property
+ private String prefix_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new BundleTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public BundleTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setBasename(String basename_) {
+ this.basename_ = basename_;
+ }
+
+ // for EL-based attribute
+ public void setPrefix(String prefix_) {
+ this.prefix_ = prefix_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ basename_ = prefix_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ basename = (String) ExpressionUtil.evalNotNull(
+ "bundle", "basename", basename_, String.class, this, pageContext);
+ prefix = (String) ExpressionUtil.evalNotNull(
+ "bundle", "prefix", prefix_, String.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/ExceptionTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/ExceptionTag.java
new file mode 100644
index 0000000..4cf1b32
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/ExceptionTag.java
@@ -0,0 +1,171 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A handler for <exception> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class ExceptionTag extends ExceptionSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+ private String bundle_; // stores EL-based property
+ private String stackTrace_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new ExceptionTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public ExceptionTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+ // for EL-based attribute
+ public void setBundle(String bundle_) {
+ this.bundle_ = bundle_;
+ }
+
+ // for EL-based attribute
+ public void setStackTrace(String stackTrace_) {
+ this.stackTrace_ = stackTrace_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = bundle_ = stackTrace_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = (Exception) ExpressionUtil.evalNotNull(
+ "exception", "value", value_, Exception.class, this, pageContext);
+ bundle = (ResourceBundle) ExpressionUtil.evalNotNull(
+ "exception", "bundle", bundle_, ResourceBundle.class, this,
+ pageContext);
+
+ if (stackTrace_ != null) {
+ if (stackTrace_.equalsIgnoreCase("false"))
+ stackTrace = false;
+ else if (stackTrace_.equalsIgnoreCase("true"))
+ stackTrace = true;
+ else
+ throw new JspTagException(
+ Resources.getMessage("PARAM_STACKTRACE_BOOLEAN",
+ stackTrace_));
+ }
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java
new file mode 100644
index 0000000..6d78783
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java
@@ -0,0 +1,165 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <formatDate> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class FormatDateTag extends FormatDateSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+ private String pattern_; // stores EL-based property
+ private String timeZone_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new FormatDateTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public FormatDateTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+ // for EL-based attribute
+ public void setPattern(String pattern_) {
+ this.pattern_ = pattern_;
+ }
+
+ // for EL-based attribute
+ public void setTimeZone(String timeZone_) {
+ this.timeZone_ = timeZone_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = pattern_ = timeZone_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = ExpressionUtil.evalNotNull(
+ "formatDate", "value", value_, Object.class, this, pageContext);
+ pattern = (String) ExpressionUtil.evalNotNull(
+ "formatDate", "pattern", pattern_, String.class, this,
+ pageContext);
+
+ String tz = (String) ExpressionUtil.evalNotNull(
+ "formatDate", "timeZone", timeZone_, String.class, this,
+ pageContext);
+ if (tz != null)
+ timeZone = TimeZone.getTimeZone(tz);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java
new file mode 100644
index 0000000..bb8591f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java
@@ -0,0 +1,154 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <formatNumber> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class FormatNumberTag extends FormatNumberSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+ private String pattern_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new FormatNumberTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public FormatNumberTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+ // for EL-based attribute
+ public void setPattern(String pattern_) {
+ this.pattern_ = pattern_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = pattern_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = ExpressionUtil.evalNotNull(
+ "formatNumber", "value", value_, Object.class, this, pageContext);
+ pattern = (String) ExpressionUtil.evalNotNull(
+ "formatNumber", "pattern", pattern_, String.class, this,
+ pageContext);
+ }
+}
+
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/LocaleTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/LocaleTag.java
new file mode 100644
index 0000000..63e0e01
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/LocaleTag.java
@@ -0,0 +1,152 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <locale> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class LocaleTag extends LocaleSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+ private String variant_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new LocaleTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public LocaleTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+ // for EL-based attribute
+ public void setVariant(String variant_) {
+ this.variant_ = variant_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = variant_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = (String) ExpressionUtil.evalNotNull(
+ "locale", "value", value_, String.class, this, pageContext);
+ variant = (String) ExpressionUtil.evalNotNull(
+ "locale", "variant", variant_, String.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/MessageArgTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/MessageArgTag.java
new file mode 100644
index 0000000..0a06032
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/MessageArgTag.java
@@ -0,0 +1,144 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <messageArg> that accepts message arguments as
+ * Strings and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class MessageArgTag extends MessageArgSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new MessageArgTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public MessageArgTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = ExpressionUtil.evalNotNull(
+ "messageArg", "value", value_, Object.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/MessageFormatTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/MessageFormatTag.java
new file mode 100644
index 0000000..d9ce853
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/MessageFormatTag.java
@@ -0,0 +1,144 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <messageFormat> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class MessageFormatTag extends MessageFormatSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new MessageFormatTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public MessageFormatTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = (String) ExpressionUtil.evalNotNull(
+ "message", "value", value_, String.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java
new file mode 100644
index 0000000..56b08ba
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java
@@ -0,0 +1,153 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <message> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class MessageTag extends MessageSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String key_; // stores EL-based property
+ private String bundle_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new MessageTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public MessageTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setKey(String key_) {
+ this.key_ = key_;
+ }
+
+ // for EL-based attribute
+ public void setBundle(String bundle_) {
+ this.bundle_ = bundle_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ key_ = bundle_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ key = (String) ExpressionUtil.evalNotNull(
+ "message", "key", key_, String.class, this, pageContext);
+ bundle = (ResourceBundle) ExpressionUtil.evalNotNull(
+ "message", "bundle", bundle_, ResourceBundle.class, this,
+ pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java
new file mode 100644
index 0000000..c423ebd
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java
@@ -0,0 +1,153 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <parseDate> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class ParseDateTag extends ParseDateSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+ private String pattern_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new ParseDateTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public ParseDateTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+ // for EL-based attribute
+ public void setPattern(String pattern_) {
+ this.pattern_ = pattern_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = pattern_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = (String) ExpressionUtil.evalNotNull(
+ "parseDate", "value", value_, String.class, this, pageContext);
+ pattern = (String) ExpressionUtil.evalNotNull(
+ "parseDate", "pattern", pattern_, String.class, this,
+ pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java
new file mode 100644
index 0000000..f5fa024
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java
@@ -0,0 +1,154 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <parseNumber> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class ParseNumberTag extends ParseNumberSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+ private String pattern_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new ParseNumberTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public ParseNumberTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+ // for EL-based attribute
+ public void setPattern(String pattern_) {
+ this.pattern_ = pattern_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = pattern_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = (String) ExpressionUtil.evalNotNull(
+ "parseNumber", "value", value_, String.class, this, pageContext);
+ pattern = (String) ExpressionUtil.evalNotNull(
+ "parseNumber", "pattern", pattern_, String.class, this,
+ pageContext);
+ }
+}
+
diff --git a/src/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java b/src/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java
new file mode 100644
index 0000000..ba422dc
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java
@@ -0,0 +1,144 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <timeZone> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class TimeZoneTag extends TimeZoneSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String value_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new TimeZoneTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public TimeZoneTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ value_ = null;
+ }
+
+ // Evaluates expressions as necessary
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ value = (String) ExpressionUtil.evalNotNull(
+ "timeZone", "value", value_, String.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/xml/ParamTag.java b/src/org/apache/taglibs/standard/tag/el/xml/ParamTag.java
new file mode 100644
index 0000000..593a691
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/xml/ParamTag.java
@@ -0,0 +1,147 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.xml.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A handler for <param> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class ParamTag extends ParamSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String name_; // stores EL-based property
+ private String value_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ public ParamTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setName(String name_) {
+ this.name_ = name_;
+ }
+
+ public void setValue(String value_) {
+ this.value_ = value_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ name_ = value_ = null;
+ }
+
+ /* Evaluates expressions as necessary */
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ name = (String) ExpressionUtil.evalNotNull(
+ "import", "name", name_, String.class, this, pageContext);
+ value = (String) ExpressionUtil.evalNotNull(
+ "import", "value", value_, String.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/xml/ParseTag.java b/src/org/apache/taglibs/standard/tag/el/xml/ParseTag.java
new file mode 100644
index 0000000..385ec18
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/xml/ParseTag.java
@@ -0,0 +1,152 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.xml.sax.XMLFilter;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.xml.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A handler for <parse> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class ParseTag extends ParseSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String source_; // stores EL-based property
+ private String filter_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ /**
+ * Constructs a new ParseTag. As with TagSupport, subclasses
+ * should not provide other constructors and are expected to call
+ * the superclass constructor
+ */
+ public ParseTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setFilter(String filter_) {
+ this.filter_ = filter_;
+ }
+
+ public void setSource(String source_) {
+ this.source_ = source_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ source_ = filter_ = null;
+ }
+
+ /* Evaluates expressions as necessary */
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ source = ExpressionUtil.evalNotNull(
+ "parse", "source", source_, Object.class, this, pageContext);
+ filter = (XMLFilter) ExpressionUtil.evalNotNull(
+ "parse", "filter", filter_, XMLFilter.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/xml/TransformTag.java b/src/org/apache/taglibs/standard/tag/el/xml/TransformTag.java
new file mode 100644
index 0000000..90653dc
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/xml/TransformTag.java
@@ -0,0 +1,166 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.Result;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.xml.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A handler for <transform> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class TransformTag extends TransformSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String source_; // stores EL-based property
+ private String xslt_; // stores EL-based property
+ private String transformer_; // stores EL-based property
+ private String result_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ public TransformTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setSource(String source_) {
+ this.source_ = source_;
+ }
+
+ // for EL-based attribute
+ public void setXslt(String xslt_) {
+ this.xslt_ = xslt_;
+ }
+
+ // for EL-based attribute
+ public void setTransformer(String transformer_) {
+ this.transformer_ = transformer_;
+ }
+
+ // for EL-based attribute
+ public void setResult(String result_) {
+ this.result_ = result_;
+ }
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ source_ = xslt_ = transformer_ = result_ = null;
+ }
+
+ /* Evaluates expressions as necessary */
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ source = ExpressionUtil.evalNotNull(
+ "transform", "source", source_, Object.class, this, pageContext);
+ xslt = ExpressionUtil.evalNotNull(
+ "transform", "xslt", xslt_, Object.class, this, pageContext);
+ transformer = (Transformer) ExpressionUtil.evalNotNull(
+ "transform", "transformer", transformer_, Transformer.class,
+ this, pageContext);
+ result = (Result) ExpressionUtil.evalNotNull(
+ "transform", "result", result_, Result.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/el/xml/TransformerTag.java b/src/org/apache/taglibs/standard/tag/el/xml/TransformerTag.java
new file mode 100644
index 0000000..0e4be52
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/el/xml/TransformerTag.java
@@ -0,0 +1,140 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.el.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+import org.apache.taglibs.standard.tag.common.xml.*;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A handler for <transformer> that accepts attributes as Strings
+ * and evaluates them as expressions at runtime.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class TransformerTag extends TransformerSupport {
+
+ //*********************************************************************
+ // 'Private' state (implementation details)
+
+ private String xslt_; // stores EL-based property
+
+
+ //*********************************************************************
+ // Constructor
+
+ public TransformerTag() {
+ super();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Tag logic
+
+ // evaluates expression and chains to parent
+ public int doStartTag() throws JspException {
+
+ // evaluate any expressions we were passed, once per invocation
+ evaluateExpressions();
+
+ // chain to the parent implementation
+ return super.doStartTag();
+ }
+
+
+ // Releases any resources we may have (or inherit)
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for EL-based attribute
+ public void setXslt(String xslt_) {
+ this.xslt_ = xslt_;
+ }
+
+
+
+ //*********************************************************************
+ // Private (utility) methods
+
+ // (re)initializes state (during release() or construction)
+ private void init() {
+ // null implies "no expression"
+ xslt_ = null;
+ }
+
+ /* Evaluates expressions as necessary */
+ private void evaluateExpressions() throws JspException {
+ /*
+ * Note: we don't check for type mismatches here; we assume
+ * the expression evaluator will return the expected type
+ * (by virtue of knowledge we give it about what that type is).
+ * A ClassCastException here is truly unexpected, so we let it
+ * propagate up.
+ */
+
+ xslt = ExpressionUtil.evalNotNull(
+ "transform", "xslt", xslt_, Object.class, this, pageContext);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java
new file mode 100644
index 0000000..e1f3f23
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <bundle> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class BundleTag extends BundleSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setBasename(String basename) throws JspTagException {
+ this.basename = basename;
+ }
+
+ // for tag attribute
+ public void setPrefix(String prefix) throws JspTagException {
+ this.prefix = prefix;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/ExceptionTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/ExceptionTag.java
new file mode 100644
index 0000000..ff2abb2
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/ExceptionTag.java
@@ -0,0 +1,89 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <exception> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class ExceptionTag extends ExceptionSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(JspException value) throws JspTagException {
+ this.value = value;
+ }
+
+ // for tag attribute
+ public void setBundle(ResourceBundle bundle) throws JspTagException {
+ this.bundle = bundle;
+ }
+
+ // for tag attribute
+ public void setStackTrace(boolean stackTrace) throws JspTagException {
+ this.stackTrace = stackTrace;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java
new file mode 100644
index 0000000..7e4c39d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java
@@ -0,0 +1,89 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <formatDate> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class FormatDateTag extends FormatDateSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+
+ // for tag attribute
+ public void setPattern(String pattern) throws JspTagException {
+ this.pattern = pattern;
+ }
+
+ // for tag attribute
+ public void setTimeZone(String timeZone) throws JspTagException {
+ this.timeZone = TimeZone.getTimeZone(timeZone);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java
new file mode 100644
index 0000000..84fc906
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <formatNumber> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class FormatNumberTag extends FormatNumberSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(Object value) throws JspTagException {
+ this.value = value;
+ }
+
+ // for tag attribute
+ public void setPattern(String pattern) throws JspTagException {
+ this.pattern = pattern;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/LocaleTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/LocaleTag.java
new file mode 100644
index 0000000..9a27fe2
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/LocaleTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <locale> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class LocaleTag extends LocaleSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+
+ // for tag attribute
+ public void setVariant(String variant) throws JspTagException {
+ this.variant = variant;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/MessageArgTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/MessageArgTag.java
new file mode 100644
index 0000000..7dda522
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/MessageArgTag.java
@@ -0,0 +1,79 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <messageArg> that supports rtexprvalue-based
+ * message arguments.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class MessageArgTag extends MessageArgSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(Object value) throws JspTagException {
+ this.value = value;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/MessageFormatTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/MessageFormatTag.java
new file mode 100644
index 0000000..b1d9e06
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/MessageFormatTag.java
@@ -0,0 +1,79 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <messageFormat> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class MessageFormatTag extends MessageFormatSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java
new file mode 100644
index 0000000..f766759
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <message> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class MessageTag extends MessageSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setKey(String key) throws JspTagException {
+ this.key = key;
+ }
+
+ // for tag attribute
+ public void setBundle(ResourceBundle bundle) throws JspTagException {
+ this.bundle = bundle;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java
new file mode 100644
index 0000000..cb4c263
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <parseDate> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class ParseDateTag extends ParseDateSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+
+ // for tag attribute
+ public void setPattern(String pattern) throws JspTagException {
+ this.pattern = pattern;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java
new file mode 100644
index 0000000..b30ed1e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <parseNumber> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class ParseNumberTag extends ParseNumberSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+
+ // for tag attribute
+ public void setPattern(String pattern) throws JspTagException {
+ this.pattern = pattern;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java b/src/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java
new file mode 100644
index 0000000..e043e52
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java
@@ -0,0 +1,79 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.fmt;
+
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.*;
+
+/**
+ * <p>A handler for <timeZone> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Jan Luehe
+ */
+
+public class TimeZoneTag extends TimeZoneSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java b/src/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java
new file mode 100644
index 0000000..d312013
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.xml.*;
+
+/**
+ * <p>A handler for <param> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class ParamTag extends ParamSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setName(String name) throws JspTagException {
+ this.name = name;
+ }
+
+ // for tag attribute
+ public void setValue(String value) throws JspTagException {
+ this.value = value;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java b/src/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java
new file mode 100644
index 0000000..da91fca
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java
@@ -0,0 +1,85 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.xml.sax.XMLFilter;
+import org.apache.taglibs.standard.tag.common.xml.*;
+
+/**
+ * <p>A handler for <parse> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class ParseTag extends ParseSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setSource(Object source) throws JspTagException {
+ this.source = source;
+ }
+
+ // for tag attribute
+ public void setFilter(XMLFilter filter) throws JspTagException {
+ this.filter = filter;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java b/src/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java
new file mode 100644
index 0000000..0d3b266
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java
@@ -0,0 +1,96 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.Result;
+import org.apache.taglibs.standard.tag.common.xml.*;
+
+/**
+ * <p>A handler for <transform> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class TransformTag extends TransformSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setSource(Object source) throws JspTagException {
+ this.source = source;
+ }
+
+ // for tag attribute
+ public void setXslt(Object xslt) throws JspTagException {
+ this.xslt = xslt;
+ }
+
+ // for tag attribute
+ public void setTransformer(Transformer transformer) throws JspTagException {
+ this.transformer = transformer;
+ }
+
+ // for tag attribute
+ public void setResult(Result result) throws JspTagException {
+ this.result = result;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tag/rt/xml/TransformerTag.java b/src/org/apache/taglibs/standard/tag/rt/xml/TransformerTag.java
new file mode 100644
index 0000000..8dc102a
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tag/rt/xml/TransformerTag.java
@@ -0,0 +1,79 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tag.rt.xml;
+
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.xml.*;
+
+/**
+ * <p>A handler for <transformer> that supports rtexprvalue-based
+ * attributes.</p>
+ *
+ * @author Shawn Bayern
+ */
+
+public class TransformerTag extends TransformerSupport {
+
+ //*********************************************************************
+ // Accessor methods
+
+ // for tag attribute
+ public void setXslt(Object xslt) throws JspTagException {
+ this.xslt = xslt;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tei/BundleTEI.java b/src/org/apache/taglibs/standard/tei/BundleTEI.java
new file mode 100644
index 0000000..93403a8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/BundleTEI.java
@@ -0,0 +1,74 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <bundle> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class BundleTEI extends TagExtraInfo {
+
+ /**
+ * Validates the <tt>scope</tt> attribute of the <bundle> tag.
+ */
+ public boolean isValid(TagData data) {
+ return Util.isValidScope(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/DeclareTEI.java b/src/org/apache/taglibs/standard/tei/DeclareTEI.java
new file mode 100644
index 0000000..526a84e
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/DeclareTEI.java
@@ -0,0 +1,82 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>An implementation of TagExtraInfo provided for <declare>.
+ * We simply set up a scripting variable for the ID and value that
+ * <declare> already stored. For EA2, DefineTEI *always* declares
+ * the variable; no option is given via a tag attribute. Visibility is
+ * always AT_END.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class DeclareTEI extends TagExtraInfo {
+
+ // purposely inherit JavaDoc and semantics from TagExtraInfo
+ public VariableInfo[] getVariableInfo(TagData data) {
+ // construct the relevant VariableInfo object
+ VariableInfo id = new VariableInfo(
+ data.getAttributeString("id"),
+ data.getAttributeString("type") == null ?
+ "java.lang.Object" : data.getAttributeString("type"),
+ true,
+ VariableInfo.AT_END);
+ return new VariableInfo[] { id };
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/ForEachTEI.java b/src/org/apache/taglibs/standard/tei/ForEachTEI.java
new file mode 100644
index 0000000..3e7ddbf
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/ForEachTEI.java
@@ -0,0 +1,84 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>An implementation of TagExtraInfo that implements validation for
+ * ForEachTag's attributes</p>
+ *
+ * @author Shawn Bayern
+ */
+public class ForEachTEI extends TagExtraInfo {
+
+ final private static String ITEMS = "items";
+ final private static String BEGIN = "begin";
+ final private static String END = "end";
+
+ /*
+ * Currently implements the following rules:
+ *
+ * - If 'items' is not specified, 'begin' and 'end' must be
+ */
+ public boolean isValid(TagData us) {
+ if (!Util.isSpecified(us, ITEMS))
+ if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END)))
+ return false;
+ return true;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tei/FormatDateTEI.java b/src/org/apache/taglibs/standard/tei/FormatDateTEI.java
new file mode 100644
index 0000000..e2e6b56
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/FormatDateTEI.java
@@ -0,0 +1,122 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <formatDate> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class FormatDateTEI extends TagExtraInfo {
+
+ private static final String TYPE_ATTRIBUTE = "type";
+ private static final String TIMESTYLE_ATTRIBUTE = "timeStyle";
+ private static final String DATESTYLE_ATTRIBUTE = "dateStyle";
+
+ /**
+ * Validates the attributes of the <formatDate> tag.
+ *
+ * <p> The following validation rules are enforced:
+ *
+ * <ul>
+ * <li> The (case-insensitive) value of the <tt>type</tt> attribute must
+ * be equal to "date", "time", or "both".
+ * <li> The (case-insensitive) value of the <tt>timeStyle</tt> and
+ * <tt>dateStyle</tt> attributes must be equal to "default",
+ * "short", "medium", "long", or
+ * "full".
+ * </ul>
+ */
+ public boolean isValid(TagData data) {
+ if (!isValidType(data)
+ || !isValidStyle(data.getAttributeString(TIMESTYLE_ATTRIBUTE))
+ || !isValidStyle(data.getAttributeString(DATESTYLE_ATTRIBUTE)))
+ return false;
+ return true;
+ }
+
+ /*
+ * Returns true if the 'type' attribute is valid.
+ */
+ static boolean isValidType(TagData data) {
+ String type = data.getAttributeString(TYPE_ATTRIBUTE);
+ if ((type != null)
+ && !type.equals(FormatDateSupport.DATE_STRING)
+ && !type.equals(FormatDateSupport.TIME_STRING)
+ && !type.equals(FormatDateSupport.DATETIME_STRING))
+ return false;
+ return true;
+ }
+
+ /*
+ * Returns true if the given 'timeStyle' or 'dateStyle' attribute is
+ * present.
+ */
+ private boolean isValidStyle(String style) {
+ if ((style != null)
+ && !style.equals(FormatDateSupport.DEFAULT_STYLE)
+ && !style.equals(FormatDateSupport.SHORT_STYLE)
+ && !style.equals(FormatDateSupport.MEDIUM_STYLE)
+ && !style.equals(FormatDateSupport.LONG_STYLE)
+ && !style.equals(FormatDateSupport.FULL_STYLE))
+ return false;
+ return true;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/FormatNumberTEI.java b/src/org/apache/taglibs/standard/tei/FormatNumberTEI.java
new file mode 100644
index 0000000..012dc8d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/FormatNumberTEI.java
@@ -0,0 +1,108 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+import org.apache.taglibs.standard.tag.common.fmt.FormatNumberSupport;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <formatNumber> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class FormatNumberTEI extends TagExtraInfo {
+
+ private static final String TYPE_ATTRIBUTE = "type";
+ private static final String PATTERN_ATTRIBUTE = "pattern";
+
+ /**
+ * Validates the attributes of the <formatNumber> tag.
+ *
+ * <p> The following validation rules are enforced:
+ *
+ * <ul>
+ * <li> The (case-insensitive) value of the <tt>type</tt> attribute must
+ * be equal to "number", "currency", or
+ * "percent".
+ * <li> The <tt>pattern</tt> attribute may be used only when formatting
+ * numbers (that is, if the <tt>type</tt> attribute is missing or equal to
+ * "number").
+ * </ul>
+ */
+ public boolean isValid(TagData data) {
+ return isValidFormatNumber(data);
+ }
+
+ /*
+ * Returns true if the 'type' and 'pattern' attributes are valid.
+ */
+ static boolean isValidFormatNumber(TagData data) {
+ String type = data.getAttributeString(TYPE_ATTRIBUTE);
+ if (type != null) {
+ if (!type.equals(FormatNumberSupport.NUMBER_STRING)
+ && !type.equals(FormatNumberSupport.CURRENCY_STRING)
+ && !type.equals(FormatNumberSupport.PERCENT_STRING))
+ return false;
+
+ if (Util.isSpecified(data, PATTERN_ATTRIBUTE)
+ && !type.equals(FormatNumberSupport.NUMBER_STRING))
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/LocaleTEI.java b/src/org/apache/taglibs/standard/tei/LocaleTEI.java
new file mode 100644
index 0000000..a3388cb
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/LocaleTEI.java
@@ -0,0 +1,74 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <locale> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class LocaleTEI extends TagExtraInfo {
+
+ /**
+ * Validates the <tt>scope</tt> attribute of the <locale> tag.
+ */
+ public boolean isValid(TagData data) {
+ return Util.isValidScope(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/MessageFormatTEI.java b/src/org/apache/taglibs/standard/tei/MessageFormatTEI.java
new file mode 100644
index 0000000..c4ef188
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/MessageFormatTEI.java
@@ -0,0 +1,74 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <messageFormat> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class MessageFormatTEI extends TagExtraInfo {
+
+ /**
+ * Validates the <tt>scope</tt> attribute of the <messageFormat> tag.
+ */
+ public boolean isValid(TagData data) {
+ return Util.isValidScope(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/MessageTEI.java b/src/org/apache/taglibs/standard/tei/MessageTEI.java
new file mode 100644
index 0000000..8d9ba65
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/MessageTEI.java
@@ -0,0 +1,74 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <message> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class MessageTEI extends TagExtraInfo {
+
+ /**
+ * Validates the <tt>scope</tt> attribute of the <message> tag.
+ */
+ public boolean isValid(TagData data) {
+ return Util.isValidScope(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/ParseDateTEI.java b/src/org/apache/taglibs/standard/tei/ParseDateTEI.java
new file mode 100644
index 0000000..eef8500
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/ParseDateTEI.java
@@ -0,0 +1,77 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <parseDate> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class ParseDateTEI extends TagExtraInfo {
+
+ /**
+ * Validates the <tt>type</tt> attribute of the <parseDate> tag.
+ *
+ * <p> The (case-insensitive) value of the <tt>type</tt> attribute must
+ * be equal to "date", "time", or "both".
+ */
+ public boolean isValid(TagData data) {
+ return FormatDateTEI.isValidType(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/ParseNumberTEI.java b/src/org/apache/taglibs/standard/tei/ParseNumberTEI.java
new file mode 100644
index 0000000..d867ccd
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/ParseNumberTEI.java
@@ -0,0 +1,85 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <parseNumber> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class ParseNumberTEI extends TagExtraInfo {
+
+ /**
+ * Validates the attributes of the <parseNumber> tag.
+ *
+ * <p> The following validation rules are enforced:
+ *
+ * <ul>
+ * <li> The (case-insensitive) value of the <tt>type</tt> attribute must
+ * be equal to "number", "currency", or
+ * "percent".
+ * <li> The <tt>pattern</tt> attribute may be used only when parsing
+ * numbers (that is, if the <tt>type</tt> attribute is missing or equal to
+ * "number").
+ * </ul>
+ */
+ public boolean isValid(TagData data) {
+ return FormatNumberTEI.isValidFormatNumber(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/TimeZoneTEI.java b/src/org/apache/taglibs/standard/tei/TimeZoneTEI.java
new file mode 100644
index 0000000..dab3a09
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/TimeZoneTEI.java
@@ -0,0 +1,74 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * An implementation of TagExtraInfo that implements validation for
+ * <timeZone> tag's attributes.
+ *
+ * @author Jan Luehe
+ */
+public class TimeZoneTEI extends TagExtraInfo {
+
+ /**
+ * Validates the <tt>scope</tt> attribute of the <timeZone> tag.
+ */
+ public boolean isValid(TagData data) {
+ return Util.isValidScope(data);
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/Util.java b/src/org/apache/taglibs/standard/tei/Util.java
new file mode 100644
index 0000000..e7078c8
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/Util.java
@@ -0,0 +1,89 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>Utilities in support of TagExtraInfo classes.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class Util {
+
+ private static final String SCOPE_ATTRIBUTE = "scope";
+ private static final String PAGE_SCOPE = "page";
+ private static final String REQUEST_SCOPE = "request";
+ private static final String SESSION_SCOPE = "session";
+
+ // returns true if the given attribute name is specified, false otherwise
+ public static boolean isSpecified(TagData data, String attributeName) {
+ return (data.getAttribute(attributeName) != null);
+ }
+
+ // returns true if the 'scope' attribute is valid
+ public static boolean isValidScope(TagData data) {
+ String scope = data.getAttributeString(SCOPE_ATTRIBUTE);
+
+ if ((scope != null)
+ && !scope.equals(PAGE_SCOPE)
+ && !scope.equals(REQUEST_SCOPE)
+ && !scope.equals(SESSION_SCOPE))
+ return false;
+
+ return true;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tei/XmlTransformTEI.java b/src/org/apache/taglibs/standard/tei/XmlTransformTEI.java
new file mode 100644
index 0000000..d40cbc2
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tei/XmlTransformTEI.java
@@ -0,0 +1,89 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tei;
+
+import javax.servlet.jsp.tagext.*;
+
+/**
+ * <p>An implementation of TagExtraInfo that implements validation for
+ * ForEachTag's attributes</p>
+ *
+ * @author Shawn Bayern
+ */
+public class XmlTransformTEI extends TagExtraInfo {
+
+ final private static String RESULT = "result";
+ final private static String TRANSFORMER = "transformer";
+ final private static String VAR = "var";
+ final private static String XSLT = "xslt";
+
+ /*
+ * Currently implements the following rules:
+ *
+ * - If 'items' is not specified, 'begin' and 'end' must be
+ */
+ public boolean isValid(TagData us) {
+ // disallow both XSLT and TRANSFORMER
+ if (Util.isSpecified(us, XSLT) && Util.isSpecified(us, TRANSFORMER))
+ return false;
+
+ // disallow both VAR and RESULT
+ if (Util.isSpecified(us, VAR) && Util.isSpecified(us, RESULT))
+ return false;
+ return true;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tlv/JstlBaseTLV.java b/src/org/apache/taglibs/standard/tlv/JstlBaseTLV.java
new file mode 100644
index 0000000..2165c69
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tlv/JstlBaseTLV.java
@@ -0,0 +1,258 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tlv;
+
+import java.io.*;
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.parsers.*;
+import org.xml.sax.*;
+import org.xml.sax.helpers.*;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluator;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A base class to support SAX-based validation in JSTL.</p>
+ *
+ * @author Shawn Bayern
+ */
+public abstract class JstlBaseTLV extends TagLibraryValidator {
+
+ //*********************************************************************
+ // Implementation Overview
+
+ /*
+ * We essentially just run the page through a SAX parser, handling
+ * the callbacks that interest us. The SAX parser is supplied by
+ * subclasses using the protected getHandler() method.
+ */
+
+ protected abstract DefaultHandler getHandler();
+
+
+ //*********************************************************************
+ // Constants
+
+ // parameter names
+ private final String EXP_ATT_PARAM = "expressionAttributes";
+
+
+ //*********************************************************************
+ // Validation and configuration state (protected)
+
+ protected String prefix; // our taglib's prefix
+ protected Vector messageVector; // temporary error messages
+ protected Map config; // configuration (Map of Sets)
+ protected boolean failed; // have we failed >0 times?
+ protected String lastElementId; // the last element we've seen
+
+ //*********************************************************************
+ // Constructor and lifecycle management
+
+ public JstlBaseTLV() {
+ super();
+ init();
+ }
+
+ private void init() {
+ messageVector = null;
+ prefix = null;
+ config = null;
+ }
+
+ public void release() {
+ super.release();
+ init();
+ }
+
+
+ //*********************************************************************
+ // Validation entry point
+
+ public synchronized ValidationMessage[] validate(
+ String prefix, String uri, PageData page) {
+ try {
+
+ // initialize
+ messageVector = new Vector();
+
+ // save the prefix
+ this.prefix = prefix;
+
+ // parse parameters if necessary
+ try {
+ if (config == null)
+ configure((String) getInitParameters().get(EXP_ATT_PARAM));
+ } catch (NoSuchElementException ex) {
+ // parsing error
+ return vmFromString(
+ Resources.getMessage("TLV_PARAMETER_ERROR",
+ EXP_ATT_PARAM));
+ }
+
+ // get a handler
+ DefaultHandler h = getHandler();
+
+ // parse the page
+ SAXParserFactory f = SAXParserFactory.newInstance();
+ f.setValidating(true);
+ SAXParser p = f.newSAXParser();
+ p.parse(page.getInputStream(), h);
+
+ if (messageVector.size() == 0)
+ return null;
+ else
+ return vmFromVector(messageVector);
+
+ } catch (SAXException ex) {
+ return vmFromString(ex.toString());
+ } catch (ParserConfigurationException ex) {
+ return vmFromString(ex.toString());
+ } catch (IOException ex) {
+ return vmFromString(ex.toString());
+ }
+ }
+
+ //*********************************************************************
+ // Protected utility functions
+
+ // delegate validation to the appropriate expression language
+ protected String validateExpression(String evaluator,
+ String elem, String att, String expr) {
+
+ // let's just use the cache kept by the ExpressionEvaluatorManager
+ ExpressionEvaluator current;
+ try {
+ current =
+ ExpressionEvaluatorManager.getEvaluatorByName(evaluator);
+ } catch (JspException ex) {
+ // (using JspException here feels ugly, but it's what EEM uses)
+ return ex.getMessage();
+ }
+
+ String response = current.validate(att, expr);
+ if (response == null)
+ return response;
+ else
+ return "<" + elem + "> / attribute = '" + att + "': "
+ + response;
+ }
+
+ // utility method to help us match elements in our tagset
+ protected boolean isTag(String qn, String unqualifiedName) {
+ return (qn.equals(prefix + ":" + unqualifiedName));
+ }
+
+ // utility method to determine if an attribute exists
+ protected boolean hasAttribute(Attributes a, String att) {
+ return (a.getValue(att) != null);
+ }
+
+ /*
+ * method to assist with failure [ as if it's not easy enough
+ * already :-) ]
+ */
+ protected void fail(String message) {
+ failed = true;
+ messageVector.add(new ValidationMessage(lastElementId, message));
+ }
+
+
+ //*********************************************************************
+ // Miscellaneous utility functions
+
+ // parses our configuration parameter for element:attribute pairs
+ private void configure(String info) {
+ // construct our configuration map
+ config = new HashMap();
+
+ // leave the map empty if we have nothing to configure
+ if (info == null)
+ return;
+
+ // separate parameter into space-separated tokens and store them
+ StringTokenizer st = new StringTokenizer(info);
+ while (st.hasMoreTokens()) {
+ String pair = st.nextToken();
+ StringTokenizer pairTokens = new StringTokenizer(pair, ":");
+ String element = pairTokens.nextToken();
+ String attribute = pairTokens.nextToken();
+ Object atts = config.get(element);
+ if (atts == null) {
+ atts = new HashSet();
+ config.put(element, atts);
+ }
+ ((Set) atts).add(attribute);
+ }
+ }
+
+ // constructs a ValidationMessage[] from a single String and no ID
+ static ValidationMessage[] vmFromString(String message) {
+ return new ValidationMessage[] {
+ new ValidationMessage(null, message)
+ };
+ }
+
+ // constructs a ValidationMessage[] from a ValidationMessage Vector
+ static ValidationMessage[] vmFromVector(Vector v) {
+ ValidationMessage[] vm = new ValidationMessage[v.size()];
+ for (int i = 0; i < vm.length; i++)
+ vm[i] = (ValidationMessage) v.get(i);
+ return vm;
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tlv/JstlCoreTLV.java b/src/org/apache/taglibs/standard/tlv/JstlCoreTLV.java
new file mode 100644
index 0000000..200cfc9
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tlv/JstlCoreTLV.java
@@ -0,0 +1,352 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tlv;
+
+import java.io.*;
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.parsers.*;
+import org.xml.sax.*;
+import org.xml.sax.helpers.*;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluator;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A SAX-based TagLibraryValidator for the core JSTL tag library.
+ * Currently implements the following checks:</p>
+ *
+ * <ul>
+ * <li>Expression syntax validation, with full support for
+ * <jx:expressionLanguage></li>
+ * <li>Choose / when / otherwise constraints</li>
+ * <li>Tag bodies that must either be empty or non-empty given
+ * particular attributes. (E.g., <set> cannot have a body when
+ * 'value' is specified; it *must* have a body otherwise.) For
+ * these purposes, "having a body" refers to non-whitespace
+ * content inside the tag.</li>
+ * <li>Other minor constraints.</li>
+ * </ul>
+ *
+ * @author Shawn Bayern
+ */
+public class JstlCoreTLV extends JstlBaseTLV {
+
+ //*********************************************************************
+ // Implementation Overview
+
+ /*
+ * We essentially just run the page through a SAX parser, handling
+ * the callbacks that interest us. We collapse <jsp:text> elements
+ * into the text they contain, since this simplifies processing
+ * somewhat. Even a quick glance at the implementation shows its
+ * necessary, tree-oriented nature: multiple Stacks, an understanding
+ * of 'depth', and so on all are important as we recover necessary
+ * state upon each callback. This TLV demonstrates various techniques,
+ * from the general "how do I use a SAX parser for a TLV?" to
+ * "how do I read my init parameters and then validate?" But also,
+ * the specific SAX methodology was kept as general as possible to
+ * allow for experimentation and flexibility.
+ */
+
+
+ //*********************************************************************
+ // Constants
+
+ // tag names
+ private final String CHOOSE = "choose";
+ private final String WHEN = "when";
+ private final String OTHERWISE = "otherwise";
+ private final String EXPR = "expr";
+ private final String SET = "set";
+ private final String IMPORT = "import";
+ private final String PARAM = "param";
+ private final String URL_ENCODE = "urlEncode";
+ private final String EXPLANG = "expressionLanguage";
+ private final String JSP_TEXT = "jsp:text";
+
+ // attribute names
+ private final String EVAL = "evaluator";
+ private final String VALUE = "value";
+ private final String DEFAULT = "default";
+ private final String VAR_READER = "varReader";
+
+
+ //*********************************************************************
+ // Contract fulfillment
+
+ protected DefaultHandler getHandler() {
+ return new Handler();
+ }
+
+
+ //*********************************************************************
+ // SAX event handler
+
+ /** The handler that provides the base of our implementation. */
+ private class Handler extends DefaultHandler {
+
+ // parser state
+ private int depth = 0;
+ private Stack chooseDepths = new Stack();
+ private Stack chooseHasOtherwise = new Stack();
+ private Stack expressionLanguage = new Stack();
+ private Stack importWithReaderDepths = new Stack();
+ private Stack importWithoutReaderDepths = new Stack();
+ private String lastElementName = null;
+ private boolean bodyNecessary = false;
+ private boolean bodyIllegal = false;
+ private boolean lastImportHadReader = false;
+
+ public Handler() {
+ // "install" the default evaluator
+ String defaultEvaluator = JstlCoreTLVHelper.getEvaluatorName();
+ if (defaultEvaluator != null)
+ expressionLanguage.push(defaultEvaluator);
+ }
+
+ // process under the existing context (state), then modify it
+ public void startElement(
+ String ns, String ln, String qn, Attributes a) {
+
+ // for simplicity, we can ignore <jsp:text> for our purposes
+ // (don't bother distinguishing between it and its characters)
+ if (qn.equals(JSP_TEXT))
+ return;
+
+ // check body-related constraint
+ if (bodyIllegal)
+ fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
+
+ // temporarily "install" new expression language if appropriate
+ if (isTag(qn, EXPLANG))
+ expressionLanguage.push(a.getValue(EVAL));
+
+ // validate expression syntax if we need to
+ Set expAtts;
+ if (qn.startsWith(prefix + ":")
+ && (expAtts = (Set) config.get(ln)) != null) {
+ for (int i = 0; i < a.getLength(); i++) {
+ String attName = a.getLocalName(i);
+ if (expAtts.contains(attName)) {
+ if (expressionLanguage.empty())
+ fail("Unexpected failure to determine "
+ + "expression language.");
+ String vMsg =
+ validateExpression(
+ (String) expressionLanguage.peek(),
+ ln,
+ attName,
+ a.getValue(i));
+ if (vMsg != null)
+ fail(vMsg);
+ }
+ }
+ }
+
+ // check invariants for <choose>
+ if (chooseChild()) {
+ // ensure <choose> has the right children
+ if(!isTag(qn, WHEN) && !isTag(qn, OTHERWISE)) {
+ fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
+ prefix, CHOOSE, qn));
+ }
+
+ // make sure <otherwise> is the last tag
+ if (((Boolean) chooseHasOtherwise.peek()).booleanValue()) {
+ fail(Resources.getMessage("TLV_ILLEGAL_ORDER",
+ qn, prefix, OTHERWISE, CHOOSE));
+ }
+ if (isTag(qn, OTHERWISE)) {
+ chooseHasOtherwise.pop();
+ chooseHasOtherwise.push(new Boolean(true));
+ }
+
+ }
+
+ // check invariants for <import>
+ if (!importWithReaderDepths.empty()) {
+ // we're in an <import varReader="..."> tag, where
+ // <param> tags are illegal
+ if (isTag(qn, PARAM)) {
+ fail(Resources.getMessage("TLV_ILLEGAL_PARAM",
+ prefix, PARAM, IMPORT, VAR_READER));
+ }
+ }
+ if (!importWithoutReaderDepths.empty()) {
+ // we're in an <import> without a Reader; nothing but
+ // <param> is allowed
+ if (!isTag(qn, PARAM))
+ fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
+ qn, prefix, IMPORT));
+ }
+
+ // now, modify state
+
+ // we're a choose, so record new choose-specific state
+ if (isTag(qn, CHOOSE)) {
+ chooseDepths.push(new Integer(depth));
+ chooseHasOtherwise.push(new Boolean(false));
+ }
+
+ // if we're in an import, record relevant state
+ if (isTag(qn, IMPORT)) {
+ if (hasAttribute(a, VAR_READER)) {
+ importWithReaderDepths.push(new Integer(depth));
+ lastImportHadReader = true;
+ } else {
+ importWithoutReaderDepths.push(new Integer(depth));
+ lastImportHadReader = false;
+ }
+ }
+
+ // set up a check against illegal attribute/body combinations
+ bodyIllegal = false;
+ bodyNecessary = false;
+ if (isTag(qn, EXPR)) {
+ if (hasAttribute(a, DEFAULT))
+ bodyIllegal = true;
+ } else if (isTag(qn, SET)) {
+ if (hasAttribute(a, VALUE))
+ bodyIllegal = true;
+ else
+ bodyNecessary = true;
+ } else if (isTag(qn, URL_ENCODE)) {
+ if (hasAttribute(a, VALUE))
+ bodyIllegal = true;
+ else
+ bodyNecessary = true;
+ }
+
+ // record the most recent tag (for error reporting)
+ lastElementName = qn;
+ lastElementId = a.getValue("id");
+
+ // we're a new element, so increase depth
+ depth++;
+ }
+
+ public void characters(char[] ch, int start, int length) {
+
+ // ignore strings that are just whitespace
+ String s = new String(ch, start, length).trim();
+ if (s.equals(""))
+ return;
+
+ // check and update body-related constraints
+ if (bodyIllegal)
+ fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
+ bodyNecessary = false; // body is no longer necessary!
+ if (!importWithoutReaderDepths.empty()) {
+ // we're in an <import> without a Reader; nothing but
+ // <param> is allowed
+ fail(Resources.getMessage("TLV_ILLEGAL_BODY",
+ prefix + ":" + IMPORT));
+ }
+
+ // make sure <choose> has no non-whitespace text
+ if (chooseChild()) {
+ String msg =
+ Resources.getMessage("TLV_ILLEGAL_TEXT_BODY",
+ prefix, CHOOSE,
+ (s.length() < 7 ? s : s.substring(0,7)));
+ fail(msg);
+ }
+ }
+
+ public void endElement(String ns, String ln, String qn) {
+
+ // consistently, we ignore JSP_TEXT
+ if (qn.equals(JSP_TEXT))
+ return;
+
+ // handle body-related invariant
+ if (bodyNecessary)
+ fail(Resources.getMessage("TLV_MISSING_BODY",
+ lastElementName));
+ bodyIllegal = false; // reset: we've left the tag
+
+ // update <choose>-related state
+ if (isTag(qn, CHOOSE)) {
+ chooseDepths.pop();
+ chooseHasOtherwise.pop();
+ }
+
+ // update <import>-related state
+ if (isTag(qn, IMPORT)) {
+ if (lastImportHadReader)
+ importWithReaderDepths.pop();
+ else
+ importWithoutReaderDepths.pop();
+ }
+
+ // update language state
+ if (isTag(qn, EXPLANG))
+ expressionLanguage.pop();
+
+ // update our depth
+ depth--;
+ }
+
+ // are we directly under a <choose>?
+ private boolean chooseChild() {
+ return (!chooseDepths.empty()
+ && (depth - 1) == ((Integer) chooseDepths.peek()).intValue());
+ }
+
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tlv/JstlCoreTLVHelper.java b/src/org/apache/taglibs/standard/tlv/JstlCoreTLVHelper.java
new file mode 100644
index 0000000..3ec600d
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tlv/JstlCoreTLVHelper.java
@@ -0,0 +1,105 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tlv;
+
+import javax.servlet.*;
+
+/**
+ * <p>A helper class for the TLV that listens to the servlet context
+ * in order to store and vend out (to the TLV) relevant context
+ * parameters.</p>
+ *
+ * <p>This class is application-dependent; it is expected that one
+ * version of it will be loaded per application.</p>
+ *
+ * @author Shawn Bayern
+ */
+public class JstlCoreTLVHelper implements ServletContextListener {
+
+ //*********************************************************************
+ // Constants
+ private static final String EVALUATOR_PARAMETER =
+ "javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass";
+
+
+ //*********************************************************************
+ // Static state
+
+ private static String evaluatorName = null;
+
+
+ //*********************************************************************
+ // Static state retrival methods
+
+ public static String getEvaluatorName() {
+ return evaluatorName;
+ }
+
+
+ //*********************************************************************
+ // Implementation of 'listener' behavior
+
+ // recovers the one context parameter we need
+ public void contextInitialized(ServletContextEvent sce) {
+ evaluatorName =
+ sce.getServletContext().getInitParameter(EVALUATOR_PARAMETER);
+ }
+
+ public void contextDestroyed(ServletContextEvent sce) {
+ evaluatorName = null;
+ }
+
+}
diff --git a/src/org/apache/taglibs/standard/tlv/JstlXmlTLV.java b/src/org/apache/taglibs/standard/tlv/JstlXmlTLV.java
new file mode 100644
index 0000000..d57ab2f
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tlv/JstlXmlTLV.java
@@ -0,0 +1,301 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tlv;
+
+import java.io.*;
+import java.util.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import javax.xml.parsers.*;
+import org.xml.sax.*;
+import org.xml.sax.helpers.*;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluator;
+import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
+import org.apache.taglibs.standard.resources.Resources;
+
+/**
+ * <p>A SAX-based TagLibraryValidator for the JSTL XML library.
+ * Currently implements the following checks:</p>
+ *
+ * <ul>
+ * <li>Expression syntax validation, with full support for
+ * <jx:expressionLanguage></li>
+ * <li>Choose / when / otherwise constraints</li>
+ * <li>Tag bodies that must either be empty or non-empty given
+ * particular attributes.</li>
+ * <li>Other minor constraints.</li>
+ * </ul>
+ *
+ * @author Shawn Bayern
+ */
+public class JstlXmlTLV extends JstlBaseTLV {
+
+ //*********************************************************************
+ // Implementation Overview
+
+ /*
+ * We essentially just run the page through a SAX parser, handling
+ * the callbacks that interest us. We collapse <jsp:text> elements
+ * into the text they contain, since this simplifies processing
+ * somewhat. Even a quick glance at the implementation shows its
+ * necessary, tree-oriented nature: multiple Stacks, an understanding
+ * of 'depth', and so on all are important as we recover necessary
+ * state upon each callback. This TLV demonstrates various techniques,
+ * from the general "how do I use a SAX parser for a TLV?" to
+ * "how do I read my init parameters and then validate?" But also,
+ * the specific SAX methodology was kept as general as possible to
+ * allow for experimentation and flexibility.
+ *
+ * Much of the code and structure is duplicated from JstlCoreTLV.
+ * An effort has been made to re-use code where unambiguously useful.
+ * However, splitting logic among parent/child classes isn't the
+ * cleanest approach when writing a parser like the one we need.
+ */
+
+
+ //*********************************************************************
+ // Constants
+
+ // tag names
+ private final String CHOOSE = "choose";
+ private final String WHEN = "when";
+ private final String OTHERWISE = "otherwise";
+ private final String PARSE = "parse";
+ private final String PARAM = "param";
+ private final String TRANSFORM = "transform";
+ private final String EXPLANG = "expressionLanguage";
+ private final String JSP_TEXT = "jsp:text";
+
+ // attribute names
+ private final String EVAL = "evaluator";
+ private final String VALUE = "value";
+ private final String SOURCE = "source";
+
+
+ //*********************************************************************
+ // Contract fulfillment
+
+ protected DefaultHandler getHandler() {
+ return new Handler();
+ }
+
+
+ //*********************************************************************
+ // SAX event handler
+
+ /** The handler that provides the base of our implementation. */
+ private class Handler extends DefaultHandler {
+
+ // parser state
+ private int depth = 0;
+ private Stack chooseDepths = new Stack();
+ private Stack chooseHasOtherwise = new Stack();
+ private Stack expressionLanguage = new Stack();
+ private String lastElementName = null;
+ private boolean bodyNecessary = false;
+ private boolean bodyIllegal = false;
+
+ public Handler() {
+ // "install" the default evaluator
+ String defaultEvaluator = JstlCoreTLVHelper.getEvaluatorName();
+ if (defaultEvaluator != null)
+ expressionLanguage.push(defaultEvaluator);
+ }
+
+ // process under the existing context (state), then modify it
+ public void startElement(
+ String ns, String ln, String qn, Attributes a) {
+
+ // for simplicity, we can ignore <jsp:text> for our purposes
+ // (don't bother distinguishing between it and its characters)
+ if (qn.equals(JSP_TEXT))
+ return;
+
+ // check body-related constraint
+ if (bodyIllegal)
+ fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
+
+ // temporarily "install" new expression language if appropriate
+ if (isTag(qn, EXPLANG))
+ expressionLanguage.push(a.getValue(EVAL));
+
+ // validate expression syntax if we need to
+ Set expAtts;
+ if (qn.startsWith(prefix + ":")
+ && (expAtts = (Set) config.get(ln)) != null) {
+ for (int i = 0; i < a.getLength(); i++) {
+ String attName = a.getLocalName(i);
+ if (expAtts.contains(attName)) {
+ if (expressionLanguage.empty())
+ fail("Unexpected failure to determine "
+ + "expression language.");
+ String vMsg =
+ validateExpression(
+ (String) expressionLanguage.peek(),
+ ln,
+ attName,
+ a.getValue(i));
+ if (vMsg != null)
+ fail(vMsg);
+ }
+ }
+ }
+
+ // check invariants for <choose>
+ if (chooseChild()) {
+ // ensure <choose> has the right children
+ if(!isTag(qn, WHEN) && !isTag(qn, OTHERWISE)) {
+ fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
+ prefix, CHOOSE, qn));
+ }
+
+ // make sure <otherwise> is the last tag
+ if (((Boolean) chooseHasOtherwise.peek()).booleanValue()) {
+ fail(Resources.getMessage("TLV_ILLEGAL_ORDER",
+ qn, prefix, OTHERWISE, CHOOSE));
+ }
+ if (isTag(qn, OTHERWISE)) {
+ chooseHasOtherwise.pop();
+ chooseHasOtherwise.push(new Boolean(true));
+ }
+
+ }
+
+ // now, modify state
+
+ // we're a choose, so record new choose-specific state
+ if (isTag(qn, CHOOSE)) {
+ chooseDepths.push(new Integer(depth));
+ chooseHasOtherwise.push(new Boolean(false));
+ }
+
+ // set up a check against illegal attribute/body combinations
+ bodyIllegal = false;
+ bodyNecessary = false;
+ if (isTag(qn, PARSE) || isTag(qn, TRANSFORM)) {
+ if (hasAttribute(a, SOURCE))
+ bodyIllegal = true;
+ } else if (isTag(qn, PARAM)) {
+ if (hasAttribute(a, VALUE))
+ bodyIllegal = true;
+ else
+ bodyNecessary = true;
+ }
+
+ // record the most recent tag (for error reporting)
+ lastElementName = qn;
+ lastElementId = a.getValue("id");
+
+ // we're a new element, so increase depth
+ depth++;
+ }
+
+ public void characters(char[] ch, int start, int length) {
+
+ // ignore strings that are just whitespace
+ String s = new String(ch, start, length).trim();
+ if (s.equals(""))
+ return;
+
+ // check and update body-related constraints
+ if (bodyIllegal)
+ fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
+ bodyNecessary = false; // body is no longer necessary!
+
+ // make sure <choose> has no non-whitespace text
+ if (chooseChild()) {
+ String msg =
+ Resources.getMessage("TLV_ILLEGAL_TEXT_BODY",
+ prefix, CHOOSE,
+ (s.length() < 7 ? s : s.substring(0,7)));
+ fail(msg);
+ }
+ }
+
+ public void endElement(String ns, String ln, String qn) {
+
+ // consistently, we ignore JSP_TEXT
+ if (qn.equals(JSP_TEXT))
+ return;
+
+ // handle body-related invariant
+ if (bodyNecessary)
+ fail(Resources.getMessage("TLV_MISSING_BODY",
+ lastElementName));
+ bodyIllegal = false; // reset: we've left the tag
+
+ // update <choose>-related state
+ if (isTag(qn, CHOOSE)) {
+ chooseDepths.pop();
+ chooseHasOtherwise.pop();
+ }
+
+ // update language state
+ if (isTag(qn, EXPLANG))
+ expressionLanguage.pop();
+
+ // update our depth
+ depth--;
+ }
+
+ // are we directly under a <choose>?
+ private boolean chooseChild() {
+ return (!chooseDepths.empty()
+ && (depth - 1) == ((Integer) chooseDepths.peek()).intValue());
+ }
+
+ }
+}
diff --git a/src/org/apache/taglibs/standard/tlv/ScriptFreeTLV.java b/src/org/apache/taglibs/standard/tlv/ScriptFreeTLV.java
new file mode 100644
index 0000000..fcffdac
--- /dev/null
+++ b/src/org/apache/taglibs/standard/tlv/ScriptFreeTLV.java
@@ -0,0 +1,268 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 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", "Tomcat", 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.taglibs.standard.tlv;
+
+import javax.servlet.jsp.tagext.TagLibraryValidator;
+import javax.servlet.jsp.tagext.PageData;
+import javax.servlet.jsp.tagext.ValidationMessage;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.SAXParser;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.DefaultHandler;
+import java.io.InputStream;
+import java.util.Map;
+
+import java.io.IOException;
+import org.xml.sax.SAXException;
+import javax.xml.parsers.ParserConfigurationException;
+
+/**
+ * <p>A SAX-based TagLibraryValidator for enforcing restrictions against
+ * the use of JSP scripting elements.</p>
+ * <p>This TLV supports four initialization parameters, for controlling
+ * which of the four types of scripting elements are allowed or prohibited:</p>
+ * <ul>
+ * <li><b>allowDeclarations</b>: if true, indicates that declaration elements
+ * are not prohibited.
+ * <li><b>allowScriptlets</b>: if true, indicates that scriptlets are not
+ * prohibited
+ * <li><b>allowExpressions</b>: if true, indicates that top-level expression
+ * elements (i.e., expressions not associated with request-time attribute
+ * values) are not prohibited.
+ * <li><b>allowRTExpressions</b>: if true, indicates that expression elements
+ * associated with request-time attribute values are not prohibited.
+ * </ul>
+ * <p>The default value for all for initialization parameters is false,
+ * indicating all forms of scripting elements are to be prohibited.</p>
+ *
+ * @author <a href="mailto:mak@taglib.com">Mark A. Kolb</a>
+ * @author Shawn Bayern
+ */
+public class ScriptFreeTLV extends TagLibraryValidator {
+ private boolean allowDeclarations = false;
+ private boolean allowScriptlets = false;
+ private boolean allowExpressions = false;
+ private boolean allowRTExpressions = false;
+ private SAXParserFactory factory;
+
+ /**
+ * Constructs a new validator instance.
+ * Initializes the parser factory to create non-validating, namespace-aware
+ * SAX parsers.
+ */
+ public ScriptFreeTLV () {
+ factory = SAXParserFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ }
+ /**
+ * Sets the values of the initialization parameters, as supplied in the TLD.
+ * @param initParms a mapping from the names of the initialization parameters
+ * to their values, as specified in the TLD.
+ */
+ public void setInitParameters (Map initParms) {
+ super.setInitParameters(initParms);
+ String declarationsParm = (String) initParms.get("allowDeclarations");
+ String scriptletsParm = (String) initParms.get("allowScriptlets");
+ String expressionsParm = (String) initParms.get("allowExpressions");
+ String rtExpressionsParm = (String) initParms.get("allowRTExpressions");
+
+ allowDeclarations = "true".equalsIgnoreCase(declarationsParm);
+ allowScriptlets = "true".equalsIgnoreCase(scriptletsParm);
+ allowExpressions = "true".equalsIgnoreCase(expressionsParm);
+ allowRTExpressions = "true".equalsIgnoreCase(rtExpressionsParm);
+ }
+
+ /**
+ * Validates a single JSP page.
+ * @param prefix the namespace prefix specified by the page for the
+ * custom tag library being validated.
+ * @param uri the URI specified by the page for the TLD of the
+ * custom tag library being validated.
+ * @param page a wrapper around the XML representation of the page
+ * being validated.
+ * @returns null, if the page is valid; otherwise, a ValidationMessage[]
+ * containing one or more messages indicating why the page is not valid.
+ */
+ public ValidationMessage[] validate
+ (String prefix, String uri, PageData page) {
+ InputStream in = null;
+ SAXParser parser;
+ MyContentHandler handler = new MyContentHandler();
+ try {
+ synchronized (factory) {
+ parser = factory.newSAXParser();
+ }
+ in = page.getInputStream();
+ parser.parse(in, handler);
+ }
+ catch (ParserConfigurationException e) {
+ return JstlBaseTLV.vmFromString(e.getMessage());
+ }
+ catch (SAXException e) {
+ return JstlBaseTLV.vmFromString(e.getMessage());
+ }
+ catch (IOException e) {
+ return JstlBaseTLV.vmFromString(e.getMessage());
+ }
+ finally {
+ if (in != null) try { in.close(); } catch (IOException e) {}
+ }
+ return handler.reportResults();
+ }
+
+ /**
+ * Handler for SAX events.
+ * Four counters are provided as instance variables,
+ * for counting occurrences of prohibited scripting elements.
+ */
+ private class MyContentHandler extends DefaultHandler {
+ private int declarationCount = 0;
+ private int scriptletCount = 0;
+ private int expressionCount = 0;
+ private int rtExpressionCount = 0;
+
+ /**
+ * This event is received whenever a new element is encountered.
+ * The qualified name of each such element is compared against
+ * the names of any prohibited scripting elements. When found, the
+ * corresponding counter is incremented.
+ * If expressions representing request-time attribute values are
+ * prohibited, it is also necessary to check the values of all
+ * attributes specified by the element. (Trying to figure out
+ * which attributes actually support request-time attribute values
+ * and checking only those is far more trouble than it's worth.)
+ */
+ public void startElement (String namespaceUri,
+ String localName, String qualifiedName,
+ Attributes atts) {
+ if ((! allowDeclarations)
+ && qualifiedName.equals("jsp:declaration"))
+ ++declarationCount;
+ else if ((! allowScriptlets)
+ && qualifiedName.equals("jsp:scriptlet"))
+ ++scriptletCount;
+ else if ((! allowExpressions)
+ && qualifiedName.equals("jsp:expression"))
+ ++expressionCount;
+ if (! allowRTExpressions) countRTExpressions(atts);
+ }
+ /**
+ * Auxiliary method for checking attribute values to see if
+ * are specified via request-time attribute values.
+ * Expressions representing request-time attribute values are
+ * recognized by their "%=" and "%" delimiters. When found, the
+ * corresponding counter is incremented.
+ */
+ private void countRTExpressions (Attributes atts) {
+ int stop = atts.getLength();
+ for (int i = 0; i < stop; ++i) {
+ String attval = atts.getValue(i);
+ if (attval.startsWith("%=") && attval.endsWith("%"))
+ ++rtExpressionCount;
+ }
+ }
+ /**
+ * Constructs a String reporting the number(s) of prohibited
+ * scripting elements that were detected, if any.
+ * Returns null if no violations were found, making the result
+ * of this method suitable for the return value of the
+ * TagLibraryValidator.validate() method.
+ *
+ * TODO: The update from 7/13/2001 merely makes this validator
+ * compliant with the new TLV API, but does not fully take advantage
+ * of this API. In the future, we should do so... but because
+ * of the possibility that anti-script checking will be incorporated
+ * into the base TLV, I've held off for now and just changed this
+ * class to use the new API. -- SB.
+ */
+ public ValidationMessage[] reportResults () {
+ if (declarationCount + scriptletCount + expressionCount > 0) {
+ StringBuffer results = new StringBuffer("JSP page contains ");
+ boolean first = true;
+ if (declarationCount > 0) {
+ results.append(Integer.toString(declarationCount));
+ results.append(" declaration");
+ if (declarationCount > 1) results.append('s');
+ first = false;
+ }
+ if (scriptletCount > 0) {
+ if (! first) results.append(", ");
+ results.append(Integer.toString(scriptletCount));
+ results.append(" scriptlet");
+ if (scriptletCount > 1) results.append('s');
+ first = false;
+ }
+ if (expressionCount > 0) {
+ if (! first) results.append(", ");
+ results.append(Integer.toString(expressionCount));
+ results.append(" expression");
+ if (expressionCount > 1) results.append('s');
+ }
+ if (rtExpressionCount > 0) {
+ if (! first) results.append(", ");
+ results.append(Integer.toString(rtExpressionCount));
+ results.append(" request-time attribute value");
+ if (rtExpressionCount > 1) results.append('s');
+ }
+ results.append(".");
+ return JstlBaseTLV.vmFromString(results.toString());
+ } else {
+ return null;
+ }
+ }
+ }
+}
diff --git a/xml/intro.xml b/xml/intro.xml
new file mode 100644
index 0000000..4e9ec7c
--- /dev/null
+++ b/xml/intro.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<document url="./intro.xml">
+
+<!-- Change all instances of jsptl with the jakarta-taglib
+ name for this tag library.
+
+ Change all instances of {display-name} with the name to use
+ for things such as titles in the tag library documentation.
+
+ Change all instances of {your-name} with your name, this is
+ for things such as document author and list of contributors.
+
+ If you are doing a release of the taglib, replace {release-version}
+ with the version of the taglib.
+
+ For a news item, replace date="MM/DD/YYYY" with the date.
+ -->
+
+<properties>
+ <author>Glenn Nielsen</author>
+ <title>The Jakarta-Taglibs Project: JSP Standard Tag Library (JSTL)</title>
+</properties>
+
+<body>
+
+ <section name="JSP Standard Tag Library" href="Welcome">
+
+ <p>The <a href="http://www.jcp.org/jsr/detail/52.jsp">JSR-052 Expert Group</a>,
+ operating under the Java Community Process, will be hosting the
+ reference implementation of the JSP Standard Tag Library (JSTL) at
+ Jakarta Taglibs. JSTL is not finalized yet, but early-access releases
+ are currently available.
+ </p>
+
+ <p><b>NOTE:</b> JSTL requires a JSP container that supports
+ the Java Servlet 2.3 and JavaServer Pages 1.2 specifications.
+ Jakarta <a href="http://jakarta.apache.org/tomcat/">
+ Tomcat 4</a> supports the new specifications.
+ </p>
+
+ <p><b>IMPORTANT:</b> This release of JSTL is an early-access release and
+ does not represent a standard of any kind. The API and implementation are
+ subject to change in the future. The major purpose of this release is to
+ provide early information to the community of JSP developers about the
+ direction and scope of JSTL. Community feedback is actively sought; if
+ you have any comments, please email us at
+ <a href="mailto:jsr052-comments@sun.com">jsr052-comments@sun.com</a>.
+ </p>
+
+ </section>
+
+ <section name="JSP Standard Tag Library News" href="News">
+
+ <news>
+ <newsitem date="10/09/2001">
+ Early Access Release 1.2 is now available for
+ <a href="/builds/jakarta-taglibs/releases/jsptl">download</a>.
+ This version, like EA 1.1, is compatible with Tomcat 4.0.
+ </newsitem>
+ <newsitem date="07/23/2001">
+ Early Access Release 1.1 as made available for download.
+ This version was compatible with
+ Tomcat 4 B6 and Tomcat 4.0.
+ </newsitem>
+ <newsitem date="07/10/2001">
+ Early Access Release 1 of the JSTL was made available for
+ download.
+ </newsitem>
+ <newsitem date="07/08/2001">
+ JSTL contributed by the Java Community Process
+ <a href="http://www.jcp.org/jsr/detail/52.jsp">JSR-052 Expert Group</a>
+ and imported into CVS.
+ </newsitem>
+ </news>
+
+ </section>
+
+ <section name="Documentation" href="Documentation">
+
+ <p>For more information about the JSP Standard Tag Library,
+ look at the on-line documentation:</p>
+ <ul>
+ <!-- Uncomment this section and modify as needed when you start
+ doing releases of the taglib, a link can be made to each
+ available release. -->
+ <li>View the current release (EA2.2)
+ <a href="jsptl-ea1/index.html">
+ JSP Standard Tag Library EA2 Documentation</a>
+ </li>
+
+ <li>View the development version of the
+ <a href="index.html">JSP Standard Tag Library Documentation</a>
+ </li>
+ </ul>
+
+ <p>For information on how to use the distributions,
+ look at the following documentation:</p>
+
+ <ul>
+ <li>Using the Jakarta-Taglibs
+ <a href="http://jakarta.apache.org/taglibs/binarydist.html">
+ Binary Distribution</a></li>
+ <li>Using the Jakarta-Taglibs
+ <a href="http://jakarta.apache.org/taglibs/sourcedist.html">
+ Source Distribution</a></li>
+ </ul>
+
+ </section>
+
+ <section name="Download" href="Download">
+
+ <!-- Uncomment this section and modify as needed when you start
+ doing releases of the taglib. -->
+ <p>Download a binary distribution of the JSP Standard Tag Library
+ EA2 release</p>
+ <ul>
+ <li>Download
+ <a href="http://jakarta.apache.org/builds/jakarta-taglibs/releases/jsptl/">
+ JSP Standard Tag Library EA2 release</a></li>
+ </ul>
+
+ <p>A download of the nightly development build for the JSP Standard
+ Tag Library as a binary distribution is available</p>
+ <ul>
+ <li>Download
+ <a href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly/projects/jsptl/">
+ JSP Standard Tag Library build</a></li>
+ </ul>
+
+ <p>Nightly build distributions of the development version for all the
+ Jakarta-Taglibs are available for download:</p>
+ <ul>
+ <li>Download
+ <a href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly/src/">
+ Jakarta-Taglibs Source</a></li>
+ <li>Download entire
+ <a href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly">
+ Jakarta-Taglibs Distribution</a></li>
+ </ul>
+
+ </section>
+
+ <section name="Contributors" href="Contributors">
+
+ <p>List of contributors:</p>
+
+ <ul>
+ <li>The <a href="http://www.jcp.org/jsr/detail/52.jsp">JSR-052 Expert Group</a></li>
+ <li>Shawn Bayern</li>
+ <li>Pierre Delisle</li>
+ <li>Scott Hasse</li>
+ <li>Nathan Abramson</li>
+ <li>Glenn Nielsen</li>
+ <li>Mark Kolb</li>
+ <li>Dmitri Plotnikov</li>
+ <li>Justyna Horwat</li>
+ </ul>
+
+ </section>
+
+ </body>
+
+</document>