├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── api
├── jstl-api.iml
├── pom.xml
└── src
│ └── main
│ └── java
│ └── javax
│ └── servlet
│ └── jsp
│ └── jstl
│ ├── core
│ ├── ConditionalTagSupport.java
│ ├── Config.java
│ ├── IndexedValueExpression.java
│ ├── IteratedExpression.java
│ ├── IteratedValueExpression.java
│ ├── LoopTag.java
│ ├── LoopTagStatus.java
│ ├── LoopTagSupport.java
│ └── package.html
│ ├── fmt
│ ├── LocaleSupport.java
│ ├── LocalizationContext.java
│ └── package.html
│ ├── sql
│ ├── Result.java
│ ├── ResultImpl.java
│ ├── ResultSupport.java
│ ├── SQLExecutionTag.java
│ └── package.html
│ └── tlv
│ ├── PermittedTaglibsTLV.java
│ ├── ScriptFreeTLV.java
│ └── package.html
├── impl
├── exclude.xml
├── jstl-impl.iml
├── jstl-impl.ipr
├── jstl-impl.iws
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── apache
│ │ └── taglibs
│ │ └── standard
│ │ ├── Version.java
│ │ ├── extra
│ │ └── spath
│ │ │ ├── ASCII_CharStream.java
│ │ │ ├── ASCII_UCodeESC_CharStream.java
│ │ │ ├── AbsolutePath.java
│ │ │ ├── AttributePredicate.java
│ │ │ ├── ParseException.java
│ │ │ ├── Path.java
│ │ │ ├── Predicate.java
│ │ │ ├── RelativePath.java
│ │ │ ├── SPathFilter.java
│ │ │ ├── SPathParser.java
│ │ │ ├── SPathParser.jj
│ │ │ ├── SPathParserConstants.java
│ │ │ ├── SPathParserTokenManager.java
│ │ │ ├── SPathTag.java
│ │ │ ├── Step.java
│ │ │ ├── Token.java
│ │ │ ├── TokenMgrError.java
│ │ │ └── spath.tld
│ │ ├── functions
│ │ └── Functions.java
│ │ ├── lang
│ │ ├── jstl
│ │ │ ├── AndOperator.java
│ │ │ ├── ArithmeticOperator.java
│ │ │ ├── ArraySuffix.java
│ │ │ ├── BeanInfoIndexedProperty.java
│ │ │ ├── BeanInfoManager.java
│ │ │ ├── BeanInfoProperty.java
│ │ │ ├── BinaryOperator.java
│ │ │ ├── BinaryOperatorExpression.java
│ │ │ ├── BooleanLiteral.java
│ │ │ ├── Coercions.java
│ │ │ ├── ComplexValue.java
│ │ │ ├── Constants.java
│ │ │ ├── DivideOperator.java
│ │ │ ├── ELEvaluator.java
│ │ │ ├── ELException.java
│ │ │ ├── ELParser.jj
│ │ │ ├── EmptyOperator.java
│ │ │ ├── EnumeratedMap.java
│ │ │ ├── EqualityOperator.java
│ │ │ ├── EqualsOperator.java
│ │ │ ├── Evaluator.java
│ │ │ ├── Expression.java
│ │ │ ├── ExpressionString.java
│ │ │ ├── FloatingPointLiteral.java
│ │ │ ├── FunctionInvocation.java
│ │ │ ├── GreaterThanOperator.java
│ │ │ ├── GreaterThanOrEqualsOperator.java
│ │ │ ├── ImplicitObjects.java
│ │ │ ├── IntegerDivideOperator.java
│ │ │ ├── IntegerLiteral.java
│ │ │ ├── JSTLVariableResolver.java
│ │ │ ├── LessThanOperator.java
│ │ │ ├── LessThanOrEqualsOperator.java
│ │ │ ├── Literal.java
│ │ │ ├── Logger.java
│ │ │ ├── MinusOperator.java
│ │ │ ├── ModulusOperator.java
│ │ │ ├── MultiplyOperator.java
│ │ │ ├── NamedValue.java
│ │ │ ├── NotEqualsOperator.java
│ │ │ ├── NotOperator.java
│ │ │ ├── NullLiteral.java
│ │ │ ├── OrOperator.java
│ │ │ ├── PlusOperator.java
│ │ │ ├── PrimitiveObjects.java
│ │ │ ├── PropertySuffix.java
│ │ │ ├── RelationalOperator.java
│ │ │ ├── Resources.properties
│ │ │ ├── Resources_ja.properties
│ │ │ ├── StringLiteral.java
│ │ │ ├── UnaryMinusOperator.java
│ │ │ ├── UnaryOperator.java
│ │ │ ├── UnaryOperatorExpression.java
│ │ │ ├── ValueSuffix.java
│ │ │ ├── VariableResolver.java
│ │ │ ├── parser
│ │ │ │ ├── ELParser.java
│ │ │ │ ├── ELParserConstants.java
│ │ │ │ ├── ELParserTokenManager.java
│ │ │ │ ├── ParseException.java
│ │ │ │ ├── SimpleCharStream.java
│ │ │ │ ├── Token.java
│ │ │ │ └── TokenMgrError.java
│ │ │ └── test
│ │ │ │ ├── Bean1.java
│ │ │ │ ├── Bean2.java
│ │ │ │ ├── Bean2Editor.java
│ │ │ │ ├── EvaluationTest.java
│ │ │ │ ├── PageContextImpl.java
│ │ │ │ ├── ParserTest.java
│ │ │ │ ├── StaticFunctionTests.java
│ │ │ │ ├── beans
│ │ │ │ ├── Factory.java
│ │ │ │ ├── PrivateBean1a.java
│ │ │ │ ├── PrivateBean2b.java
│ │ │ │ ├── PrivateBean2c.java
│ │ │ │ ├── PrivateBean2d.java
│ │ │ │ ├── PublicBean1.java
│ │ │ │ ├── PublicBean1b.java
│ │ │ │ ├── PublicBean2a.java
│ │ │ │ └── PublicInterface2.java
│ │ │ │ ├── evaluationTests.txt
│ │ │ │ ├── evaluationTestsOutput.txt
│ │ │ │ ├── parserTests.txt
│ │ │ │ └── parserTestsOutput.txt
│ │ └── support
│ │ │ ├── ExpressionEvaluator.java
│ │ │ └── ExpressionEvaluatorManager.java
│ │ ├── resources
│ │ ├── Resources.java
│ │ ├── Resources.properties
│ │ └── Resources_ja.properties
│ │ ├── tag
│ │ ├── common
│ │ │ ├── core
│ │ │ │ ├── CatchTag.java
│ │ │ │ ├── ChooseTag.java
│ │ │ │ ├── DeclareTag.java
│ │ │ │ ├── ForEachSupport.java
│ │ │ │ ├── ForTokensSupport.java
│ │ │ │ ├── ImportSupport.java
│ │ │ │ ├── NullAttributeException.java
│ │ │ │ ├── OtherwiseTag.java
│ │ │ │ ├── OutSupport.java
│ │ │ │ ├── ParamParent.java
│ │ │ │ ├── ParamSupport.java
│ │ │ │ ├── RedirectSupport.java
│ │ │ │ ├── RemoveTag.java
│ │ │ │ ├── SetSupport.java
│ │ │ │ ├── UrlSupport.java
│ │ │ │ ├── Util.java
│ │ │ │ └── WhenTagSupport.java
│ │ │ ├── fmt
│ │ │ │ ├── BundleSupport.java
│ │ │ │ ├── FormatDateSupport.java
│ │ │ │ ├── FormatNumberSupport.java
│ │ │ │ ├── MessageSupport.java
│ │ │ │ ├── ParamSupport.java
│ │ │ │ ├── ParseDateSupport.java
│ │ │ │ ├── ParseNumberSupport.java
│ │ │ │ ├── RequestEncodingSupport.java
│ │ │ │ ├── SetBundleSupport.java
│ │ │ │ ├── SetLocaleSupport.java
│ │ │ │ ├── SetTimeZoneSupport.java
│ │ │ │ └── TimeZoneSupport.java
│ │ │ ├── sql
│ │ │ │ ├── DataSourceUtil.java
│ │ │ │ ├── DataSourceWrapper.java
│ │ │ │ ├── DateParamTagSupport.java
│ │ │ │ ├── DriverTag.java
│ │ │ │ ├── ParamTagSupport.java
│ │ │ │ ├── QueryTagSupport.java
│ │ │ │ ├── ResultImpl.java
│ │ │ │ ├── SetDataSourceTagSupport.java
│ │ │ │ ├── TransactionTagSupport.java
│ │ │ │ └── UpdateTagSupport.java
│ │ │ └── xml
│ │ │ │ ├── ExprSupport.java
│ │ │ │ ├── ForEachTag.java
│ │ │ │ ├── IfTag.java
│ │ │ │ ├── JSTLXPathConstants.java
│ │ │ │ ├── JSTLXPathFactory.java
│ │ │ │ ├── JSTLXPathImpl.java
│ │ │ │ ├── JSTLXPathNamespaceContext.java
│ │ │ │ ├── JSTLXPathVariableResolver.java
│ │ │ │ ├── ParamSupport.java
│ │ │ │ ├── ParseSupport.java
│ │ │ │ ├── SetTag.java
│ │ │ │ ├── TransformSupport.java
│ │ │ │ ├── UnresolvableException.java
│ │ │ │ ├── WhenTag.java
│ │ │ │ └── XPathUtil.java
│ │ ├── el
│ │ │ ├── core
│ │ │ │ ├── ExpressionUtil.java
│ │ │ │ ├── ForEachTag.java
│ │ │ │ ├── ForTokensTag.java
│ │ │ │ ├── IfTag.java
│ │ │ │ ├── ImportTag.java
│ │ │ │ ├── OutTag.java
│ │ │ │ ├── ParamTag.java
│ │ │ │ ├── RedirectTag.java
│ │ │ │ ├── SetTag.java
│ │ │ │ ├── UrlTag.java
│ │ │ │ └── WhenTag.java
│ │ │ ├── fmt
│ │ │ │ ├── BundleTag.java
│ │ │ │ ├── FormatDateTag.java
│ │ │ │ ├── FormatNumberTag.java
│ │ │ │ ├── MessageTag.java
│ │ │ │ ├── ParamTag.java
│ │ │ │ ├── ParseDateTag.java
│ │ │ │ ├── ParseNumberTag.java
│ │ │ │ ├── RequestEncodingTag.java
│ │ │ │ ├── SetBundleTag.java
│ │ │ │ ├── SetLocaleTag.java
│ │ │ │ ├── SetTimeZoneTag.java
│ │ │ │ └── TimeZoneTag.java
│ │ │ ├── sql
│ │ │ │ ├── DateParamTag.java
│ │ │ │ ├── ParamTag.java
│ │ │ │ ├── QueryTag.java
│ │ │ │ ├── SetDataSourceTag.java
│ │ │ │ ├── TransactionTag.java
│ │ │ │ └── UpdateTag.java
│ │ │ └── xml
│ │ │ │ ├── ExprTag.java
│ │ │ │ ├── ParamTag.java
│ │ │ │ ├── ParseTag.java
│ │ │ │ └── TransformTag.java
│ │ └── rt
│ │ │ ├── core
│ │ │ ├── ForEachTag.java
│ │ │ ├── ForTokensTag.java
│ │ │ ├── IfTag.java
│ │ │ ├── ImportTag.java
│ │ │ ├── OutTag.java
│ │ │ ├── ParamTag.java
│ │ │ ├── RedirectTag.java
│ │ │ ├── SetTag.java
│ │ │ ├── UrlTag.java
│ │ │ └── WhenTag.java
│ │ │ ├── fmt
│ │ │ ├── BundleTag.java
│ │ │ ├── FormatDateTag.java
│ │ │ ├── FormatNumberTag.java
│ │ │ ├── MessageTag.java
│ │ │ ├── ParamTag.java
│ │ │ ├── ParseDateTag.java
│ │ │ ├── ParseNumberTag.java
│ │ │ ├── RequestEncodingTag.java
│ │ │ ├── SetBundleTag.java
│ │ │ ├── SetLocaleTag.java
│ │ │ ├── SetTimeZoneTag.java
│ │ │ └── TimeZoneTag.java
│ │ │ ├── sql
│ │ │ ├── DateParamTag.java
│ │ │ ├── ParamTag.java
│ │ │ ├── QueryTag.java
│ │ │ ├── SetDataSourceTag.java
│ │ │ ├── TransactionTag.java
│ │ │ └── UpdateTag.java
│ │ │ └── xml
│ │ │ ├── ExprTag.java
│ │ │ ├── ParamTag.java
│ │ │ ├── ParseTag.java
│ │ │ └── TransformTag.java
│ │ ├── tei
│ │ ├── DeclareTEI.java
│ │ ├── ForEachTEI.java
│ │ ├── ImportTEI.java
│ │ ├── Util.java
│ │ ├── XmlParseTEI.java
│ │ └── XmlTransformTEI.java
│ │ └── tlv
│ │ ├── JstlBaseTLV.java
│ │ ├── JstlCoreTLV.java
│ │ ├── JstlFmtTLV.java
│ │ ├── JstlSqlTLV.java
│ │ └── JstlXmlTLV.java
│ └── resources
│ └── META-INF
│ ├── c-1_0-rt.tld
│ ├── c-1_0.tld
│ ├── c.tld
│ ├── fmt-1_0-rt.tld
│ ├── fmt-1_0.tld
│ ├── fmt.tld
│ ├── fn.tld
│ ├── permittedTaglibs.tld
│ ├── scriptfree.tld
│ ├── sql-1_0-rt.tld
│ ├── sql-1_0.tld
│ ├── sql.tld
│ ├── x-1_0-rt.tld
│ ├── x-1_0.tld
│ └── x.tld
└── pom.xml
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | #### :warning:This project is now part of the EE4J initiative. This repository has been archived as all activities are now happening in the [corresponding Eclipse repository](https://github.com/eclipse-ee4j/jstl-api). See [here](https://www.eclipse.org/ee4j/status.php) for the overall EE4J transition status.
2 |
3 | ---
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #### :warning:This project is now part of the EE4J initiative. This repository has been archived as all activities are now happening in the [corresponding Eclipse repository](https://github.com/eclipse-ee4j/jstl-api). See [here](https://www.eclipse.org/ee4j/status.php) for the overall EE4J transition status.
2 |
3 | ---
4 | # Prerequisites
5 |
6 | To build this project, Oracle JDK 1.7 is required.
7 |
8 | While JDK 1.7 allows the project to build despite Javadoc tags/params related warning, it fails with JDK 1.8.
9 |
--------------------------------------------------------------------------------
/api/jstl-api.iml:
--------------------------------------------------------------------------------
1 |
2 |
JSTL allows developers to write custom iteration tags by 24 | * implementing the LoopTag interface. This is not to be confused 25 | * with javax.servlet.jsp.tagext.IterationTag as defined in JSP 1.2. 26 | * LoopTag establishes a mechanism for iteration tags to be recognized 27 | * and for type-safe implicit collaboration with custom subtags. 28 | * 29 | *
In most cases, it will not be necessary to implement this interface 30 | * manually, for a base support class (LoopTagSupport) is provided 31 | * to facilitate implementation.
32 | * 33 | * @author Shawn Bayern 34 | */ 35 | 36 | public interface LoopTag extends Tag { 37 | 38 | /** 39 | * Retrieves the current item in the iteration. Behaves 40 | * idempotently; calling getCurrent() repeatedly should return the same 41 | * Object until the iteration is advanced. (Specifically, calling 42 | * getCurrent() does not advance the iteration.) 43 | * 44 | * @return the current item as an object 45 | */ 46 | public Object getCurrent(); 47 | 48 | /** 49 | * Retrieves a 'status' object to provide information about the 50 | * current round of the iteration. 51 | * 52 | * @return The LoopTagStatus for the current LoopTag. 53 | */ 54 | public LoopTagStatus getLoopStatus(); 55 | } 56 | -------------------------------------------------------------------------------- /api/src/main/java/javax/servlet/jsp/jstl/core/package.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Classes and interfaces related to the core tag library component of the JavaServer Pages Standard Tag Library (JSTL). 27 | 28 |This tag library component provides: 29 |
This tag library component provides a number of formatting tags which allow numbers, dates, and times in a JSP page to be formatted and parsed in a locale-sensitive or customized manner. 29 | 30 | 31 | -------------------------------------------------------------------------------- /api/src/main/java/javax/servlet/jsp/jstl/tlv/package.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | Reusable Tag Library Validator (TLV) classes provided by the JavaServer Pages Standard Tag Library (JSTL). 27 | 28 |TLVs allow translation-time validation of the XML view of a JSP page. The TLVs provided by JSTL allow tag library authors to enforce restrictions regarding the use of scripting elements and permitted tag libraries in JSP pages. 29 | 30 |
For example, any JSP page that imports the tag library with the following Tag Library Descriptor (TLD) file will be restricted to using JSTL tags: 31 | 32 |
33 | <?xml version="1.0" encoding="UTF-8" ?> 34 | 35 | <taglib xmlns="http://java.sun.com/xml/ns/javaee" 36 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 37 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" 38 | version="2.1"> 39 | <description> 40 | Restricts JSP pages to the JSTL tag libraries 41 | </description> 42 | <display-name>permittedTaglibs</display-name> 43 | <tlib-version>1.1</tlib-version> 44 | <short-name>permittedTaglibs</short-name> 45 | <uri>http://java.sun.com/jstl/permittedTaglibs</uri> 46 | 47 | <validator> 48 | <validator-class> 49 | javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV 50 | </validator-class> 51 | <init-param> 52 | <description> 53 | Whitespace-separated list of taglib URIs to permit. 54 | </description> 55 | <param-name>permittedTaglibs</param-name> 56 | <param-value> 57 | http://java.sun.com/jsp/jstl/core 58 | http://java.sun.com/jsp/jstl/fmt 59 | http://java.sun.com/jsp/jstl/sql 60 | http://java.sun.com/jsp/jstl/xml 61 | </param-value> 62 | </init-param> 63 | </validator> 64 | </taglib> 65 |66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /impl/exclude.xml: -------------------------------------------------------------------------------- 1 | 42 | 43 |
Represents an absolute SPath expression. Essentially a marker 24 | * class.
25 | * 26 | * @author Shawn Bayern 27 | */ 28 | public class AbsolutePath extends Path { 29 | 30 | private boolean all; 31 | private RelativePath base; 32 | 33 | /** 34 | * Constructs a new AbsolutePath object based on a RelativePath. 35 | * An absolute path is the same as a relative path, except that it 36 | * begins with '/' or '//' (which one, of those two, can be 37 | * determined by the first Step returned from getSteps()). 38 | */ 39 | public AbsolutePath(RelativePath base) { 40 | if (base == null) 41 | throw new IllegalArgumentException("non-null base required"); 42 | this.base = base; 43 | } 44 | 45 | // inherit JavaDoc comment 46 | public List getSteps() { 47 | // simply return our base's Step objects 48 | return base.getSteps(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/extra/spath/AttributePredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.extra.spath; 19 | 20 | 21 | /** 22 | *Represents a predicate expression concerning a single attribute.
23 | * 24 | * @author Shawn Bayern 25 | */ 26 | public class AttributePredicate extends Predicate { 27 | 28 | private String attribute, target; 29 | 30 | /** 31 | * Constructs a new AttributePredicate, given an attribute name 32 | * and a target literal (with which to test equality). 33 | */ 34 | public AttributePredicate(String attribute, String target) { 35 | if (attribute == null) 36 | throw new IllegalArgumentException("non-null attribute needed"); 37 | if (attribute.indexOf(":") != -1) 38 | throw new IllegalArgumentException( 39 | "namespace-qualified attribute names are not currently " + 40 | "supported"); 41 | this.attribute = attribute; 42 | 43 | if (target == null) 44 | throw new IllegalArgumentException("non-null target needed"); 45 | // strip quotation marks from target 46 | this.target = target.substring(1, target.length() - 1); 47 | } 48 | 49 | /** 50 | * Returns true if the given SAX AttributeList is suitable, given our 51 | * attribute name and target; returns false otherwise. 52 | */ 53 | public boolean isMatchingAttribute(org.xml.sax.Attributes a) { 54 | String attValue = a.getValue("", attribute); 55 | return (attValue != null && attValue.equals(target)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/extra/spath/Path.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.extra.spath; 19 | 20 | import java.util.List; 21 | 22 | /** 23 | *Represents a simple path (SPath) expression. A path is an ordered 24 | * list of Steps. 25 | * 26 | * @author Shawn Bayern 27 | */ 28 | public abstract class Path { 29 | 30 | /** 31 | * Retrives an ordered list of Step objects representing this 32 | * expression. The result is safely modifiable by the caller and 33 | * must support List.add(Object) and List.add(int, Object). 34 | */ 35 | public abstract List getSteps(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/extra/spath/Predicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.extra.spath; 19 | 20 | 21 | /** 22 | *
Represents a simple predicate expression.
23 | * 24 | * @author Shawn Bayern 25 | */ 26 | public abstract class Predicate { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.extra.spath; 19 | 20 | import java.util.List; 21 | import java.util.Vector; 22 | 23 | /** 24 | *Represents a relative SPath expression.
25 | * 26 | * @author Shawn Bayern 27 | */ 28 | public class RelativePath extends Path { 29 | 30 | private RelativePath next; 31 | private Step step; 32 | 33 | /** 34 | * Constructs a new RelativePath object, based on a Step and another 35 | * (possibly null) RelativePath. If 'all' is true, then the path 36 | * matches all instances of 'next' underneath 'step'; otherwise; 37 | * 'next' must be an immediate child of 'step'. 38 | */ 39 | public RelativePath(Step step, RelativePath next) { 40 | if (step == null) 41 | throw new IllegalArgumentException("non-null step required"); 42 | this.step = step; 43 | this.next = next; 44 | } 45 | 46 | // inherit JavaDoc comment 47 | public List getSteps() { 48 | // simply merge our 'step' with our 'next' 49 | List l; 50 | if (next != null) 51 | l = next.getSteps(); 52 | else 53 | l = new Vector(); 54 | l.add(0, step); 55 | return l; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.extra.spath; 19 | 20 | public interface SPathParserConstants { 21 | 22 | int EOF = 0; 23 | int LITERAL = 1; 24 | int QNAME = 2; 25 | int NCNAME = 3; 26 | int NSWILDCARD = 4; 27 | int NCNAMECHAR = 5; 28 | int LETTER = 6; 29 | int DIGIT = 7; 30 | int COMBINING_CHAR = 8; 31 | int EXTENDER = 9; 32 | int UNDERSCORE = 10; 33 | int DOT = 11; 34 | int DASH = 12; 35 | int SLASH = 13; 36 | int STAR = 14; 37 | int COLON = 15; 38 | int START_BRACKET = 16; 39 | int END_BRACKET = 17; 40 | int AT = 18; 41 | int EQUALS = 19; 42 | 43 | int DEFAULT = 0; 44 | 45 | String[] tokenImage = { 46 | "Tag handler that exposes SPath functionality.
26 | * 27 | * @author Shawn Bayern 28 | */ 29 | 30 | public class SPathTag extends TagSupport { 31 | 32 | //********************************************************************* 33 | // Internal state 34 | 35 | private String select; // tag attribute 36 | private String var; // tag attribute 37 | 38 | //********************************************************************* 39 | // Construction and initialization 40 | 41 | /** 42 | * Constructs a new handler. As with TagSupport, subclasses should 43 | * not provide other constructors and are expected to call the 44 | * superclass constructor. 45 | */ 46 | public SPathTag() { 47 | super(); 48 | init(); 49 | } 50 | 51 | // resets local state 52 | private void init() { 53 | select = var = null; 54 | } 55 | 56 | 57 | //********************************************************************* 58 | // Tag logic 59 | 60 | // applies XPath expression from 'select' and exposes a filter as 'var' 61 | public int doStartTag() throws JspException { 62 | try { 63 | SPathFilter s = new SPathFilter(new SPathParser(select).expression()); 64 | pageContext.setAttribute(var, s); 65 | return SKIP_BODY; 66 | } catch (ParseException ex) { 67 | throw new JspTagException(ex.toString(), ex); 68 | } 69 | } 70 | 71 | // Releases any resources we may have (or inherit) 72 | public void release() { 73 | super.release(); 74 | init(); 75 | } 76 | 77 | 78 | //********************************************************************* 79 | // Attribute accessors 80 | 81 | public void setSelect(String select) { 82 | this.select = select; 83 | } 84 | 85 | public void setVar(String var) { 86 | this.var = var; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/AndOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *The implementation of the and operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class AndOperator 29 | extends BinaryOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final AndOperator SINGLETON = 36 | new AndOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public AndOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "and"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given value 63 | **/ 64 | public Object apply (Object pLeft, 65 | Object pRight, 66 | Object pContext, 67 | Logger pLogger) 68 | throws ELException 69 | { 70 | // Coerce the values to booleans 71 | boolean left = 72 | Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); 73 | boolean right = 74 | Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); 75 | 76 | return PrimitiveObjects.getBoolean (left && right); 77 | } 78 | 79 | //------------------------------------- 80 | /** 81 | * 82 | * Returns true if evaluation is necessary given the specified Left 83 | * value. The And/OrOperators make use of this 84 | **/ 85 | public boolean shouldEvaluate (Object pLeft) 86 | { 87 | return 88 | (pLeft instanceof Boolean) && 89 | ((Boolean) pLeft).booleanValue () == true; 90 | } 91 | 92 | //------------------------------------- 93 | /** 94 | * 95 | * Returns true if the operator expects its arguments to be coerced 96 | * to Booleans. The And/Or operators set this to true. 97 | **/ 98 | public boolean shouldCoerceToBoolean () 99 | { 100 | return true; 101 | } 102 | 103 | //------------------------------------- 104 | } 105 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArithmeticOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
This is the superclass for all binary arithmetic operators 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public abstract class ArithmeticOperator 29 | extends BinaryOperator 30 | { 31 | //------------------------------------- 32 | /** 33 | * 34 | * Applies the operator to the given value 35 | **/ 36 | public Object apply (Object pLeft, 37 | Object pRight, 38 | Object pContext, 39 | Logger pLogger) 40 | throws ELException 41 | { 42 | return Coercions.applyArithmeticOperator (pLeft, pRight, this, pLogger); 43 | } 44 | 45 | //------------------------------------- 46 | /** 47 | * 48 | * Applies the operator to the given double values, returning a double 49 | **/ 50 | public abstract double apply (double pLeft, 51 | double pRight, 52 | Logger pLogger); 53 | 54 | //------------------------------------- 55 | /** 56 | * 57 | * Applies the operator to the given double values, returning a double 58 | **/ 59 | public abstract long apply (long pLeft, 60 | long pRight, 61 | Logger pLogger); 62 | 63 | //------------------------------------- 64 | } 65 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.beans.PropertyDescriptor; 21 | import java.lang.reflect.Method; 22 | 23 | /** 24 | * 25 | *
This contains the information for one property in a BeanInfo - 26 | * PropertyDescriptor, read method, and write method. This class is 27 | * necessary because the read/write methods in the PropertyDescriptor 28 | * may not be accessible if the bean given to the introspector is not 29 | * a public class. In this case, a publicly accessible version of the 30 | * method must be found by searching for a public superclass/interface 31 | * that declares the method (this searching is done by the 32 | * BeanInfoManager). 33 | * 34 | * @author Nathan Abramson - Art Technology Group 35 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 36 | **/ 37 | 38 | public class BeanInfoProperty 39 | { 40 | //------------------------------------- 41 | // Properties 42 | //------------------------------------- 43 | // property readMethod 44 | 45 | Method mReadMethod; 46 | public Method getReadMethod () 47 | { return mReadMethod; } 48 | 49 | //------------------------------------- 50 | // property writeMethod 51 | 52 | Method mWriteMethod; 53 | public Method getWriteMethod () 54 | { return mWriteMethod; } 55 | 56 | //------------------------------------- 57 | // property propertyDescriptor 58 | 59 | PropertyDescriptor mPropertyDescriptor; 60 | public PropertyDescriptor getPropertyDescriptor () 61 | { return mPropertyDescriptor; } 62 | 63 | //------------------------------------- 64 | /** 65 | * 66 | * Constructor 67 | **/ 68 | public BeanInfoProperty (Method pReadMethod, 69 | Method pWriteMethod, 70 | PropertyDescriptor pPropertyDescriptor) 71 | { 72 | mReadMethod = pReadMethod; 73 | mWriteMethod = pWriteMethod; 74 | mPropertyDescriptor = pPropertyDescriptor; 75 | } 76 | 77 | //------------------------------------- 78 | } 79 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
This is the superclass for all binary operators 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public abstract class BinaryOperator 29 | { 30 | //------------------------------------- 31 | /** 32 | * 33 | * Constructor 34 | **/ 35 | public BinaryOperator () 36 | { 37 | } 38 | 39 | //------------------------------------- 40 | // Expression methods 41 | //------------------------------------- 42 | /** 43 | * 44 | * Returns the symbol representing the operator 45 | **/ 46 | public abstract String getOperatorSymbol (); 47 | 48 | //------------------------------------- 49 | /** 50 | * 51 | * Applies the operator to the given pair of values 52 | **/ 53 | public abstract Object apply (Object pLeft, 54 | Object pRight, 55 | Object pContext, 56 | Logger pLogger) 57 | throws ELException; 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Returns true if evaluation is necessary given the specified Left 63 | * value. The And/OrOperators make use of this 64 | **/ 65 | public boolean shouldEvaluate (Object pLeft) 66 | { 67 | return true; 68 | } 69 | 70 | //------------------------------------- 71 | /** 72 | * 73 | * Returns true if the operator expects its arguments to be coerced 74 | * to Booleans. The And/Or operators set this to true. 75 | **/ 76 | public boolean shouldCoerceToBoolean () 77 | { 78 | return false; 79 | } 80 | 81 | //------------------------------------- 82 | } 83 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BooleanLiteral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
An expression representing a boolean literal value 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class BooleanLiteral 29 | extends Literal 30 | { 31 | //------------------------------------- 32 | // Member variables 33 | //------------------------------------- 34 | 35 | public static final BooleanLiteral TRUE = new BooleanLiteral ("true"); 36 | public static final BooleanLiteral FALSE = new BooleanLiteral ("false"); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public BooleanLiteral (String pToken) 44 | { 45 | super (getValueFromToken (pToken)); 46 | } 47 | 48 | //------------------------------------- 49 | /** 50 | * 51 | * Parses the given token into the literal value 52 | **/ 53 | static Object getValueFromToken (String pToken) 54 | { 55 | return 56 | ("true".equals (pToken)) ? 57 | Boolean.TRUE : 58 | Boolean.FALSE; 59 | } 60 | 61 | //------------------------------------- 62 | // Expression methods 63 | //------------------------------------- 64 | /** 65 | * 66 | * Returns the expression in the expression language syntax 67 | **/ 68 | public String getExpressionString () 69 | { 70 | return (getValue () == Boolean.TRUE) ? "true" : "false"; 71 | } 72 | 73 | //------------------------------------- 74 | } 75 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/DivideOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the divide operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class DivideOperator 29 | extends BinaryOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final DivideOperator SINGLETON = 36 | new DivideOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public DivideOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "/"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given value 63 | **/ 64 | public Object apply (Object pLeft, 65 | Object pRight, 66 | Object pContext, 67 | Logger pLogger) 68 | throws ELException 69 | { 70 | if (pLeft == null && 71 | pRight == null) { 72 | if (pLogger.isLoggingWarning ()) { 73 | pLogger.logWarning 74 | (Constants.ARITH_OP_NULL, 75 | getOperatorSymbol ()); 76 | } 77 | return PrimitiveObjects.getInteger (0); 78 | } 79 | 80 | double left = 81 | Coercions.coerceToPrimitiveNumber (pLeft, Double.class, pLogger). 82 | doubleValue (); 83 | double right = 84 | Coercions.coerceToPrimitiveNumber (pRight, Double.class, pLogger). 85 | doubleValue (); 86 | 87 | try { 88 | return PrimitiveObjects.getDouble (left / right); 89 | } 90 | catch (Exception exc) { 91 | if (pLogger.isLoggingError ()) { 92 | pLogger.logError 93 | (Constants.ARITH_ERROR, 94 | getOperatorSymbol (), 95 | "" + left, 96 | "" + right); 97 | } 98 | return PrimitiveObjects.getInteger (0); 99 | } 100 | } 101 | 102 | //------------------------------------- 103 | } 104 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | 21 | /** 22 | * 23 | * Represents any of the exception conditions that arise during the 24 | * operation evaluation of the evaluator. 25 | * 26 | * @author Nathan Abramson - Art Technology Group 27 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 28 | **/ 29 | 30 | public class ELException 31 | extends Exception 32 | { 33 | //------------------------------------- 34 | // Member variables 35 | //------------------------------------- 36 | 37 | Throwable mRootCause; 38 | 39 | //------------------------------------- 40 | /** 41 | * 42 | * Constructor 43 | **/ 44 | public ELException () 45 | { 46 | super (); 47 | } 48 | 49 | //------------------------------------- 50 | /** 51 | * 52 | * Constructor 53 | **/ 54 | public ELException (String pMessage) 55 | { 56 | super (pMessage); 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Constructor 63 | **/ 64 | public ELException (Throwable pRootCause) 65 | { 66 | mRootCause = pRootCause; 67 | } 68 | 69 | //------------------------------------- 70 | /** 71 | * 72 | * Constructor 73 | **/ 74 | public ELException (String pMessage, 75 | Throwable pRootCause) 76 | { 77 | super (pMessage); 78 | mRootCause = pRootCause; 79 | } 80 | 81 | //------------------------------------- 82 | /** 83 | * 84 | * Returns the root cause 85 | **/ 86 | public Throwable getRootCause () 87 | { 88 | return mRootCause; 89 | } 90 | 91 | //------------------------------------- 92 | /** 93 | * 94 | * String representation 95 | **/ 96 | public String toString () 97 | { 98 | if (getMessage () == null) { 99 | return mRootCause.toString (); 100 | } 101 | else if (mRootCause == null) { 102 | return getMessage (); 103 | } 104 | else { 105 | return getMessage () + ": " + mRootCause; 106 | } 107 | } 108 | 109 | //------------------------------------- 110 | } 111 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EmptyOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.lang.reflect.Array; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | /** 25 | * 26 | *
The implementation of the empty operator 27 | * 28 | * @author Nathan Abramson - Art Technology Group 29 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 30 | **/ 31 | 32 | public class EmptyOperator 33 | extends UnaryOperator 34 | { 35 | //------------------------------------- 36 | // Singleton 37 | //------------------------------------- 38 | 39 | public static final EmptyOperator SINGLETON = 40 | new EmptyOperator (); 41 | 42 | //------------------------------------- 43 | /** 44 | * 45 | * Constructor 46 | **/ 47 | public EmptyOperator () 48 | { 49 | } 50 | 51 | //------------------------------------- 52 | // Expression methods 53 | //------------------------------------- 54 | /** 55 | * 56 | * Returns the symbol representing the operator 57 | **/ 58 | public String getOperatorSymbol () 59 | { 60 | return "empty"; 61 | } 62 | 63 | //------------------------------------- 64 | /** 65 | * 66 | * Applies the operator to the given value 67 | **/ 68 | public Object apply (Object pValue, 69 | Object pContext, 70 | Logger pLogger) 71 | throws ELException 72 | { 73 | // See if the value is null 74 | if (pValue == null) { 75 | return PrimitiveObjects.getBoolean (true); 76 | } 77 | 78 | // See if the value is a zero-length String 79 | else if ("".equals (pValue)) { 80 | return PrimitiveObjects.getBoolean (true); 81 | } 82 | 83 | // See if the value is a zero-length array 84 | else if (pValue.getClass ().isArray () && 85 | Array.getLength (pValue) == 0) { 86 | return PrimitiveObjects.getBoolean (true); 87 | } 88 | 89 | // See if the value is an empty List 90 | else if (pValue instanceof List && 91 | ((List) pValue).isEmpty ()) { 92 | return PrimitiveObjects.getBoolean (true); 93 | } 94 | 95 | // See if the value is an empty Map 96 | else if (pValue instanceof Map && 97 | ((Map) pValue).isEmpty ()) { 98 | return PrimitiveObjects.getBoolean (true); 99 | } 100 | 101 | // Otherwise, not empty 102 | else { 103 | return PrimitiveObjects.getBoolean (false); 104 | } 105 | } 106 | 107 | //------------------------------------- 108 | } 109 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualityOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
This is the superclass for all equality operators (==, !=) 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public abstract class EqualityOperator 29 | extends BinaryOperator 30 | { 31 | //------------------------------------- 32 | /** 33 | * 34 | * Applies the operator to the given value 35 | **/ 36 | public Object apply (Object pLeft, 37 | Object pRight, 38 | Object pContext, 39 | Logger pLogger) 40 | throws ELException 41 | { 42 | return Coercions.applyEqualityOperator (pLeft, pRight, this, pLogger); 43 | } 44 | 45 | //------------------------------------- 46 | /** 47 | * 48 | * Applies the operator given the fact that the two elements are 49 | * equal. 50 | **/ 51 | public abstract boolean apply (boolean pAreEqual, 52 | Logger pLogger); 53 | 54 | //------------------------------------- 55 | } 56 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualsOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the equals operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class EqualsOperator 29 | extends EqualityOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final EqualsOperator SINGLETON = 36 | new EqualsOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public EqualsOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "=="; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator given the fact that the two elements are 63 | * equal. 64 | **/ 65 | public boolean apply (boolean pAreEqual, 66 | Logger pLogger) 67 | { 68 | return pAreEqual; 69 | } 70 | 71 | //------------------------------------- 72 | } 73 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Expression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.util.Map; 21 | 22 | /** 23 | * 24 | *
The abstract class from which all expression types 25 | * derive. 26 | * 27 | * @author Nathan Abramson - Art Technology Group 28 | * @author Shawn Bayern 29 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 30 | **/ 31 | 32 | public abstract class Expression 33 | { 34 | //------------------------------------- 35 | // Member variables 36 | //------------------------------------- 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Returns the expression in the expression language syntax 42 | **/ 43 | public abstract String getExpressionString (); 44 | 45 | //------------------------------------- 46 | /** 47 | * 48 | * Evaluates the expression in the given context 49 | **/ 50 | public abstract Object evaluate (Object pContext, 51 | VariableResolver pResolver, 52 | Map functions, 53 | String defaultPrefix, 54 | Logger pLogger) 55 | throws ELException; 56 | 57 | //------------------------------------- 58 | 59 | } 60 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FloatingPointLiteral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
An expression representing a floating point literal value. The 23 | * value is stored internally as a double. 24 | * 25 | * @author Nathan Abramson - Art Technology Group 26 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 27 | **/ 28 | 29 | public class FloatingPointLiteral 30 | extends Literal 31 | { 32 | //------------------------------------- 33 | /** 34 | * 35 | * Constructor 36 | **/ 37 | public FloatingPointLiteral (String pToken) 38 | { 39 | super (getValueFromToken (pToken)); 40 | } 41 | 42 | //------------------------------------- 43 | /** 44 | * 45 | * Parses the given token into the literal value 46 | **/ 47 | static Object getValueFromToken (String pToken) 48 | { 49 | return new Double (pToken); 50 | } 51 | 52 | //------------------------------------- 53 | // Expression methods 54 | //------------------------------------- 55 | /** 56 | * 57 | * Returns the expression in the expression language syntax 58 | **/ 59 | public String getExpressionString () 60 | { 61 | return getValue ().toString (); 62 | } 63 | 64 | //------------------------------------- 65 | } 66 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerDivideOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the integer divide operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class IntegerDivideOperator 29 | extends BinaryOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final IntegerDivideOperator SINGLETON = 36 | new IntegerDivideOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public IntegerDivideOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "idiv"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given value 63 | **/ 64 | public Object apply (Object pLeft, 65 | Object pRight, 66 | Object pContext, 67 | Logger pLogger) 68 | throws ELException 69 | { 70 | if (pLeft == null && 71 | pRight == null) { 72 | if (pLogger.isLoggingWarning ()) { 73 | pLogger.logWarning 74 | (Constants.ARITH_OP_NULL, 75 | getOperatorSymbol ()); 76 | } 77 | return PrimitiveObjects.getInteger (0); 78 | } 79 | 80 | long left = 81 | Coercions.coerceToPrimitiveNumber (pLeft, Long.class, pLogger). 82 | longValue (); 83 | long right = 84 | Coercions.coerceToPrimitiveNumber (pRight, Long.class, pLogger). 85 | longValue (); 86 | 87 | try { 88 | return PrimitiveObjects.getLong (left / right); 89 | } 90 | catch (Exception exc) { 91 | if (pLogger.isLoggingError ()) { 92 | pLogger.logError 93 | (Constants.ARITH_ERROR, 94 | getOperatorSymbol (), 95 | "" + left, 96 | "" + right); 97 | } 98 | return PrimitiveObjects.getInteger (0); 99 | } 100 | } 101 | 102 | //------------------------------------- 103 | } 104 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerLiteral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
An expression representing an integer literal value. The value 23 | * is stored internally as a long. 24 | * 25 | * @author Nathan Abramson - Art Technology Group 26 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: jluehe $ 27 | **/ 28 | 29 | public class IntegerLiteral 30 | extends Literal 31 | { 32 | //------------------------------------- 33 | /** 34 | * 35 | * Constructor 36 | **/ 37 | public IntegerLiteral (String pToken) 38 | { 39 | super (getValueFromToken (pToken)); 40 | } 41 | 42 | //------------------------------------- 43 | /** 44 | * 45 | * Parses the given token into the literal value 46 | **/ 47 | static Object getValueFromToken (String pToken) 48 | { 49 | return Long.valueOf(pToken); 50 | } 51 | 52 | //------------------------------------- 53 | // Expression methods 54 | //------------------------------------- 55 | /** 56 | * 57 | * Returns the expression in the expression language syntax 58 | **/ 59 | public String getExpressionString () 60 | { 61 | return getValue ().toString (); 62 | } 63 | 64 | //------------------------------------- 65 | } 66 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Literal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.util.Map; 21 | 22 | /** 23 | * 24 | *
An expression representing a literal value 25 | * 26 | * @author Nathan Abramson - Art Technology Group 27 | * @author Shawn Bayern 28 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 29 | **/ 30 | 31 | public abstract class Literal 32 | extends Expression 33 | { 34 | //------------------------------------- 35 | // Properties 36 | //------------------------------------- 37 | // property value 38 | 39 | Object mValue; 40 | public Object getValue () 41 | { return mValue; } 42 | public void setValue (Object pValue) 43 | { mValue = pValue; } 44 | 45 | //------------------------------------- 46 | /** 47 | * 48 | * Constructor 49 | **/ 50 | public Literal (Object pValue) 51 | { 52 | mValue = pValue; 53 | } 54 | 55 | //------------------------------------- 56 | // Expression methods 57 | //------------------------------------- 58 | /** 59 | * 60 | * Evaluates to the literal value 61 | **/ 62 | public Object evaluate (Object pContext, 63 | VariableResolver pResolver, 64 | Map functions, 65 | String defaultPrefix, 66 | Logger pLogger) 67 | throws ELException 68 | { 69 | return mValue; 70 | } 71 | 72 | //------------------------------------- 73 | } 74 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MinusOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the minus operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class MinusOperator 29 | extends ArithmeticOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final MinusOperator SINGLETON = 36 | new MinusOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public MinusOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "-"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given double values, returning a double 63 | **/ 64 | public double apply (double pLeft, 65 | double pRight, 66 | Logger pLogger) 67 | { 68 | return pLeft - pRight; 69 | } 70 | 71 | //------------------------------------- 72 | /** 73 | * 74 | * Applies the operator to the given double values, returning a double 75 | **/ 76 | public long apply (long pLeft, 77 | long pRight, 78 | Logger pLogger) 79 | { 80 | return pLeft - pRight; 81 | } 82 | 83 | //------------------------------------- 84 | } 85 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MultiplyOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the multiply operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class MultiplyOperator 29 | extends ArithmeticOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final MultiplyOperator SINGLETON = 36 | new MultiplyOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public MultiplyOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "*"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given double values, returning a double 63 | **/ 64 | public double apply (double pLeft, 65 | double pRight, 66 | Logger pLogger) 67 | { 68 | return pLeft * pRight; 69 | } 70 | 71 | //------------------------------------- 72 | /** 73 | * 74 | * Applies the operator to the given double values, returning a double 75 | **/ 76 | public long apply (long pLeft, 77 | long pRight, 78 | Logger pLogger) 79 | { 80 | return pLeft * pRight; 81 | } 82 | 83 | //------------------------------------- 84 | } 85 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NamedValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.util.Map; 21 | 22 | /** 23 | * 24 | *
Represents a name that can be used as the first element of a 25 | * value. 26 | * 27 | * @author Nathan Abramson - Art Technology Group 28 | * @author Shawn Bayern 29 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 30 | **/ 31 | 32 | public class NamedValue 33 | extends Expression 34 | { 35 | //------------------------------------- 36 | // Constants 37 | //------------------------------------- 38 | 39 | //------------------------------------- 40 | // Properties 41 | //------------------------------------- 42 | // property name 43 | 44 | String mName; 45 | public String getName () 46 | { return mName; } 47 | 48 | //------------------------------------- 49 | /** 50 | * 51 | * Constructor 52 | **/ 53 | public NamedValue (String pName) 54 | { 55 | mName = pName; 56 | } 57 | 58 | //------------------------------------- 59 | // Expression methods 60 | //------------------------------------- 61 | /** 62 | * 63 | * Returns the expression in the expression language syntax 64 | **/ 65 | public String getExpressionString () 66 | { 67 | return StringLiteral.toIdentifierToken (mName); 68 | } 69 | 70 | //------------------------------------- 71 | /** 72 | * 73 | * Evaluates by looking up the name in the VariableResolver 74 | **/ 75 | public Object evaluate (Object pContext, 76 | VariableResolver pResolver, 77 | Map functions, 78 | String defaultPrefix, 79 | Logger pLogger) 80 | throws ELException 81 | { 82 | if (pResolver == null) { 83 | return null; 84 | } 85 | else { 86 | return pResolver.resolveVariable (mName, pContext); 87 | } 88 | } 89 | 90 | //------------------------------------- 91 | } 92 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotEqualsOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the not equals operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class NotEqualsOperator 29 | extends EqualityOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final NotEqualsOperator SINGLETON = 36 | new NotEqualsOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public NotEqualsOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "!="; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator given the fact that the two elements are 63 | * equal. 64 | **/ 65 | public boolean apply (boolean pAreEqual, 66 | Logger pLogger) 67 | { 68 | return !pAreEqual; 69 | } 70 | 71 | //------------------------------------- 72 | } 73 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the not operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class NotOperator 29 | extends UnaryOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final NotOperator SINGLETON = 36 | new NotOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public NotOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "not"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given value 63 | **/ 64 | public Object apply (Object pValue, 65 | Object pContext, 66 | Logger pLogger) 67 | throws ELException 68 | { 69 | // Coerce the value to a boolean 70 | boolean val = Coercions.coerceToBoolean (pValue, pLogger).booleanValue (); 71 | 72 | return PrimitiveObjects.getBoolean (!val); 73 | } 74 | 75 | //------------------------------------- 76 | } 77 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NullLiteral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
An expression representing a null literal value 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class NullLiteral 29 | extends Literal 30 | { 31 | //------------------------------------- 32 | // Member variables 33 | //------------------------------------- 34 | 35 | public static final NullLiteral SINGLETON = new NullLiteral (); 36 | 37 | //------------------------------------- 38 | /** 39 | * 40 | * Constructor 41 | **/ 42 | public NullLiteral () 43 | { 44 | super (null); 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the expression in the expression language syntax 53 | **/ 54 | public String getExpressionString () 55 | { 56 | return "null"; 57 | } 58 | 59 | //------------------------------------- 60 | } 61 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/OrOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the or operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class OrOperator 29 | extends BinaryOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final OrOperator SINGLETON = 36 | new OrOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public OrOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "or"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given value 63 | **/ 64 | public Object apply (Object pLeft, 65 | Object pRight, 66 | Object pContext, 67 | Logger pLogger) 68 | throws ELException 69 | { 70 | // Coerce the values to booleans 71 | boolean left = 72 | Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); 73 | boolean right = 74 | Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); 75 | 76 | return PrimitiveObjects.getBoolean (left || right); 77 | } 78 | 79 | //------------------------------------- 80 | /** 81 | * 82 | * Returns true if evaluation is necessary given the specified Left 83 | * value. The And/OrOperators make use of this 84 | **/ 85 | public boolean shouldEvaluate (Object pLeft) 86 | { 87 | return 88 | (pLeft instanceof Boolean) && 89 | ((Boolean) pLeft).booleanValue () == false; 90 | } 91 | 92 | //------------------------------------- 93 | /** 94 | * 95 | * Returns true if the operator expects its arguments to be coerced 96 | * to Booleans. The And/Or operators set this to true. 97 | **/ 98 | public boolean shouldCoerceToBoolean () 99 | { 100 | return true; 101 | } 102 | 103 | //------------------------------------- 104 | } 105 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PlusOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
The implementation of the plus operator 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class PlusOperator 29 | extends ArithmeticOperator 30 | { 31 | //------------------------------------- 32 | // Singleton 33 | //------------------------------------- 34 | 35 | public static final PlusOperator SINGLETON = 36 | new PlusOperator (); 37 | 38 | //------------------------------------- 39 | /** 40 | * 41 | * Constructor 42 | **/ 43 | public PlusOperator () 44 | { 45 | } 46 | 47 | //------------------------------------- 48 | // Expression methods 49 | //------------------------------------- 50 | /** 51 | * 52 | * Returns the symbol representing the operator 53 | **/ 54 | public String getOperatorSymbol () 55 | { 56 | return "+"; 57 | } 58 | 59 | //------------------------------------- 60 | /** 61 | * 62 | * Applies the operator to the given double values, returning a double 63 | **/ 64 | public double apply (double pLeft, 65 | double pRight, 66 | Logger pLogger) 67 | { 68 | return pLeft + pRight; 69 | } 70 | 71 | //------------------------------------- 72 | /** 73 | * 74 | * Applies the operator to the given double values, returning a double 75 | **/ 76 | public long apply (long pLeft, 77 | long pRight, 78 | Logger pLogger) 79 | { 80 | return pLeft + pRight; 81 | } 82 | 83 | //------------------------------------- 84 | } 85 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PropertySuffix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.util.Map; 21 | 22 | /** 23 | * 24 | *
Represents an operator that obtains the value of another value's 25 | * property. This is a specialization of ArraySuffix - a.b is 26 | * equivalent to a["b"] 27 | * 28 | * @author Nathan Abramson - Art Technology Group 29 | * @author Shawn Bayern 30 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 31 | **/ 32 | 33 | public class PropertySuffix 34 | extends ArraySuffix 35 | { 36 | //------------------------------------- 37 | // Properties 38 | //------------------------------------- 39 | // property name 40 | 41 | String mName; 42 | public String getName () 43 | { return mName; } 44 | public void setName (String pName) 45 | { mName = pName; } 46 | 47 | //------------------------------------- 48 | /** 49 | * 50 | * Constructor 51 | **/ 52 | public PropertySuffix (String pName) 53 | { 54 | super (null); 55 | mName = pName; 56 | } 57 | 58 | //------------------------------------- 59 | /** 60 | * 61 | * Gets the value of the index 62 | **/ 63 | Object evaluateIndex (Object pContext, 64 | VariableResolver pResolver, 65 | Map functions, 66 | String defaultPrefix, 67 | Logger pLogger) 68 | throws ELException 69 | { 70 | return mName; 71 | } 72 | 73 | //------------------------------------- 74 | /** 75 | * 76 | * Returns the operator symbol 77 | **/ 78 | String getOperatorSymbol () 79 | { 80 | return "."; 81 | } 82 | 83 | //------------------------------------- 84 | // ValueSuffix methods 85 | //------------------------------------- 86 | /** 87 | * 88 | * Returns the expression in the expression language syntax 89 | **/ 90 | public String getExpressionString () 91 | { 92 | return "." + StringLiteral.toIdentifierToken (mName); 93 | } 94 | 95 | //------------------------------------- 96 | } 97 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/RelationalOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
This is the superclass for all relational operators (except == 23 | * or !=) 24 | * 25 | * @author Nathan Abramson - Art Technology Group 26 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 27 | **/ 28 | 29 | public abstract class RelationalOperator 30 | extends BinaryOperator 31 | { 32 | //------------------------------------- 33 | /** 34 | * 35 | * Applies the operator to the given value 36 | **/ 37 | public Object apply (Object pLeft, 38 | Object pRight, 39 | Object pContext, 40 | Logger pLogger) 41 | throws ELException 42 | { 43 | return Coercions.applyRelationalOperator (pLeft, pRight, this, pLogger); 44 | } 45 | 46 | //------------------------------------- 47 | /** 48 | * 49 | * Applies the operator to the given double values 50 | **/ 51 | public abstract boolean apply (double pLeft, 52 | double pRight, 53 | Logger pLogger); 54 | 55 | //------------------------------------- 56 | /** 57 | * 58 | * Applies the operator to the given long values 59 | **/ 60 | public abstract boolean apply (long pLeft, 61 | long pRight, 62 | Logger pLogger); 63 | 64 | //------------------------------------- 65 | /** 66 | * 67 | * Applies the operator to the given String values 68 | **/ 69 | public abstract boolean apply (String pLeft, 70 | String pRight, 71 | Logger pLogger); 72 | 73 | //------------------------------------- 74 | } 75 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
This is the superclass for all unary operators 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public abstract class UnaryOperator 29 | { 30 | //------------------------------------- 31 | /** 32 | * 33 | * Constructor 34 | **/ 35 | public UnaryOperator () 36 | { 37 | } 38 | 39 | //------------------------------------- 40 | // Expression methods 41 | //------------------------------------- 42 | /** 43 | * 44 | * Returns the symbol representing the operator 45 | **/ 46 | public abstract String getOperatorSymbol (); 47 | 48 | //------------------------------------- 49 | /** 50 | * 51 | * Applies the operator to the given value 52 | **/ 53 | public abstract Object apply (Object pValue, 54 | Object pContext, 55 | Logger pLogger) 56 | throws ELException; 57 | 58 | //------------------------------------- 59 | } 60 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ValueSuffix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | import java.util.Map; 21 | 22 | /** 23 | * 24 | *
Represents an element that can appear as a suffix in a complex 25 | * value, such as a property or index operator, or a method call (should 26 | * they ever need to be supported). 27 | * 28 | * @author Nathan Abramson - Art Technology Group 29 | * @author Shawn Bayern 30 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 31 | **/ 32 | 33 | public abstract class ValueSuffix 34 | { 35 | //------------------------------------- 36 | /** 37 | * 38 | * Returns the expression in the expression language syntax 39 | **/ 40 | public abstract String getExpressionString (); 41 | 42 | //------------------------------------- 43 | /** 44 | * 45 | * Evaluates the expression in the given context, operating on the 46 | * given value. 47 | **/ 48 | public abstract Object evaluate (Object pValue, 49 | Object pContext, 50 | VariableResolver pResolver, 51 | Map functions, 52 | String defaultPrefix, 53 | Logger pLogger) 54 | throws ELException; 55 | 56 | //------------------------------------- 57 | } 58 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/VariableResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl; 19 | 20 | /** 21 | * 22 | *
This class is used to customize the way the evaluator resolves 23 | * variable references. For example, instances of this class can 24 | * implement their own variable lookup mechanisms, or introduce the 25 | * notion of "implicit variables" which override any other variables. 26 | * An instance of this class should be passed to the evaluator's 27 | * constructor. 28 | * 29 | *
Whenever the evaluator is invoked, it is passed a "context" 30 | * Object from the application. For example, in a JSP environment, 31 | * the "context" is a PageContext. That context object is eventually 32 | * passed to this class, so that this class has a context in which to 33 | * resolve variables. 34 | * 35 | * @author Nathan Abramson - Art Technology Group 36 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 37 | **/ 38 | 39 | public interface VariableResolver 40 | { 41 | //------------------------------------- 42 | /** 43 | * 44 | * Resolves the specified variable within the given context. 45 | * Returns null if the variable is not found. 46 | **/ 47 | public Object resolveVariable (String pName, 48 | Object pContext) 49 | throws ELException; 50 | 51 | //------------------------------------- 52 | } 53 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/Bean2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test; 19 | 20 | /** 21 | * 22 | *
This is a test bean that holds a single String 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class Bean2 29 | { 30 | //------------------------------------- 31 | // Properties 32 | //------------------------------------- 33 | // property value 34 | 35 | String mValue; 36 | public String getValue () 37 | { return mValue; } 38 | public void setValue (String pValue) 39 | { mValue = pValue; } 40 | 41 | //------------------------------------- 42 | // Member variables 43 | //------------------------------------- 44 | 45 | //------------------------------------- 46 | /** 47 | * 48 | * Constructor 49 | **/ 50 | public Bean2 (String pValue) 51 | { 52 | mValue = pValue; 53 | } 54 | 55 | //------------------------------------- 56 | public String toString () 57 | { 58 | return ("Bean2[" + mValue + "]"); 59 | } 60 | 61 | //------------------------------------- 62 | 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/Bean2Editor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test; 19 | 20 | import java.beans.PropertyEditorSupport; 21 | 22 | /** 23 | * 24 | * PropertyEditor for parsing Bean2 25 | * 26 | * @author Nathan Abramson - Art Technology Group 27 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 28 | **/ 29 | 30 | public class Bean2Editor 31 | extends PropertyEditorSupport 32 | { 33 | //------------------------------------- 34 | public void setAsText (String pText) 35 | throws IllegalArgumentException 36 | { 37 | if ("badvalue".equals (pText)) { 38 | throw new IllegalArgumentException ("Bad value " + pText); 39 | } 40 | else { 41 | setValue (new Bean2 (pText)); 42 | } 43 | } 44 | 45 | //------------------------------------- 46 | } 47 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/Factory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A factory for generating the various beans 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class Factory 29 | { 30 | public static PublicBean1 createBean1 () 31 | { 32 | return new PublicBean1 (); 33 | } 34 | 35 | public static PublicBean1 createBean2 () 36 | { 37 | return new PrivateBean1a (); 38 | } 39 | 40 | public static PublicBean1 createBean3 () 41 | { 42 | return new PublicBean1b (); 43 | } 44 | 45 | public static PublicInterface2 createBean4 () 46 | { 47 | return new PublicBean2a (); 48 | } 49 | 50 | public static PublicInterface2 createBean5 () 51 | { 52 | return new PrivateBean2b (); 53 | } 54 | 55 | public static PublicInterface2 createBean6 () 56 | { 57 | return new PrivateBean2c (); 58 | } 59 | 60 | public static PublicInterface2 createBean7 () 61 | { 62 | return new PrivateBean2d (); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean1a.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A private bean subclassing a public bean 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 26 | **/ 27 | 28 | class PrivateBean1a 29 | extends PublicBean1 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2b.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A private implementation of a public interface 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 26 | **/ 27 | 28 | class PrivateBean2b 29 | implements PublicInterface2 30 | { 31 | public Object getValue () { return "got the value"; } 32 | } 33 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2c.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A private subclass of a public class impelementing a public 23 | * interface 24 | * 25 | * @author Nathan Abramson - Art Technology Group 26 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 27 | **/ 28 | 29 | class PrivateBean2c 30 | extends PublicBean2a 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2d.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A private subclass of a private class impelementing a public 23 | * interface 24 | * 25 | * @author Nathan Abramson - Art Technology Group 26 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 27 | **/ 28 | 29 | class PrivateBean2d 30 | extends PrivateBean2b 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A publicly-accessible bean 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class PublicBean1 29 | { 30 | public Object getValue () { return "got the value"; } 31 | } 32 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1b.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A public bean subclassing a private bean subclassing a public 23 | * bean 24 | * 25 | * @author Nathan Abramson - Art Technology Group 26 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 27 | **/ 28 | 29 | public class PublicBean1b 30 | extends PrivateBean1a 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean2a.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A publicly-accessible implementation of a public interface 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 26 | **/ 27 | 28 | public class PublicBean2a 29 | implements PublicInterface2 30 | { 31 | public Object getValue () { return "got the value"; } 32 | } 33 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicInterface2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.jstl.test.beans; 19 | 20 | /** 21 | * 22 | *
A publicly-accessible interface 23 | * 24 | * @author Nathan Abramson - Art Technology Group 25 | * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ 26 | **/ 27 | 28 | public interface PublicInterface2 29 | { 30 | public Object getValue (); 31 | } 32 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.lang.support; 19 | 20 | import javax.servlet.jsp.JspException; 21 | import javax.servlet.jsp.PageContext; 22 | import javax.servlet.jsp.tagext.Tag; 23 | 24 | /** 25 | *
The interface for an expression-language validator and evaluator. 26 | * Classes that implement an expression language expose their functionality 27 | * via this interface.
28 | * 29 | *The validate() and evaluate() methods must be thread-safe. That is, 30 | * multiple threads may call these methods on the same ExpressionEvaluator 31 | * object simultaneously. Implementations should synchronize access if 32 | * they depend on transient state. Implementations should not, however, 33 | * assume that only one object of each ExpressionEvaluator type will be 34 | * instantiated; global caching should therefore be static. No release() 35 | * mechanism or robust lifecycle is specified, for language-interpreter 36 | * pluggability is experimental in EA2.
37 | * 38 | *WARNING: This class supports experimentation for the EA2 39 | * release of JSTL; it is not expected to be part of the final RI or 40 | * specification.
41 | * 42 | * @author Shawn Bayern (based exactly on rev1 draft) 43 | */ 44 | public interface ExpressionEvaluator { 45 | 46 | /** 47 | * Translation time validation of an expression. 48 | * This method will return a null String if the expression 49 | * is valid; otherwise an error message. 50 | */ 51 | public String validate(String attributeName, 52 | String expression); 53 | 54 | /** 55 | * Evaluates the expression at request time. 56 | */ 57 | public Object evaluate(String attributeName, 58 | String expression, 59 | Class expectedType, 60 | Tag tag, 61 | PageContext pageContext) 62 | throws JspException; 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/core/CatchTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.core; 19 | 20 | import javax.servlet.jsp.PageContext; 21 | import javax.servlet.jsp.tagext.TagSupport; 22 | import javax.servlet.jsp.tagext.TryCatchFinally; 23 | 24 | /** 25 | *Tag handler for <catch> in JSTL 1.0.
26 | * 27 | *<catch> simply catches any Throwables that occur in its body 28 | * and optionally exposes them. 29 | * 30 | * @author Shawn Bayern 31 | */ 32 | 33 | public class CatchTag extends TagSupport implements TryCatchFinally { 34 | 35 | /* 36 | * If all tags that I proposed were this simple, people might 37 | * think I was just trying to avoid work. :-) 38 | */ 39 | 40 | //********************************************************************* 41 | // Constructor and lifecycle management 42 | 43 | // initialize inherited and local state 44 | public CatchTag() { 45 | super(); 46 | init(); 47 | } 48 | 49 | // Releases any resources we may have (or inherit) 50 | public void release() { 51 | super.release(); 52 | init(); 53 | } 54 | 55 | private void init() { 56 | var = null; 57 | } 58 | 59 | 60 | //********************************************************************* 61 | // Private state 62 | 63 | private String var; // tag attribute 64 | private boolean caught; // internal status 65 | 66 | 67 | //********************************************************************* 68 | // Tag logic 69 | 70 | public int doStartTag() { 71 | caught = false; 72 | return EVAL_BODY_INCLUDE; 73 | } 74 | 75 | public void doCatch(Throwable t) { 76 | if (var != null) 77 | pageContext.setAttribute(var, t, PageContext.PAGE_SCOPE); 78 | caught = true; 79 | } 80 | 81 | public void doFinally() { 82 | if (var != null && !caught) 83 | pageContext.removeAttribute(var, PageContext.PAGE_SCOPE); 84 | } 85 | 86 | 87 | //********************************************************************* 88 | // Attribute accessors 89 | 90 | public void setVar(String var) { 91 | this.var = var; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/core/DeclareTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.core; 19 | 20 | import javax.servlet.jsp.tagext.TagSupport; 21 | 22 | /** 23 | *
Tag handler for <declaregt; in JSTL. This tag handler is 24 | * essentially a runtime no-op as far as tag logic is concerned; the 25 | * only important functionality of the tag is to expose a scripting 26 | * variable for an existing scoped attribute.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class DeclareTag extends TagSupport { 32 | 33 | /* 34 | * We're not identical to TagSupport only because we need to 35 | * accept an additional "type" attribute. 36 | */ 37 | public void setType(String x) { } 38 | } 39 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/core/NullAttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.core; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.resources.Resources; 23 | 24 | /** 25 | *NullAttributeException is a JspTagException that will be thrown 26 | * by the JSTL RI handlers when a tag attribute illegally evaluates 27 | * to 'null'.
28 | * 29 | * @author Shawn Bayern 30 | */ 31 | 32 | public class NullAttributeException extends JspTagException { 33 | 34 | /** 35 | * Constructs a NullAttributeException with appropriate information. 36 | * 37 | * @param tag The name of the tag in which the error occurred. 38 | * @param att The attribute value for which the error occurred. 39 | */ 40 | public NullAttributeException(String tag, String att) { 41 | super(Resources.getMessage("TAG_NULL_ATTRIBUTE", att, tag)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OtherwiseTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.core; 19 | 20 | 21 | /** 22 | *Tag handler for <otherwise> in JSTL.
23 | * 24 | * @author Shawn Bayern 25 | */ 26 | 27 | public class OtherwiseTag extends WhenTagSupport { 28 | 29 | /* 30 | *Interface for tag handlers implementing valid parent tags for 22 | * <c:param>.
23 | * 24 | * @author Shawn Bayern 25 | */ 26 | 27 | public interface ParamParent { 28 | 29 | /** 30 | * Adds a parameter to this tag's URL. The intent is that the 31 | * <param> subtag will call this to register URL parameters. 32 | * Assumes that 'name' and 'value' are appropriately encoded and do 33 | * not contain any meaningful metacharacters; in order words, escaping 34 | * is the responsibility of the caller. 35 | * 36 | * @see ParamSupport 37 | */ 38 | void addParameter(String name, String value); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/core/WhenTagSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.core; 19 | 20 | import javax.servlet.jsp.JspException; 21 | import javax.servlet.jsp.JspTagException; 22 | import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 23 | import javax.servlet.jsp.tagext.Tag; 24 | 25 | import org.apache.taglibs.standard.resources.Resources; 26 | 27 | /** 28 | *WhenTagSupport is an abstract class that facilitates 29 | * implementation of <when>-style tags in both the rtexprvalue 30 | * and expression-evaluating libraries. It also supports 31 | * <otherwise>.
32 | * 33 | *In particular, this base class does the following:
34 | * 35 | *Tag handler for <expr> in JSTL's XML library.
26 | * 27 | * @author Shawn Bayern 28 | */ 29 | 30 | public abstract class ExprSupport extends TagSupport { 31 | 32 | //********************************************************************* 33 | // Internal state 34 | 35 | private String select; // tag attribute 36 | protected boolean escapeXml; // tag attribute 37 | 38 | //********************************************************************* 39 | // Construction and initialization 40 | 41 | /** 42 | * Constructs a new handler. As with TagSupport, subclasses should 43 | * not provide other constructors and are expected to call the 44 | * superclass constructor. 45 | */ 46 | public ExprSupport() { 47 | super(); 48 | init(); 49 | } 50 | 51 | // resets local state 52 | private void init() { 53 | select = null; 54 | escapeXml = true; 55 | } 56 | 57 | 58 | //********************************************************************* 59 | // Tag logic 60 | 61 | // applies XPath expression from 'select' and prints the result 62 | public int doStartTag() throws JspException { 63 | try { 64 | XPathUtil xu = new XPathUtil(pageContext); 65 | String result = xu.valueOf(XPathUtil.getContext(this), select); 66 | org.apache.taglibs.standard.tag.common.core.OutSupport.out( 67 | pageContext, escapeXml, result); 68 | return SKIP_BODY; 69 | } catch (java.io.IOException ex) { 70 | throw new JspTagException(ex.toString(), ex); 71 | } 72 | } 73 | 74 | // Releases any resources we may have (or inherit) 75 | public void release() { 76 | super.release(); 77 | init(); 78 | } 79 | 80 | 81 | //********************************************************************* 82 | // Attribute accessors 83 | 84 | public void setSelect(String select) { 85 | this.select = select; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/IfTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.xml; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 22 | 23 | /** 24 | *Tag handler for <if> in JSTL's XML library.
25 | * 26 | * @author Shawn Bayern 27 | */ 28 | 29 | public class IfTag extends ConditionalTagSupport { 30 | 31 | //********************************************************************* 32 | // Constructor and lifecycle management 33 | 34 | // initialize inherited and local state 35 | public IfTag() { 36 | super(); 37 | init(); 38 | } 39 | 40 | // Releases any resources we may have (or inherit) 41 | public void release() { 42 | super.release(); 43 | init(); 44 | } 45 | 46 | 47 | //********************************************************************* 48 | // Supplied conditional logic 49 | 50 | protected boolean condition() throws JspTagException { 51 | XPathUtil xu = new XPathUtil(pageContext); 52 | return (xu.booleanValueOf(XPathUtil.getContext(this), select)); 53 | } 54 | 55 | 56 | //********************************************************************* 57 | // Private state 58 | 59 | private String select; // the value of the 'test' attribute 60 | 61 | 62 | //********************************************************************* 63 | // Attribute accessors 64 | 65 | public void setSelect(String select) { 66 | this.select = select; 67 | } 68 | 69 | 70 | //********************************************************************* 71 | // Private utility methods 72 | 73 | // resets internal state 74 | private void init() { 75 | select = null; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.xml; 19 | 20 | 21 | import javax.xml.namespace.QName; 22 | 23 | /** 24 | * This class is added to provide support for a generic Object type in return type 25 | * arguement for XPath's evaluate instance method. 26 | * 27 | * @author dhirup 28 | */ 29 | public class JSTLXPathConstants { 30 | 31 | /** 32 | *Private constructor to prevent instantiation.
33 | */ 34 | private JSTLXPathConstants() { 35 | } 36 | 37 | // To support generic Object types 38 | public static final QName OBJECT = new QName("http://www.w3.org/1999/XSL/Transform", "OBJECT"); 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.xml; 19 | 20 | import org.apache.xpath.jaxp.XPathFactoryImpl; 21 | 22 | /** 23 | * This factory class is added to provide access to our own implementation 24 | * of XPath, so that we can support a generic Object type in return type 25 | * arguement for XPath's evaluate instance method. 26 | * 27 | * @author dhirup 28 | */ 29 | public class JSTLXPathFactory extends XPathFactoryImpl { 30 | 31 | public javax.xml.xpath.XPath newXPath() { 32 | return new org.apache.taglibs.standard.tag.common.xml.JSTLXPathImpl(null, null); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.common.xml; 19 | 20 | import javax.servlet.jsp.JspException; 21 | import javax.servlet.jsp.JspTagException; 22 | import javax.servlet.jsp.tagext.BodyTagSupport; 23 | import javax.servlet.jsp.tagext.Tag; 24 | 25 | import org.apache.taglibs.standard.resources.Resources; 26 | 27 | /** 28 | *Support for tag handlers for <param>, the XML parameter 29 | * subtag for <transformt<.
30 | * 31 | * @see TransformSupport 32 | * @author Shawn Bayern 33 | */ 34 | 35 | public abstract class ParamSupport extends BodyTagSupport { 36 | 37 | //********************************************************************* 38 | // Protected state 39 | 40 | protected String name; // 'name' attribute 41 | protected Object value; // 'value' attribute 42 | 43 | //********************************************************************* 44 | // Constructor and initialization 45 | 46 | public ParamSupport() { 47 | super(); 48 | init(); 49 | } 50 | 51 | private void init() { 52 | name = null; 53 | value = null; 54 | } 55 | 56 | 57 | //********************************************************************* 58 | // Tag logic 59 | 60 | // simply send our name and value to our parentTag handler for <if> in JSTL's XML library.
26 | * 27 | * @author Shawn Bayern 28 | */ 29 | 30 | public class WhenTag extends WhenTagSupport { 31 | 32 | //********************************************************************* 33 | // Constructor and lifecycle management 34 | 35 | // initialize inherited and local state 36 | public WhenTag() { 37 | super(); 38 | init(); 39 | } 40 | 41 | // Releases any resources we may have (or inherit) 42 | public void release() { 43 | super.release(); 44 | init(); 45 | } 46 | 47 | 48 | //********************************************************************* 49 | // Supplied conditional logic 50 | 51 | protected boolean condition() throws JspTagException { 52 | XPathUtil xu = new XPathUtil(pageContext); 53 | return (xu.booleanValueOf(XPathUtil.getContext(this), select)); 54 | } 55 | 56 | //********************************************************************* 57 | // Private state 58 | 59 | private String select; // the value of the 'test' attribute 60 | 61 | 62 | //********************************************************************* 63 | // Attribute accessors 64 | 65 | public void setSelect(String select) { 66 | this.select = select; 67 | } 68 | 69 | 70 | //********************************************************************* 71 | // Private utility methods 72 | 73 | // resets internal state 74 | private void init() { 75 | select = null; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.el.core; 19 | 20 | import javax.servlet.jsp.JspException; 21 | import javax.servlet.jsp.PageContext; 22 | import javax.servlet.jsp.tagext.Tag; 23 | 24 | import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 25 | import org.apache.taglibs.standard.tag.common.core.NullAttributeException; 26 | 27 | /** 28 | *Contains some static utilities to facilitate common forms of 29 | * expression evaluation.
30 | * 31 | * @author Shawn Bayern 32 | */ 33 | 34 | public class ExpressionUtil { 35 | 36 | /** Evaluates an expression if present, but does not allow the expression 37 | * to evaluate to 'null', throwing a NullAttributeException if it 38 | * does. The function can return null, however, if the 39 | * expression itself is null. 40 | */ 41 | public static Object evalNotNull(String tagName, 42 | String attributeName, 43 | String expression, 44 | Class expectedType, 45 | Tag tag, 46 | PageContext pageContext) 47 | throws JspException { 48 | if (expression != null) { 49 | Object r = ExpressionEvaluatorManager.evaluate( 50 | attributeName, expression, expectedType, tag, pageContext); 51 | if (r == null) 52 | throw new NullAttributeException(tagName, attributeName); 53 | return r; 54 | } else 55 | return null; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.el.core; 19 | 20 | import javax.servlet.jsp.JspException; 21 | import javax.servlet.jsp.JspTagException; 22 | import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 23 | 24 | import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 25 | import org.apache.taglibs.standard.tag.common.core.NullAttributeException; 26 | 27 | /** 28 | *Tag handler for <if> in JSTL's expression-evaluating library. 29 | * Because of the support provided by the ConditionalTagSupport class, 30 | * thistag is trivial enough not to require a separate base supporting 31 | * class common to both libraries.
32 | * 33 | * @author Shawn Bayern 34 | */ 35 | 36 | public class IfTag extends ConditionalTagSupport { 37 | 38 | //********************************************************************* 39 | // Constructor and lifecycle management 40 | 41 | // initialize inherited and local state 42 | public IfTag() { 43 | super(); 44 | init(); 45 | } 46 | 47 | // Releases any resources we may have (or inherit) 48 | public void release() { 49 | super.release(); 50 | init(); 51 | } 52 | 53 | 54 | //********************************************************************* 55 | // Supplied conditional logic 56 | 57 | protected boolean condition() throws JspTagException { 58 | try { 59 | Object r = ExpressionEvaluatorManager.evaluate( 60 | "test", test, Boolean.class, this, pageContext); 61 | if (r == null) 62 | throw new NullAttributeException("if", "test"); 63 | else 64 | return (((Boolean) r).booleanValue()); 65 | } catch (JspException ex) { 66 | throw new JspTagException(ex.toString(), ex); 67 | } 68 | } 69 | 70 | 71 | //********************************************************************* 72 | // Private state 73 | 74 | private String test; // the value of the 'test' attribute 75 | 76 | 77 | //********************************************************************* 78 | // Accessors 79 | 80 | // receives the tag's 'test' attribute 81 | public void setTest(String test) { 82 | this.test = test; 83 | } 84 | 85 | 86 | //********************************************************************* 87 | // Private utility methods 88 | 89 | // resets internal state 90 | private void init() { 91 | test = null; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.el.core; 19 | 20 | import javax.servlet.jsp.JspException; 21 | import javax.servlet.jsp.JspTagException; 22 | 23 | import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 24 | import org.apache.taglibs.standard.tag.common.core.NullAttributeException; 25 | import org.apache.taglibs.standard.tag.common.core.WhenTagSupport; 26 | 27 | /** 28 | *Tag handler for <when> in JSTL's expression-evaluating 29 | * library.
30 | * 31 | * @author Shawn Bayern 32 | */ 33 | 34 | public class WhenTag extends WhenTagSupport { 35 | 36 | //********************************************************************* 37 | // Constructor and lifecycle management 38 | 39 | // initialize inherited and local state 40 | public WhenTag() { 41 | super(); 42 | init(); 43 | } 44 | 45 | // Releases any resources we may have (or inherit) 46 | public void release() { 47 | super.release(); 48 | init(); 49 | } 50 | 51 | 52 | //********************************************************************* 53 | // Supplied conditional logic 54 | 55 | protected boolean condition() throws JspTagException { 56 | try { 57 | Object r = ExpressionEvaluatorManager.evaluate( 58 | "test", test, Boolean.class, this, pageContext); 59 | if (r == null) 60 | throw new NullAttributeException("when", "test"); 61 | else 62 | return (((Boolean) r).booleanValue()); 63 | } catch (JspException ex) { 64 | throw new JspTagException(ex.toString(), ex); 65 | } 66 | } 67 | 68 | 69 | //********************************************************************* 70 | // Private state 71 | 72 | private String test; // the value of the 'test' attribute 73 | 74 | 75 | //********************************************************************* 76 | // Accessors 77 | 78 | // receives the tag's 'test' attribute 79 | public void setTest(String test) { 80 | this.test = test; 81 | } 82 | 83 | 84 | //********************************************************************* 85 | // Private utility methods 86 | 87 | // resets internal state 88 | private void init() { 89 | test = null; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import java.util.ArrayList; 21 | 22 | import javax.servlet.jsp.JspTagException; 23 | import javax.servlet.jsp.jstl.core.LoopTag; 24 | import javax.servlet.jsp.tagext.IterationTag; 25 | 26 | import org.apache.taglibs.standard.tag.common.core.ForEachSupport; 27 | 28 | /** 29 | *A handler for <forEach> that supports rtexprvalue-based 30 | * attributes.
31 | * 32 | * @author Shawn Bayern 33 | */ 34 | 35 | public class ForEachTag 36 | extends ForEachSupport 37 | implements LoopTag, IterationTag 38 | { 39 | 40 | //********************************************************************* 41 | // Accessor methods 42 | 43 | // for tag attribute 44 | public void setBegin(int begin) throws JspTagException { 45 | this.beginSpecified = true; 46 | this.begin = begin; 47 | validateBegin(); 48 | } 49 | 50 | // for tag attribute 51 | public void setEnd(int end) throws JspTagException { 52 | this.endSpecified = true; 53 | this.end = end; 54 | validateEnd(); 55 | } 56 | 57 | // for tag attribute 58 | public void setStep(int step) throws JspTagException { 59 | this.stepSpecified = true; 60 | this.step = step; 61 | validateStep(); 62 | } 63 | 64 | public void setItems(Object o) throws JspTagException { 65 | // for null items, simulate an empty list 66 | if (o == null) 67 | rawItems = new ArrayList(); 68 | else 69 | rawItems = o; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | import javax.servlet.jsp.jstl.core.LoopTag; 22 | import javax.servlet.jsp.tagext.IterationTag; 23 | 24 | import org.apache.taglibs.standard.tag.common.core.ForTokensSupport; 25 | 26 | /** 27 | *A handler for <forTokens> that supports rtexprvalue-based 28 | * attributes.
29 | * 30 | * @author Shawn Bayern 31 | */ 32 | 33 | public class ForTokensTag 34 | extends ForTokensSupport 35 | implements LoopTag, IterationTag 36 | { 37 | 38 | //********************************************************************* 39 | // Accessor methods 40 | 41 | // for tag attribute 42 | public void setBegin(int begin) throws JspTagException { 43 | this.beginSpecified = true; 44 | this.begin = begin; 45 | validateBegin(); 46 | } 47 | 48 | // for tag attribute 49 | public void setEnd(int end) throws JspTagException { 50 | this.endSpecified = true; 51 | this.end = end; 52 | validateEnd(); 53 | } 54 | 55 | // for tag attribute 56 | public void setStep(int step) throws JspTagException { 57 | this.stepSpecified = true; 58 | this.step = step; 59 | validateStep(); 60 | } 61 | 62 | // stores the 'items' String we're passed 63 | public void setItems(Object s) throws JspTagException { 64 | items = s; 65 | // use the empty string to indicate "no iteration" 66 | if (s == null) 67 | items = ""; 68 | } 69 | 70 | // stores the 'delims' String we're passed 71 | public void setDelims(String s) throws JspTagException { 72 | delims = s; 73 | // use the empty string to cause monolithic tokenization 74 | if (s == null) 75 | delims = ""; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 21 | 22 | /** 23 | *Tag handler for <if> in JSTL's rtexprvalue library. Because 24 | * of the support provided by the ConditionalTagSupport class, this 25 | * tag is trivial enough not to require a separate base supporting class 26 | * common to both libraries.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class IfTag extends ConditionalTagSupport { 32 | 33 | //********************************************************************* 34 | // Constructor and lifecycle management 35 | 36 | // initialize inherited and local state 37 | public IfTag() { 38 | super(); 39 | init(); 40 | } 41 | 42 | // Releases any resources we may have (or inherit) 43 | public void release() { 44 | super.release(); 45 | init(); 46 | } 47 | 48 | 49 | //********************************************************************* 50 | // Supplied conditional logic 51 | 52 | protected boolean condition() { 53 | return test; 54 | } 55 | 56 | 57 | //********************************************************************* 58 | // Private state 59 | 60 | private boolean test; // the value of the 'test' attribute 61 | 62 | 63 | //********************************************************************* 64 | // Accessors 65 | 66 | // receives the tag's 'test' attribute 67 | public void setTest(boolean test) { 68 | this.test = test; 69 | } 70 | 71 | 72 | //********************************************************************* 73 | // Private utility methods 74 | 75 | // resets internal state 76 | private void init() { 77 | test = false; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.core.ImportSupport; 23 | 24 | /** 25 | *A handler for <import> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class ImportTag extends ImportSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setUrl(String url) throws JspTagException { 38 | this.url = url; 39 | } 40 | 41 | // for tag attribute 42 | public void setContext(String context) throws JspTagException { 43 | this.context = context; 44 | } 45 | 46 | // for tag attribute 47 | public void setCharEncoding(String charEncoding) throws JspTagException { 48 | this.charEncoding = charEncoding; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import org.apache.taglibs.standard.tag.common.core.OutSupport; 21 | 22 | /** 23 | *Tag handler for <out> in JSTL's rtexprvalue library.
24 | * 25 | * @author Shawn Bayern 26 | */ 27 | 28 | public class OutTag extends OutSupport { 29 | 30 | //********************************************************************* 31 | // Accessors 32 | 33 | // for tag attribute 34 | public void setValue(Object value) { 35 | this.value = value; 36 | } 37 | 38 | // for tag attribute 39 | public void setDefault(String def) { 40 | this.def = def; 41 | } 42 | 43 | // for tag attribute 44 | public void setEscapeXml(boolean escapeXml) { 45 | this.escapeXml = escapeXml; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.core.ParamSupport; 23 | 24 | /** 25 | *A handler for <param> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class ParamTag extends ParamSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setName(String name) throws JspTagException { 38 | this.name = name; 39 | } 40 | 41 | // for tag attribute 42 | public void setValue(String value) throws JspTagException { 43 | this.value = value; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/RedirectTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.core.RedirectSupport; 23 | 24 | /** 25 | *A handler for <redirect> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class RedirectTag extends RedirectSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setUrl(String url) throws JspTagException { 38 | this.url = url; 39 | } 40 | 41 | // for tag attribute 42 | public void setContext(String context) throws JspTagException { 43 | this.context = context; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/SetTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import org.apache.taglibs.standard.tag.common.core.SetSupport; 21 | 22 | /** 23 | *Tag handler for <set> in JSTL's rtexprvalue library.
24 | * 25 | * @author Shawn Bayern 26 | */ 27 | 28 | public class SetTag extends SetSupport { 29 | 30 | //********************************************************************* 31 | // Accessors 32 | 33 | // for tag attribute 34 | public void setValue(Object value) { 35 | this.value = value; 36 | this.valueSpecified = true; 37 | } 38 | 39 | // for tag attribute 40 | public void setTarget(Object target) { 41 | this.target = target; 42 | } 43 | 44 | // for tag attribute 45 | public void setProperty(String property) { 46 | this.property = property; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/UrlTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.core.UrlSupport; 23 | 24 | /** 25 | *A handler for <urlEncode> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class UrlTag extends UrlSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setValue(String value) throws JspTagException { 38 | this.value = value; 39 | } 40 | 41 | // for tag attribute 42 | public void setContext(String context) throws JspTagException { 43 | this.context = context; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/WhenTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.core; 19 | 20 | import org.apache.taglibs.standard.tag.common.core.WhenTagSupport; 21 | 22 | /** 23 | *Tag handler for <when> in JSTL's rtexprvalue library.
24 | * 25 | * @author Shawn Bayern 26 | */ 27 | 28 | public class WhenTag extends WhenTagSupport { 29 | 30 | //********************************************************************* 31 | // Constructor and lifecycle management 32 | 33 | // initialize inherited and local state 34 | public WhenTag() { 35 | super(); 36 | init(); 37 | } 38 | 39 | // Releases any resources we may have (or inherit) 40 | public void release() { 41 | super.release(); 42 | init(); 43 | } 44 | 45 | 46 | //********************************************************************* 47 | // Supplied conditional logic 48 | 49 | protected boolean condition() { 50 | return test; 51 | } 52 | 53 | 54 | //********************************************************************* 55 | // Private state 56 | 57 | private boolean test; // the value of the 'test' attribute 58 | 59 | 60 | //********************************************************************* 61 | // Accessors 62 | 63 | // receives the tag's 'test' attribute 64 | public void setTest(boolean test) { 65 | this.test = test; 66 | } 67 | 68 | 69 | //********************************************************************* 70 | // Private utility methods 71 | 72 | // resets internal state 73 | private void init() { 74 | test = false; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.BundleSupport; 23 | 24 | /** 25 | *A handler for <bundle> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class BundleTag extends BundleSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setBasename(String basename) throws JspTagException { 38 | this.basename = basename; 39 | } 40 | 41 | // for tag attribute 42 | public void setPrefix(String prefix) throws JspTagException { 43 | this.prefix = prefix; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import java.util.Date; 21 | 22 | import javax.servlet.jsp.JspTagException; 23 | 24 | import org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport; 25 | 26 | /** 27 | *A handler for <formatDate> that supports rtexprvalue-based 28 | * attributes.
29 | * 30 | * @author Jan Luehe 31 | */ 32 | 33 | public class FormatDateTag extends FormatDateSupport { 34 | 35 | //********************************************************************* 36 | // Accessor methods 37 | 38 | // 'value' attribute 39 | public void setValue(Date value) throws JspTagException { 40 | this.value = value; 41 | } 42 | 43 | // 'type' attribute 44 | public void setType(String type) throws JspTagException { 45 | this.type = type; 46 | } 47 | 48 | // 'dateStyle' attribute 49 | public void setDateStyle(String dateStyle) throws JspTagException { 50 | this.dateStyle = dateStyle; 51 | } 52 | 53 | // 'timeStyle' attribute 54 | public void setTimeStyle(String timeStyle) throws JspTagException { 55 | this.timeStyle = timeStyle; 56 | } 57 | 58 | // 'pattern' attribute 59 | public void setPattern(String pattern) throws JspTagException { 60 | this.pattern = pattern; 61 | } 62 | 63 | // 'timeZone' attribute 64 | public void setTimeZone(Object timeZone) throws JspTagException { 65 | this.timeZone = timeZone; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.FormatNumberSupport; 23 | 24 | /** 25 | *A handler for <formatNumber> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class FormatNumberTag extends FormatNumberSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // 'value' attribute 37 | public void setValue(Object value) throws JspTagException { 38 | this.value = value; 39 | this.valueSpecified = true; 40 | } 41 | 42 | // 'type' attribute 43 | public void setType(String type) throws JspTagException { 44 | this.type = type; 45 | } 46 | 47 | // 'pattern' attribute 48 | public void setPattern(String pattern) throws JspTagException { 49 | this.pattern = pattern; 50 | } 51 | 52 | // 'currencyCode' attribute 53 | public void setCurrencyCode(String currencyCode) throws JspTagException { 54 | this.currencyCode = currencyCode; 55 | } 56 | 57 | // 'currencySymbol' attribute 58 | public void setCurrencySymbol(String currencySymbol) 59 | throws JspTagException { 60 | this.currencySymbol = currencySymbol; 61 | } 62 | 63 | // 'groupingUsed' attribute 64 | public void setGroupingUsed(boolean isGroupingUsed) 65 | throws JspTagException { 66 | this.isGroupingUsed = isGroupingUsed; 67 | this.groupingUsedSpecified = true; 68 | } 69 | 70 | // 'maxIntegerDigits' attribute 71 | public void setMaxIntegerDigits(int maxDigits) throws JspTagException { 72 | this.maxIntegerDigits = maxDigits; 73 | this.maxIntegerDigitsSpecified = true; 74 | } 75 | 76 | // 'minIntegerDigits' attribute 77 | public void setMinIntegerDigits(int minDigits) throws JspTagException { 78 | this.minIntegerDigits = minDigits; 79 | this.minIntegerDigitsSpecified = true; 80 | } 81 | 82 | // 'maxFractionDigits' attribute 83 | public void setMaxFractionDigits(int maxDigits) throws JspTagException { 84 | this.maxFractionDigits = maxDigits; 85 | this.maxFractionDigitsSpecified = true; 86 | } 87 | 88 | // 'minFractionDigits' attribute 89 | public void setMinFractionDigits(int minDigits) throws JspTagException { 90 | this.minFractionDigits = minDigits; 91 | this.minFractionDigitsSpecified = true; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | import javax.servlet.jsp.jstl.fmt.LocalizationContext; 22 | 23 | import org.apache.taglibs.standard.tag.common.fmt.MessageSupport; 24 | 25 | /** 26 | *A handler for <message> that supports rtexprvalue-based 27 | * attributes.
28 | * 29 | * @author Jan Luehe 30 | */ 31 | 32 | public class MessageTag extends MessageSupport { 33 | 34 | //********************************************************************* 35 | // Accessor methods 36 | 37 | // for tag attribute 38 | public void setKey(String key) throws JspTagException { 39 | this.keyAttrValue = key; 40 | this.keySpecified = true; 41 | } 42 | 43 | // for tag attribute 44 | public void setBundle(LocalizationContext locCtxt) throws JspTagException { 45 | this.bundleAttrValue = locCtxt; 46 | this.bundleSpecified = true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParamTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.ParamSupport; 23 | 24 | /** 25 | *A handler for <param> that supports rtexprvalue-based 26 | * message arguments.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class ParamTag extends ParamSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setValue(Object value) throws JspTagException { 38 | this.value = value; 39 | this.valueSpecified = true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import java.util.Locale; 21 | 22 | import javax.servlet.jsp.JspTagException; 23 | 24 | import org.apache.taglibs.standard.tag.common.fmt.ParseDateSupport; 25 | import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; 26 | 27 | /** 28 | *A handler for <parseDate> that supports rtexprvalue-based 29 | * attributes.
30 | * 31 | * @author Jan Luehe 32 | */ 33 | 34 | public class ParseDateTag extends ParseDateSupport { 35 | 36 | //********************************************************************* 37 | // Accessor methods 38 | 39 | // 'value' attribute 40 | public void setValue(String value) throws JspTagException { 41 | this.value = value; 42 | this.valueSpecified = true; 43 | } 44 | 45 | // 'type' attribute 46 | public void setType(String type) throws JspTagException { 47 | this.type = type; 48 | } 49 | 50 | // 'dateStyle' attribute 51 | public void setDateStyle(String dateStyle) throws JspTagException { 52 | this.dateStyle = dateStyle; 53 | } 54 | 55 | // 'timeStyle' attribute 56 | public void setTimeStyle(String timeStyle) throws JspTagException { 57 | this.timeStyle = timeStyle; 58 | } 59 | 60 | // 'pattern' attribute 61 | public void setPattern(String pattern) throws JspTagException { 62 | this.pattern = pattern; 63 | } 64 | 65 | // 'timeZone' attribute 66 | public void setTimeZone(Object timeZone) throws JspTagException { 67 | this.timeZone = timeZone; 68 | } 69 | 70 | // 'parseLocale' attribute 71 | public void setParseLocale(Object loc) throws JspTagException { 72 | if (loc != null) { 73 | if (loc instanceof Locale) { 74 | this.parseLocale = (Locale) loc; 75 | } else { 76 | if (!"".equals((String) loc)) { 77 | this.parseLocale = SetLocaleSupport.parseLocale((String) 78 | loc); 79 | } 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import java.util.Locale; 21 | 22 | import javax.servlet.jsp.JspTagException; 23 | 24 | import org.apache.taglibs.standard.tag.common.fmt.ParseNumberSupport; 25 | import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; 26 | 27 | /** 28 | *A handler for <parseNumber> that supports rtexprvalue-based 29 | * attributes.
30 | * 31 | * @author Jan Luehe 32 | */ 33 | 34 | public class ParseNumberTag extends ParseNumberSupport { 35 | 36 | //********************************************************************* 37 | // Accessor methods 38 | 39 | // 'value' attribute 40 | public void setValue(String value) throws JspTagException { 41 | this.value = value; 42 | this.valueSpecified = true; 43 | } 44 | 45 | // 'type' attribute 46 | public void setType(String type) throws JspTagException { 47 | this.type = type; 48 | } 49 | 50 | // 'pattern' attribute 51 | public void setPattern(String pattern) throws JspTagException { 52 | this.pattern = pattern; 53 | } 54 | 55 | // 'parseLocale' attribute 56 | public void setParseLocale(Object loc) throws JspTagException { 57 | if (loc != null) { 58 | if (loc instanceof Locale) { 59 | this.parseLocale = (Locale) loc; 60 | } else { 61 | if (!"".equals((String) loc)) { 62 | this.parseLocale = SetLocaleSupport.parseLocale((String) 63 | loc); 64 | } 65 | } 66 | } 67 | } 68 | 69 | // 'integerOnly' attribute 70 | public void setIntegerOnly(boolean isIntegerOnly) throws JspTagException { 71 | this.isIntegerOnly = isIntegerOnly; 72 | this.integerOnlySpecified = true; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/RequestEncodingTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.RequestEncodingSupport; 23 | 24 | /** 25 | *A handler for <requestEncoding> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class RequestEncodingTag extends RequestEncodingSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setValue(String value) throws JspTagException { 38 | this.value = value; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.SetBundleSupport; 23 | 24 | /** 25 | *A handler for <setBundle> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class SetBundleTag extends SetBundleSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setBasename(String basename) throws JspTagException { 38 | this.basename = basename; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetLocaleTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; 23 | 24 | /** 25 | *A handler for <setLocale> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class SetLocaleTag extends SetLocaleSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setValue(Object value) throws JspTagException { 38 | this.value = value; 39 | } 40 | 41 | // for tag attribute 42 | public void setVariant(String variant) throws JspTagException { 43 | this.variant = variant; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetTimeZoneTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.SetTimeZoneSupport; 23 | 24 | /** 25 | *A handler for <setTimeZone> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class SetTimeZoneTag extends SetTimeZoneSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setValue(Object value) throws JspTagException { 38 | this.value = value; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.fmt; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.fmt.TimeZoneSupport; 23 | 24 | /** 25 | *A handler for <timeZone> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Jan Luehe 29 | */ 30 | 31 | public class TimeZoneTag extends TimeZoneSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setValue(Object value) throws JspTagException { 38 | this.value = value; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ExprTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.xml; 19 | 20 | import org.apache.taglibs.standard.tag.common.xml.ExprSupport; 21 | 22 | /** 23 | *A handler for <out> that supports rtexprvalue-based 24 | * attributes.
25 | * 26 | * @author Shawn Bayern 27 | */ 28 | 29 | public class ExprTag extends ExprSupport { 30 | 31 | //********************************************************************* 32 | // Accessor methods 33 | 34 | // for tag attribute 35 | public void setEscapeXml(boolean escapeXml) { 36 | this.escapeXml = escapeXml; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.xml; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.xml.ParamSupport; 23 | 24 | /** 25 | *A handler for <param> that supports rtexprvalue-based 26 | * attributes.
27 | * 28 | * @author Shawn Bayern 29 | */ 30 | 31 | public class ParamTag extends ParamSupport { 32 | 33 | //********************************************************************* 34 | // Accessor methods 35 | 36 | // for tag attribute 37 | public void setName(String name) throws JspTagException { 38 | this.name = name; 39 | } 40 | 41 | // for tag attribute 42 | public void setValue(Object value) throws JspTagException { 43 | this.value = value; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.xml; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | 22 | import org.apache.taglibs.standard.tag.common.xml.ParseSupport; 23 | import org.xml.sax.XMLFilter; 24 | 25 | /** 26 | *A handler for <parse> that supports rtexprvalue-based 27 | * attributes.
28 | * 29 | * @author Shawn Bayern 30 | */ 31 | 32 | public class ParseTag extends ParseSupport { 33 | 34 | //********************************************************************* 35 | // Accessor methods 36 | 37 | // Deprecated as of JSTL 1.1 38 | // for tag attribute 39 | public void setXml(Object xml) throws JspTagException { 40 | this.xml = xml; 41 | } 42 | 43 | // 'doc' replaces 'xml' as of JSTL 1.1 44 | public void setDoc(Object xml) throws JspTagException { 45 | this.xml = xml; 46 | } 47 | 48 | public void setSystemId(String systemId) throws JspTagException { 49 | this.systemId = systemId; 50 | } 51 | 52 | // for tag attribute 53 | public void setFilter(XMLFilter filter) throws JspTagException { 54 | this.filter = filter; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tag.rt.xml; 19 | 20 | import javax.servlet.jsp.JspTagException; 21 | import javax.xml.transform.Result; 22 | 23 | import org.apache.taglibs.standard.tag.common.xml.TransformSupport; 24 | 25 | /** 26 | *A handler for <transform> that supports rtexprvalue-based 27 | * attributes.
28 | * 29 | * @author Shawn Bayern 30 | */ 31 | 32 | public class TransformTag extends TransformSupport { 33 | 34 | //********************************************************************* 35 | // Accessor methods 36 | 37 | // Deprecated as of JSTL 1.1 38 | // for tag attribute 39 | public void setXml(Object xml) throws JspTagException { 40 | this.xml = xml; 41 | } 42 | 43 | // 'doc' replaces 'xml' as of JSTL 1.1 44 | public void setDoc(Object xml) throws JspTagException { 45 | this.xml = xml; 46 | } 47 | 48 | // Deprecated as of JSTL 1.1 49 | // for tag attribute 50 | public void setXmlSystemId(String xmlSystemId) throws JspTagException { 51 | this.xmlSystemId = xmlSystemId; 52 | } 53 | 54 | // 'docSystemId' replaces 'xmlSystemId' as of JSTL 1.1 55 | public void setDocSystemId(String xmlSystemId) throws JspTagException { 56 | this.xmlSystemId = xmlSystemId; 57 | } 58 | 59 | // for tag attribute 60 | public void setXslt(Object xslt) throws JspTagException { 61 | this.xslt = xslt; 62 | } 63 | 64 | // for tag attribute 65 | public void setXsltSystemId(String xsltSystemId) throws JspTagException { 66 | this.xsltSystemId = xsltSystemId; 67 | } 68 | 69 | // for tag attribute 70 | public void setResult(Result result) throws JspTagException { 71 | this.result = result; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tei; 19 | 20 | import javax.servlet.jsp.tagext.TagData; 21 | import javax.servlet.jsp.tagext.TagExtraInfo; 22 | import javax.servlet.jsp.tagext.VariableInfo; 23 | 24 | /** 25 | *An implementation of TagExtraInfo provided for <declare>. 26 | * We simply set up a scripting variable for the ID and value that 27 | * <declare> already stored. For EA2, DefineTEI *always* declares 28 | * the variable; no option is given via a tag attribute. Visibility is 29 | * always AT_END.
30 | * 31 | * @author Shawn Bayern 32 | */ 33 | public class DeclareTEI extends TagExtraInfo { 34 | 35 | // purposely inherit JavaDoc and semantics from TagExtraInfo 36 | public VariableInfo[] getVariableInfo(TagData data) { 37 | // construct the relevant VariableInfo object 38 | VariableInfo id = new VariableInfo( 39 | data.getAttributeString("id"), 40 | data.getAttributeString("type") == null ? 41 | "java.lang.Object" : data.getAttributeString("type"), 42 | true, 43 | VariableInfo.AT_END); 44 | return new VariableInfo[] { id }; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tei/ForEachTEI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tei; 19 | 20 | import javax.servlet.jsp.tagext.TagData; 21 | import javax.servlet.jsp.tagext.TagExtraInfo; 22 | 23 | /** 24 | *An implementation of TagExtraInfo that implements validation for 25 | * ForEachTag's attributes
26 | * 27 | * @author Shawn Bayern 28 | */ 29 | public class ForEachTEI extends TagExtraInfo { 30 | 31 | final private static String ITEMS = "items"; 32 | final private static String BEGIN = "begin"; 33 | final private static String END = "end"; 34 | 35 | /* 36 | * Currently implements the following rules: 37 | * 38 | * - If 'items' is not specified, 'begin' and 'end' must be 39 | */ 40 | public boolean isValid(TagData us) { 41 | if (!Util.isSpecified(us, ITEMS)) 42 | if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END))) 43 | return false; 44 | return true; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tei/ImportTEI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tei; 19 | 20 | import javax.servlet.jsp.tagext.TagData; 21 | import javax.servlet.jsp.tagext.TagExtraInfo; 22 | 23 | /** 24 | *An implementation of TagExtraInfo that implements validation for 25 | * <c:import>'s attributes
26 | * 27 | * @author Shawn Bayern 28 | */ 29 | public class ImportTEI extends TagExtraInfo { 30 | 31 | final private static String VAR = "var"; 32 | final private static String VAR_READER = "varReader"; 33 | 34 | public boolean isValid(TagData us) { 35 | // don't allow both VAR and VAR_READER, together 36 | if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_READER)) 37 | return false; 38 | 39 | return true; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tei/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tei; 19 | 20 | import javax.servlet.jsp.tagext.TagData; 21 | 22 | /** 23 | *Utilities in support of TagExtraInfo classes.
24 | * 25 | * @author Shawn Bayern 26 | */ 27 | public class Util { 28 | 29 | /** 30 | * Returns true if the given attribute name is specified, false otherwise. 31 | */ 32 | public static boolean isSpecified(TagData data, String attributeName) { 33 | return (data.getAttribute(attributeName) != null); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /impl/src/main/java/org/apache/taglibs/standard/tei/XmlParseTEI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. 3 | * Copyright 2004 The Apache Software Foundation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.taglibs.standard.tei; 19 | 20 | import javax.servlet.jsp.tagext.TagData; 21 | import javax.servlet.jsp.tagext.TagExtraInfo; 22 | 23 | /** 24 | *An implementation of TagExtraInfo that implements validation for
25 | *
An implementation of TagExtraInfo that implements validation for 25 | * <x:transform>'s attributes
26 | * 27 | * @author Shawn Bayern 28 | */ 29 | public class XmlTransformTEI extends TagExtraInfo { 30 | 31 | final private static String XSLT = "xslt"; 32 | final private static String RESULT = "result"; 33 | final private static String VAR = "var"; 34 | 35 | public boolean isValid(TagData us) { 36 | // require XSLT 37 | if (!Util.isSpecified(us, XSLT)) 38 | return false; 39 | 40 | // disallow both VAR and RESULT 41 | if (Util.isSpecified(us, VAR) && Util.isSpecified(us, RESULT)) 42 | return false; 43 | return true; 44 | } 45 | 46 | } 47 | --------------------------------------------------------------------------------