From c2d277b2b54ba10a9941bb1955fb680ccb0fd9db Mon Sep 17 00:00:00 2001 From: Arjan Tijms Date: Mon, 6 Feb 2023 20:34:40 +0100 Subject: [PATCH] Remove implementation folder; moved to the Eclipse WaSP project. Signed-off-by: Arjan Tijms --- impl/exclude.xml | 39 - impl/pom.xml | 488 ---- .../org/apache/taglibs/standard/Version.java | 131 - .../extra/spath/ASCII_CharStream.java | 388 --- .../spath/ASCII_UCodeESC_CharStream.java | 531 ---- .../standard/extra/spath/AbsolutePath.java | 52 - .../extra/spath/AttributePredicate.java | 57 - .../standard/extra/spath/ParseException.java | 209 -- .../taglibs/standard/extra/spath/Path.java | 38 - .../standard/extra/spath/Predicate.java | 28 - .../standard/extra/spath/RelativePath.java | 59 - .../standard/extra/spath/SPathFilter.java | 282 -- .../standard/extra/spath/SPathParser.java | 700 ----- .../standard/extra/spath/SPathParser.jj | 297 --- .../extra/spath/SPathParserConstants.java | 68 - .../extra/spath/SPathParserTokenManager.java | 735 ------ .../standard/extra/spath/SPathTag.java | 91 - .../taglibs/standard/extra/spath/Step.java | 133 - .../taglibs/standard/extra/spath/Token.java | 97 - .../standard/extra/spath/TokenMgrError.java | 150 -- .../taglibs/standard/extra/spath/spath.tld | 53 - .../taglibs/standard/functions/Functions.java | 233 -- .../standard/lang/jstl/AndOperator.java | 104 - .../lang/jstl/ArithmeticOperator.java | 64 - .../standard/lang/jstl/ArraySuffix.java | 316 --- .../lang/jstl/BeanInfoIndexedProperty.java | 143 - .../standard/lang/jstl/BeanInfoManager.java | 377 --- .../standard/lang/jstl/BeanInfoProperty.java | 78 - .../standard/lang/jstl/BinaryOperator.java | 82 - .../lang/jstl/BinaryOperatorExpression.java | 140 - .../standard/lang/jstl/BooleanLiteral.java | 74 - .../taglibs/standard/lang/jstl/Coercions.java | 1026 -------- .../standard/lang/jstl/ComplexValue.java | 117 - .../taglibs/standard/lang/jstl/Constants.java | 204 -- .../standard/lang/jstl/DivideOperator.java | 103 - .../standard/lang/jstl/ELEvaluator.java | 471 ---- .../standard/lang/jstl/ELException.java | 110 - .../taglibs/standard/lang/jstl/ELParser.jj | 781 ------ .../standard/lang/jstl/EmptyOperator.java | 108 - .../standard/lang/jstl/EnumeratedMap.java | 180 -- .../standard/lang/jstl/EqualityOperator.java | 55 - .../standard/lang/jstl/EqualsOperator.java | 72 - .../taglibs/standard/lang/jstl/Evaluator.java | 168 -- .../standard/lang/jstl/Expression.java | 59 - .../standard/lang/jstl/ExpressionString.java | 109 - .../lang/jstl/FloatingPointLiteral.java | 65 - .../lang/jstl/FunctionInvocation.java | 146 - .../lang/jstl/GreaterThanOperator.java | 119 - .../jstl/GreaterThanOrEqualsOperator.java | 119 - .../standard/lang/jstl/ImplicitObjects.java | 1139 -------- .../lang/jstl/IntegerDivideOperator.java | 103 - .../standard/lang/jstl/IntegerLiteral.java | 65 - .../lang/jstl/JSTLVariableResolver.java | 109 - .../standard/lang/jstl/LessThanOperator.java | 119 - .../lang/jstl/LessThanOrEqualsOperator.java | 119 - .../taglibs/standard/lang/jstl/Literal.java | 73 - .../taglibs/standard/lang/jstl/Logger.java | 777 ------ .../standard/lang/jstl/MinusOperator.java | 84 - .../standard/lang/jstl/ModulusOperator.java | 132 - .../standard/lang/jstl/MultiplyOperator.java | 84 - .../standard/lang/jstl/NamedValue.java | 91 - .../standard/lang/jstl/NotEqualsOperator.java | 72 - .../standard/lang/jstl/NotOperator.java | 76 - .../standard/lang/jstl/NullLiteral.java | 60 - .../standard/lang/jstl/OrOperator.java | 104 - .../standard/lang/jstl/PlusOperator.java | 84 - .../standard/lang/jstl/PrimitiveObjects.java | 244 -- .../standard/lang/jstl/PropertySuffix.java | 96 - .../lang/jstl/RelationalOperator.java | 74 - .../standard/lang/jstl/Resources.properties | 158 -- .../lang/jstl/Resources_ja.properties | 139 - .../standard/lang/jstl/StringLiteral.java | 184 -- .../lang/jstl/UnaryMinusOperator.java | 136 - .../standard/lang/jstl/UnaryOperator.java | 59 - .../lang/jstl/UnaryOperatorExpression.java | 134 - .../standard/lang/jstl/ValueSuffix.java | 57 - .../standard/lang/jstl/VariableResolver.java | 52 - .../standard/lang/jstl/parser/ELParser.java | 1242 --------- .../lang/jstl/parser/ELParserConstants.java | 136 - .../jstl/parser/ELParserTokenManager.java | 1057 -------- .../lang/jstl/parser/ParseException.java | 209 -- .../lang/jstl/parser/SimpleCharStream.java | 417 --- .../standard/lang/jstl/parser/Token.java | 97 - .../lang/jstl/parser/TokenMgrError.java | 150 -- .../lang/support/ExpressionEvaluator.java | 63 - .../support/ExpressionEvaluatorManager.java | 151 -- .../taglibs/standard/resources/Resources.java | 127 - .../standard/resources/Resources.properties | 330 --- .../resources/Resources_ja.properties | 314 --- .../standard/tag/common/core/CatchTag.java | 94 - .../standard/tag/common/core/ChooseTag.java | 102 - .../standard/tag/common/core/DeclareTag.java | 38 - .../tag/common/core/ForEachSupport.java | 416 --- .../tag/common/core/ForTokensSupport.java | 103 - .../tag/common/core/ImportSupport.java | 582 ---- .../common/core/NullAttributeException.java | 43 - .../tag/common/core/OtherwiseTag.java | 38 - .../standard/tag/common/core/OutSupport.java | 205 -- .../standard/tag/common/core/ParamParent.java | 40 - .../tag/common/core/ParamSupport.java | 183 -- .../tag/common/core/RedirectSupport.java | 123 - .../standard/tag/common/core/RemoveTag.java | 103 - .../standard/tag/common/core/SetSupport.java | 241 -- .../standard/tag/common/core/UrlSupport.java | 167 -- .../standard/tag/common/core/Util.java | 295 --- .../tag/common/core/WhenTagSupport.java | 72 - .../tag/common/fmt/BundleSupport.java | 328 --- .../tag/common/fmt/FormatDateSupport.java | 206 -- .../tag/common/fmt/FormatNumberSupport.java | 336 --- .../tag/common/fmt/MessageSupport.java | 218 -- .../standard/tag/common/fmt/ParamSupport.java | 95 - .../tag/common/fmt/ParseDateSupport.java | 232 -- .../tag/common/fmt/ParseNumberSupport.java | 201 -- .../common/fmt/RequestEncodingSupport.java | 111 - .../tag/common/fmt/SetBundleSupport.java | 98 - .../tag/common/fmt/SetLocaleSupport.java | 468 ---- .../tag/common/fmt/SetTimeZoneSupport.java | 110 - .../tag/common/fmt/TimeZoneSupport.java | 153 -- .../tag/common/sql/DataSourceUtil.java | 143 - .../tag/common/sql/DataSourceWrapper.java | 155 -- .../tag/common/sql/DateParamTagSupport.java | 108 - .../standard/tag/common/sql/DriverTag.java | 138 - .../tag/common/sql/ParamTagSupport.java | 63 - .../tag/common/sql/QueryTagSupport.java | 302 --- .../standard/tag/common/sql/ResultImpl.java | 175 -- .../common/sql/SetDataSourceTagSupport.java | 130 - .../tag/common/sql/TransactionTagSupport.java | 207 -- .../tag/common/sql/UpdateTagSupport.java | 260 -- .../common/xml/DocumentBuilderProvider.java | 81 - .../standard/tag/common/xml/ExprSupport.java | 87 - .../standard/tag/common/xml/ForEachTag.java | 123 - .../standard/tag/common/xml/IfTag.java | 77 - .../standard/tag/common/xml/JSTLNodeList.java | 101 - .../tag/common/xml/JSTLXPathConstants.java | 41 - .../tag/common/xml/JSTLXPathFactory.java | 38 - .../tag/common/xml/JSTLXPathImpl.java | 315 --- .../common/xml/JSTLXPathNamespaceContext.java | 168 -- .../common/xml/JSTLXPathVariableResolver.java | 187 -- .../standard/tag/common/xml/ParamSupport.java | 83 - .../standard/tag/common/xml/ParseSupport.java | 312 --- .../standard/tag/common/xml/SetTag.java | 108 - .../tag/common/xml/TransformSupport.java | 383 --- .../tag/common/xml/UnresolvableException.java | 46 - .../standard/tag/common/xml/WhenTag.java | 77 - .../standard/tag/common/xml/XPathUtil.java | 174 -- .../standard/tag/el/core/ExpressionUtil.java | 57 - .../standard/tag/el/core/ForEachTag.java | 163 -- .../standard/tag/el/core/ForTokensTag.java | 177 -- .../taglibs/standard/tag/el/core/IfTag.java | 93 - .../standard/tag/el/core/ImportTag.java | 123 - .../taglibs/standard/tag/el/core/OutTag.java | 119 - .../standard/tag/el/core/ParamTag.java | 112 - .../standard/tag/el/core/RedirectTag.java | 110 - .../taglibs/standard/tag/el/core/SetTag.java | 130 - .../taglibs/standard/tag/el/core/UrlTag.java | 111 - .../taglibs/standard/tag/el/core/WhenTag.java | 91 - .../standard/tag/el/fmt/BundleTag.java | 112 - .../standard/tag/el/fmt/FormatDateTag.java | 168 -- .../standard/tag/el/fmt/FormatNumberTag.java | 251 -- .../standard/tag/el/fmt/MessageTag.java | 123 - .../taglibs/standard/tag/el/fmt/ParamTag.java | 108 - .../standard/tag/el/fmt/ParseDateTag.java | 195 -- .../standard/tag/el/fmt/ParseNumberTag.java | 177 -- .../tag/el/fmt/RequestEncodingTag.java | 107 - .../standard/tag/el/fmt/SetBundleTag.java | 100 - .../standard/tag/el/fmt/SetLocaleTag.java | 111 - .../standard/tag/el/fmt/SetTimeZoneTag.java | 100 - .../standard/tag/el/fmt/TimeZoneTag.java | 100 - .../standard/tag/el/sql/DateParamTag.java | 66 - .../taglibs/standard/tag/el/sql/ParamTag.java | 46 - .../taglibs/standard/tag/el/sql/QueryTag.java | 121 - .../standard/tag/el/sql/SetDataSourceTag.java | 103 - .../standard/tag/el/sql/TransactionTag.java | 61 - .../standard/tag/el/sql/UpdateTag.java | 62 - .../taglibs/standard/tag/el/xml/ExprTag.java | 116 - .../taglibs/standard/tag/el/xml/ParamTag.java | 108 - .../taglibs/standard/tag/el/xml/ParseTag.java | 127 - .../standard/tag/el/xml/TransformTag.java | 144 - .../standard/tag/rt/core/ForEachTag.java | 71 - .../standard/tag/rt/core/ForTokensTag.java | 78 - .../taglibs/standard/tag/rt/core/IfTag.java | 79 - .../standard/tag/rt/core/ImportTag.java | 51 - .../taglibs/standard/tag/rt/core/OutTag.java | 47 - .../standard/tag/rt/core/ParamTag.java | 46 - .../standard/tag/rt/core/RedirectTag.java | 46 - .../taglibs/standard/tag/rt/core/SetTag.java | 48 - .../taglibs/standard/tag/rt/core/UrlTag.java | 46 - .../taglibs/standard/tag/rt/core/WhenTag.java | 76 - .../standard/tag/rt/fmt/BundleTag.java | 45 - .../standard/tag/rt/fmt/FormatDateTag.java | 67 - .../standard/tag/rt/fmt/FormatNumberTag.java | 93 - .../standard/tag/rt/fmt/MessageTag.java | 48 - .../taglibs/standard/tag/rt/fmt/ParamTag.java | 41 - .../standard/tag/rt/fmt/ParseDateTag.java | 83 - .../standard/tag/rt/fmt/ParseNumberTag.java | 74 - .../tag/rt/fmt/RequestEncodingTag.java | 40 - .../standard/tag/rt/fmt/SetBundleTag.java | 40 - .../standard/tag/rt/fmt/SetLocaleTag.java | 45 - .../standard/tag/rt/fmt/SetTimeZoneTag.java | 40 - .../standard/tag/rt/fmt/TimeZoneTag.java | 40 - .../standard/tag/rt/sql/DateParamTag.java | 38 - .../taglibs/standard/tag/rt/sql/ParamTag.java | 32 - .../taglibs/standard/tag/rt/sql/QueryTag.java | 77 - .../standard/tag/rt/sql/SetDataSourceTag.java | 53 - .../standard/tag/rt/sql/TransactionTag.java | 57 - .../standard/tag/rt/sql/UpdateTag.java | 51 - .../taglibs/standard/tag/rt/xml/ExprTag.java | 39 - .../taglibs/standard/tag/rt/xml/ParamTag.java | 46 - .../taglibs/standard/tag/rt/xml/ParseTag.java | 57 - .../standard/tag/rt/xml/TransformTag.java | 74 - .../taglibs/standard/tei/DeclareTEI.java | 46 - .../taglibs/standard/tei/ForEachTEI.java | 47 - .../taglibs/standard/tei/ImportTEI.java | 42 - .../org/apache/taglibs/standard/tei/Util.java | 36 - .../taglibs/standard/tei/XmlParseTEI.java | 54 - .../taglibs/standard/tei/XmlTransformTEI.java | 46 - .../taglibs/standard/tlv/JstlBaseTLV.java | 341 --- .../taglibs/standard/tlv/JstlCoreTLV.java | 326 --- .../taglibs/standard/tlv/JstlFmtTLV.java | 257 -- .../taglibs/standard/tlv/JstlSqlTLV.java | 231 -- .../taglibs/standard/tlv/JstlXmlTLV.java | 306 --- impl/src/main/resources/META-INF/c-1_0-rt.tld | 411 --- impl/src/main/resources/META-INF/c-1_0.tld | 434 --- impl/src/main/resources/META-INF/c-1_2.tld | 589 ----- impl/src/main/resources/META-INF/c.tld | 590 ----- .../main/resources/META-INF/fmt-1_0-rt.tld | 421 --- impl/src/main/resources/META-INF/fmt-1_0.tld | 460 ---- impl/src/main/resources/META-INF/fmt-1_1.tld | 688 ----- impl/src/main/resources/META-INF/fmt.tld | 689 ----- impl/src/main/resources/META-INF/fn-1_1.tld | 224 -- impl/src/main/resources/META-INF/fn.tld | 225 -- .../META-INF/permittedTaglibs-1_1.tld | 51 - .../resources/META-INF/permittedTaglibs.tld | 54 - .../resources/META-INF/scriptfree-1_1.tld | 68 - .../main/resources/META-INF/scriptfree.tld | 70 - .../main/resources/META-INF/sql-1_0-rt.tld | 206 -- impl/src/main/resources/META-INF/sql-1_0.tld | 231 -- impl/src/main/resources/META-INF/sql-1_1.tld | 306 --- impl/src/main/resources/META-INF/sql.tld | 307 --- impl/src/main/resources/META-INF/x-1_0-rt.tld | 274 -- impl/src/main/resources/META-INF/x-1_0.tld | 291 -- impl/src/main/resources/META-INF/x-1_1.tld | 465 ---- impl/src/main/resources/META-INF/x.tld | 466 ---- .../standard/lang/jstl/test/Bean1.java | 276 -- .../standard/lang/jstl/test/Bean2.java | 63 - .../standard/lang/jstl/test/Bean2Editor.java | 46 - .../lang/jstl/test/EvaluationTest.java | 259 -- .../standard/lang/jstl/test/FunctionTest.java | 112 - .../standard/lang/jstl/test/ParserTest.java | 117 - .../lang/jstl/test/TestUtilities.java | 61 - .../lang/jstl/test/beans/Factory.java | 64 - .../lang/jstl/test/beans/PrivateBean1a.java | 31 - .../lang/jstl/test/beans/PrivateBean2b.java | 32 - .../lang/jstl/test/beans/PrivateBean2c.java | 32 - .../lang/jstl/test/beans/PrivateBean2d.java | 32 - .../lang/jstl/test/beans/PublicBean1.java | 31 - .../lang/jstl/test/beans/PublicBean1b.java | 32 - .../lang/jstl/test/beans/PublicBean2a.java | 32 - .../jstl/test/beans/PublicInterface2.java | 31 - .../lang/jstl/test/mock/PageContextImpl.java | 327 --- impl/src/test/resources/evaluationTests.txt | 1058 -------- .../test/resources/evaluationTestsOutput.txt | 2345 ----------------- impl/src/test/resources/parserTests.txt | 165 -- impl/src/test/resources/parserTestsOutput.txt | 265 -- pom.xml | 1 - 265 files changed, 48973 deletions(-) delete mode 100644 impl/exclude.xml delete mode 100755 impl/pom.xml delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/Version.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/AbsolutePath.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/AttributePredicate.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/ParseException.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/Path.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/Predicate.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathFilter.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.jj delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/Step.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/Token.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/TokenMgrError.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/extra/spath/spath.tld delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/AndOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArithmeticOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArraySuffix.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoIndexedProperty.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoManager.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoProperty.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperatorExpression.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BooleanLiteral.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ComplexValue.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Constants.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/DivideOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELException.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELParser.jj delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EmptyOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EnumeratedMap.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualityOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualsOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Expression.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ExpressionString.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FloatingPointLiteral.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FunctionInvocation.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOrEqualsOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerDivideOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerLiteral.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOrEqualsOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Literal.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Logger.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MinusOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ModulusOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MultiplyOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NamedValue.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotEqualsOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NullLiteral.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/OrOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PlusOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PrimitiveObjects.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PropertySuffix.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/RelationalOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources.properties delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources_ja.properties delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/StringLiteral.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryMinusOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperatorExpression.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ValueSuffix.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/VariableResolver.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserConstants.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserTokenManager.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ParseException.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/resources/Resources.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/resources/Resources.properties delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/resources/Resources_ja.properties delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/CatchTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ChooseTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/DeclareTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/NullAttributeException.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OtherwiseTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OutSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamParent.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RedirectSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RemoveTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/UrlSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/core/WhenTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java delete mode 100755 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParamSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetTimeZoneSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/TimeZoneSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DateParamTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ParamTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ResultImpl.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/SetDataSourceTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/TransactionTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/DocumentBuilderProvider.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/IfTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLNodeList.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathConstants.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathFactory.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathImpl.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathNamespaceContext.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathVariableResolver.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/SetTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/RequestEncodingTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetBundleTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetLocaleTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetTimeZoneTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/DateParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/QueryTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/SetDataSourceTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/TransactionTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/UpdateTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ExprTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParseTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/TransformTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/RedirectTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/SetTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/UrlTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/WhenTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/RequestEncodingTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetLocaleTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetTimeZoneTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/DateParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/QueryTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/SetDataSourceTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/TransactionTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/UpdateTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ExprTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tei/ForEachTEI.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tei/ImportTEI.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tei/Util.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tei/XmlParseTEI.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tei/XmlTransformTEI.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tlv/JstlFmtTLV.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tlv/JstlSqlTLV.java delete mode 100644 impl/src/main/java/org/apache/taglibs/standard/tlv/JstlXmlTLV.java delete mode 100644 impl/src/main/resources/META-INF/c-1_0-rt.tld delete mode 100644 impl/src/main/resources/META-INF/c-1_0.tld delete mode 100644 impl/src/main/resources/META-INF/c-1_2.tld delete mode 100644 impl/src/main/resources/META-INF/c.tld delete mode 100644 impl/src/main/resources/META-INF/fmt-1_0-rt.tld delete mode 100644 impl/src/main/resources/META-INF/fmt-1_0.tld delete mode 100644 impl/src/main/resources/META-INF/fmt-1_1.tld delete mode 100644 impl/src/main/resources/META-INF/fmt.tld delete mode 100644 impl/src/main/resources/META-INF/fn-1_1.tld delete mode 100644 impl/src/main/resources/META-INF/fn.tld delete mode 100644 impl/src/main/resources/META-INF/permittedTaglibs-1_1.tld delete mode 100644 impl/src/main/resources/META-INF/permittedTaglibs.tld delete mode 100644 impl/src/main/resources/META-INF/scriptfree-1_1.tld delete mode 100644 impl/src/main/resources/META-INF/scriptfree.tld delete mode 100644 impl/src/main/resources/META-INF/sql-1_0-rt.tld delete mode 100644 impl/src/main/resources/META-INF/sql-1_0.tld delete mode 100644 impl/src/main/resources/META-INF/sql-1_1.tld delete mode 100644 impl/src/main/resources/META-INF/sql.tld delete mode 100644 impl/src/main/resources/META-INF/x-1_0-rt.tld delete mode 100644 impl/src/main/resources/META-INF/x-1_0.tld delete mode 100644 impl/src/main/resources/META-INF/x-1_1.tld delete mode 100644 impl/src/main/resources/META-INF/x.tld delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean1.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2Editor.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/FunctionTest.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/TestUtilities.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/Factory.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean1a.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2b.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2c.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2d.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1b.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean2a.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicInterface2.java delete mode 100644 impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/mock/PageContextImpl.java delete mode 100644 impl/src/test/resources/evaluationTests.txt delete mode 100644 impl/src/test/resources/evaluationTestsOutput.txt delete mode 100644 impl/src/test/resources/parserTests.txt delete mode 100644 impl/src/test/resources/parserTestsOutput.txt diff --git a/impl/exclude.xml b/impl/exclude.xml deleted file mode 100644 index c88700b..0000000 --- a/impl/exclude.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/impl/pom.xml b/impl/pom.xml deleted file mode 100755 index e1ac85d..0000000 --- a/impl/pom.xml +++ /dev/null @@ -1,488 +0,0 @@ - - - - - 4.0.0 - - - org.eclipse.ee4j - project - 1.0.7 - - - - org.glassfish.web - jakarta.servlet.jsp.jstl - 3.0.1-SNAPSHOT - jar - - Jakarta Standard Tag Library Implementation - Jakarta Standard Tag Library Implementation - https://projects.eclipse.org/projects/ee4j.jstl - - - EPL 2.0 - http://www.eclipse.org/legal/epl-2.0 - repo - - - GPL2 w/ CPE - https://www.gnu.org/software/classpath/license.html - repo - - - - - - yaminikb - Yamini K B - Oracle Corporation - http://www.oracle.com/ - - - - - Kin Man Chung - - - - - - JSTL dev mailing list - jstl-dev@eclipse.org - https://dev.eclipse.org/mailman/listinfo/jstl-dev - https://dev.eclipse.org/mailman/listinfo/jstl-dev - https://dev.eclipse.org/mhonarc/lists/jstl-dev - - - - - scm:git:https://github.com/eclipse-ee4j/jstl-api.git - scm:git:ssh://git@github.com/eclipse-ee4j/jstl-api.git - https://github.com/eclipse-ee4j/jstl-api - HEAD - - - github - https://github.com/eclipse-ee4j/jstl-api/issues - - - - - jakarta.servlet - jakarta.servlet-api - 6.0.0 - provided - - - jakarta.servlet.jsp - jakarta.servlet.jsp-api - 3.1.0 - provided - - - jakarta.el - jakarta.el-api - 5.0.0 - provided - - - jakarta.servlet.jsp.jstl - jakarta.servlet.jsp.jstl-api - 3.0.0 - provided - - - xalan - xalan - 2.7.2 - compile - - - xml-apis - xml-apis - - - - - org.junit.jupiter - junit-jupiter-engine - 5.8.2 - test - - - - - - - src/main/java - - **/*.properties - **/*.xml - - - - src/main/resources - - - ${project.basedir}/.. - - LICENSE.md - NOTICE.md - - META-INF - - - ${project.basedir} - - LICENSE.md - NOTICE.md - - META-INF - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0 - - - enforce-maven - - enforce - - - - - 3.6.0 - - - - - - - - - - maven-compiler-plugin - 3.8.1 - - 11 - -Xlint:unchecked - - - - - - org.apache.felix - maven-bundle-plugin - 5.1.3 - - - org.glassfish.web.jakarta.servlet.jsp.jstl - - org.apache.taglibs.standard, - org.apache.taglibs.standard.extra.spath, - org.apache.taglibs.standard.functions, - org.apache.taglibs.standard.lang.jstl, - org.apache.taglibs.standard.lang.jstl.parser, - org.apache.taglibs.standard.lang.support, - org.apache.taglibs.standard.resources, - org.apache.taglibs.standard.tag.common.core, - org.apache.taglibs.standard.tag.common.fmt, - org.apache.taglibs.standard.tag.common.sql, - org.apache.taglibs.standard.tag.common.xml, - org.apache.taglibs.standard.tag.el.core, - org.apache.taglibs.standard.tag.el.fmt, - org.apache.taglibs.standard.tag.el.sql, - org.apache.taglibs.standard.tag.el.xml, - org.apache.taglibs.standard.tag.rt.core, - org.apache.taglibs.standard.tag.rt.fmt, - org.apache.taglibs.standard.tag.rt.sql, - org.apache.taglibs.standard.tag.rt.xml, - org.apache.taglibs.standard.tei, - org.apache.taglibs.standard.tlv, - org.glassfish.jstl.integration - - - !org.apache.bcel, - !org.apache.regexp, - !org.apache.xml, - !org.apache.xml.dtm, - !org.apache.xml.utils, - !org.apache.xpath, - !org.apache.xpath.jaxp, - !org.apache.xpath.objects, - !org.apache.xpath.res, - !java_cup.runtime, - !trax, - org.xml.sax.ext, - * - - - - - - bundle-manifest - process-classes - - manifest - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - jakarta.servlet.jsp.jstl - 2.0 - ${project.organization.name} - ${project.version} - ${project.organization.name} - - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - ${project.build.directory}/dependency-reduced-pom.xml - - - xalan:xalan - - - - - xalan:xalan - - META-INF/** - - - - - - org.apache.xpath - org.eclipse.tags.shaded.org.apache.xpath - - - org.apache.xml - org.eclipse.tags.shaded.org.apache.xml - - - org.apache.xalan - org.eclipse.tags.shaded.org.apache.xalan - - - org.apache.regexp - org.eclipse.tags.shaded.org.apache.regexp - - - org.apache.bcel - org.eclipse.tags.shaded.org.apache.bcel - - - java_cup.runtime - org.eclipse.tags.shaded.java_cup.runtime - - - trax - org.eclipse.tags.shaded.trax - - - - - - - - - maven-source-plugin - - true - - - - attach-sources - - jar-no-fork - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - timestamp-property - - timestamp-property - - validate - - current.year - yyyy - en_US - - - - - - maven-javadoc-plugin - 3.3.1 - - 11 - -Xdoclint:none - true - - - true - - - Jakarta Standard Tag Library Documentation - jakarta.servlet.jsp.jstl* - - - - - - attach-javadocs - - jar - - - - - Jakarta Standard Tag Library Documentation - org.apache.taglibs - - - none - - - - - - - - - - maven-surefire-plugin - 3.0.0-M7 - - - - - - - - - tlddocs - - - - - org.codehaus.mojo - exec-maven-plugin - 3.0.0 - - - generateTldDoc - prepare-package - - java - - - true - false - com.sun.tlddoc.TLDDoc - - -doctitle - Jakarta Tags doc - -windowtitle - Jakarta Tags Doc - -d - ${project.build.directory}/tlddoc - ${project.basedir}/src/main/resources/META-INF/sql.tld - ${project.basedir}/src/main/resources/META-INF/x.tld - ${project.basedir}/src/main/resources/META-INF/fmt.tld - ${project.basedir}/src/main/resources/META-INF/c.tld - ${project.basedir}/src/main/resources/META-INF/fn.tld - - - - - - - org.glassfish.web - tagsdoc - 1.0-SNAPSHOT - - - - - - - - diff --git a/impl/src/main/java/org/apache/taglibs/standard/Version.java b/impl/src/main/java/org/apache/taglibs/standard/Version.java deleted file mode 100644 index dc02c22..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/Version.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard; - -/** - * [lifted from xalan] - * - * Administrative class to keep track of the version number of - * the standard tag library. - *

This class implements the upcoming standard of having - * org.apache.project-name.Version.getVersion() be a standard way - * to get version information. - */ -public class Version -{ - /** - * Get the basic version string for the current release. - * Version String formatted like - * "standard-taglib v.r[.dd| Dnn]". - * - * Futurework: have this read version info from jar manifest. - * - * @return String denoting our current version - */ - public static String getVersion() - { - return getProduct() + " " + - getMajorVersionNum() + "." + getReleaseVersionNum()+ "." + - getMaintenanceVersionNum() + - ((getDevelopmentVersionNum() > 0) ? - ("_D" + getDevelopmentVersionNum()) : ""); - } - - /** - * Print the processor version to the command line. - * - * @param argv command line arguments, unused. - */ - public static void main(String argv[]) - { - System.out.println(getVersion()); - } - - /** - * Name of product - */ - public static String getProduct() - { - return "standard-taglib"; - } - - /** - * Major version number. - * Version number. This changes only when there is a - * significant, externally apparent enhancement from - * the previous release. 'n' represents the n'th - * version. - * - * Clients should carefully consider the implications - * of new versions as external interfaces and behaviour - * may have changed. - */ - public static int getMajorVersionNum() - { - return 1; - } - - /** - * Release Number. - * Release number. This changes when: - * - a new set of functionality is to be added, eg, - * implementation of a new W3C specification. - * - API or behaviour change. - * - its designated as a reference release. - */ - public static int getReleaseVersionNum() - { - return 2; - } - - /** - * Maintenance Drop Number. - * Optional identifier used to designate maintenance - * drop applied to a specific release and contains - * fixes for defects reported. It maintains compatibility - * with the release and contains no API changes. - * When missing, it designates the final and complete - * development drop for a release. - */ - public static int getMaintenanceVersionNum() - { - return 0; - } - - /** - * Development Drop Number. - * Optional identifier designates development drop of - * a specific release. D01 is the first development drop - * of a new release. - * - * Development drops are works in progress towards a - * compeleted, final release. A specific development drop - * may not completely implement all aspects of a new - * feature, which may take several development drops to - * complete. At the point of the final drop for the - * release, the D suffix will be omitted. - * - * Each 'D' drops can contain functional enhancements as - * well as defect fixes. 'D' drops may not be as stable as - * the final releases. - */ - public static int getDevelopmentVersionNum() - { - return 0; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java deleted file mode 100644 index 3854b9f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_CharStream.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */ - -package org.apache.taglibs.standard.extra.spath; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (without unicode processing). - */ - -public final class ASCII_CharStream -{ - public static final boolean staticFlag = false; - int bufsize; - int available; - int tokenBegin; - public int bufpos = -1; - private int bufline[]; - private int bufcolumn[]; - - private int column = 0; - private int line = 1; - - private boolean prevCharIsCR = false; - private boolean prevCharIsLF = false; - - private java.io.Reader inputStream; - - private char[] buffer; - private int maxNextCharInd = 0; - private int inBuf = 0; - - private void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos += (bufsize - tokenBegin)); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos -= tokenBegin); - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - - bufsize += 2048; - available = bufsize; - tokenBegin = 0; - } - - private void FillBuff() throws java.io.IOException { - if (maxNextCharInd == available) { - if (available == bufsize) { - if (tokenBegin > 2048) { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } else if (tokenBegin < 0) { - bufpos = maxNextCharInd = 0; - } else { - ExpandBuff(false); - } - } else if (available > tokenBegin) { - available = bufsize; - } else if ((tokenBegin - available) < 2048) { - ExpandBuff(true); - } else { - available = tokenBegin; - } - } - - int i; - try { - if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { - inputStream.close(); - throw new java.io.IOException(); - } else { - maxNextCharInd += i; - } - } catch (java.io.IOException e) { - --bufpos; - backup(0); - if (tokenBegin == -1) { - tokenBegin = bufpos; - } - throw e; - } - } - - public final char BeginToken() throws java.io.IOException - { - tokenBegin = -1; - char c = readChar(); - tokenBegin = bufpos; - - return c; - } - - private void UpdateLineColumn(char c) { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (8 - (column & 07)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public final char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]); - } - - if (++bufpos >= maxNextCharInd) - FillBuff(); - - char c = (char)((char)0xff & buffer[bufpos]); - - UpdateLineColumn(c); - return (c); - } - - /** - * @deprecated - * @see #getEndColumn - */ - - public final int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @deprecated - * @see #getEndLine - */ - - public final int getLine() { - return bufline[bufpos]; - } - - public final int getEndColumn() { - return bufcolumn[bufpos]; - } - - public final int getEndLine() { - return bufline[bufpos]; - } - - public final int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public final int getBeginLine() { - return bufline[tokenBegin]; - } - - public final void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public ASCII_CharStream(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - - public ASCII_CharStream(java.io.Reader dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - public ASCII_CharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public ASCII_CharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - public final String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public final char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() - { - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token.
- */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0; - int columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java deleted file mode 100644 index 7f26bd4..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ASCII_UCodeESC_CharStream.java +++ /dev/null @@ -1,531 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Generated By:JavaCC: Do not edit this line. ASCII_UCodeESC_CharStream.java Version 0.7pre6 */ - -package org.apache.taglibs.standard.extra.spath; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (with java-like unicode escape processing). - */ - -public final class ASCII_UCodeESC_CharStream -{ - public static final boolean staticFlag = false; - static final int hexval(char c) throws java.io.IOException { - switch(c) - { - case '0' : - return 0; - case '1' : - return 1; - case '2' : - return 2; - case '3' : - return 3; - case '4' : - return 4; - case '5' : - return 5; - case '6' : - return 6; - case '7' : - return 7; - case '8' : - return 8; - case '9' : - return 9; - - case 'a' : - case 'A' : - return 10; - case 'b' : - case 'B' : - return 11; - case 'c' : - case 'C' : - return 12; - case 'd' : - case 'D' : - return 13; - case 'e' : - case 'E' : - return 14; - case 'f' : - case 'F' : - return 15; - } - - throw new java.io.IOException(); // Should never come here - } - - public int bufpos = -1; - int bufsize; - int available; - int tokenBegin; - private int bufline[]; - private int bufcolumn[]; - - private int column = 0; - private int line = 1; - - private java.io.Reader inputStream; - - private boolean prevCharIsCR = false; - private boolean prevCharIsLF = false; - - private char[] nextCharBuf; - private char[] buffer; - private int maxNextCharInd = 0; - private int nextCharInd = -1; - private int inBuf = 0; - - private void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - bufpos += (bufsize - tokenBegin); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - bufpos -= tokenBegin; - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - available = (bufsize += 2048); - tokenBegin = 0; - } - - private void FillBuff() throws java.io.IOException { - int i; - if (maxNextCharInd == 4096) - maxNextCharInd = nextCharInd = 0; - - try { - if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { - inputStream.close(); - throw new java.io.IOException(); - } else { - maxNextCharInd += i; - } - } - catch(java.io.IOException e) { - if (bufpos != 0) - { - --bufpos; - backup(0); - } - else - { - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - throw e; - } - } - - private char ReadByte() throws java.io.IOException { - if (++nextCharInd >= maxNextCharInd) { - FillBuff(); - } - - return nextCharBuf[nextCharInd]; - } - - public final char BeginToken() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0) - : ++bufpos]; - } - - tokenBegin = 0; - bufpos = -1; - - return readChar(); - } - - private void AdjustBuffSize() { - if (available == bufsize) { - if (tokenBegin > 2048) { - bufpos = 0; - available = tokenBegin; - } else { - ExpandBuff(false); - } - } else if (available > tokenBegin) { - available = bufsize; - } else if ((tokenBegin - available) < 2048) { - ExpandBuff(true); - } else { - available = tokenBegin; - } - } - - private void UpdateLineColumn(char c) { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (8 - (column & 07)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public final char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]; - } - - char c; - - if (++bufpos == available) - AdjustBuffSize(); - - if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\')) - { - UpdateLineColumn(c); - - int backSlashCnt = 1; - - for (;;) // Read all the backslashes - { - if (++bufpos == available) - AdjustBuffSize(); - - try - { - if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\') - { - UpdateLineColumn(c); - // found a non-backslash char. - if ((c == 'u') && ((backSlashCnt & 1) == 1)) - { - if (--bufpos < 0) - bufpos = bufsize - 1; - - break; - } - - backup(backSlashCnt); - return '\\'; - } - } - catch(java.io.IOException e) - { - if (backSlashCnt > 1) - backup(backSlashCnt); - - return '\\'; - } - - UpdateLineColumn(c); - backSlashCnt++; - } - - // Here, we have seen an odd number of backslash's followed by a 'u' - try - { - while ((c = (char)((char)0xff & ReadByte())) == 'u') - ++column; - - buffer[bufpos] = c = (char)(hexval(c) << 12 | - hexval((char)((char)0xff & ReadByte())) << 8 | - hexval((char)((char)0xff & ReadByte())) << 4 | - hexval((char)((char)0xff & ReadByte()))); - - column += 4; - } - catch(java.io.IOException e) - { - throw new Error("Invalid escape character at line " + line + - " column " + column + "."); - } - - if (backSlashCnt == 1) - return c; - else - { - backup(backSlashCnt - 1); - return '\\'; - } - } - else - { - UpdateLineColumn(c); - return (c); - } - } - - /** - * @deprecated - * @see #getEndColumn - */ - - public final int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @deprecated - * @see #getEndLine - */ - - public final int getLine() { - return bufline[bufpos]; - } - - public final int getEndColumn() { - return bufcolumn[bufpos]; - } - - public final int getEndLine() { - return bufline[bufpos]; - } - - public final int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public final int getBeginLine() { - return bufline[tokenBegin]; - } - - public final void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public ASCII_UCodeESC_CharStream(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - - public ASCII_UCodeESC_CharStream(java.io.Reader dstream, - int startline, int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - nextCharInd = bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - - public final String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public final char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() - { - nextCharBuf = null; - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token.
- */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0; - int columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/AbsolutePath.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/AbsolutePath.java deleted file mode 100644 index 2a2c78f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/AbsolutePath.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -import java.util.List; - -/** - *

Represents an absolute SPath expression. Essentially a marker - * class.

- * - * @author Shawn Bayern - */ -public class AbsolutePath extends Path { - - private boolean all; - private RelativePath base; - - /** - * Constructs a new AbsolutePath object based on a RelativePath. - * An absolute path is the same as a relative path, except that it - * begins with '/' or '//' (which one, of those two, can be - * determined by the first Step returned from getSteps()). - */ - public AbsolutePath(RelativePath base) { - if (base == null) - throw new IllegalArgumentException("non-null base required"); - this.base = base; - } - - // inherit JavaDoc comment - @Override - public List getSteps() { - // simply return our base's Step objects - return base.getSteps(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/AttributePredicate.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/AttributePredicate.java deleted file mode 100644 index 9eb11fd..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/AttributePredicate.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - - -/** - *

Represents a predicate expression concerning a single attribute.

- * - * @author Shawn Bayern - */ -public class AttributePredicate extends Predicate { - - private String attribute, target; - - /** - * Constructs a new AttributePredicate, given an attribute name - * and a target literal (with which to test equality). - */ - public AttributePredicate(String attribute, String target) { - if (attribute == null) - throw new IllegalArgumentException("non-null attribute needed"); - if (attribute.contains(":")) { - throw new IllegalArgumentException("namespace-qualified attribute names are not currently supported"); - } - this.attribute = attribute; - - if (target == null) - throw new IllegalArgumentException("non-null target needed"); - // strip quotation marks from target - this.target = target.substring(1, target.length() - 1); - } - - /** - * Returns true if the given SAX AttributeList is suitable, given our - * attribute name and target; returns false otherwise. - */ - public boolean isMatchingAttribute(org.xml.sax.Attributes a) { - String attValue = a.getValue("", attribute); - return (attValue != null && attValue.equals(target)); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ParseException.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ParseException.java deleted file mode 100644 index 742bb50..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/ParseException.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends Exception { - - /** - * This constructor is used by the method "generateParseException" - * in the generated parser. Calling this constructor generates - * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: - */ - public ParseException(Token currentTokenVal, - int[][] expectedTokenSequencesVal, - String[] tokenImageVal - ) - { - super(""); - specialConstructor = true; - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - specialConstructor = false; - } - - public ParseException(String message) { - super(message); - specialConstructor = false; - } - - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this object has been created - * due to a parse error, and you do not catch it (it gets thrown - * from the parser), then this method is called during the printing - * of the final stack trace, and hence the correct error message - * gets displayed. - */ - @Override - public String getMessage() { - if (!specialConstructor) { - return super.getMessage(); - } - String expected = ""; - int maxSize = 0; - for (int[] expectedTokenSequence : expectedTokenSequences) { - if (maxSize < expectedTokenSequence.length) { - maxSize = expectedTokenSequence.length; - } - for (int j = 0; j < expectedTokenSequence.length; j++) { - expected += tokenImage[expectedTokenSequence[j]] + " "; - } - if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) { - expected += "..."; - } - expected += eol + " "; - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += add_escapes(tok.image); - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - retval += expected; - return retval; - } - - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - */ - protected String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Path.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Path.java deleted file mode 100644 index 1019f9b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Path.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -import java.util.List; - -/** - *

Represents a simple path (SPath) expression. A path is an ordered - * list of Steps. - * - * @author Shawn Bayern - */ -public abstract class Path { - - /** - * Retrieves an ordered list of Step objects representing this - * expression. The result is safely modifiable by the caller and - * must support List.add(Object) and List.add(int, Object). - */ - public abstract List getSteps(); - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Predicate.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Predicate.java deleted file mode 100644 index f4ce3d7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Predicate.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - - -/** - *

Represents a simple predicate expression.

- * - * @author Shawn Bayern - */ -public abstract class Predicate { - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java deleted file mode 100644 index d260065..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/RelativePath.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -import java.util.List; -import java.util.Vector; - -/** - *

Represents a relative SPath expression.

- * - * @author Shawn Bayern - */ -public class RelativePath extends Path { - - private RelativePath next; - private Step step; - - /** - * Constructs a new RelativePath object, based on a Step and another - * (possibly null) RelativePath. If 'all' is true, then the path - * matches all instances of 'next' underneath 'step'; otherwise; - * 'next' must be an immediate child of 'step'. - */ - public RelativePath(Step step, RelativePath next) { - if (step == null) - throw new IllegalArgumentException("non-null step required"); - this.step = step; - this.next = next; - } - - // inherit JavaDoc comment - @Override - public List getSteps() { - // simply merge our 'step' with our 'next' - List l; - if (next != null) - l = next.getSteps(); - else - l = new Vector<>(); - l.add(0, step); - return l; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathFilter.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathFilter.java deleted file mode 100644 index 70803e7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathFilter.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -import java.util.List; -import java.util.Stack; - -/* -import org.apache.xalan.serialize.Serializer; -import org.apache.xalan.serialize.SerializerFactory; -import org.apache.xalan.templates.OutputProperties; -*/ -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.XMLFilterImpl; - -/** - *

Filters a SAX stream based on a single supplied SPath - * expression.

- * - * @author Shawn Bayern - */ -public class SPathFilter extends XMLFilterImpl { - - //********************************************************************* - // Protected state - - /** The steps in the SPath expression we use for filtering. */ - protected List steps; - - //********************************************************************* - // Private state in support of filtering - - private int depth; // depth in parsed document - private Stack acceptedDepths; // depth of acceptance - private int excludedDepth; // depth of exclusion - - private static final boolean DEBUG = false; - - //********************************************************************* - // Main method (for testing) - - /** Simple command-line interface, mostly for testing. */ -/* - public static void main(String args[]) - throws ParseException, IOException, SAXException { -// temporary... -System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser"); - - // retrieve and parse the expression - String expr = args[0]; - SPathParser s = new SPathParser(expr); - Path p = s.expression(); - - // construct the appropriate SAX chain - // (reader -> us -> serializer) - XMLReader r = XMLReaderFactory.createXMLReader(); - XMLFilter f1 = new SPathFilter(p); - XMLFilter f2 = new XMLFilterImpl(); - f1.setParent(r); - f2.setParent(f1); - Serializer sz = SerializerFactory.getSerializer - (OutputProperties.getDefaultMethodProperties("xml")); - sz.setOutputStream(System.out); - f2.setContentHandler(sz.asContentHandler()); - - // go! - f2.parse(new InputSource(System.in)); - System.out.println(); - } -*/ - - //********************************************************************* - // Constructor and initialization methods - - /** Constructs a new SPathFilter, given a Path. */ - public SPathFilter(Path path) { - init(); - this.steps = path.getSteps(); - } - - /** Initializes state used for filtering. */ - private void init() { - depth = 0; - excludedDepth = -1; - acceptedDepths = new Stack<>(); - } - - //********************************************************************* - // ContentHandler methods - - // startElement() and endElement() both require and modify filter - // state. They contain and direct the bulk of the filter's operation. - - /** Filter for startElement(). */ - @Override - public void startElement(String uri, - String localName, - String qName, - Attributes a) throws SAXException { - // always update the depth - depth++; - - // if we're in an accepted section, simply pass through - if (isAccepted()) { - getContentHandler().startElement(uri, localName, qName, a); - return; - } - - // likewise, if we're excluded, then simply block and return - if (isExcluded()) - return; - - // now, not accepted or excluded, let's see if we've got a match. - // we need to get the appropriate step based on the number of - // steps we've previously accepted - Step currentStep = steps.get(acceptedDepths.size()); - - if (nodeMatchesStep(currentStep, uri, localName, qName, a)) { - if (DEBUG) - System.err.println("*** Progressive match (" + acceptedDepths.size() + "): " + localName); - // new match (progressive) - acceptedDepths.push(depth - 1); - - // is it enough? give acceptance another chance... - if (isAccepted()) - getContentHandler().startElement(uri, localName, qName, a); - } else if (!currentStep.isDepthUnlimited()) { - // if the step was preceded by '/' instead of '//', then - // we can't have a match at this node or beneath it - excludedDepth = depth - 1; - } - - // nothing left to check; no reason to include node - return; - } - - /** Filter for endElement(). */ - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - // reduce the depth - depth--; - - if (isExcluded()) { - // determine if exclusion ends with us - if (excludedDepth == depth) - excludedDepth = -1; - - // either way, we have been excluded, so pass nothing through - return; - } - - // if we're excepted (for now), include ourselves... - if (isAccepted()) { - getContentHandler().endElement(uri, localName, qName); - - if (DEBUG) { - System.err.println("*** Closing tag: " + localName); - System.err.println("*** acceptedDepths.size(): " + acceptedDepths.size()); - System.err.println("*** last accepted depth: " + acceptedDepths.peek()); - System.err.println("*** depth: " + depth); - } - } - // now, back off if we correspond to a "successful" start tag - if (acceptedDepths.size() > 0 && acceptedDepths.peek() == depth) { - acceptedDepths.pop(); - } - } - - // The remaining ContentHandler functions require only one bit of - // state: are we in a mode where we pass them through, or does - // the current state dictate that we ignore them. They need no other - // information and cannot have any effect on the current state. - - /** Filter for ignoreableWhitespace(). */ - @Override - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - if (isAccepted()) - getContentHandler().ignorableWhitespace(ch, start, length); - } - - /** Filter for characters(). */ - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (isAccepted()) - getContentHandler().characters(ch, start, length); - } - - /** Filter for startPrefixMapping(). */ - @Override - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - if (isAccepted()) - getContentHandler().startPrefixMapping(prefix, uri); - } - - /** Filter for endPrefixMapping(). */ - @Override - public void endPrefixMapping(String prefix) - throws SAXException { - if (isAccepted()) - getContentHandler().endPrefixMapping(prefix); - } - - /** Filter for processingInstruction(). */ - @Override - public void processingInstruction(String target, String data) - throws SAXException { - if (isAccepted()) - getContentHandler().processingInstruction(target, data); - } - - /** Filter for skippedEntity(). */ - @Override - public void skippedEntity(String name) throws SAXException { - if (isAccepted()) - getContentHandler().skippedEntity(name); - } - - // We reset state in startDocument(), in case we're reused - /** Resets state. */ - @Override - public void startDocument() { - init(); - } - - //********************************************************************* - // Private utility methods - - public static boolean nodeMatchesStep(Step s, - String uri, - String localName, - String qName, - Attributes a) { - // if the name doesn't match, then we've got a loser - if (!s.isMatchingName(uri, localName)) - return false; - - // it's still in the game; check the predicates - List l = s.getPredicates(); - for (int i = 0; l != null && i < l.size(); i++) { - Predicate p = l.get(i); - if (!(p instanceof AttributePredicate)) - throw new UnsupportedOperationException - ("only attribute predicates are supported by filter"); - if (!((AttributePredicate) p).isMatchingAttribute(a)) - return false; // all predicates must match - } - - // it's survived - return true; - } - - /** Returns true if events should be passed through, false otherwise. */ - private boolean isAccepted() { - return (acceptedDepths.size() >= steps.size()); - } - - /** Returns true if events should be blocked, false otherwise. */ - private boolean isExcluded() { - return (excludedDepth != -1); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java deleted file mode 100644 index bcb3b25..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.java +++ /dev/null @@ -1,700 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.taglibs.standard.extra.spath; - -import java.util.Enumeration; -import java.util.List; -import java.util.Vector; - -public class SPathParser implements SPathParserConstants { - - /** - * Simple command-line parser interface, primarily for testing. - */ - public static void main(String args[]) throws ParseException { - SPathParser parser = new SPathParser(System.in); - Path p = parser.expression(); - List stepList = p.getSteps(); - - // output for simple testing - System.out.println(); - if (p instanceof AbsolutePath) { - System.out.println("Root: /"); - } - for (int i = 0; i < stepList.size(); i++) { - Step s = stepList.get(i); - System.out.print("Step: " + s.getName()); - if (s.isDepthUnlimited()) { - System.out.print("(*)"); - } - System.out.println(); - } - } - - // custom constructor to accept a String - public SPathParser(String x) { - this(new java.io.StringReader(x)); - } - -//********************************************************************* -// Actual SPath grammar - final public Path expression() throws ParseException { - Path expr; - if (jj_2_1(2147483647)) { - expr = absolutePath(); - jj_consume_token(0); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case QNAME: - case NSWILDCARD: - case SLASH: - case STAR: - expr = relativePath(); - jj_consume_token(0); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - return expr; - } - - final public AbsolutePath absolutePath() throws ParseException { - RelativePath relPath; - jj_consume_token(SLASH); - relPath = relativePath(); - return new AbsolutePath(relPath); - } - -// as an example, we use recursion here to handle a list - final public RelativePath relativePath() throws ParseException { - RelativePath relPath = null; - Step step; - step = step(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SLASH: - jj_consume_token(SLASH); - relPath = relativePath(); - break; - default: - jj_la1[1] = jj_gen; - ; - } - return new RelativePath(step, relPath); - } - -// as an example, we use inline code here to handle a list -/* - * (i'm doing something perhaps unusual here, including the - * as if it were part of the step. this mechanism for differentiating - * '/' from '//' seems most natural, even if it is a bit unconventional.) - */ - final public Step step() throws ParseException { - Token slash = null; - String nt; - Vector pl = null; - Predicate p; - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SLASH: - slash = jj_consume_token(SLASH); - break; - default: - jj_la1[2] = jj_gen; - ; - } - nt = nameTest(); - label_1: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case START_BRACKET: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_1; - } - p = predicate(); - if (pl == null) { - pl = new Vector<>(); - } - pl.add(p); - } - // if 'slash != null', then we have '//' versus '/' - return new Step(slash != null, nt, pl); - } - - final public String nameTest() throws ParseException { - Token name; - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STAR: - name = jj_consume_token(STAR); - break; - case NSWILDCARD: - name = jj_consume_token(NSWILDCARD); - break; - case QNAME: - name = jj_consume_token(QNAME); - break; - default: - jj_la1[4] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - return name.toString(); - } - - final public Predicate predicate() throws ParseException { - Predicate p; - jj_consume_token(START_BRACKET); - p = attributePredicate(); - jj_consume_token(END_BRACKET); - return p; - } - - final public Predicate attributePredicate() throws ParseException { - Token attname, target; - jj_consume_token(AT); - attname = jj_consume_token(QNAME); - jj_consume_token(EQUALS); - target = jj_consume_token(LITERAL); - return new AttributePredicate(attname.toString(), target.toString()); - } - - private boolean jj_2_1(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - boolean retval = !jj_3_1(); - jj_save(0, xla); - return retval; - } - - private boolean jj_3R_13() { - if (jj_scan_token(AT)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(QNAME)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(EQUALS)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(LITERAL)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3_1() { - if (jj_3R_2()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_10() { - if (jj_scan_token(NSWILDCARD)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_11() { - if (jj_scan_token(QNAME)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_2() { - if (jj_scan_token(SLASH)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_3R_3()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_12() { - if (jj_scan_token(START_BRACKET)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_3R_13()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(END_BRACKET)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_8() { - if (jj_3R_12()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_5() { - if (jj_scan_token(SLASH)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_3R_3()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_6() { - if (jj_scan_token(SLASH)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_3() { - if (jj_3R_4()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - Token xsp; - xsp = jj_scanpos; - if (jj_3R_5()) { - jj_scanpos = xsp; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_4() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_6()) { - jj_scanpos = xsp; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_3R_7()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - while (true) { - xsp = jj_scanpos; - if (jj_3R_8()) { - jj_scanpos = xsp; - break; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - } - return false; - } - - private boolean jj_3R_9() { - if (jj_scan_token(STAR)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_7() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_9()) { - jj_scanpos = xsp; - if (jj_3R_10()) { - jj_scanpos = xsp; - if (jj_3R_11()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - public SPathParserTokenManager token_source; - ASCII_UCodeESC_CharStream jj_input_stream; - public Token token, jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - public boolean lookingAhead = false; - private int jj_gen; - final private int[] jj_la1 = new int[5]; - final private int[] jj_la1_0 = {0x6014, 0x2000, 0x2000, 0x10000, 0x4014,}; - final private JJCalls[] jj_2_rtns = new JJCalls[1]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - public SPathParser(java.io.InputStream stream) { - jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1); - token_source = new SPathParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 5; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public void ReInit(java.io.InputStream stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 5; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public SPathParser(java.io.Reader stream) { - jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1); - token_source = new SPathParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 5; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 5; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public SPathParser(SPathParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 5; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public void ReInit(SPathParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 5; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) { - token = token.next; - } else { - token = token.next = token_source.getNextToken(); - } - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (JJCalls c : jj_2_rtns) { - while (c != null) { - if (c.gen < jj_gen) { - c.first = null; - } - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; - Token tok = token; - while (tok != null && tok != jj_scanpos) { - i++; - tok = tok.next; - } - if (tok != null) { - jj_add_error_token(kind, i); - } - } - return (jj_scanpos.kind != kind); - } - - final public Token getNextToken() { - if (token.next != null) { - token = token.next; - } else { - token = token.next = token_source.getNextToken(); - } - jj_ntk = -1; - jj_gen++; - return token; - } - - final public Token getToken(int index) { - Token t = lookingAhead ? jj_scanpos : token; - for (int i = 0; i < index; i++) { - if (t.next != null) { - t = t.next; - } else { - t = t.next = token_source.getNextToken(); - } - } - return t; - } - - private int jj_ntk() { - if ((jj_nt = token.next) == null) { - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - } else { - return (jj_ntk = jj_nt.kind); - } - } - - private Vector jj_expentries = new Vector<>(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - System.arraycopy(jj_lasttokens, 0, jj_expentry, 0, jj_endpos); - boolean exists = false; - for (Enumeration enum_ = jj_expentries.elements(); enum_.hasMoreElements();) { - int[] oldentry = enum_.nextElement(); - if (oldentry.length == jj_expentry.length) { - exists = true; - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - exists = false; - break; - } - } - if (exists) { - break; - } - } - } - if (!exists) { - jj_expentries.addElement(jj_expentry); - } - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - } - - final public ParseException generateParseException() { - jj_expentries.removeAllElements(); - boolean[] la1tokens = new boolean[20]; - for (int i = 0; i < 20; i++) { - la1tokens[i] = false; - } - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 5; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1 << j)) != 0) { - la1tokens[j] = true; - } - } - } - } - for (int i = 0; i < 20; i++) { - if (la1tokens[i]) { - jj_expentry = new int[1]; - jj_expentry[0] = i; - jj_expentries.addElement(jj_expentry); - } - } - jj_endpos = 0; - jj_rescan_token(); - jj_add_error_token(0, 0); - int[][] exptokseq = new int[jj_expentries.size()][]; - for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.elementAt(i); - } - return new ParseException(token, exptokseq, tokenImage); - } - - final public void enable_tracing() { - } - - final public void disable_tracing() { - } - - private void jj_rescan_token() { - jj_rescan = true; - for (int i = 0; i < 1; i++) { - JJCalls p = jj_2_rtns[i]; - do { - if (p.gen > jj_gen) { - jj_la = p.arg; - jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: - jj_3_1(); - break; - } - } - p = p.next; - } while (p != null); - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { - p = p.next = new JJCalls(); - break; - } - p = p.next; - } - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; - } - - static final class JJCalls { - - int gen; - Token first; - int arg; - JJCalls next; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.jj b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.jj deleted file mode 100644 index d65af36..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParser.jj +++ /dev/null @@ -1,297 +0,0 @@ -//********************************************************************* -// SPath grammar (JavaCC) -// Author: Shawn Bayern -// For JSTL reference implementation (Apache Jakarta Taglibs) - - -//********************************************************************* -// Configuration and boilerplate - -options { - STATIC = false; // we'll need multiple instances - JAVA_UNICODE_ESCAPE = true; // XML uses Unicode too -} - -PARSER_BEGIN(SPathParser) - -package org.apache.taglibs.standard.extra.spath; - -import java.util.Vector; - -public class SPathParser { - - /** Simple command-line parser interface, primarily for testing. */ - public static void main(String args[]) throws ParseException - { - SPathParser parser = new SPathParser(System.in); - Path p = parser.expression(); - java.util.List l = p.getSteps(); - - // output for simple testing - System.out.println(); - if (p instanceof AbsolutePath) - System.out.println("Root: /"); - for (int i = 0; i < l.size(); i++) { - Step s = (Step) l.get(i); - System.out.print("Step: " + s.getName()); - if (s.isDepthUnlimited()) - System.out.print("(*)"); - System.out.println(); - } - } - - // custom constructor to accept a String - public SPathParser(String x) { - this(new StringReader(x)); - } - -} - -PARSER_END(SPathParser) - -//********************************************************************* -// Literals - -TOKEN : -{ - < LITERAL: - ("\"" ((~["\"","\\"]) | ("\\" ( ["\\","\""] )))* "\"") | - ("\'" ((~["\'","\\"]) | ("\\" ( ["\\","\'"] )))* "\'") - > -} - -//********************************************************************* -// Primitive identifiers - -TOKEN : -{ - < QNAME: ()? () > - |< NCNAME: ( | ) ()* > - |< NSWILDCARD: () > - |< #NCNAMECHAR: (||||| - |) > - |< #LETTER: - ( - ["\u0041"-"\u005A"] | ["\u0061"-"\u007A"] | ["\u00C0"-"\u00D6"] | - ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u00FF"] | ["\u0100"-"\u0131"] | - ["\u0134"-"\u013E"] | ["\u0141"-"\u0148"] | ["\u014A"-"\u017E"] | - ["\u0180"-"\u01C3"] | ["\u01CD"-"\u01F0"] | ["\u01F4"-"\u01F5"] | - ["\u01FA"-"\u0217"] | ["\u0250"-"\u02A8"] | ["\u02BB"-"\u02C1"] | - "\u0386" | ["\u0388"-"\u038A"] | "\u038C" | ["\u038E"-"\u03A1"] | - ["\u03A3"-"\u03CE"] | ["\u03D0"-"\u03D6"] | "\u03DA" | "\u03DC" | - "\u03DE" | "\u03E0" | ["\u03E2"-"\u03F3"] | ["\u0401"-"\u040C"] | - ["\u040E"-"\u044F"] | ["\u0451"-"\u045C"] | ["\u045E"-"\u0481"] | - ["\u0490"-"\u04C4"] | ["\u04C7"-"\u04C8"] | ["\u04CB"-"\u04CC"] | - ["\u04D0"-"\u04EB"] | ["\u04EE"-"\u04F5"] | ["\u04F8"-"\u04F9"] | - ["\u0531"-"\u0556"] | "\u0559" | ["\u0561"-"\u0586"] | - ["\u05D0"-"\u05EA"] | ["\u05F0"-"\u05F2"] | ["\u0621"-"\u063A"] | - ["\u0641"-"\u064A"] | ["\u0671"-"\u06B7"] | ["\u06BA"-"\u06BE"] | - ["\u06C0"-"\u06CE"] | ["\u06D0"-"\u06D3"] | "\u06D5" | - ["\u06E5"-"\u06E6"] | ["\u0905"-"\u0939"] | "\u093D" | - ["\u0958"-"\u0961"] | ["\u0985"-"\u098C"] | ["\u098F"-"\u0990"] | - ["\u0993"-"\u09A8"] | ["\u09AA"-"\u09B0"] | "\u09B2" | - ["\u09B6"-"\u09B9"] | ["\u09DC"-"\u09DD"] | ["\u09DF"-"\u09E1"] | - ["\u09F0"-"\u09F1"] | ["\u0A05"-"\u0A0A"] | ["\u0A0F"-"\u0A10"] | - ["\u0A13"-"\u0A28"] | ["\u0A2A"-"\u0A30"] | ["\u0A32"-"\u0A33"] | - ["\u0A35"-"\u0A36"] | ["\u0A38"-"\u0A39"] | ["\u0A59"-"\u0A5C"] | - "\u0A5E" | ["\u0A72"-"\u0A74"] | ["\u0A85"-"\u0A8B"] | "\u0A8D" | - ["\u0A8F"-"\u0A91"] | ["\u0A93"-"\u0AA8"] | ["\u0AAA"-"\u0AB0"] | - ["\u0AB2"-"\u0AB3"] | ["\u0AB5"-"\u0AB9"] | "\u0ABD" | "\u0AE0" | - ["\u0B05"-"\u0B0C"] | ["\u0B0F"-"\u0B10"] | ["\u0B13"-"\u0B28"] | - ["\u0B2A"-"\u0B30"] | ["\u0B32"-"\u0B33"] | ["\u0B36"-"\u0B39"] | - "\u0B3D" | ["\u0B5C"-"\u0B5D"] | ["\u0B5F"-"\u0B61"] | - ["\u0B85"-"\u0B8A"] | ["\u0B8E"-"\u0B90"] | ["\u0B92"-"\u0B95"] | - ["\u0B99"-"\u0B9A"] | "\u0B9C" | ["\u0B9E"-"\u0B9F"] | - ["\u0BA3"-"\u0BA4"] | ["\u0BA8"-"\u0BAA"] | ["\u0BAE"-"\u0BB5"] | - ["\u0BB7"-"\u0BB9"] | ["\u0C05"-"\u0C0C"] | ["\u0C0E"-"\u0C10"] | - ["\u0C12"-"\u0C28"] | ["\u0C2A"-"\u0C33"] | ["\u0C35"-"\u0C39"] | - ["\u0C60"-"\u0C61"] | ["\u0C85"-"\u0C8C"] | ["\u0C8E"-"\u0C90"] | - ["\u0C92"-"\u0CA8"] | ["\u0CAA"-"\u0CB3"] | ["\u0CB5"-"\u0CB9"] | - "\u0CDE" | ["\u0CE0"-"\u0CE1"] | ["\u0D05"-"\u0D0C"] | - ["\u0D0E"-"\u0D10"] | ["\u0D12"-"\u0D28"] | ["\u0D2A"-"\u0D39"] | - ["\u0D60"-"\u0D61"] | ["\u0E01"-"\u0E2E"] | "\u0E30" | - ["\u0E32"-"\u0E33"] | ["\u0E40"-"\u0E45"] | ["\u0E81"-"\u0E82"] | - "\u0E84" | ["\u0E87"-"\u0E88"] | "\u0E8A" | "\u0E8D" | - ["\u0E94"-"\u0E97"] | ["\u0E99"-"\u0E9F"] | ["\u0EA2"-"\u0EA3"] | - "\u0EA5" | "\u0EA7" | ["\u0EAA"-"\u0EAB"] | ["\u0EAD"-"\u0EAE"] | - "\u0EB0" | ["\u0EB2"-"\u0EB3"] | "\u0EBD" | ["\u0EC0"-"\u0EC4"] | - ["\u0F40"-"\u0F47"] | ["\u0F49"-"\u0F69"] | ["\u10A0"-"\u10C5"] | - ["\u10D0"-"\u10F6"] | "\u1100" | ["\u1102"-"\u1103"] | - ["\u1105"-"\u1107"] | "\u1109" | ["\u110B"-"\u110C"] | - ["\u110E"-"\u1112"] | "\u113C" | "\u113E" | "\u1140" | "\u114C" | - "\u114E" | "\u1150" | ["\u1154"-"\u1155"] | "\u1159" | - ["\u115F"-"\u1161"] | "\u1163" | "\u1165" | "\u1167" | "\u1169" | - ["\u116D"-"\u116E"] | ["\u1172"-"\u1173"] | "\u1175" | - "\u119E" | "\u11A8" | "\u11AB" | ["\u11AE"-"\u11AF"] | - ["\u11B7"-"\u11B8"] | "\u11BA" | ["\u11BC"-"\u11C2"] | "\u11EB" | - "\u11F0" | "\u11F9" | ["\u1E00"-"\u1E9B"] | ["\u1EA0"-"\u1EF9"] | - ["\u1F00"-"\u1F15"] | ["\u1F18"-"\u1F1D"] | ["\u1F20"-"\u1F45"] | - ["\u1F48"-"\u1F4D"] | ["\u1F50"-"\u1F57"] | "\u1F59" | "\u1F5B" | - "\u1F5D" | ["\u1F5F"-"\u1F7D"] | ["\u1F80"-"\u1FB4"] | - ["\u1FB6"-"\u1FBC"] | "\u1FBE" | ["\u1FC2"-"\u1FC4"] | - ["\u1FC6"-"\u1FCC"] | ["\u1FD0"-"\u1FD3"] | ["\u1FD6"-"\u1FDB"] | - ["\u1FE0"-"\u1FEC"] | ["\u1FF2"-"\u1FF4"] | ["\u1FF6"-"\u1FFC"] | - "\u2126" | ["\u212A"-"\u212B"] | "\u212E" | ["\u2180"-"\u2182"] | - ["\u3041"-"\u3094"] | ["\u30A1"-"\u30FA"] | ["\u3105"-"\u312C"] | - ["\uAC00"-"\uD7A3"] | ["\u4E00"-"\u9FA5"] | "\u3007" | - ["\u3021"-"\u3029"] - ) - > - |< #DIGIT: - ( - ["\u0030"-"\u0039"] | ["\u0660"-"\u0669"] | ["\u06F0"-"\u06F9"] | - ["\u0966"-"\u096F"] | ["\u09E6"-"\u09EF"] | ["\u0A66"-"\u0A6F"] | - ["\u0AE6"-"\u0AEF"] | ["\u0B66"-"\u0B6F"] | ["\u0BE7"-"\u0BEF"] | - ["\u0C66"-"\u0C6F"] | ["\u0CE6"-"\u0CEF"] | ["\u0D66"-"\u0D6F"] | - ["\u0E50"-"\u0E59"] | ["\u0ED0"-"\u0ED9"] | ["\u0F20"-"\u0F29"] - ) - > - |< #COMBINING_CHAR: - ( - ["\u0300"-"\u0345"] | ["\u0360"-"\u0361"] | ["\u0483"-"\u0486"] | - ["\u0591"-"\u05A1"] | ["\u05A3"-"\u05B9"] | ["\u05BB"-"\u05BD"] | - "\u05BF" | ["\u05C1"-"\u05C2"] | "\u05C4" | ["\u064B"-"\u0652"] | - "\u0670" | ["\u06D6"-"\u06DC"] | ["\u06DD"-"\u06DF"] | - ["\u06E0"-"\u06E4"] | ["\u06E7"-"\u06E8"] | ["\u06EA"-"\u06ED"] | - ["\u0901"-"\u0903"] | "\u093C" | ["\u093E"-"\u094C"] | "\u094D" | - ["\u0951"-"\u0954"] | ["\u0962"-"\u0963"] | ["\u0981"-"\u0983"] | - "\u09BC" | "\u09BE" | "\u09BF" | ["\u09C0"-"\u09C4"] | - ["\u09C7"-"\u09C8"] | ["\u09CB"-"\u09CD"] | "\u09D7" | - ["\u09E2"-"\u09E3"] | "\u0A02" | "\u0A3C" | "\u0A3E" | "\u0A3F" | - ["\u0A40"-"\u0A42"] | ["\u0A47"-"\u0A48"] | ["\u0A4B"-"\u0A4D"] | - ["\u0A70"-"\u0A71"] | ["\u0A81"-"\u0A83"] | "\u0ABC" | - ["\u0ABE"-"\u0AC5"] | ["\u0AC7"-"\u0AC9"] | ["\u0ACB"-"\u0ACD"] | - ["\u0B01"-"\u0B03"] | "\u0B3C" | ["\u0B3E"-"\u0B43"] | - ["\u0B47"-"\u0B48"] | ["\u0B4B"-"\u0B4D"] | ["\u0B56"-"\u0B57"] | - ["\u0B82"-"\u0B83"] | ["\u0BBE"-"\u0BC2"] | ["\u0BC6"-"\u0BC8"] | - ["\u0BCA"-"\u0BCD"] | "\u0BD7" | ["\u0C01"-"\u0C03"] | - ["\u0C3E"-"\u0C44"] | ["\u0C46"-"\u0C48"] | ["\u0C4A"-"\u0C4D"] | - ["\u0C55"-"\u0C56"] | ["\u0C82"-"\u0C83"] | ["\u0CBE"-"\u0CC4"] | - ["\u0CC6"-"\u0CC8"] | ["\u0CCA"-"\u0CCD"] | ["\u0CD5"-"\u0CD6"] | - ["\u0D02"-"\u0D03"] | ["\u0D3E"-"\u0D43"] | ["\u0D46"-"\u0D48"] | - ["\u0D4A"-"\u0D4D"] | "\u0D57" | "\u0E31" | ["\u0E34"-"\u0E3A"] | - ["\u0E47"-"\u0E4E"] | "\u0EB1" | ["\u0EB4"-"\u0EB9"] | - ["\u0EBB"-"\u0EBC"] | ["\u0EC8"-"\u0ECD"] | ["\u0F18"-"\u0F19"] | - "\u0F35" | "\u0F37" | "\u0F39" | "\u0F3E" | "\u0F3F" | - ["\u0F71"-"\u0F84"] | ["\u0F86"-"\u0F8B"] | ["\u0F90"-"\u0F95"] | - "\u0F97" | ["\u0F99"-"\u0FAD"] | ["\u0FB1"-"\u0FB7"] | "\u0FB9" | - ["\u20D0"-"\u20DC"] | "\u20E1" | ["\u302A"-"\u302F"] | "\u3099" | - "\u309A" - ) > - |< #EXTENDER: - ( - "\u00B7" | "\u02D0" | "\u02D1" | "\u0387" | "\u0640" | "\u0E46" | - "\u0EC6" | "\u3005" | ["\u3031"-"\u3035"] | ["\u309D"-"\u309E"] | - ["\u30FC"-"\u30FE"] - ) > - |< #UNDERSCORE: "_" > - |< #DOT: "." > - |< #DASH: "-" > -} - -//********************************************************************* -// Separators - -TOKEN : -{ - < SLASH: "/" > - |< STAR: "*" > - |< COLON: ":" > - |< START_BRACKET: "[" > - |< END_BRACKET: "]" > - |< AT: "@" > - |< EQUALS: "=" > -} - - -//********************************************************************* -// Actual SPath grammar - -Path expression(): -{ - Path expr; -} -{ - ( LOOKAHEAD(absolutePath()) expr = absolutePath() - | expr = relativePath() ) - { return expr; } -} - -AbsolutePath absolutePath(): -{ - RelativePath relPath; -} -{ - ( relPath = relativePath() ) - { return new AbsolutePath(relPath); } -} - -// as an example, we use recursion here to handle a list -RelativePath relativePath(): -{ - RelativePath relPath = null; - Step step; -} -{ - ( step = step() - ( relPath = relativePath())? ) - { - return new RelativePath(step, relPath); - } -} - -// as an example, we use inline code here to handle a list -/* - * (i'm doing something perhaps unusual here, including the - * as if it were part of the step. this mechanism for differentiating - * '/' from '//' seems most natural, even if it is a bit unconventional.) - */ -Step step(): -{ - Token slash = null; - String nt; - Vector pl = null; - Predicate p; -} -{ - ( (slash = )? - nt = nameTest() - ( p = predicate() - { - if (pl == null) pl = new Vector(); - pl.add(p); - } - )* - ) - { - // if 'slash != null', then we have '//' versus '/' - return new Step(slash != null, nt, pl); - } -} - -String nameTest(): -{ - Token name; -} -{ - ( name = | name = | name = ) - { return name.toString(); } -} - -Predicate predicate(): -{ - Predicate p; -} -{ - ( p = attributePredicate() ) - { return p; } -} - -Predicate attributePredicate(): -{ - Token attname, target; -} -{ - ( attname = target = ) - { return new AttributePredicate(attname.toString(), target.toString()); } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java deleted file mode 100644 index 65096a9..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserConstants.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -public interface SPathParserConstants { - - int EOF = 0; - int LITERAL = 1; - int QNAME = 2; - int NCNAME = 3; - int NSWILDCARD = 4; - int NCNAMECHAR = 5; - int LETTER = 6; - int DIGIT = 7; - int COMBINING_CHAR = 8; - int EXTENDER = 9; - int UNDERSCORE = 10; - int DOT = 11; - int DASH = 12; - int SLASH = 13; - int STAR = 14; - int COLON = 15; - int START_BRACKET = 16; - int END_BRACKET = 17; - int AT = 18; - int EQUALS = 19; - - int DEFAULT = 0; - - String[] tokenImage = { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\"_\"", - "\".\"", - "\"-\"", - "\"/\"", - "\"*\"", - "\":\"", - "\"[\"", - "\"]\"", - "\"@\"", - "\"=\"", - }; - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java deleted file mode 100644 index ef2e3b8..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathParserTokenManager.java +++ /dev/null @@ -1,735 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.taglibs.standard.extra.spath; - -public class SPathParserTokenManager implements SPathParserConstants { - - private int jjStopStringLiteralDfa_0(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_0(int pos, long active0) { - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); - } - - private int jjStopAtPos(int pos, int kind) { - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; - } - - private int jjStartNfaWithStates_0(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_0(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_0() { - switch (curChar) { - case 42: - return jjStopAtPos(0, 14); - case 47: - return jjStopAtPos(0, 13); - case 58: - return jjStopAtPos(0, 15); - case 61: - return jjStopAtPos(0, 19); - case 64: - return jjStopAtPos(0, 18); - case 91: - return jjStopAtPos(0, 16); - case 93: - return jjStopAtPos(0, 17); - default: - return jjMoveNfa_0(0, 0); - } - } - - private void jjCheckNAdd(int state) { - if (jjrounds[state] != jjround) { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - - private void jjAddStates(int start, int end) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); - } - - private void jjCheckNAddTwoStates(int state1, int state2) { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - - private void jjCheckNAddStates(int start, int end) { - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); - } - - private void jjCheckNAddStates(int start) { - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); - } - static final long[] jjbitVec0 = { - 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL - }; - static final long[] jjbitVec2 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL - }; - static final long[] jjbitVec3 = { - 0x0L, 0xffffffffffffc000L, 0xfffff0007fffffffL, 0x7fffffL - }; - static final long[] jjbitVec4 = { - 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL - }; - static final long[] jjbitVec5 = { - 0x7ff3ffffffffffffL, 0x7ffffffffffffdfeL, 0xffffffffffffffffL, 0xfc31ffffffffe00fL - }; - static final long[] jjbitVec6 = { - 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x3L - }; - static final long[] jjbitVec7 = { - 0x0L, 0x0L, 0xfffffffbffffd740L, 0xffffd547f7fffL - }; - static final long[] jjbitVec8 = { - 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff0003L, 0x33fcfffffff199fL - }; - static final long[] jjbitVec9 = { - 0xfffe000000000000L, 0xfffffffe027fffffL, 0x7fL, 0x707ffffff0000L - }; - static final long[] jjbitVec10 = { - 0x7fffffe00000000L, 0xfffe0000000007feL, 0x7cffffffffffffffL, 0x60002f7fffL - }; - static final long[] jjbitVec11 = { - 0x23ffffffffffffe0L, 0x3ff000000L, 0x3c5fdfffff99fe0L, 0x30003b0000000L - }; - static final long[] jjbitVec12 = { - 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100000000L - }; - static final long[] jjbitVec13 = { - 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L - }; - static final long[] jjbitVec14 = { - 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L - }; - static final long[] jjbitVec15 = { - 0x3fffdfffffddfe0L, 0x300000000L, 0x0L, 0x0L - }; - static final long[] jjbitVec16 = { - 0xd7ffffffffffeL, 0x3fL, 0x200d6caefef02596L, 0x1fL - }; - static final long[] jjbitVec17 = { - 0x0L, 0x3fffffffeffL, 0x0L, 0x0L - }; - static final long[] jjbitVec18 = { - 0x0L, 0x0L, 0xffffffff00000000L, 0x7fffffffff003fL - }; - static final long[] jjbitVec19 = { - 0x500000000007daedL, 0x2c62ab82315001L, 0xf580c90040000000L, 0x201080000000007L - }; - static final long[] jjbitVec20 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL - }; - static final long[] jjbitVec21 = { - 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL - }; - static final long[] jjbitVec22 = { - 0x4c4000000000L, 0x0L, 0x7L, 0x0L - }; - static final long[] jjbitVec23 = { - 0x3fe00000080L, 0xfffffffffffffffeL, 0xfffffffe001fffffL, 0x7ffffffffffffffL - }; - static final long[] jjbitVec24 = { - 0x1fffffffffe0L, 0x0L, 0x0L, 0x0L - }; - static final long[] jjbitVec25 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L - }; - static final long[] jjbitVec26 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L - }; - static final long[] jjbitVec27 = { - 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL - }; - static final long[] jjbitVec28 = { - 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x30003L - }; - static final long[] jjbitVec29 = { - 0xffffffffffffffffL, 0x30000003fL, 0xfffffffbffffd7c0L, 0xffffd547f7fffL - }; - static final long[] jjbitVec30 = { - 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff007bL, 0x33fcfffffff199fL - }; - static final long[] jjbitVec31 = { - 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe007fL, 0x707ffffff0016L - }; - static final long[] jjbitVec32 = { - 0x7fffffe00000000L, 0xffff03ff0007ffffL, 0x7cffffffffffffffL, 0x3ff3dffffef7fffL - }; - static final long[] jjbitVec33 = { - 0xf3ffffffffffffeeL, 0xffcfff1e3fffL, 0xd3c5fdfffff99feeL, 0x3ffcfb080399fL - }; - static final long[] jjbitVec34 = { - 0xd36dfdfffff987e4L, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100003bbfL - }; - static final long[] jjbitVec35 = { - 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L - }; - static final long[] jjbitVec36 = { - 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL - }; - static final long[] jjbitVec37 = { - 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x0L, 0x0L - }; - static final long[] jjbitVec38 = { - 0x7ff7ffffffffffeL, 0x3ff7fffL, 0x3bff6caefef02596L, 0x3ff3f5fL - }; - static final long[] jjbitVec39 = { - 0xc2a003ff03000000L, 0xfffe03fffffffeffL, 0x2fe3ffffebf0fdfL, 0x0L - }; - static final long[] jjbitVec40 = { - 0x0L, 0x0L, 0x0L, 0x21fff0000L - }; - static final long[] jjbitVec41 = { - 0x3efffe000000a0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x77ffffffffffffffL - }; - - private int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 19; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (;;) { - if (++jjround == 0x7fffffff) { - ReInitRounds(); - } - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if (curChar == 39) { - jjCheckNAddStates(0, 2); - } else if (curChar == 34) { - jjCheckNAddStates(3, 5); - } - break; - case 1: - if ((0xfffffffbffffffffL & l) != 0L) { - jjCheckNAddStates(3, 5); - } - break; - case 3: - if (curChar == 34) { - jjCheckNAddStates(3, 5); - } - break; - case 4: - if (curChar == 34 && kind > 1) { - kind = 1; - } - break; - case 5: - case 8: - if (curChar == 39) { - jjCheckNAddStates(0, 2); - } - break; - case 6: - if ((0xffffff7fffffffffL & l) != 0L) { - jjCheckNAddStates(0, 2); - } - break; - case 9: - if (curChar == 39 && kind > 1) { - kind = 1; - } - break; - case 11: - if ((0x3ff600000000000L & l) != 0L) { - jjAddStates(6, 7); - } - break; - case 12: - if (curChar == 58) { - jjstateSet[jjnewStateCnt++] = 13; - } - break; - case 14: - if ((0x3ff600000000000L & l) == 0L) { - break; - } - if (kind > 2) { - kind = 2; - } - jjstateSet[jjnewStateCnt++] = 14; - break; - case 15: - if ((0x3ff600000000000L & l) == 0L) { - break; - } - if (kind > 3) { - kind = 3; - } - jjstateSet[jjnewStateCnt++] = 15; - break; - case 16: - if ((0x3ff600000000000L & l) != 0L) { - jjAddStates(8, 9); - } - break; - case 17: - if (curChar == 58) { - jjstateSet[jjnewStateCnt++] = 18; - } - break; - case 18: - if (curChar == 42 && kind > 4) { - kind = 4; - } - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x7fffffe87fffffeL & l) == 0L) { - break; - } - if (kind > 2) { - kind = 2; - } - jjCheckNAddStates(10, 15); - break; - case 1: - if ((0xffffffffefffffffL & l) != 0L) { - jjCheckNAddStates(3, 5); - } - break; - case 2: - if (curChar == 92) { - jjstateSet[jjnewStateCnt++] = 3; - } - break; - case 3: - if (curChar == 92) { - jjCheckNAddStates(3, 5); - } - break; - case 6: - if ((0xffffffffefffffffL & l) != 0L) { - jjCheckNAddStates(0, 2); - } - break; - case 7: - if (curChar == 92) { - jjstateSet[jjnewStateCnt++] = 8; - } - break; - case 8: - if (curChar == 92) { - jjCheckNAddStates(0, 2); - } - break; - case 11: - if ((0x7fffffe87fffffeL & l) != 0L) { - jjCheckNAddTwoStates(11, 12); - } - break; - case 13: - case 14: - if ((0x7fffffe87fffffeL & l) == 0L) { - break; - } - if (kind > 2) { - kind = 2; - } - jjCheckNAdd(14); - break; - case 15: - if ((0x7fffffe87fffffeL & l) == 0L) { - break; - } - if (kind > 3) { - kind = 3; - } - jjCheckNAdd(15); - break; - case 16: - if ((0x7fffffe87fffffeL & l) != 0L) { - jjCheckNAddTwoStates(16, 17); - } - break; - default: - break; - } - } while (i != startsAt); - } else { - int hiByte = curChar >> 8; - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) { - break; - } - if (kind > 2) { - kind = 2; - } - jjCheckNAddStates(10, 15); - break; - case 1: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { - jjAddStates(3, 5); - } - break; - case 6: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { - jjAddStates(0, 2); - } - break; - case 11: - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { - jjCheckNAddTwoStates(11, 12); - } - break; - case 13: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) { - break; - } - if (kind > 2) { - kind = 2; - } - jjCheckNAdd(14); - break; - case 14: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) { - break; - } - if (kind > 2) { - kind = 2; - } - jjCheckNAdd(14); - break; - case 15: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) { - break; - } - if (kind > 3) { - kind = 3; - } - jjCheckNAdd(15); - break; - case 16: - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { - jjCheckNAddTwoStates(16, 17); - } - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 19 - (jjnewStateCnt = startsAt))) { - return curPos; - } - try { - curChar = input_stream.readChar(); - } catch (java.io.IOException e) { - return curPos; - } - } - } - static final int[] jjnextStates = { - 6, 7, 9, 1, 2, 4, 11, 12, 16, 17, 11, 12, 14, 15, 16, 17,}; - - private static boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec2[i2] & l2) != 0L); - default: - if ((jjbitVec0[i1] & l1) != 0L) { - return true; - } - return false; - } - } - - private static boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec4[i2] & l2) != 0L); - case 1: - return ((jjbitVec5[i2] & l2) != 0L); - case 2: - return ((jjbitVec6[i2] & l2) != 0L); - case 3: - return ((jjbitVec7[i2] & l2) != 0L); - case 4: - return ((jjbitVec8[i2] & l2) != 0L); - case 5: - return ((jjbitVec9[i2] & l2) != 0L); - case 6: - return ((jjbitVec10[i2] & l2) != 0L); - case 9: - return ((jjbitVec11[i2] & l2) != 0L); - case 10: - return ((jjbitVec12[i2] & l2) != 0L); - case 11: - return ((jjbitVec13[i2] & l2) != 0L); - case 12: - return ((jjbitVec14[i2] & l2) != 0L); - case 13: - return ((jjbitVec15[i2] & l2) != 0L); - case 14: - return ((jjbitVec16[i2] & l2) != 0L); - case 15: - return ((jjbitVec17[i2] & l2) != 0L); - case 16: - return ((jjbitVec18[i2] & l2) != 0L); - case 17: - return ((jjbitVec19[i2] & l2) != 0L); - case 30: - return ((jjbitVec20[i2] & l2) != 0L); - case 31: - return ((jjbitVec21[i2] & l2) != 0L); - case 33: - return ((jjbitVec22[i2] & l2) != 0L); - case 48: - return ((jjbitVec23[i2] & l2) != 0L); - case 49: - return ((jjbitVec24[i2] & l2) != 0L); - case 159: - return ((jjbitVec25[i2] & l2) != 0L); - case 215: - return ((jjbitVec26[i2] & l2) != 0L); - default: - if ((jjbitVec3[i1] & l1) != 0L) { - return true; - } - return false; - } - } - - private static boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec27[i2] & l2) != 0L); - case 1: - return ((jjbitVec5[i2] & l2) != 0L); - case 2: - return ((jjbitVec28[i2] & l2) != 0L); - case 3: - return ((jjbitVec29[i2] & l2) != 0L); - case 4: - return ((jjbitVec30[i2] & l2) != 0L); - case 5: - return ((jjbitVec31[i2] & l2) != 0L); - case 6: - return ((jjbitVec32[i2] & l2) != 0L); - case 9: - return ((jjbitVec33[i2] & l2) != 0L); - case 10: - return ((jjbitVec34[i2] & l2) != 0L); - case 11: - return ((jjbitVec35[i2] & l2) != 0L); - case 12: - return ((jjbitVec36[i2] & l2) != 0L); - case 13: - return ((jjbitVec37[i2] & l2) != 0L); - case 14: - return ((jjbitVec38[i2] & l2) != 0L); - case 15: - return ((jjbitVec39[i2] & l2) != 0L); - case 16: - return ((jjbitVec18[i2] & l2) != 0L); - case 17: - return ((jjbitVec19[i2] & l2) != 0L); - case 30: - return ((jjbitVec20[i2] & l2) != 0L); - case 31: - return ((jjbitVec21[i2] & l2) != 0L); - case 32: - return ((jjbitVec40[i2] & l2) != 0L); - case 33: - return ((jjbitVec22[i2] & l2) != 0L); - case 48: - return ((jjbitVec41[i2] & l2) != 0L); - case 49: - return ((jjbitVec24[i2] & l2) != 0L); - case 159: - return ((jjbitVec25[i2] & l2) != 0L); - case 215: - return ((jjbitVec26[i2] & l2) != 0L); - default: - if ((jjbitVec3[i1] & l1) != 0L) { - return true; - } - return false; - } - } - public static final String[] jjstrLiteralImages = { - "", null, null, null, null, null, null, null, null, null, null, null, null, - "\57", "\52", "\72", "\133", "\135", "\100", "\75",}; - public static final String[] lexStateNames = { - "DEFAULT",}; - private ASCII_UCodeESC_CharStream input_stream; - private final int[] jjrounds = new int[19]; - private final int[] jjstateSet = new int[38]; - protected char curChar; - - public SPathParserTokenManager(ASCII_UCodeESC_CharStream stream) { - if (ASCII_UCodeESC_CharStream.staticFlag) { - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - } - input_stream = stream; - } - - public SPathParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState) { - this(stream); - SwitchTo(lexState); - } - - public void ReInit(ASCII_UCodeESC_CharStream stream) { - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() { - int i; - jjround = 0x80000001; - for (i = 19; i-- > 0;) { - jjrounds[i] = 0x80000000; - } - } - - public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - public void SwitchTo(int lexState) { - if (lexState >= 1 || lexState < 0) { - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - } else { - curLexState = lexState; - } - } - - private Token jjFillToken() { - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; - } - - int curLexState = 0; - int defaultLexState = 0; - int jjnewStateCnt; - int jjround; - int jjmatchedPos; - int jjmatchedKind; - - public final Token getNextToken() { - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop: - for (;;) { - try { - curChar = input_stream.BeginToken(); - } catch (java.io.IOException e) { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) { - input_stream.backup(curPos - jjmatchedPos - 1); - } - matchedToken = jjFillToken(); - return matchedToken; - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { - input_stream.readChar(); - input_stream.backup(1); - } catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } else { - error_column++; - } - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathTag.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathTag.java deleted file mode 100644 index 561afbe..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/SPathTag.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.tagext.TagSupport; - -/** - *

Tag handler that exposes SPath functionality.

- * - * @author Shawn Bayern - */ - -public class SPathTag extends TagSupport { - - //********************************************************************* - // Internal state - - private String select; // tag attribute - private String var; // tag attribute - - //********************************************************************* - // Construction and initialization - - /** - * Constructs a new handler. As with TagSupport, subclasses should - * not provide other constructors and are expected to call the - * superclass constructor. - */ - public SPathTag() { - super(); - init(); - } - - // resets local state - private void init() { - select = var = null; - } - - - //********************************************************************* - // Tag logic - - // applies XPath expression from 'select' and exposes a filter as 'var' - @Override - public int doStartTag() throws JspException { - try { - SPathFilter s = new SPathFilter(new SPathParser(select).expression()); - pageContext.setAttribute(var, s); - return SKIP_BODY; - } catch (ParseException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - // Releases any resources we may have (or inherit) - @Override - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Attribute accessors - - public void setSelect(String select) { - this.select = select; - } - - public void setVar(String var) { - this.var = var; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Step.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Step.java deleted file mode 100644 index 7306c52..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Step.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -import java.util.List; - -/** - *

Represents a 'step' in an SPath expression.

- * - * @author Shawn Bayern - */ -public class Step { - - private boolean depthUnlimited; - private String name; - private List predicates; - - // record a few things for for efficiency... - private String uri, localPart; - - /** - * Constructs a new Step object, given a name and a (possibly null) - * list of predicates. A boolean is also passed, indicating - * whether this particular Step is relative to the 'descendent-or-self' - * axis of the node courrently under consideration. If true, it is; - * if false, then this Step is rooted as a direct child of the node - * under consideration. - */ - public Step(boolean depthUnlimited, String name, List predicates) { - if (name == null) - throw new IllegalArgumentException("non-null name required"); - this.depthUnlimited = depthUnlimited; - this.name = name; - this.predicates = predicates; - } - - /** - * Returns true if the given name matches the Step object's - * name, taking into account the Step object's wildcards; returns - * false otherwise. - */ - public boolean isMatchingName(String uri, String localPart) { - // check and normalize arguments - if (localPart == null) - throw new IllegalArgumentException("need non-null localPart"); - if (uri != null && uri.equals("")) - uri = null; - - // split name into uri/localPart if we haven't done so already - if (this.localPart == null && this.uri == null) - parseStepName(); - - // generic wildcard - if (this.uri == null && this.localPart.equals("*")) - return true; - - // match will null namespace - if (uri == null && this.uri == null - && localPart.equals(this.localPart)) - return true; - - if (uri != null && this.uri != null && uri.equals(this.uri)) { - // exact match - if (localPart.equals(this.localPart)) - return true; - - // namespace-specific wildcard - if (this.localPart.equals("*")) - return true; - } - - // no match - return false; - } - - /** Returns true if the Step's depth is unlimited, false otherwise. */ - public boolean isDepthUnlimited() { - return depthUnlimited; - } - - /** Returns the Step's node name. */ - public String getName() { - return name; - } - - /** Returns a list of this Step object's predicates. */ - public List getPredicates() { - return predicates; - } - - /** Lazily computes some information about our name. */ - private void parseStepName() { - String prefix; - int colonIndex = name.indexOf(":"); - - if (colonIndex == -1) { - // no colon, so localpart is simply name (even if it's "*") - prefix = null; - localPart = name; - } else { - prefix = name.substring(0, colonIndex); - localPart = name.substring(colonIndex + 1); - } - - uri = mapPrefix(prefix); - } - - /** Returns a URI for the given prefix, given our mappings. */ - private String mapPrefix(String prefix) { - // ability to specify a mapping is, as of yet, unimplemented - if (prefix == null) - return null; - else - throw new IllegalArgumentException( - "unknown prefix '" + prefix + "'"); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Token.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Token.java deleted file mode 100644 index 0fe2298..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/Token.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -/** - * Describes the input token stream. - */ - -public class Token { - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * Returns the image. - */ - @Override - public final String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : - * - * case MyParserConstants.ID : return new IDToken(); - * - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. - */ - public static final Token newToken(int ofKind) - { - switch(ofKind) - { - default : return new Token(); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/TokenMgrError.java b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/TokenMgrError.java deleted file mode 100644 index 00e402e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/TokenMgrError.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.extra.spath; - -public class TokenMgrError extends Error -{ - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** - * Lexical error occured. - */ - static final int LEXICAL_ERROR = 0; - - /** - * An attempt wass made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; - - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; - - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - */ - protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - - /** - * Returns a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - * Parameters : - * EOFSeen : indicates if EOF caused the lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured - * curchar : the offending character - * Note: You can customize the lexical error message by modifying this method. - */ - private static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * - * "Internal Error : Please file a bug report .... " - * - * from this method for such cases in the release version of your parser. - */ - @Override - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/spath.tld b/impl/src/main/java/org/apache/taglibs/standard/extra/spath/spath.tld deleted file mode 100644 index 3f5f3c7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/extra/spath/spath.tld +++ /dev/null @@ -1,53 +0,0 @@ - - - - PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" - "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> - - 1.0 - 1.2 - spath - http://jakarta.apache.org/taglibs/standard/spath - Sample SPath (filter) taglib - - The JSTL RI's hopefully useful example of an XMLFilter. - - - - filter - org.apache.taglibs.standard.extra.spath.SPathTag - JSP - - Exposes an XMLFilter that filters an XML document based on a subset - of the XPath language. - - - select - true - false - - - var - true - false - - - - diff --git a/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java b/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java deleted file mode 100644 index 674dfcc..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.functions; - -import java.lang.reflect.Array; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Map; -import java.util.StringTokenizer; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - *

JSTL Functions

- * - * @author Pierre Delisle - */ - -public class Functions { - - //********************************************************************* - // String capitalization - - /** - * Converts all of the characters of the input string to upper case. - */ - public static String toUpperCase(String input) { - return input.toUpperCase(); - } - - /** - * Converts all of the characters of the input string to lower case. - */ - public static String toLowerCase(String input) { - return input.toLowerCase(); - } - - //********************************************************************* - // Substring processing - - public static int indexOf(String input, String substring) { - if (input == null) input = ""; - if (substring == null) substring = ""; - return input.indexOf(substring); - } - - public static boolean contains(String input, String substring) { - return indexOf(input, substring) != -1; - } - - public static boolean containsIgnoreCase(String input, String substring) { - if (input == null) input = ""; - if (substring == null) substring = ""; - String inputUC = input.toUpperCase(); - String substringUC = substring.toUpperCase(); - return indexOf(inputUC, substringUC) != -1; - } - - public static boolean startsWith(String input, String substring) { - if (input == null) input = ""; - if (substring == null) substring = ""; - return input.startsWith(substring); - } - - public static boolean endsWith(String input, String substring) { - if (input == null) input = ""; - if (substring == null) substring = ""; - return input.endsWith(substring); - } - - public static String substring(String input, int beginIndex, int endIndex) { - if (input == null) input = ""; - if (beginIndex >= input.length()) return ""; - if (beginIndex < 0) beginIndex = 0; - if (endIndex < 0 || endIndex > input.length()) endIndex = input.length(); - if (endIndex < beginIndex) return ""; - return input.substring(beginIndex, endIndex); - } - - public static String substringAfter(String input, String substring) { - if (input == null) input = ""; - if (input.length() == 0) return ""; - if (substring == null) substring = ""; - if (substring.length() == 0) return input; - - int index = input.indexOf(substring); - if (index == -1) { - return ""; - } else { - return input.substring(index+substring.length()); - } - } - - public static String substringBefore(String input, String substring) { - if (input == null) input = ""; - if (input.length() == 0) return ""; - if (substring == null) substring = ""; - if (substring.length() == 0) return ""; - - int index = input.indexOf(substring); - if (index == -1) { - return ""; - } else { - return input.substring(0, index); - } - } - - //********************************************************************* - // Character replacement - - public static String escapeXml(String input) { - if (input == null) return ""; - return Util.escapeXml(input); - } - - public static String trim(String input) { - if (input == null) return ""; - return input.trim(); - } - - public static String replace( - String input, - String substringBefore, - String substringAfter) - { - if (input == null) input = ""; - if (input.length() == 0) return ""; - if (substringBefore == null) substringBefore = ""; - if (substringBefore.length() == 0) return input; - - StringBuilder buf = new StringBuilder(input.length()); - int startIndex = 0; - int index; - while ((index = input.indexOf(substringBefore, startIndex)) != -1) { - buf.append(input.substring(startIndex, index)).append(substringAfter); - startIndex = index + substringBefore.length(); - } - return buf.append(input.substring(startIndex)).toString(); - } - - public static String[] split( - String input, - String delimiters) - { - String[] array; - if (input == null) input = ""; - if (input.length() == 0) { - array = new String[1]; - array[0] = ""; - return array; - } - - if (delimiters == null) delimiters = ""; - - StringTokenizer tok = new StringTokenizer(input, delimiters); - int count = tok.countTokens(); - array = new String[count]; - int i = 0; - while (tok.hasMoreTokens()) { - array[i++] = tok.nextToken(); - } - return array; - } - - //********************************************************************* - // Collections processing - - public static int length(Object obj) throws JspTagException { - if (obj == null) return 0; - - if (obj instanceof String) return ((String)obj).length(); - if (obj instanceof Collection) return ((Collection)obj).size(); - if (obj instanceof Map) return ((Map)obj).size(); - - int count = 0; - if (obj instanceof Iterator) { - Iterator iter = (Iterator)obj; - count = 0; - while (iter.hasNext()) { - count++; - iter.next(); - } - return count; - } - if (obj instanceof Enumeration) { - Enumeration enum_ = (Enumeration)obj; - count = 0; - while (enum_.hasMoreElements()) { - count++; - enum_.nextElement(); - } - return count; - } - try { - count = Array.getLength(obj); - return count; - } catch (IllegalArgumentException ex) {} - throw new JspTagException(Resources.getMessage("FOREACH_BAD_ITEMS")); - } - - public static String join(String[] array, String separator) { - if (array == null) return ""; - if (separator == null) separator = ""; - - StringBuilder buf = new StringBuilder(); - for (int i=0; iThe implementation of the and operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class AndOperator - extends BinaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final AndOperator SINGLETON = - new AndOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public AndOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "and"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - // Coerce the values to booleans - boolean left = - Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); - boolean right = - Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); - - return PrimitiveObjects.getBoolean (left && right); - } - - //------------------------------------- - /** - * - * Returns true if evaluation is necessary given the specified Left - * value. The And/OrOperators make use of this - **/ - public boolean shouldEvaluate (Object pLeft) - { - return - (pLeft instanceof Boolean) && - ((Boolean) pLeft).booleanValue () == true; - } - - //------------------------------------- - /** - * - * Returns true if the operator expects its arguments to be coerced - * to Booleans. The And/Or operators set this to true. - **/ - public boolean shouldCoerceToBoolean () - { - return true; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArithmeticOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArithmeticOperator.java deleted file mode 100644 index d2e3f96..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArithmeticOperator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This is the superclass for all binary arithmetic operators - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class ArithmeticOperator - extends BinaryOperator -{ - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - return Coercions.applyArithmeticOperator (pLeft, pRight, this, pLogger); - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public abstract double apply (double pLeft, - double pRight, - Logger pLogger); - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public abstract long apply (long pLeft, - long pRight, - Logger pLogger); - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArraySuffix.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArraySuffix.java deleted file mode 100644 index 824b80a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ArraySuffix.java +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.Map; - -/** - * - *

Represents an operator that obtains a Map entry, an indexed - * value, a property value, or an indexed property value of an object. - * The following are the rules for evaluating this operator: - * - *

    - * Evaluating a[b] (assuming a.b == a["b"])
    - *   a is null
    - *     return null
    - *   b is null
    - *     return null
    - *   a is Map
    - *     !a.containsKey (b)
    - *       return null
    - *     a.get(b) == null
    - *       return null
    - *     otherwise
    - *       return a.get(b)
    - *   a is List or array
    - *     coerce b to int (using coercion rules)
    - *     coercion couldn't be performed
    - *       error
    - *     a.get(b) or Array.get(a, b) throws ArrayIndexOutOfBoundsException or IndexOutOfBoundsException
    - *       return null
    - *     a.get(b) or Array.get(a, b) throws other exception
    - *       error
    - *     return a.get(b) or Array.get(a, b)
    - * 
    - *   coerce b to String
    - *   b is a readable property of a
    - *     getter throws an exception
    - *       error
    - *     otherwise
    - *       return result of getter call
    - *
    - *   otherwise
    - *     error
    - * 
- * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ArraySuffix - extends ValueSuffix -{ - //------------------------------------- - // Constants - //------------------------------------- - - // Zero-argument array - static Object [] sNoArgs = new Object [0]; - - //------------------------------------- - // Properties - //------------------------------------- - // property index - - Expression mIndex; - public Expression getIndex () - { return mIndex; } - public void setIndex (Expression pIndex) - { mIndex = pIndex; } - - //------------------------------------- - /** - * - * Constructor - **/ - public ArraySuffix (Expression pIndex) - { - mIndex = pIndex; - } - - //------------------------------------- - /** - * - * Gets the value of the index - **/ - Object evaluateIndex (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - return mIndex.evaluate (pContext, pResolver, functions, defaultPrefix, - pLogger); - } - - //------------------------------------- - /** - * - * Returns the operator symbol - **/ - String getOperatorSymbol () - { - return "[]"; - } - - //------------------------------------- - // ValueSuffix methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return "[" + mIndex.getExpressionString () + "]"; - } - - //------------------------------------- - /** - * - * Evaluates the expression in the given context, operating on the - * given value. - **/ - public Object evaluate (Object pValue, - Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - Object indexVal; - String indexStr; - BeanInfoProperty property; - BeanInfoIndexedProperty ixproperty; - - // Check for null value - if (pValue == null) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.CANT_GET_INDEXED_VALUE_OF_NULL, - getOperatorSymbol ()); - } - return null; - } - - // Evaluate the index - else if ((indexVal = evaluateIndex (pContext, pResolver, - functions, defaultPrefix, pLogger)) == - null) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.CANT_GET_NULL_INDEX, - getOperatorSymbol ()); - } - return null; - } - - // See if it's a Map - else if (pValue instanceof Map) { - Map val = (Map) pValue; - return val.get (indexVal); - } - - // See if it's a List or array - else if (pValue instanceof List || - pValue.getClass ().isArray ()) { - Integer indexObj = Coercions.coerceToInteger (indexVal, pLogger); - if (indexObj == null) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.BAD_INDEX_VALUE, - getOperatorSymbol (), - indexVal.getClass ().getName ()); - } - return null; - } - else if (pValue instanceof List) { - try { - return ((List) pValue).get (indexObj.intValue ()); - } - catch (ArrayIndexOutOfBoundsException exc) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.EXCEPTION_ACCESSING_LIST, - exc, - indexObj); - } - return null; - } - catch (IndexOutOfBoundsException exc) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.EXCEPTION_ACCESSING_LIST, - exc, - indexObj); - } - return null; - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.EXCEPTION_ACCESSING_LIST, - exc, - indexObj); - } - return null; - } - } - else { - try { - return Array.get (pValue, indexObj.intValue ()); - } - catch (ArrayIndexOutOfBoundsException exc) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.EXCEPTION_ACCESSING_ARRAY, - exc, - indexObj); - } - return null; - } - catch (IndexOutOfBoundsException exc) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.EXCEPTION_ACCESSING_ARRAY, - exc, - indexObj); - } - return null; - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.EXCEPTION_ACCESSING_ARRAY, - exc, - indexObj); - } - return null; - } - } - } - - // Coerce to a String for property access - - else if ((indexStr = Coercions.coerceToString (indexVal, pLogger)) == - null) { - return null; - } - - // Look for a JavaBean property - else if ((property = BeanInfoManager.getBeanInfoProperty - (pValue.getClass (), - indexStr, - pLogger)) != null && - property.getReadMethod () != null) { - try { - return property.getReadMethod ().invoke (pValue, sNoArgs); - } - catch (InvocationTargetException exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ERROR_GETTING_PROPERTY, - exc.getTargetException (), - indexStr, - pValue.getClass ().getName ()); - } - return null; - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ERROR_GETTING_PROPERTY, - exc, - indexStr, - pValue.getClass ().getName ()); - } - return null; - } - } - - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.CANT_FIND_INDEX, - indexVal, - pValue.getClass ().getName (), - getOperatorSymbol ()); - } - return null; - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoIndexedProperty.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoIndexedProperty.java deleted file mode 100644 index bac27f5..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoIndexedProperty.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - - - -import java.beans.IndexedPropertyDescriptor; - -import java.beans.PropertyDescriptor; - -import java.lang.reflect.Method; - - - -/** - - * - - *

This contains the information for one indexed property in a - - * BeanInfo - IndexedPropertyDescriptor, read method, and write - - * method. This class is necessary because the read/write methods in - - * the IndexedPropertyDescriptor may not be accessible if the bean - - * given to the introspector is not a public class. In this case, a - - * publicly accessible version of the method must be found by - - * searching for a public superclass/interface that declares the - - * method (this searching is done by the BeanInfoManager). - - * - - * @author Nathan Abramson - Art Technology Group - - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - - **/ - - - -public class BeanInfoIndexedProperty - -{ - - //------------------------------------- - - // Properties - - //------------------------------------- - - // property readMethod - - - - Method mReadMethod; - - public Method getReadMethod () - - { return mReadMethod; } - - - - //------------------------------------- - - // property writeMethod - - - - Method mWriteMethod; - - public Method getWriteMethod () - - { return mWriteMethod; } - - - - //------------------------------------- - - // property propertyDescriptor - - - - IndexedPropertyDescriptor mIndexedPropertyDescriptor; - - public IndexedPropertyDescriptor getIndexedPropertyDescriptor () - - { return mIndexedPropertyDescriptor; } - - - - //------------------------------------- - - /** - - * - - * Constructor - - **/ - - public BeanInfoIndexedProperty - - (Method pReadMethod, - - Method pWriteMethod, - - IndexedPropertyDescriptor pIndexedPropertyDescriptor) - - { - - mReadMethod = pReadMethod; - - mWriteMethod = pWriteMethod; - - mIndexedPropertyDescriptor = pIndexedPropertyDescriptor; - - } - - - - //------------------------------------- - -} - diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoManager.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoManager.java deleted file mode 100644 index e53cf82..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoManager.java +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.beans.BeanInfo; -import java.beans.EventSetDescriptor; -import java.beans.IndexedPropertyDescriptor; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.Map; - -/** - * - *

Manages the BeanInfo for one class - contains the BeanInfo, and - * also a mapping from property name to BeanInfoProperty. There are - * also static methods for accessing the BeanInfoManager for a class - - * those mappings are cached permanently so that once the - * BeanInfoManager is calculated, it doesn't have to be calculated - * again. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public class BeanInfoManager -{ - //------------------------------------- - // Properties - //------------------------------------- - // property beanClass - - Class mBeanClass; - public Class getBeanClass () - { return mBeanClass; } - - //------------------------------------- - // Member variables - //------------------------------------- - - // The BeanInfo - BeanInfo mBeanInfo; - - /** Mapping from property name to BeanInfoProperty */ - Map mPropertyByName; - - /** Mapping from property name to BeanInfoIndexedProperty */ - Map mIndexedPropertyByName; - - /** Mapping from event set name to event set descriptor */ - Map mEventSetByName; - - // Flag if this is initialized - boolean mInitialized; - - /** The global mapping from class to BeanInfoManager */ - static Map, BeanInfoManager> mBeanInfoManagerByClass = new HashMap<>(); - - //------------------------------------- - /** - * - * Constructor - **/ - BeanInfoManager (Class pBeanClass) - { - mBeanClass = pBeanClass; - } - - //------------------------------------- - /** - * - * Returns the BeanInfoManager for the specified class - **/ - public static BeanInfoManager getBeanInfoManager (Class pClass) - { - BeanInfoManager ret = mBeanInfoManagerByClass.get(pClass); - if (ret == null) { - ret = createBeanInfoManager (pClass); - } - return ret; - } - - //------------------------------------- - /** - * - * Creates and registers the BeanInfoManager for the given class if - * it isn't already registered. - **/ - static synchronized BeanInfoManager createBeanInfoManager(Class pClass) { - // Because this method is synchronized statically, the - // BeanInfoManager is not initialized at this time (otherwise it - // could end up being a bottleneck for the entire system). It is - // put into the map in an uninitialized state. The first time - // someone tries to use it, it will be initialized (with proper - // synchronizations in place to make sure it is only initialized - // once). - - BeanInfoManager ret = mBeanInfoManagerByClass.get(pClass); - if (ret == null) { - ret = new BeanInfoManager (pClass); - mBeanInfoManagerByClass.put (pClass, ret); - } - return ret; - } - - //------------------------------------- - /** - * - * Returns the BeanInfoProperty for the specified property in the - * given class, or null if not found. - **/ - public static BeanInfoProperty getBeanInfoProperty - (Class pClass, - String pPropertyName, - Logger pLogger) - throws ELException - { - return getBeanInfoManager (pClass).getProperty (pPropertyName, pLogger); - } - - //------------------------------------- - /** - * - * Returns the BeanInfoIndexedProperty for the specified property in - * the given class, or null if not found. - **/ - public static BeanInfoIndexedProperty getBeanInfoIndexedProperty - (Class pClass, - String pIndexedPropertyName, - Logger pLogger) - throws ELException - { - return getBeanInfoManager - (pClass).getIndexedProperty (pIndexedPropertyName, pLogger); - } - - //------------------------------------- - /** - * - * Makes sure that this class has been initialized, and synchronizes - * the initialization if it's required. - **/ - void checkInitialized (Logger pLogger) - throws ELException - { - if (!mInitialized) { - synchronized (this) { - if (!mInitialized) { - initialize (pLogger); - mInitialized = true; - } - } - } - } - - //------------------------------------- - /** - * - * Initializes by mapping property names to BeanInfoProperties - **/ - void initialize (Logger pLogger) - throws ELException - { - try { - mBeanInfo = Introspector.getBeanInfo (mBeanClass); - - mPropertyByName = new HashMap<>(); - mIndexedPropertyByName = new HashMap<>(); - PropertyDescriptor [] pds = mBeanInfo.getPropertyDescriptors (); - for (int i = 0; pds != null && i < pds.length; i++) { - // Treat as both an indexed property and a normal property - PropertyDescriptor pd = pds [i]; - if (pd instanceof IndexedPropertyDescriptor) { - IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; - Method readMethod = getPublicMethod (ipd.getIndexedReadMethod ()); - Method writeMethod = getPublicMethod (ipd.getIndexedWriteMethod ()); - BeanInfoIndexedProperty property = new BeanInfoIndexedProperty - (readMethod, - writeMethod, - ipd); - - mIndexedPropertyByName.put (ipd.getName (), property); - } - - Method readMethod = getPublicMethod (pd.getReadMethod ()); - Method writeMethod = getPublicMethod (pd.getWriteMethod ()); - BeanInfoProperty property = new BeanInfoProperty - (readMethod, - writeMethod, - pd); - - mPropertyByName.put (pd.getName (), property); - } - - mEventSetByName = new HashMap<>(); - EventSetDescriptor [] esds = mBeanInfo.getEventSetDescriptors (); - for (int i = 0; esds != null && i < esds.length; i++) { - EventSetDescriptor esd = esds [i]; - mEventSetByName.put (esd.getName (), esd); - } - } - catch (IntrospectionException exc) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.EXCEPTION_GETTING_BEANINFO, - exc, - mBeanClass.getName ()); - } - } - } - - //------------------------------------- - /** - * - * Returns the BeanInfo for the class - **/ - BeanInfo getBeanInfo (Logger pLogger) - throws ELException - { - checkInitialized (pLogger); - return mBeanInfo; - } - - //------------------------------------- - /** - * - * Returns the BeanInfoProperty for the given property name, or null - * if not found. - **/ - public BeanInfoProperty getProperty(String pPropertyName, Logger pLogger) throws ELException { - checkInitialized(pLogger); - return mPropertyByName.get(pPropertyName); - } - - //------------------------------------- - /** - * - * Returns the BeanInfoIndexedProperty for the given property name, - * or null if not found. - **/ - public BeanInfoIndexedProperty getIndexedProperty - (String pIndexedPropertyName, - Logger pLogger) - throws ELException - { - checkInitialized (pLogger); - return mIndexedPropertyByName.get(pIndexedPropertyName); - } - - //------------------------------------- - /** - * - * Returns the EventSetDescriptor for the given event set name, or - * null if not found. - **/ - public EventSetDescriptor getEventSet (String pEventSetName, - Logger pLogger) - throws ELException - { - checkInitialized (pLogger); - return mEventSetByName.get (pEventSetName); - } - - //------------------------------------- - // Finding the public version of a method - if a PropertyDescriptor - // is obtained for a non-public class that implements a public - // interface, the read/write methods will be for the class, and - // therefore inaccessible. To correct this, a version of the same - // method must be found in a superclass or interface. - //------------------------------------- - /** - * - * Returns a publicly-accessible version of the given method, by - * searching for a public declaring class. - **/ - static Method getPublicMethod (Method pMethod) - { - if (pMethod == null) { - return null; - } - - // See if the method is already available from a public class - Class cl = pMethod.getDeclaringClass (); - if (Modifier.isPublic (cl.getModifiers ())) { - return pMethod; - } - - // Otherwise, try to find a public class that declares the method - Method ret = getPublicMethod (cl, pMethod); - if (ret != null) { - return ret; - } - else { - return pMethod; - } - } - - //------------------------------------- - /** - * - * If the given class is public and has a Method that declares the - * same name and arguments as the given method, then that method is - * returned. Otherwise the superclass and interfaces are searched - * recursively. - **/ - static Method getPublicMethod (Class pClass, - Method pMethod) - { - // See if this is a public class declaring the method - if (Modifier.isPublic (pClass.getModifiers ())) { - try { - Method m; - try { - m = pClass.getDeclaredMethod (pMethod.getName (), - pMethod.getParameterTypes ()); - } catch (java.security.AccessControlException ex) { - // kludge to accommodate J2EE RI's default settings - // TODO: see if we can simply replace - // getDeclaredMethod() with getMethod() ...? - m = pClass.getMethod(pMethod.getName (), - pMethod.getParameterTypes ()); - } - if (Modifier.isPublic (m.getModifiers ())) { - return m; - } - } - catch (NoSuchMethodException exc) {} - } - - // Search the interfaces - { - Class [] interfaces = pClass.getInterfaces (); - if (interfaces != null) { - for (int i = 0; i < interfaces.length; i++) { - Method m = getPublicMethod (interfaces [i], pMethod); - if (m != null) { - return m; - } - } - } - } - - // Search the superclass - { - Class superclass = pClass.getSuperclass (); - if (superclass != null) { - Method m = getPublicMethod (superclass, pMethod); - if (m != null) { - return m; - } - } - } - - return null; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoProperty.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoProperty.java deleted file mode 100644 index a71e560..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BeanInfoProperty.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; - -/** - * - *

This contains the information for one property in a BeanInfo - - * PropertyDescriptor, read method, and write method. This class is - * necessary because the read/write methods in the PropertyDescriptor - * may not be accessible if the bean given to the introspector is not - * a public class. In this case, a publicly accessible version of the - * method must be found by searching for a public superclass/interface - * that declares the method (this searching is done by the - * BeanInfoManager). - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public class BeanInfoProperty -{ - //------------------------------------- - // Properties - //------------------------------------- - // property readMethod - - Method mReadMethod; - public Method getReadMethod () - { return mReadMethod; } - - //------------------------------------- - // property writeMethod - - Method mWriteMethod; - public Method getWriteMethod () - { return mWriteMethod; } - - //------------------------------------- - // property propertyDescriptor - - PropertyDescriptor mPropertyDescriptor; - public PropertyDescriptor getPropertyDescriptor () - { return mPropertyDescriptor; } - - //------------------------------------- - /** - * - * Constructor - **/ - public BeanInfoProperty (Method pReadMethod, - Method pWriteMethod, - PropertyDescriptor pPropertyDescriptor) - { - mReadMethod = pReadMethod; - mWriteMethod = pWriteMethod; - mPropertyDescriptor = pPropertyDescriptor; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperator.java deleted file mode 100644 index e992d76..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperator.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This is the superclass for all binary operators - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class BinaryOperator -{ - //------------------------------------- - /** - * - * Constructor - **/ - public BinaryOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public abstract String getOperatorSymbol (); - - //------------------------------------- - /** - * - * Applies the operator to the given pair of values - **/ - public abstract Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException; - - //------------------------------------- - /** - * - * Returns true if evaluation is necessary given the specified Left - * value. The And/OrOperators make use of this - **/ - public boolean shouldEvaluate (Object pLeft) - { - return true; - } - - //------------------------------------- - /** - * - * Returns true if the operator expects its arguments to be coerced - * to Booleans. The And/Or operators set this to true. - **/ - public boolean shouldCoerceToBoolean () - { - return false; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperatorExpression.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperatorExpression.java deleted file mode 100644 index d9f95dc..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BinaryOperatorExpression.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.List; -import java.util.Map; - -/** - * - *

An expression representing a binary operator on a value - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class BinaryOperatorExpression - extends Expression -{ - //------------------------------------- - // Properties - //------------------------------------- - // property expression - - Expression mExpression; - public Expression getExpression () - { return mExpression; } - public void setExpression (Expression pExpression) - { mExpression = pExpression; } - - //------------------------------------- - // property operators - - List mOperators; - public List getOperators () - { return mOperators; } - public void setOperators (List pOperators) - { mOperators = pOperators; } - - //------------------------------------- - // property expressions - - List mExpressions; - public List getExpressions () - { return mExpressions; } - public void setExpressions (List pExpressions) - { mExpressions = pExpressions; } - - //------------------------------------- - /** - * - * Constructor - **/ - public BinaryOperatorExpression (Expression pExpression, - List pOperators, - List pExpressions) - { - mExpression = pExpression; - mOperators = pOperators; - mExpressions = pExpressions; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - @Override - public String getExpressionString() { - StringBuilder buf = new StringBuilder(); - buf.append("("); - buf.append(mExpression.getExpressionString()); - for (int i = 0; i < mOperators.size(); i++) { - BinaryOperator operator = (BinaryOperator) mOperators.get(i); - Expression expression = (Expression) mExpressions.get(i); - buf.append(" "); - buf.append(operator.getOperatorSymbol()); - buf.append(" "); - buf.append(expression.getExpressionString()); - } - buf.append(")"); - - return buf.toString(); - } - - //------------------------------------- - /** - * - * Evaluates to the literal value - **/ - public Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - Object value = mExpression.evaluate (pContext, pResolver, functions, - defaultPrefix, pLogger); - for (int i = 0; i < mOperators.size (); i++) { - BinaryOperator operator = (BinaryOperator) mOperators.get (i); - - // For the And/Or operators, we need to coerce to a boolean - // before testing if we shouldEvaluate - if (operator.shouldCoerceToBoolean ()) { - value = Coercions.coerceToBoolean (value, pLogger); - } - - if (operator.shouldEvaluate (value)) { - Expression expression = (Expression) mExpressions.get (i); - Object nextValue = expression.evaluate (pContext, pResolver, - functions, defaultPrefix, - pLogger); - - value = operator.apply (value, nextValue, pContext, pLogger); - } - } - return value; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BooleanLiteral.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BooleanLiteral.java deleted file mode 100644 index 55fe354..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/BooleanLiteral.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

An expression representing a boolean literal value - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class BooleanLiteral - extends Literal -{ - //------------------------------------- - // Member variables - //------------------------------------- - - public static final BooleanLiteral TRUE = new BooleanLiteral ("true"); - public static final BooleanLiteral FALSE = new BooleanLiteral ("false"); - - //------------------------------------- - /** - * - * Constructor - **/ - public BooleanLiteral (String pToken) - { - super (getValueFromToken (pToken)); - } - - //------------------------------------- - /** - * - * Parses the given token into the literal value - **/ - static Object getValueFromToken (String pToken) - { - return - ("true".equals (pToken)) ? - Boolean.TRUE : - Boolean.FALSE; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return (getValue () == Boolean.TRUE) ? "true" : "false"; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java deleted file mode 100644 index 5cc4daf..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Coercions.java +++ /dev/null @@ -1,1026 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.beans.PropertyEditor; -import java.beans.PropertyEditorManager; - -/** - * - *

This class contains the logic for coercing data types before - * operators are applied to them. - * - *

The following is the list of rules applied for various type - * conversions. - * - *

    - * Applying arithmetic operator
    - *   Binary operator - A {+,-,*} B
    - *     if A and B are null
    - *       return 0
    - *     if A or B is Float, Double, or String containing ".", "e", or "E"
    - *       coerce both A and B to Double
    - *       apply operator
    - *     otherwise
    - *       coerce both A and B to Long
    - *       apply operator
    - *     if operator results in exception (such as divide by 0), error
    - * 
    - *   Binary operator - A {/,div} B
    - *     if A and B are null
    - *       return 0
    - *     otherwise
    - *       coerce both A and B to Double
    - *       apply operator
    - *     if operator results in exception (such as divide by 0), error
    - * 
    - *   Binary operator - A {%,mod} B
    - *     if A and B are null
    - *       return 0
    - *     if A or B is Float, Double, or String containing ".", "e" or "E"
    - *       coerce both to Double
    - *       apply operator
    - *     otherwise
    - *       coerce both A and B to Long
    - *       apply operator
    - *     if operator results in exception (such as divide by 0), error
    - * 
    - *   Unary minus operator - -A
    - *     if A is null
    - *       return 0
    - *     if A is String
    - *       if A contains ".", "e", or "E"
    - *         coerce to Double, apply operator
    - *       otherwise
    - *         coerce to a Long and apply operator
    - *     if A is Byte,Short,Integer,Long,Float,Double
    - *       retain type, apply operator
    - *     if operator results in exception, error
    - *     otherwise
    - *       error
    - *
    - * Applying "empty" operator - empty A
    - *   if A is null
    - *     return true
    - *   if A is zero-length String
    - *     return true
    - *   if A is zero-length array
    - *     return true
    - *   if A is List and ((List) A).isEmpty()
    - *     return true
    - *   if A is Map and ((Map) A).isEmpty()
    - *     return true
    - *   otherwise
    - *     return false
    - * 
    - * Applying logical operators
    - *   Binary operator - A {and,or} B
    - *     coerce both A and B to Boolean, apply operator
    - *   NOTE - operator stops as soon as expression can be determined, i.e.,
    - *     A and B and C and D - if B is false, then only A and B is evaluated
    - *   Unary not operator - not A
    - *     coerce A to Boolean, apply operator
    - * 
    - * Applying relational operator
    - *   A {{@literal <},{@literal >},{@literal <}=,{@literal >}=,lt,gt,lte,gte} B
    - *     if A==B
    - *       if operator is {@literal >}= or {@literal <}=
    - *         return true
    - *       otherwise
    - *         return false
    - *     if A or B is null
    - *       return false
    - *     if A or B is Float or Double
    - *       coerce both A and B to Double
    - *       apply operator
    - *     if A or B is Byte,Short,Character,Integer,Long
    - *       coerce both A and B to Long
    - *       apply operator
    - *     if A or B is String
    - *       coerce both A and B to String, compare lexically
    - *     if A is Comparable
    - *       if A.compareTo (B) throws exception
    - *         error
    - *       otherwise
    - *         use result of A.compareTo(B)
    - *     if B is Comparable
    - *       if B.compareTo (A) throws exception
    - *         error
    - *       otherwise
    - *         use result of B.compareTo(A)
    - *     otherwise
    - *       error
    - * 
    - * Applying equality operator
    - *   A {==,!=} B
    - *     if A==B
    - *       apply operator
    - *     if A or B is null
    - *       return false for ==, true for !=
    - *     if A or B is Float or Double
    - *       coerce both A and B to Double
    - *       apply operator
    - *     if A or B is Byte,Short,Character,Integer,Long
    - *       coerce both A and B to Long
    - *       apply operator
    - *     if A or B is Boolean
    - *       coerce both A and B to Boolean
    - *       apply operator
    - *     if A or B is String
    - *       coerce both A and B to String, compare lexically
    - *     otherwise
    - *       if an error occurs while calling A.equals(B)
    - *         error
    - *       apply operator to result of A.equals(B)
    - * 
    - * coercions
    - * 
    - *   coerce A to String
    - *     A is String
    - *       return A
    - *     A is null
    - *       return ""
    - *     A.toString throws exception
    - *       error
    - *     otherwise
    - *       return A.toString
    - * 
    - *   coerce A to primitive Number type N
    - *     A is null or ""
    - *       return 0
    - *     A is Character
    - *       convert to short, apply following rules
    - *     A is Boolean
    - *       error
    - *     A is Number type N
    - *       return A
    - *     A is Number with less precision than N
    - *       coerce quietly
    - *     A is Number with greater precision than N
    - *       coerce quietly
    - *     A is String
    - *       new N.valueOf(A) throws exception
    - *         error
    - *       return N.valueOf(A)
    - *     otherwise
    - *       error
    - * 
    - *   coerce A to Character should be
    - *     A is null or ""
    - *       return (char) 0
    - *     A is Character
    - *       return A
    - *     A is Boolean
    - *       error
    - *     A is Number with less precision than short
    - *       coerce quietly - return (char) A
    - *     A is Number with greater precision than short
    - *       coerce quietly - return (char) A
    - *     A is String
    - *       return A.charAt (0)
    - *     otherwise
    - *       error
    - * 
    - *   coerce A to Boolean
    - *     A is null or ""
    - *       return false
    - *     A is Boolean
    - *       return A
    - *     A is String
    - *       Boolean.valueOf(A) throws exception
    - *         error
    - *       return Boolean.valueOf(A)
    - *     otherwise
    - *       error
    - * 
    - *   coerce A to any other type T
    - *     A is null
    - *       return null
    - *     A is assignable to T
    - *       coerce quietly
    - *     A is String
    - *       T has no PropertyEditor
    - *         if A is "", return null
    - *         otherwise error
    - *       T's PropertyEditor throws exception
    - *         if A is "", return null
    - *         otherwise error
    - *       otherwise
    - *         apply T's PropertyEditor
    - *     otherwise
    - *       error
    - * 
- * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class Coercions -{ - //------------------------------------- - /** - * - * Coerces the given value to the specified class. - **/ - public static Object coerce (Object pValue, - Class pClass, - Logger pLogger) - throws ELException - { - if (pClass == String.class) { - return coerceToString (pValue, pLogger); - } - else if (isPrimitiveNumberClass (pClass)) { - return coerceToPrimitiveNumber (pValue, pClass, pLogger); - } - else if (pClass == Character.class || - pClass == Character.TYPE) { - return coerceToCharacter (pValue, pLogger); - } - else if (pClass == Boolean.class || - pClass == Boolean.TYPE) { - return coerceToBoolean (pValue, pLogger); - } - else { - return coerceToObject (pValue, pClass, pLogger); - } - } - - //------------------------------------- - /** - * - * Returns true if the given class is Byte, Short, Integer, Long, - * Float, Double - **/ - static boolean isPrimitiveNumberClass (Class pClass) - { - return - pClass == Byte.class || - pClass == Byte.TYPE || - pClass == Short.class || - pClass == Short.TYPE || - pClass == Integer.class || - pClass == Integer.TYPE || - pClass == Long.class || - pClass == Long.TYPE || - pClass == Float.class || - pClass == Float.TYPE || - pClass == Double.class || - pClass == Double.TYPE; - } - - //------------------------------------- - /** - * - * Coerces the specified value to a String - **/ - public static String coerceToString (Object pValue, - Logger pLogger) - throws ELException - { - if (pValue == null) { - return ""; - } - else if (pValue instanceof String) { - return (String) pValue; - } - else { - try { - return pValue.toString (); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError (Constants.TOSTRING_EXCEPTION, - exc, - pValue.getClass ().getName ()); - } - return ""; - } - } - } - - //------------------------------------- - /** - * - * Coerces a value to the given primitive number class - **/ - public static Number coerceToPrimitiveNumber (Object pValue, - Class pClass, - Logger pLogger) - throws ELException - { - if (pValue == null || - "".equals (pValue)) { - return coerceToPrimitiveNumber (0, pClass); - } - else if (pValue instanceof Character) { - char val = ((Character) pValue).charValue (); - return coerceToPrimitiveNumber ((short) val, pClass); - } - else if (pValue instanceof Boolean) { - if (pLogger.isLoggingError ()) { - pLogger.logError (Constants.BOOLEAN_TO_NUMBER, - pValue, - pClass.getName ()); - } - return coerceToPrimitiveNumber (0, pClass); - } - else if (pValue.getClass () == pClass) { - return (Number) pValue; - } - else if (pValue instanceof Number) { - return coerceToPrimitiveNumber ((Number) pValue, pClass); - } - else if (pValue instanceof String) { - try { - return coerceToPrimitiveNumber ((String) pValue, pClass); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.STRING_TO_NUMBER_EXCEPTION, - (String) pValue, - pClass.getName ()); - } - return coerceToPrimitiveNumber (0, pClass); - } - } - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.COERCE_TO_NUMBER, - pValue.getClass ().getName (), - pClass.getName ()); - } - return coerceToPrimitiveNumber (0, pClass); - } - } - - //------------------------------------- - /** - * - * Coerces a value to an Integer, returning null if the coercion - * isn't possible. - **/ - public static Integer coerceToInteger (Object pValue, - Logger pLogger) - throws ELException - { - if (pValue == null) { - return null; - } - else if (pValue instanceof Character) { - return PrimitiveObjects.getInteger - ((int) (((Character) pValue).charValue ())); - } - else if (pValue instanceof Boolean) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning (Constants.BOOLEAN_TO_NUMBER, - pValue, - Integer.class.getName ()); - } - return PrimitiveObjects.getInteger - (((Boolean) pValue).booleanValue () ? 1 : 0); - } - else if (pValue instanceof Integer) { - return (Integer) pValue; - } - else if (pValue instanceof Number) { - return PrimitiveObjects.getInteger (((Number) pValue).intValue ()); - } - else if (pValue instanceof String) { - try { - return Integer.valueOf ((String) pValue); - } - catch (Exception exc) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.STRING_TO_NUMBER_EXCEPTION, - (String) pValue, - Integer.class.getName ()); - } - return null; - } - } - else { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.COERCE_TO_NUMBER, - pValue.getClass ().getName (), - Integer.class.getName ()); - } - return null; - } - } - - //------------------------------------- - /** - * - * Coerces a long to the given primitive number class - **/ - static Number coerceToPrimitiveNumber (long pValue, - Class pClass) - throws ELException - { - if (pClass == Byte.class || pClass == Byte.TYPE) { - return PrimitiveObjects.getByte ((byte) pValue); - } - else if (pClass == Short.class || pClass == Short.TYPE) { - return PrimitiveObjects.getShort ((short) pValue); - } - else if (pClass == Integer.class || pClass == Integer.TYPE) { - return PrimitiveObjects.getInteger ((int) pValue); - } - else if (pClass == Long.class || pClass == Long.TYPE) { - return PrimitiveObjects.getLong ((long) pValue); - } - else if (pClass == Float.class || pClass == Float.TYPE) { - return PrimitiveObjects.getFloat ((float) pValue); - } - else if (pClass == Double.class || pClass == Double.TYPE) { - return PrimitiveObjects.getDouble ((double) pValue); - } - else { - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- - /** - * - * Coerces a double to the given primitive number class - **/ - static Number coerceToPrimitiveNumber (double pValue, - Class pClass) - throws ELException - { - if (pClass == Byte.class || pClass == Byte.TYPE) { - return PrimitiveObjects.getByte ((byte) pValue); - } - else if (pClass == Short.class || pClass == Short.TYPE) { - return PrimitiveObjects.getShort ((short) pValue); - } - else if (pClass == Integer.class || pClass == Integer.TYPE) { - return PrimitiveObjects.getInteger ((int) pValue); - } - else if (pClass == Long.class || pClass == Long.TYPE) { - return PrimitiveObjects.getLong ((long) pValue); - } - else if (pClass == Float.class || pClass == Float.TYPE) { - return PrimitiveObjects.getFloat ((float) pValue); - } - else if (pClass == Double.class || pClass == Double.TYPE) { - return PrimitiveObjects.getDouble ((double) pValue); - } - else { - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- - /** - * - * Coerces a Number to the given primitive number class - **/ - static Number coerceToPrimitiveNumber (Number pValue, - Class pClass) - throws ELException - { - if (pClass == Byte.class || pClass == Byte.TYPE) { - return PrimitiveObjects.getByte (pValue.byteValue ()); - } - else if (pClass == Short.class || pClass == Short.TYPE) { - return PrimitiveObjects.getShort (pValue.shortValue ()); - } - else if (pClass == Integer.class || pClass == Integer.TYPE) { - return PrimitiveObjects.getInteger (pValue.intValue ()); - } - else if (pClass == Long.class || pClass == Long.TYPE) { - return PrimitiveObjects.getLong (pValue.longValue ()); - } - else if (pClass == Float.class || pClass == Float.TYPE) { - return PrimitiveObjects.getFloat (pValue.floatValue ()); - } - else if (pClass == Double.class || pClass == Double.TYPE) { - return PrimitiveObjects.getDouble (pValue.doubleValue ()); - } - else { - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- - /** - * - * Coerces a String to the given primitive number class - **/ - static Number coerceToPrimitiveNumber (String pValue, - Class pClass) - throws ELException - { - if (pClass == Byte.class || pClass == Byte.TYPE) { - return Byte.valueOf (pValue); - } - else if (pClass == Short.class || pClass == Short.TYPE) { - return Short.valueOf (pValue); - } - else if (pClass == Integer.class || pClass == Integer.TYPE) { - return Integer.valueOf (pValue); - } - else if (pClass == Long.class || pClass == Long.TYPE) { - return Long.valueOf (pValue); - } - else if (pClass == Float.class || pClass == Float.TYPE) { - return Float.valueOf (pValue); - } - else if (pClass == Double.class || pClass == Double.TYPE) { - return Double.valueOf (pValue); - } - else { - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- - /** - * - * Coerces a value to a Character - **/ - public static Character coerceToCharacter (Object pValue, - Logger pLogger) - throws ELException - { - if (pValue == null || - "".equals (pValue)) { - return PrimitiveObjects.getCharacter ((char) 0); - } - else if (pValue instanceof Character) { - return (Character) pValue; - } - else if (pValue instanceof Boolean) { - if (pLogger.isLoggingError ()) { - pLogger.logError (Constants.BOOLEAN_TO_CHARACTER, pValue); - } - return PrimitiveObjects.getCharacter ((char) 0); - } - else if (pValue instanceof Number) { - return PrimitiveObjects.getCharacter - ((char) ((Number) pValue).shortValue ()); - } - else if (pValue instanceof String) { - String str = (String) pValue; - return PrimitiveObjects.getCharacter (str.charAt (0)); - } - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.COERCE_TO_CHARACTER, - pValue.getClass ().getName ()); - } - return PrimitiveObjects.getCharacter ((char) 0); - } - } - - //------------------------------------- - /** - * - * Coerces a value to a Boolean - **/ - public static Boolean coerceToBoolean (Object pValue, - Logger pLogger) - throws ELException - { - if (pValue == null || - "".equals (pValue)) { - return Boolean.FALSE; - } - else if (pValue instanceof Boolean) { - return (Boolean) pValue; - } - else if (pValue instanceof String) { - String str = (String) pValue; - try { - return Boolean.valueOf (str); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.STRING_TO_BOOLEAN, - exc, - (String) pValue); - } - return Boolean.FALSE; - } - } - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.COERCE_TO_BOOLEAN, - pValue.getClass ().getName ()); - } - return Boolean.TRUE; - } - } - - //------------------------------------- - /** - * - * Coerces a value to the specified Class that is not covered by any - * of the above cases - **/ - public static Object coerceToObject (Object pValue, - Class pClass, - Logger pLogger) - throws ELException - { - if (pValue == null) { - return null; - } - else if (pClass.isAssignableFrom (pValue.getClass ())) { - return pValue; - } - else if (pValue instanceof String) { - String str = (String) pValue; - PropertyEditor pe = PropertyEditorManager.findEditor (pClass); - if (pe == null) { - if ("".equals (str)) { - return null; - } - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.NO_PROPERTY_EDITOR, - str, - pClass.getName ()); - } - return null; - } - } - try { - pe.setAsText (str); - return pe.getValue (); - } - catch (IllegalArgumentException exc) { - if ("".equals (str)) { - return null; - } - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.PROPERTY_EDITOR_ERROR, - exc, - pValue, - pClass.getName ()); - } - return null; - } - } - } - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.COERCE_TO_OBJECT, - pValue.getClass ().getName (), - pClass.getName ()); - } - return null; - } - } - - //------------------------------------- - // Applying operators - //------------------------------------- - /** - * - * Performs all of the necessary type conversions, then calls on the - * appropriate operator. - **/ - public static Object applyArithmeticOperator - (Object pLeft, - Object pRight, - ArithmeticOperator pOperator, - Logger pLogger) - throws ELException - { - if (pLeft == null && - pRight == null) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.ARITH_OP_NULL, - pOperator.getOperatorSymbol ()); - } - return PrimitiveObjects.getInteger (0); - } - - else if (isFloatingPointType (pLeft) || - isFloatingPointType (pRight) || - isFloatingPointString (pLeft) || - isFloatingPointString (pRight)) { - double left = - coerceToPrimitiveNumber (pLeft, Double.class, pLogger). - doubleValue (); - double right = - coerceToPrimitiveNumber (pRight, Double.class, pLogger). - doubleValue (); - return - PrimitiveObjects.getDouble (pOperator.apply (left, right, pLogger)); - } - - else { - long left = - coerceToPrimitiveNumber (pLeft, Long.class, pLogger). - longValue (); - long right = - coerceToPrimitiveNumber (pRight, Long.class, pLogger). - longValue (); - return - PrimitiveObjects.getLong (pOperator.apply (left, right, pLogger)); - } - } - - //------------------------------------- - /** - * - * Performs all of the necessary type conversions, then calls on the - * appropriate operator. - **/ - public static Object applyRelationalOperator - (Object pLeft, - Object pRight, - RelationalOperator pOperator, - Logger pLogger) - throws ELException - { - if (isFloatingPointType (pLeft) || - isFloatingPointType (pRight)) { - double left = - coerceToPrimitiveNumber (pLeft, Double.class, pLogger). - doubleValue (); - double right = - coerceToPrimitiveNumber (pRight, Double.class, pLogger). - doubleValue (); - return - PrimitiveObjects.getBoolean (pOperator.apply (left, right, pLogger)); - } - - else if (isIntegerType (pLeft) || - isIntegerType (pRight)) { - long left = - coerceToPrimitiveNumber (pLeft, Long.class, pLogger). - longValue (); - long right = - coerceToPrimitiveNumber (pRight, Long.class, pLogger). - longValue (); - return - PrimitiveObjects.getBoolean (pOperator.apply (left, right, pLogger)); - } - - else if (pLeft instanceof String || - pRight instanceof String) { - String left = coerceToString (pLeft, pLogger); - String right = coerceToString (pRight, pLogger); - return - PrimitiveObjects.getBoolean (pOperator.apply (left, right, pLogger)); - } - - else if (pLeft instanceof Comparable) { - try { - int result = ((Comparable) pLeft).compareTo (pRight); - return - PrimitiveObjects.getBoolean - (pOperator.apply (result, -result, pLogger)); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.COMPARABLE_ERROR, - exc, - pLeft.getClass ().getName (), - (pRight == null) ? "null" : pRight.getClass ().getName (), - pOperator.getOperatorSymbol ()); - } - return Boolean.FALSE; - } - } - - else if (pRight instanceof Comparable) { - try { - int result = ((Comparable) pRight).compareTo (pLeft); - return - PrimitiveObjects.getBoolean - (pOperator.apply (-result, result, pLogger)); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.COMPARABLE_ERROR, - exc, - pRight.getClass ().getName (), - (pLeft == null) ? "null" : pLeft.getClass ().getName (), - pOperator.getOperatorSymbol ()); - } - return Boolean.FALSE; - } - } - - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ARITH_OP_BAD_TYPE, - pOperator.getOperatorSymbol (), - pLeft.getClass ().getName (), - pRight.getClass ().getName ()); - } - return Boolean.FALSE; - } - } - - //------------------------------------- - /** - * - * Performs all of the necessary type conversions, then calls on the - * appropriate operator. - **/ - public static Object applyEqualityOperator - (Object pLeft, - Object pRight, - EqualityOperator pOperator, - Logger pLogger) - throws ELException - { - if (pLeft == pRight) { - return PrimitiveObjects.getBoolean (pOperator.apply (true, pLogger)); - } - - else if (pLeft == null || - pRight == null) { - return PrimitiveObjects.getBoolean (pOperator.apply (false, pLogger)); - } - - else if (isFloatingPointType (pLeft) || - isFloatingPointType (pRight)) { - double left = - coerceToPrimitiveNumber (pLeft, Double.class, pLogger). - doubleValue (); - double right = - coerceToPrimitiveNumber (pRight, Double.class, pLogger). - doubleValue (); - return - PrimitiveObjects.getBoolean - (pOperator.apply (left == right, pLogger)); - } - - else if (isIntegerType (pLeft) || - isIntegerType (pRight)) { - long left = - coerceToPrimitiveNumber (pLeft, Long.class, pLogger). - longValue (); - long right = - coerceToPrimitiveNumber (pRight, Long.class, pLogger). - longValue (); - return - PrimitiveObjects.getBoolean - (pOperator.apply (left == right, pLogger)); - } - - else if (pLeft instanceof Boolean || - pRight instanceof Boolean) { - boolean left = coerceToBoolean (pLeft, pLogger).booleanValue (); - boolean right = coerceToBoolean (pRight, pLogger).booleanValue (); - return - PrimitiveObjects.getBoolean - (pOperator.apply (left == right, pLogger)); - } - - else if (pLeft instanceof String || - pRight instanceof String) { - String left = coerceToString (pLeft, pLogger); - String right = coerceToString (pRight, pLogger); - return - PrimitiveObjects.getBoolean - (pOperator.apply (left.equals (right), pLogger)); - } - - else { - try { - return - PrimitiveObjects.getBoolean - (pOperator.apply (pLeft.equals (pRight), pLogger)); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ERROR_IN_EQUALS, - exc, - pLeft.getClass ().getName (), - pRight.getClass ().getName (), - pOperator.getOperatorSymbol ()); - } - return Boolean.FALSE; - } - } - } - - //------------------------------------- - /** - * - * Returns true if the given Object is of a floating point type - **/ - public static boolean isFloatingPointType (Object pObject) - { - return - pObject != null && - isFloatingPointType (pObject.getClass ()); - } - - //------------------------------------- - /** - * - * Returns true if the given class is of a floating point type - **/ - public static boolean isFloatingPointType (Class pClass) - { - return - pClass == Float.class || - pClass == Float.TYPE || - pClass == Double.class || - pClass == Double.TYPE; - } - - //------------------------------------- - /** - * - * Returns true if the given string might contain a floating point - * number - i.e., it contains ".", "e", or "E" - **/ - public static boolean isFloatingPointString (Object pObject) - { - if (pObject instanceof String) { - String str = (String) pObject; - int len = str.length (); - for (int i = 0; i < len; i++) { - char ch = str.charAt (i); - if (ch == '.' || - ch == 'e' || - ch == 'E') { - return true; - } - } - return false; - } - else { - return false; - } - } - - //------------------------------------- - /** - * - * Returns true if the given Object is of an integer type - **/ - public static boolean isIntegerType (Object pObject) - { - return - pObject != null && - isIntegerType (pObject.getClass ()); - } - - //------------------------------------- - /** - * - * Returns true if the given class is of an integer type - **/ - public static boolean isIntegerType (Class pClass) - { - return - pClass == Byte.class || - pClass == Byte.TYPE || - pClass == Short.class || - pClass == Short.TYPE || - pClass == Character.class || - pClass == Character.TYPE || - pClass == Integer.class || - pClass == Integer.TYPE || - pClass == Long.class || - pClass == Long.TYPE; - } - - //------------------------------------- - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ComplexValue.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ComplexValue.java deleted file mode 100644 index 2580c32..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ComplexValue.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.List; -import java.util.Map; - -/** - * - *

Represents a dynamic value, which consists of a prefix and an - * optional set of ValueSuffix elements. A prefix is something like - * an identifier, and a suffix is something like a "property of" or - * "indexed element of" operator. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ComplexValue - extends Expression -{ - //------------------------------------- - // Properties - //------------------------------------- - // property prefix - - Expression mPrefix; - public Expression getPrefix () - { return mPrefix; } - public void setPrefix (Expression pPrefix) - { mPrefix = pPrefix; } - - //------------------------------------- - // property suffixes - - List mSuffixes; - public List getSuffixes () - { return mSuffixes; } - public void setSuffixes (List pSuffixes) - { mSuffixes = pSuffixes; } - - //------------------------------------- - /** - * - * Constructor - **/ - public ComplexValue (Expression pPrefix, - List pSuffixes) - { - mPrefix = pPrefix; - mSuffixes = pSuffixes; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - @Override - public String getExpressionString() { - StringBuilder buf = new StringBuilder(); - buf.append(mPrefix.getExpressionString()); - - for (int i = 0; mSuffixes != null && i < mSuffixes.size(); i++) { - ValueSuffix suffix = (ValueSuffix) mSuffixes.get(i); - buf.append(suffix.getExpressionString()); - } - - return buf.toString(); - } - - //------------------------------------- - /** - * - * Evaluates by evaluating the prefix, then applying the suffixes - **/ - public Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - Object ret = mPrefix.evaluate (pContext, pResolver, functions, - defaultPrefix, pLogger); - - // Apply the suffixes - for (int i = 0; mSuffixes != null && i < mSuffixes.size (); i++) { - ValueSuffix suffix = (ValueSuffix) mSuffixes.get (i); - ret = suffix.evaluate (ret, pContext, pResolver, functions, - defaultPrefix, pLogger); - } - - return ret; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Constants.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Constants.java deleted file mode 100644 index 3a618a2..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Constants.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * - *

This contains all of the non-public constants, including - * messsage strings read from the resource file. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class Constants -{ - //------------------------------------- - // Resources - - static ResourceBundle sResources = - ResourceBundle.getBundle ("org.apache.taglibs.standard.lang.jstl.Resources"); - - //------------------------------------- - // Messages from the resource bundle - //------------------------------------- - - public static final String EXCEPTION_GETTING_BEANINFO = - getStringResource ("EXCEPTION_GETTING_BEANINFO"); - - public static final String NULL_EXPRESSION_STRING = - getStringResource ("NULL_EXPRESSION_STRING"); - - public static final String PARSE_EXCEPTION = - getStringResource ("PARSE_EXCEPTION"); - - public static final String CANT_GET_PROPERTY_OF_NULL = - getStringResource ("CANT_GET_PROPERTY_OF_NULL"); - - public static final String NO_SUCH_PROPERTY = - getStringResource ("NO_SUCH_PROPERTY"); - - public static final String NO_GETTER_METHOD = - getStringResource ("NO_GETTER_METHOD"); - - public static final String ERROR_GETTING_PROPERTY = - getStringResource ("ERROR_GETTING_PROPERTY"); - - public static final String CANT_GET_INDEXED_VALUE_OF_NULL = - getStringResource ("CANT_GET_INDEXED_VALUE_OF_NULL"); - - public static final String CANT_GET_NULL_INDEX = - getStringResource ("CANT_GET_NULL_INDEX"); - - public static final String NULL_INDEX = - getStringResource ("NULL_INDEX"); - - public static final String BAD_INDEX_VALUE = - getStringResource ("BAD_INDEX_VALUE"); - - public static final String EXCEPTION_ACCESSING_LIST = - getStringResource ("EXCEPTION_ACCESSING_LIST"); - - public static final String EXCEPTION_ACCESSING_ARRAY = - getStringResource ("EXCEPTION_ACCESSING_ARRAY"); - - public static final String CANT_FIND_INDEX = - getStringResource ("CANT_FIND_INDEX"); - - public static final String TOSTRING_EXCEPTION = - getStringResource ("TOSTRING_EXCEPTION"); - - public static final String BOOLEAN_TO_NUMBER = - getStringResource ("BOOLEAN_TO_NUMBER"); - - public static final String STRING_TO_NUMBER_EXCEPTION = - getStringResource ("STRING_TO_NUMBER_EXCEPTION"); - - public static final String COERCE_TO_NUMBER = - getStringResource ("COERCE_TO_NUMBER"); - - public static final String BOOLEAN_TO_CHARACTER = - getStringResource ("BOOLEAN_TO_CHARACTER"); - - public static final String EMPTY_STRING_TO_CHARACTER = - getStringResource ("EMPTY_STRING_TO_CHARACTER"); - - public static final String COERCE_TO_CHARACTER = - getStringResource ("COERCE_TO_CHARACTER"); - - public static final String NULL_TO_BOOLEAN = - getStringResource ("NULL_TO_BOOLEAN"); - - public static final String STRING_TO_BOOLEAN = - getStringResource ("STRING_TO_BOOLEAN"); - - public static final String COERCE_TO_BOOLEAN = - getStringResource ("COERCE_TO_BOOLEAN"); - - public static final String COERCE_TO_OBJECT = - getStringResource ("COERCE_TO_OBJECT"); - - public static final String NO_PROPERTY_EDITOR = - getStringResource ("NO_PROPERTY_EDITOR"); - - public static final String PROPERTY_EDITOR_ERROR = - getStringResource ("PROPERTY_EDITOR_ERROR"); - - public static final String ARITH_OP_NULL = - getStringResource ("ARITH_OP_NULL"); - - public static final String ARITH_OP_BAD_TYPE = - getStringResource ("ARITH_OP_BAD_TYPE"); - - public static final String ARITH_ERROR = - getStringResource ("ARITH_ERROR"); - - public static final String ERROR_IN_EQUALS = - getStringResource ("ERROR_IN_EQUALS"); - - public static final String UNARY_OP_BAD_TYPE = - getStringResource ("UNARY_OP_BAD_TYPE"); - - public static final String NAMED_VALUE_NOT_FOUND = - getStringResource ("NAMED_VALUE_NOT_FOUND"); - - public static final String CANT_GET_INDEXED_PROPERTY = - getStringResource ("CANT_GET_INDEXED_PROPERTY"); - - public static final String COMPARABLE_ERROR = - getStringResource ("COMPARABLE_ERROR"); - - public static final String BAD_IMPLICIT_OBJECT = - getStringResource ("BAD_IMPLICIT_OBJECT"); - - public static final String ATTRIBUTE_EVALUATION_EXCEPTION = - getStringResource ("ATTRIBUTE_EVALUATION_EXCEPTION"); - - public static final String ATTRIBUTE_PARSE_EXCEPTION = - getStringResource ("ATTRIBUTE_PARSE_EXCEPTION"); - - public static final String UNKNOWN_FUNCTION = - getStringResource ("UNKNOWN_FUNCTION"); - - public static final String INAPPROPRIATE_FUNCTION_ARG_COUNT = - getStringResource ("INAPPROPRIATE_FUNCTION_ARG_COUNT"); - - public static final String FUNCTION_INVOCATION_ERROR = - getStringResource ("FUNCTION_INVOCATION_ERROR"); - - - //------------------------------------- - // Getting resources - //------------------------------------- - /** - * - * - **/ - public static String getStringResource (String pResourceName) - throws MissingResourceException - { - try { - String ret = sResources.getString (pResourceName); - if (ret == null) { - String str = "ERROR: Unable to load resource " + pResourceName; - System.err.println (str); - throw new MissingResourceException - (str, - "org.apache.taglibs.standard.lang.jstl.Constants", - pResourceName); - } - else { - return ret; - } - } - catch (MissingResourceException exc) { - System.err.println ("ERROR: Unable to load resource " + - pResourceName + - ": " + - exc); - throw exc; - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/DivideOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/DivideOperator.java deleted file mode 100644 index 1ab4a14..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/DivideOperator.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the divide operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class DivideOperator - extends BinaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final DivideOperator SINGLETON = - new DivideOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public DivideOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "/"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == null && - pRight == null) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.ARITH_OP_NULL, - getOperatorSymbol ()); - } - return PrimitiveObjects.getInteger (0); - } - - double left = - Coercions.coerceToPrimitiveNumber (pLeft, Double.class, pLogger). - doubleValue (); - double right = - Coercions.coerceToPrimitiveNumber (pRight, Double.class, pLogger). - doubleValue (); - - try { - return PrimitiveObjects.getDouble (left / right); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ARITH_ERROR, - getOperatorSymbol (), - "" + left, - "" + right); - } - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java deleted file mode 100644 index f2673b6..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELEvaluator.java +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.io.Reader; -import java.io.StringReader; -import java.text.MessageFormat; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.taglibs.standard.lang.jstl.parser.ELParser; -import org.apache.taglibs.standard.lang.jstl.parser.ParseException; -import org.apache.taglibs.standard.lang.jstl.parser.Token; -import org.apache.taglibs.standard.lang.jstl.parser.TokenMgrError; - -/** - * - *

This is the main class for evaluating expression Strings. An - * expression String is a String that may contain expressions of the - * form ${...}. Multiple expressions may appear in the same - * expression String. In such a case, the expression String's value - * is computed by concatenating the String values of those evaluated - * expressions and any intervening non-expression text, then - * converting the resulting String to the expected type using the - * PropertyEditor mechanism. - * - *

In the special case where the expression String is a single - * expression, the value of the expression String is determined by - * evaluating the expression, without any intervening conversion to a - * String. - * - *

The evaluator maintains a cache mapping expression Strings to - * their parsed results. For expression Strings containing no - * expression elements, it maintains a cache mapping - * ExpectedType/ExpressionString to parsed value, so that static - * expression Strings won't have to go through a conversion step every - * time they are used. All instances of the evaluator share the same - * cache. The cache may be bypassed by setting a flag on the - * evaluator's constructor. - * - *

The evaluator must be passed a VariableResolver in its - * constructor. The VariableResolver is used to resolve variable - * names encountered in expressions, and can also be used to implement - * "implicit objects" that are always present in the namespace. - * Different applications will have different policies for variable - * lookups and implicit objects - these differences can be - * encapsulated in the VariableResolver passed to the evaluator's - * constructor. - * - *

Most VariableResolvers will need to perform their resolution - * against some context. For example, a JSP environment needs a - * PageContext to resolve variables. The evaluate() method takes a - * generic Object context which is eventually passed to the - * VariableResolver - the VariableResolver is responsible for casting - * the context to the proper type. - * - *

Once an evaluator instance has been constructed, it may be used - * multiple times, and may be used by multiple simultaneous Threads. - * In other words, an evaluator instance is well-suited for use as a - * singleton. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ELEvaluator -{ - //------------------------------------- - // Properties - //------------------------------------- - - //------------------------------------- - // Member variables - //------------------------------------- - - /** The mapping from expression String to its parsed form (String, - Expression, or ExpressionString) **/ - static Map sCachedExpressionStrings = Collections.synchronizedMap(new HashMap<>()); - - /** The mapping from ExpectedType to Maps mapping literal String to - parsed value **/ - static Map sCachedExpectedTypes = new HashMap<>(); - - /** The static Logger **/ - static Logger sLogger = new Logger (System.out); - - /** The VariableResolver **/ - VariableResolver mResolver; - - /** Flag if the cache should be bypassed **/ - boolean mBypassCache; - - //------------------------------------- - /** - * - * Constructor - * - * @param pResolver the object that should be used to resolve - * variable names encountered in expressions. If null, all variable - * references will resolve to null. - **/ - public ELEvaluator (VariableResolver pResolver) - { - mResolver = pResolver; - } - - //------------------------------------- - /** - * - * Constructor - * - * @param pResolver the object that should be used to resolve - * variable names encountered in expressions. If null, all variable - * references will resolve to null. - * - * @param pBypassCache flag indicating if the cache should be - * bypassed - **/ - public ELEvaluator (VariableResolver pResolver, - boolean pBypassCache) - { - mResolver = pResolver; - mBypassCache = pBypassCache; - } - - //------------------------------------- - /** - * - * Evaluates the given expression String - * - * @param pExpressionString the expression String to be evaluated - * @param pContext the context passed to the VariableResolver for - * resolving variable names - * @param pExpectedType the type to which the evaluated expression - * should be coerced - * @return the expression String evaluated to the given expected - * type - **/ - public Object evaluate (String pExpressionString, - Object pContext, - Class pExpectedType, - Map functions, - String defaultPrefix) - throws ELException - { - return evaluate (pExpressionString, - pContext, - pExpectedType, - functions, - defaultPrefix, - sLogger); - } - - //------------------------------------- - /** - * - * Evaluates the given expression string - **/ - Object evaluate (String pExpressionString, - Object pContext, - Class pExpectedType, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - // Check for null expression strings - if (pExpressionString == null) { - throw new ELException - (Constants.NULL_EXPRESSION_STRING); - } - - // Get the parsed version of the expression string - Object parsedValue = parseExpressionString (pExpressionString); - - // Evaluate differently based on the parsed type - if (parsedValue instanceof String) { - // Convert the String, and cache the conversion - String strValue = (String) parsedValue; - return convertStaticValueToExpectedType (strValue, - pExpectedType, - pLogger); - } - - else if (parsedValue instanceof Expression) { - // Evaluate the expression and convert - Object value = - ((Expression) parsedValue).evaluate (pContext, - mResolver, - functions, - defaultPrefix, - pLogger); - return convertToExpectedType (value, - pExpectedType, - pLogger); - } - - else if (parsedValue instanceof ExpressionString) { - // Evaluate the expression/string list and convert - String strValue = - ((ExpressionString) parsedValue).evaluate (pContext, - mResolver, - functions, - defaultPrefix, - pLogger); - return convertToExpectedType (strValue, - pExpectedType, - pLogger); - } - - else { - // This should never be reached - return null; - } - } - - //------------------------------------- - /** - * - * Gets the parsed form of the given expression string. If the - * parsed form is cached (and caching is not bypassed), return the - * cached form, otherwise parse and cache the value. Returns either - * a String, Expression, or ExpressionString. - **/ - public Object parseExpressionString (String pExpressionString) - throws ELException - { - // See if it's an empty String - if (pExpressionString.length () == 0) { - return ""; - } - - // See if it's in the cache - Object ret = mBypassCache ? null : sCachedExpressionStrings.get(pExpressionString); - - if (ret == null) { - // Parse the expression - Reader r = new StringReader (pExpressionString); - ELParser parser = new ELParser (r); - try { - ret = parser.ExpressionString (); - sCachedExpressionStrings.put(pExpressionString, ret); - } - catch (ParseException exc) { - throw new ELException - (formatParseException (pExpressionString, - exc)); - } - catch (TokenMgrError exc) { - // Note - this should never be reached, since the parser is - // constructed to tokenize any input (illegal inputs get - // parsed to or - // - throw new ELException (exc.getMessage ()); - } - } - return ret; - } - - //------------------------------------- - /** - * - * Converts the given value to the specified expected type. - **/ - Object convertToExpectedType (Object pValue, - Class pExpectedType, - Logger pLogger) - throws ELException - { - return Coercions.coerce (pValue, - pExpectedType, - pLogger); - } - - //------------------------------------- - /** - * - * Converts the given String, specified as a static expression - * string, to the given expected type. The conversion is cached. - **/ - Object convertStaticValueToExpectedType (String pValue, - Class pExpectedType, - Logger pLogger) - throws ELException - { - // See if the value is already of the expected type - if (pExpectedType == String.class || - pExpectedType == Object.class) { - return pValue; - } - - // Find the cached value - Map valueByString = getOrCreateExpectedTypeMap (pExpectedType); - if (!mBypassCache && - valueByString.containsKey (pValue)) { - return valueByString.get (pValue); - } - else { - // Convert from a String - Object ret = Coercions.coerce (pValue, pExpectedType, pLogger); - valueByString.put (pValue, ret); - return ret; - } - } - - //------------------------------------- - /** - * - * Creates or returns the Map that maps string literals to parsed - * values for the specified expected type. - **/ - static Map getOrCreateExpectedTypeMap (Class pExpectedType) - { - synchronized (sCachedExpectedTypes) { - Map ret = sCachedExpectedTypes.get (pExpectedType); - if (ret == null) { - ret = Collections.synchronizedMap(new HashMap<>()); - sCachedExpectedTypes.put(pExpectedType, ret); - } - return ret; - } - } - - //------------------------------------- - // Formatting ParseException - //------------------------------------- - /** - * - * Formats a ParseException into an error message suitable for - * displaying on a web page - **/ - static String formatParseException (String pExpressionString, - ParseException pExc) - { - // Generate the String of expected tokens - StringBuilder expectedBuf = new StringBuilder (); - int maxSize = 0; - boolean printedOne = false; - - if (pExc.expectedTokenSequences == null) - return pExc.toString(); - - for (int i = 0; i < pExc.expectedTokenSequences.length; i++) { - if (maxSize < pExc.expectedTokenSequences [i].length) { - maxSize = pExc.expectedTokenSequences [i].length; - } - for (int j = 0; j < pExc.expectedTokenSequences [i].length; j++) { - if (printedOne) { - expectedBuf.append (", "); - } - expectedBuf.append - (pExc.tokenImage [pExc.expectedTokenSequences [i] [j]]); - printedOne = true; - } - } - String expected = expectedBuf.toString (); - - // Generate the String of encountered tokens - StringBuilder encounteredBuf = new StringBuilder (); - Token tok = pExc.currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) encounteredBuf.append (" "); - if (tok.kind == 0) { - encounteredBuf.append (pExc.tokenImage [0]); - break; - } - encounteredBuf.append (addEscapes (tok.image)); - tok = tok.next; - } - String encountered = encounteredBuf.toString (); - - // Format the error message - return MessageFormat.format - (Constants.PARSE_EXCEPTION, - new Object [] { - expected, - encountered, - }); - } - - //------------------------------------- - /** - * - * Used to convert raw characters to their escaped version when - * these raw version cannot be used as part of an ASCII string - * literal. - **/ - static String addEscapes (String str) - { - StringBuilder retval = new StringBuilder (); - char ch; - for (int i = 0; i < str.length (); i++) { - switch (str.charAt (i)) { - case 0 : - continue; - case '\b': - retval.append ("\\b"); - continue; - case '\t': - retval.append ("\\t"); - continue; - case '\n': - retval.append ("\\n"); - continue; - case '\f': - retval.append ("\\f"); - continue; - case '\r': - retval.append ("\\r"); - continue; - default: - if ((ch = str.charAt (i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString (ch, 16); - retval.append("\\u").append (s.substring (s.length () - 4, s.length ())); - } - else { - retval.append (ch); - } - continue; - } - } - return retval.toString (); - } - - //------------------------------------- - // Testing methods - //------------------------------------- - /** - * - * Parses the given expression string, then converts it back to a - * String in its canonical form. This is used to test parsing. - **/ - public String parseAndRender (String pExpressionString) - throws ELException - { - Object val = parseExpressionString (pExpressionString); - if (val instanceof String) { - return (String) val; - } - else if (val instanceof Expression) { - return "${" + ((Expression) val).getExpressionString () + "}"; - } - else if (val instanceof ExpressionString) { - return ((ExpressionString) val).getExpressionString (); - } - else { - return ""; - } - } - - //------------------------------------- - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELException.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELException.java deleted file mode 100644 index bd91ab1..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELException.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - - -/** - * - * Represents any of the exception conditions that arise during the - * operation evaluation of the evaluator. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ELException - extends Exception -{ - //------------------------------------- - // Member variables - //------------------------------------- - - Throwable mRootCause; - - //------------------------------------- - /** - * - * Constructor - **/ - public ELException () - { - super (); - } - - //------------------------------------- - /** - * - * Constructor - **/ - public ELException (String pMessage) - { - super (pMessage); - } - - //------------------------------------- - /** - * - * Constructor - **/ - public ELException (Throwable pRootCause) - { - mRootCause = pRootCause; - } - - //------------------------------------- - /** - * - * Constructor - **/ - public ELException (String pMessage, - Throwable pRootCause) - { - super (pMessage); - mRootCause = pRootCause; - } - - //------------------------------------- - /** - * - * Returns the root cause - **/ - public Throwable getRootCause () - { - return mRootCause; - } - - //------------------------------------- - /** - * - * String representation - **/ - public String toString () - { - if (getMessage () == null) { - return mRootCause.toString (); - } - else if (mRootCause == null) { - return getMessage (); - } - else { - return getMessage () + ": " + mRootCause; - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELParser.jj b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELParser.jj deleted file mode 100644 index 6daed2d..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ELParser.jj +++ /dev/null @@ -1,781 +0,0 @@ -/***************************************** - * OPTIONS * - *****************************************/ - -options { - JAVA_UNICODE_ESCAPE = false; - UNICODE_INPUT = true; - STATIC = false; -} - -/***************************************** - * PARSER JAVA CODE * - *****************************************/ - -PARSER_BEGIN(ELParser) - -package org.apache.taglibs.standard.lang.jstl.parser; - -import org.apache.taglibs.standard.lang.jstl.*; -import java.util.ArrayList; -import java.util.List; - -/** - * Generated EL parser. - * - * @author Nathan Abramson - * @author Shawn Bayern - */ - -public class ELParser { - - public static void main(String args[]) - throws ParseException - { - ELParser parser = new ELParser (System.in); - parser.ExpressionString (); - } - -} - -PARSER_END(ELParser) - - -/***************************************** - * TOKENS * - *****************************************/ - - -/***************************************** -/** Tokens appearing outside of an ${...} construct **/ - - TOKEN: -{ - < NON_EXPRESSION_TEXT: - (~["$"])+ | ("$" (~["{", "$"])+) | "$" - > -| - < START_EXPRESSION: "${" > : IN_EXPRESSION -} - -/***************************************** -/** Tokens appearing inside of an ${...} construct **/ - -/* WHITE SPACE */ - - SKIP : -{ - " " -| "\t" -| "\n" -| "\r" -} - - TOKEN : -{ -/* Literals */ - - < INTEGER_LITERAL: ["0"-"9"] (["0"-"9"])* > -| - < FLOATING_POINT_LITERAL: - (["0"-"9"])+ "." (["0"-"9"])* ()? - | "." (["0"-"9"])+ ()? - | (["0"-"9"])+ - > -| - < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > -| - < STRING_LITERAL: - ("\"" ((~["\"","\\"]) | ("\\" ( ["\\","\""] )))* "\"") | - ("\'" ((~["\'","\\"]) | ("\\" ( ["\\","\'"] )))* "\'") - > -| - < BADLY_ESCAPED_STRING_LITERAL: - ("\"" (~["\"","\\"])* ("\\" ( ~["\\","\""] ))) | - ("\'" (~["\'","\\"])* ("\\" ( ~["\\","\'"] ))) - > - -/* Reserved Words and Symbols */ - -| < TRUE: "true" > -| < FALSE: "false" > -| < NULL: "null" > -| < END_EXPRESSION: "}" > : DEFAULT -| < DOT: "." > -| < GT1: ">" > -| < GT2: "gt" > -| < LT1: "<" > -| < LT2: "lt" > -| < EQ1: "==" > -| < EQ2: "eq" > -| < LE1: "<=" > -| < LE2: "le" > -| < GE1: ">=" > -| < GE2: "ge" > -| < NE1: "!=" > -| < NE2: "ne" > -| < LPAREN: "(" > -| < RPAREN: ")" > -| < COMMA: "," > -| < COLON: ":" > -| < LBRACKET: "[" > -| < RBRACKET: "]" > -| < PLUS: "+" > -| < MINUS: "-" > -| < MULTIPLY: "*" > -| < DIVIDE1: "/" > -| < DIVIDE2: "div" > -| < MODULUS1: "%" > -| < MODULUS2: "mod" > -| < NOT1: "not" > -| < NOT2: "!" > -| < AND1: "and" > -| < AND2: "&&" > -| < OR1: "or" > -| < OR2: "||" > -| < EMPTY: "empty" > - - -/* Identifiers */ - -| < IDENTIFIER: (|) (|)* > -| < #IMPL_OBJ_START: "#" > -| - < #LETTER: - [ - "\u0024", - "\u0041"-"\u005a", - "\u005f", - "\u0061"-"\u007a", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u00ff", - "\u0100"-"\u1fff", - "\u3040"-"\u318f", - "\u3300"-"\u337f", - "\u3400"-"\u3d2d", - "\u4e00"-"\u9fff", - "\uf900"-"\ufaff" - ] - > -| - < #DIGIT: - [ - "\u0030"-"\u0039", - "\u0660"-"\u0669", - "\u06f0"-"\u06f9", - "\u0966"-"\u096f", - "\u09e6"-"\u09ef", - "\u0a66"-"\u0a6f", - "\u0ae6"-"\u0aef", - "\u0b66"-"\u0b6f", - "\u0be7"-"\u0bef", - "\u0c66"-"\u0c6f", - "\u0ce6"-"\u0cef", - "\u0d66"-"\u0d6f", - "\u0e50"-"\u0e59", - "\u0ed0"-"\u0ed9", - "\u1040"-"\u1049" - ] - > - -/* This is used to catch any non-matching tokens, so as to avoid any - TokenMgrErrors */ -| < ILLEGAL_CHARACTER: (~[]) > -} - - -/***************************************** - * GRAMMAR PRODUCTIONS * - *****************************************/ - -/** - * - * Returns a String if the expression string is a single String, an - * Expression if the expression string is a single Expression, an - * ExpressionString if it's a mixture of both. - **/ -Object ExpressionString () : -{ - Object ret = ""; - List elems = null; - Object elem; -} -{ - /** Try to optimize for the case of a single expression or String **/ - (ret = AttrValueString () | ret = AttrValueExpression ()) - - - /** If there's more than one, then switch to using a List **/ - ( - (elem = AttrValueString () | elem = AttrValueExpression ()) - { - if (elems == null) { - elems = new ArrayList (); - elems.add (ret); - } - elems.add (elem); - } - )* - - { - if (elems != null) { - ret = new ExpressionString (elems.toArray ()); - } - return ret; - } -} - - -String AttrValueString () : -{ - Token t; -} -{ - t = - { return t.image; } -} - - -Expression AttrValueExpression () : -{ - Expression exp; -} -{ - exp = Expression () - { return exp; } -} - - -Expression Expression () : -{ - Expression ret; -} -{ - ret = OrExpression () - { return ret; } -} - - -Expression OrExpression () : -{ - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; -} -{ - startExpression = AndExpression () - - ( - ( - ( | ) { operator = OrOperator.SINGLETON; } - ) - expression = AndExpression () - - { - if (operators == null) { - operators = new ArrayList (); - expressions = new ArrayList (); - } - operators.add (operator); - expressions.add (expression); - } - )* - - { - if (operators != null) { - return new BinaryOperatorExpression (startExpression, - operators, - expressions); - } - else { - return startExpression; - } - } -} - - -Expression AndExpression () : -{ - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; -} -{ - startExpression = EqualityExpression () - - ( - ( - ( | ) { operator = AndOperator.SINGLETON; } - ) - expression = EqualityExpression () - - { - if (operators == null) { - operators = new ArrayList (); - expressions = new ArrayList (); - } - operators.add (operator); - expressions.add (expression); - } - )* - - { - if (operators != null) { - return new BinaryOperatorExpression (startExpression, - operators, - expressions); - } - else { - return startExpression; - } - } -} - - -Expression EqualityExpression () : -{ - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; -} -{ - startExpression = RelationalExpression () - - ( - ( - ( | ) { operator = EqualsOperator.SINGLETON; } - | ( | ) { operator = NotEqualsOperator.SINGLETON; } - ) - expression = RelationalExpression () - - { - if (operators == null) { - operators = new ArrayList (); - expressions = new ArrayList (); - } - operators.add (operator); - expressions.add (expression); - } - )* - - { - if (operators != null) { - return new BinaryOperatorExpression (startExpression, - operators, - expressions); - } - else { - return startExpression; - } - } -} - - -Expression RelationalExpression () : -{ - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; -} -{ - startExpression = AddExpression () - - ( - ( - ( | ) { operator = LessThanOperator.SINGLETON; } - | ( | ) { operator = GreaterThanOperator.SINGLETON; } - | ( | ) { operator = GreaterThanOrEqualsOperator.SINGLETON; } - | ( | ) { operator = LessThanOrEqualsOperator.SINGLETON; } - ) - expression = AddExpression () - - { - if (operators == null) { - operators = new ArrayList (); - expressions = new ArrayList (); - } - operators.add (operator); - expressions.add (expression); - } - )* - - { - if (operators != null) { - return new BinaryOperatorExpression (startExpression, - operators, - expressions); - } - else { - return startExpression; - } - } -} - - -Expression AddExpression () : -{ - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; -} -{ - startExpression = MultiplyExpression () - - ( - ( - { operator = PlusOperator.SINGLETON; } - | { operator = MinusOperator.SINGLETON; } - ) - expression = MultiplyExpression () - - { - if (operators == null) { - operators = new ArrayList (); - expressions = new ArrayList (); - } - operators.add (operator); - expressions.add (expression); - } - )* - - { - if (operators != null) { - return new BinaryOperatorExpression (startExpression, - operators, - expressions); - } - else { - return startExpression; - } - } -} - - -Expression MultiplyExpression () : -{ - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; -} -{ - startExpression = UnaryExpression () - - ( - ( - { operator = MultiplyOperator.SINGLETON; } - | ( | ) { operator = DivideOperator.SINGLETON; } - | ( | ) { operator = ModulusOperator.SINGLETON; } - ) - expression = UnaryExpression () - - { - if (operators == null) { - operators = new ArrayList (); - expressions = new ArrayList (); - } - operators.add (operator); - expressions.add (expression); - } - )* - - { - if (operators != null) { - return new BinaryOperatorExpression (startExpression, - operators, - expressions); - } - else { - return startExpression; - } - } -} - - -Expression UnaryExpression () : -{ - Expression expression; - UnaryOperator singleOperator = null; - UnaryOperator operator; - List operators = null; -} -{ - ( - ( - ( | ) { operator = NotOperator.SINGLETON; } - | { operator = UnaryMinusOperator.SINGLETON; } - | { operator = EmptyOperator.SINGLETON; } - ) - { - if (singleOperator == null) { - singleOperator = operator; - } - else if (operators == null) { - operators = new ArrayList (); - operators.add (singleOperator); - operators.add (operator); - } - else { - operators.add (operator); - } - } - )* - - expression = Value () - - { - if (operators != null) { - return new UnaryOperatorExpression (null, operators, expression); - } - else if (singleOperator != null) { - return new UnaryOperatorExpression (singleOperator, null, expression); - } - else { - return expression; - } - } -} - - -Expression Value () : -{ - Expression prefix; - ValueSuffix suffix; - List suffixes = null; -} -{ - prefix = ValuePrefix () - (suffix = ValueSuffix () - { - if (suffixes == null) { - suffixes = new ArrayList (); - } - suffixes.add (suffix); - } - )* - - { - if (suffixes == null) { - return prefix; - } - else { - return new ComplexValue (prefix, suffixes); - } - } -} - - -/** - * This is an element that can start a value - **/ -Expression ValuePrefix () : -{ - Expression ret; -} -{ - ( - ret = Literal () - | ret = Expression () - | LOOKAHEAD(QualifiedName() ) ret = FunctionInvocation () - | ret = NamedValue () - ) - { return ret; } -} - - -NamedValue NamedValue () : -{ - Token t; -} -{ - t = { return new NamedValue (t.image); } -} - - -FunctionInvocation FunctionInvocation () : -{ - String qualifiedName; - List argumentList = new ArrayList(); - Expression exp; -} -{ - ( - qualifiedName = QualifiedName() - - ( - ( - exp = Expression () - { - argumentList.add(exp); - } - ) - ( - - exp = Expression () - { - argumentList.add(exp); - } - )* - )? - - ) - { - String allowed = System.getProperty("jakarta.servlet.jsp.functions.allowed"); - if (allowed == null || !allowed.equalsIgnoreCase("true")) - throw new ParseException("EL functions are not supported."); - return new FunctionInvocation(qualifiedName, argumentList); - } -} - - -ValueSuffix ValueSuffix () : -{ - ValueSuffix suffix; -} -{ - ( - suffix = PropertySuffix () - | suffix = ArraySuffix () - ) - - { return suffix; } -} - - -PropertySuffix PropertySuffix () : -{ - Token t; - String property; -} -{ - - (property = Identifier ()) - - { - return new PropertySuffix (property); - } -} - - -ArraySuffix ArraySuffix () : -{ - Expression index; -} -{ - - index = Expression () - - - { - return new ArraySuffix (index); - } -} - - -Literal Literal () : -{ - Literal ret; -} -{ - ( - ret = BooleanLiteral () - | ret = IntegerLiteral () - | ret = FloatingPointLiteral () - | ret = StringLiteral () - | ret = NullLiteral () - ) - { return ret; } -} - - -BooleanLiteral BooleanLiteral () : -{ -} -{ - { return BooleanLiteral.TRUE; } - | { return BooleanLiteral.FALSE; } -} - - -StringLiteral StringLiteral () : -{ - Token t; -} -{ - t = - { return StringLiteral.fromToken (t.image); } -} - - -IntegerLiteral IntegerLiteral () : -{ - Token t; -} -{ - t = - { return new IntegerLiteral (t.image); } -} - - -FloatingPointLiteral FloatingPointLiteral () : -{ - Token t; -} -{ - t = - { return new FloatingPointLiteral (t.image); } -} - - -NullLiteral NullLiteral () : -{ -} -{ - - { return NullLiteral.SINGLETON; } -} - - -String Identifier () : -{ - Token t; -} -{ - ( - t = - ) - { return t.image; } -} - -String QualifiedName () : -{ - String prefix = null, localPart = null; -} -{ - ( - ( - LOOKAHEAD(Identifier() ) - prefix = Identifier () - - )? - localPart = Identifier () - ) - { - if (prefix == null) - return localPart; - else - return prefix + ":" + localPart; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EmptyOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EmptyOperator.java deleted file mode 100644 index 07b344b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EmptyOperator.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.lang.reflect.Array; -import java.util.List; -import java.util.Map; - -/** - * - *

The implementation of the empty operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class EmptyOperator - extends UnaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final EmptyOperator SINGLETON = - new EmptyOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public EmptyOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "empty"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pValue, - Object pContext, - Logger pLogger) - throws ELException - { - // See if the value is null - if (pValue == null) { - return PrimitiveObjects.getBoolean (true); - } - - // See if the value is a zero-length String - else if ("".equals (pValue)) { - return PrimitiveObjects.getBoolean (true); - } - - // See if the value is a zero-length array - else if (pValue.getClass ().isArray () && - Array.getLength (pValue) == 0) { - return PrimitiveObjects.getBoolean (true); - } - - // See if the value is an empty List - else if (pValue instanceof List && - ((List) pValue).isEmpty ()) { - return PrimitiveObjects.getBoolean (true); - } - - // See if the value is an empty Map - else if (pValue instanceof Map && - ((Map) pValue).isEmpty ()) { - return PrimitiveObjects.getBoolean (true); - } - - // Otherwise, not empty - else { - return PrimitiveObjects.getBoolean (false); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EnumeratedMap.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EnumeratedMap.java deleted file mode 100644 index 9dfbc5b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EnumeratedMap.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * - *

This is a Map implementation driven by a data source that only - * provides an enumeration of keys and a getValue(key) method. This - * class must be subclassed to implement those methods. - * - *

Some of the methods may incur a performance penalty that - * involves enumerating the entire data source. In these cases, the - * Map will try to save the results of that enumeration, but only if - * the underlying data source is immutable. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class EnumeratedMap implements Map { - //------------------------------------- - // Member variables - //------------------------------------- - - Map mMap; - - //------------------------------------- - public void clear () - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public boolean containsKey (Object pKey) - { - return getValue (pKey) != null; - } - - //------------------------------------- - public boolean containsValue (Object pValue) - { - return getAsMap ().containsValue (pValue); - } - - //------------------------------------- - public Set entrySet () - { - return getAsMap ().entrySet (); - } - - //------------------------------------- - public Object get (Object pKey) - { - return getValue (pKey); - } - - //------------------------------------- - public boolean isEmpty () - { - return !enumerateKeys ().hasMoreElements (); - } - - //------------------------------------- - public Set keySet () - { - return getAsMap ().keySet (); - } - - //------------------------------------- - public Object put (Object pKey, Object pValue) - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public void putAll (Map pMap) - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public Object remove (Object pKey) - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public int size () - { - return getAsMap ().size (); - } - - //------------------------------------- - public Collection values () - { - return getAsMap ().values (); - } - - //------------------------------------- - // Abstract methods - //------------------------------------- - /** - * - * Returns an enumeration of the keys - **/ - public abstract Enumeration enumerateKeys (); - - //------------------------------------- - /** - * - * Returns true if it is possible for this data source to change - **/ - public abstract boolean isMutable (); - - //------------------------------------- - /** - * - * Returns the value associated with the given key, or null if not - * found. - **/ - public abstract Object getValue (Object pKey); - - //------------------------------------- - /** - * - * Converts the MapSource to a Map. If the map is not mutable, this - * is cached - **/ - public Map getAsMap () - { - if (mMap != null) { - return mMap; - } - else { - Map m = convertToMap (); - if (!isMutable ()) { - mMap = m; - } - return m; - } - } - - //------------------------------------- - /** - * - * Converts to a Map - **/ - Map convertToMap () { - Map ret = new HashMap (); - for (Enumeration e = enumerateKeys(); e.hasMoreElements (); ) { - Object key = e.nextElement (); - Object value = getValue (key); - ret.put (key, value); - } - return ret; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualityOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualityOperator.java deleted file mode 100644 index ad697e8..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualityOperator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This is the superclass for all equality operators (==, !=) - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class EqualityOperator - extends BinaryOperator -{ - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - return Coercions.applyEqualityOperator (pLeft, pRight, this, pLogger); - } - - //------------------------------------- - /** - * - * Applies the operator given the fact that the two elements are - * equal. - **/ - public abstract boolean apply (boolean pAreEqual, - Logger pLogger); - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualsOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualsOperator.java deleted file mode 100644 index 2096044..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/EqualsOperator.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the equals operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class EqualsOperator - extends EqualityOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final EqualsOperator SINGLETON = - new EqualsOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public EqualsOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "=="; - } - - //------------------------------------- - /** - * - * Applies the operator given the fact that the two elements are - * equal. - **/ - public boolean apply (boolean pAreEqual, - Logger pLogger) - { - return pAreEqual; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java deleted file mode 100644 index c5c1eb8..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Evaluator.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.text.MessageFormat; -import java.util.Map; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluator; - -/** - * - *

This is the expression evaluator "adapter" that customizes it - * for use with the JSP Standard Tag Library. It uses a - * VariableResolver implementation that looks up variables from the - * PageContext and also implements its implicit objects. It also - * wraps ELExceptions in JspExceptions that describe the attribute - * name and value causing the error. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class Evaluator - implements ExpressionEvaluator -{ - //------------------------------------- - // Properties - //------------------------------------- - - //------------------------------------- - // Member variables - //------------------------------------- - - /** The singleton instance of the evaluator **/ - static ELEvaluator sEvaluator = - new ELEvaluator - (new JSTLVariableResolver ()); - - //------------------------------------- - // ExpressionEvaluator methods - //------------------------------------- - /** - * - * Translation time validation of an attribute value. This method - * will return a null String if the attribute value is valid; - * otherwise an error message. - **/ - public String validate (String pAttributeName, - String pAttributeValue) - { - try { - sEvaluator.parseExpressionString (pAttributeValue); - return null; - } - catch (ELException exc) { - return - MessageFormat.format - (Constants.ATTRIBUTE_PARSE_EXCEPTION, - new Object [] { - "" + pAttributeName, - "" + pAttributeValue, - exc.getMessage () - }); - } - } - - //------------------------------------- - /** - * - * Evaluates the expression at request time - **/ - public Object evaluate (String pAttributeName, - String pAttributeValue, - Class pExpectedType, - Tag pTag, - PageContext pPageContext, - Map functions, - String defaultPrefix) - throws JspException - { - try { - return sEvaluator.evaluate - (pAttributeValue, - pPageContext, - pExpectedType, - functions, - defaultPrefix); - } - catch (ELException exc) { - throw new JspException - (MessageFormat.format - (Constants.ATTRIBUTE_EVALUATION_EXCEPTION, - new Object [] { - "" + pAttributeName, - "" + pAttributeValue, - exc.getMessage(), - exc.getRootCause() - }), exc.getRootCause()); - } - } - - /** Conduit to old-style call for convenience. */ - public Object evaluate (String pAttributeName, - String pAttributeValue, - Class pExpectedType, - Tag pTag, - PageContext pPageContext) - throws JspException - { - return evaluate(pAttributeName, - pAttributeValue, - pExpectedType, - pTag, - pPageContext, - null, - null); - } - - - //------------------------------------- - // Testing methods - //------------------------------------- - /** - * - * Parses the given attribute value, then converts it back to a - * String in its canonical form. - **/ - public static String parseAndRender (String pAttributeValue) - throws JspException - { - try { - return sEvaluator.parseAndRender (pAttributeValue); - } - catch (ELException exc) { - throw new JspException - (MessageFormat.format - (Constants.ATTRIBUTE_PARSE_EXCEPTION, - new Object [] { - "test", - "" + pAttributeValue, - exc.getMessage () - })); - } - } - - //------------------------------------- - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Expression.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Expression.java deleted file mode 100644 index 7fcedb6..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Expression.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Map; - -/** - * - *

The abstract class from which all expression types - * derive. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class Expression -{ - //------------------------------------- - // Member variables - //------------------------------------- - - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public abstract String getExpressionString (); - - //------------------------------------- - /** - * - * Evaluates the expression in the given context - **/ - public abstract Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException; - - //------------------------------------- - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ExpressionString.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ExpressionString.java deleted file mode 100644 index d620f1e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ExpressionString.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Map; - -/** - * - *

Represents an expression String consisting of a mixture of - * Strings and Expressions. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ExpressionString -{ - //------------------------------------- - // Properties - //------------------------------------- - // property elements - - Object [] mElements; - public Object [] getElements () - { return mElements; } - public void setElements (Object [] pElements) - { mElements = pElements; } - - //------------------------------------- - /** - * - * Constructor - **/ - public ExpressionString (Object [] pElements) - { - mElements = pElements; - } - - //------------------------------------- - /** - * - * Evaluates the expression string by evaluating each element, - * converting it to a String (using toString, or "" for null values) - * and concatenating the results into a single String. - **/ - public String evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - StringBuilder buf = new StringBuilder(); - for (Object elem : mElements) { - if (elem instanceof String) { - buf.append((String) elem); - } else if (elem instanceof Expression) { - Object val - = ((Expression) elem).evaluate(pContext, - pResolver, - functions, - defaultPrefix, - pLogger); - if (val != null) { - buf.append(val.toString()); - } - } - } - return buf.toString(); - } - - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString() { - StringBuilder buf = new StringBuilder(); - for (Object elem : mElements) { - if (elem instanceof String) { - buf.append((String) elem); - } else if (elem instanceof Expression) { - buf.append("${"); - buf.append(((Expression) elem).getExpressionString()); - buf.append("}"); - } - } - return buf.toString(); - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FloatingPointLiteral.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FloatingPointLiteral.java deleted file mode 100644 index 6caf884..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FloatingPointLiteral.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

An expression representing a floating point literal value. The - * value is stored internally as a double. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class FloatingPointLiteral - extends Literal -{ - //------------------------------------- - /** - * - * Constructor - **/ - public FloatingPointLiteral (String pToken) - { - super (getValueFromToken (pToken)); - } - - //------------------------------------- - /** - * - * Parses the given token into the literal value - **/ - static Object getValueFromToken (String pToken) - { - return new Double (pToken); - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return getValue ().toString (); - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FunctionInvocation.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FunctionInvocation.java deleted file mode 100644 index 12b24af..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/FunctionInvocation.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * - *

Represents a function call.

- * - * @author Shawn Bayern (in the style of Nathan's other classes) - **/ - -public class FunctionInvocation - extends Expression -{ - //------------------------------------- - // Properties - //------------------------------------- - // property index - - private String functionName; - private List argumentList; - public String getFunctionName() { return functionName; } - public void setFunctionName(String f) { functionName = f; } - public List getArgumentList() { return argumentList; } - public void setArgumentList(List l) { argumentList = l; } - - //------------------------------------- - /** - * Constructor - **/ - public FunctionInvocation (String functionName, List argumentList) - { - this.functionName = functionName; - this.argumentList = argumentList; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * Returns the expression in the expression language syntax - **/ - @Override - public String getExpressionString () { - StringBuilder b = new StringBuilder(); - b.append(functionName); - b.append("("); - Iterator i = argumentList.iterator(); - while (i.hasNext()) { - b.append(((Expression) i.next()).getExpressionString()); - if (i.hasNext()) - b.append(", "); - } - b.append(")"); - return b.toString(); - } - - - //------------------------------------- - /** - * - * Evaluates by looking up the name in the VariableResolver - **/ - public Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - - // if the Map is null, then the function is invalid - if (functions == null) - pLogger.logError(Constants.UNKNOWN_FUNCTION, functionName); - - // normalize function name against default prefix - String functionName = this.functionName; - if (functionName.indexOf(":") == -1) { - if (defaultPrefix == null) - pLogger.logError(Constants.UNKNOWN_FUNCTION, functionName); - functionName = defaultPrefix + ":" + functionName; - } - - // ensure that the function's name is mapped - Method target = (Method) functions.get(functionName); - if (target == null) - pLogger.logError(Constants.UNKNOWN_FUNCTION, functionName); - - // ensure that the number of arguments matches the number of parameters - Class[] params = target.getParameterTypes(); - if (params.length != argumentList.size()) - pLogger.logError(Constants.INAPPROPRIATE_FUNCTION_ARG_COUNT, - Integer.valueOf(params.length), - Integer.valueOf(argumentList.size())); - - // now, walk through each parameter, evaluating and casting its argument - Object[] arguments = new Object[argumentList.size()]; - for (int i = 0; i < params.length; i++) { - // evaluate - arguments[i] = ((Expression) argumentList.get(i)).evaluate(pContext, - pResolver, - functions, - defaultPrefix, - pLogger); - // coerce - arguments[i] = Coercions.coerce(arguments[i], params[i], pLogger); - } - - // finally, invoke the target method, which we know to be static - try { - return (target.invoke(null, arguments)); - } catch (InvocationTargetException ex) { - pLogger.logError(Constants.FUNCTION_INVOCATION_ERROR, - ex.getTargetException(), - functionName); - return null; - } catch (Exception ex) { - pLogger.logError(Constants.FUNCTION_INVOCATION_ERROR, ex, functionName); - return null; - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOperator.java deleted file mode 100644 index 56925d2..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOperator.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the greater than operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class GreaterThanOperator - extends RelationalOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final GreaterThanOperator SINGLETON = - new GreaterThanOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public GreaterThanOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return ">"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == pRight) { - return Boolean.FALSE; - } - else if (pLeft == null || - pRight == null) { - return Boolean.FALSE; - } - else { - return super.apply (pLeft, pRight, pContext, pLogger); - } - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values - **/ - public boolean apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft > pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given long values - **/ - public boolean apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft > pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given String values - **/ - public boolean apply (String pLeft, - String pRight, - Logger pLogger) - { - return pLeft.compareTo (pRight) > 0; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOrEqualsOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOrEqualsOperator.java deleted file mode 100644 index 5c18104..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/GreaterThanOrEqualsOperator.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the greater than or equals operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class GreaterThanOrEqualsOperator - extends RelationalOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final GreaterThanOrEqualsOperator SINGLETON = - new GreaterThanOrEqualsOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public GreaterThanOrEqualsOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return ">="; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == pRight) { - return Boolean.TRUE; - } - else if (pLeft == null || - pRight == null) { - return Boolean.FALSE; - } - else { - return super.apply (pLeft, pRight, pContext, pLogger); - } - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values - **/ - public boolean apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft >= pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given long values - **/ - public boolean apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft >= pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given String values - **/ - public boolean apply (String pLeft, - String pRight, - Logger pLogger) - { - return pLeft.compareTo (pRight) >= 0; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java deleted file mode 100644 index d103dfb..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ImplicitObjects.java +++ /dev/null @@ -1,1139 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - - - -import java.util.ArrayList; - -import java.util.Collections; - -import java.util.Date; - -import java.util.Enumeration; - -import java.util.HashMap; - -import java.util.List; - -import java.util.Map; - -import jakarta.servlet.ServletContext; - -import jakarta.servlet.http.Cookie; - -import jakarta.servlet.http.HttpServletRequest; - -import jakarta.servlet.jsp.PageContext; - - - -/** - - * - - *

This class is used to generate the implicit Map and List objects - - * that wrap various elements of the PageContext. It also returns the - - * correct implicit object for a given implicit object name. - - * - - * @author Nathan Abramson - Art Technology Group - - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - - **/ - - - -public class ImplicitObjects - -{ - - //------------------------------------- - - // Constants - - //------------------------------------- - - - - static final String sAttributeName = - - "org.apache.taglibs.standard.ImplicitObjects"; - - - - //------------------------------------- - - // Member variables - - //------------------------------------- - - - - PageContext mContext; - - Map mPage; - - Map mRequest; - - Map mSession; - - Map mApplication; - - Map mParam; - - Map mParams; - - Map mHeader; - - Map mHeaders; - - Map mInitParam; - - Map mCookie; - - - - //------------------------------------- - - /** - - * - - * Constructor - - **/ - - public ImplicitObjects (PageContext pContext) - - { - - mContext = pContext; - - } - - - - //------------------------------------- - - /** - - * - - * Finds the ImplicitObjects associated with the PageContext, - - * creating it if it doesn't yet exist. - - **/ - - public static ImplicitObjects getImplicitObjects (PageContext pContext) - - { - - ImplicitObjects objs = - - (ImplicitObjects) - - pContext.getAttribute (sAttributeName, - - PageContext.PAGE_SCOPE); - - if (objs == null) { - - objs = new ImplicitObjects (pContext); - - pContext.setAttribute (sAttributeName, - - objs, - - PageContext.PAGE_SCOPE); - - } - - return objs; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that "wraps" page-scoped attributes - - **/ - - public Map getPageScopeMap () - - { - - if (mPage == null) { - - mPage = createPageScopeMap (mContext); - - } - - return mPage; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that "wraps" request-scoped attributes - - **/ - - public Map getRequestScopeMap () - - { - - if (mRequest == null) { - - mRequest = createRequestScopeMap (mContext); - - } - - return mRequest; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that "wraps" session-scoped attributes - - **/ - - public Map getSessionScopeMap () - - { - - if (mSession == null) { - - mSession = createSessionScopeMap (mContext); - - } - - return mSession; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that "wraps" application-scoped attributes - - **/ - - public Map getApplicationScopeMap () - - { - - if (mApplication == null) { - - mApplication = createApplicationScopeMap (mContext); - - } - - return mApplication; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that maps parameter name to a single parameter - - * values. - - **/ - - public Map getParamMap () - - { - - if (mParam == null) { - - mParam = createParamMap (mContext); - - } - - return mParam; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that maps parameter name to an array of parameter - - * values. - - **/ - - public Map getParamsMap () - - { - - if (mParams == null) { - - mParams = createParamsMap (mContext); - - } - - return mParams; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that maps header name to a single header - - * values. - - **/ - - public Map getHeaderMap () - - { - - if (mHeader == null) { - - mHeader = createHeaderMap (mContext); - - } - - return mHeader; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that maps header name to an array of header - - * values. - - **/ - - public Map getHeadersMap () - - { - - if (mHeaders == null) { - - mHeaders = createHeadersMap (mContext); - - } - - return mHeaders; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that maps init parameter name to a single init - - * parameter values. - - **/ - - public Map getInitParamMap () - - { - - if (mInitParam == null) { - - mInitParam = createInitParamMap (mContext); - - } - - return mInitParam; - - } - - - - //------------------------------------- - - /** - - * - - * Returns the Map that maps cookie name to the first matching - - * Cookie in request.getCookies(). - - **/ - - public Map getCookieMap () - - { - - if (mCookie == null) { - - mCookie = createCookieMap (mContext); - - } - - return mCookie; - - } - - - - //------------------------------------- - - // Methods for generating wrapper maps - - //------------------------------------- - - /** - - * - - * Creates the Map that "wraps" page-scoped attributes - - **/ - - public static Map createPageScopeMap (PageContext pContext) - - { - - final PageContext context = pContext; - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return context.getAttributeNamesInScope - - (PageContext.PAGE_SCOPE); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return context.getAttribute - - ((String) pKey, - - PageContext.PAGE_SCOPE); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return true; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that "wraps" request-scoped attributes - - **/ - - public static Map createRequestScopeMap (PageContext pContext) - - { - - final PageContext context = pContext; - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return context.getAttributeNamesInScope - - (PageContext.REQUEST_SCOPE); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return context.getAttribute - - ((String) pKey, - - PageContext.REQUEST_SCOPE); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return true; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that "wraps" session-scoped attributes - - **/ - - public static Map createSessionScopeMap (PageContext pContext) - - { - - final PageContext context = pContext; - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return context.getAttributeNamesInScope - - (PageContext.SESSION_SCOPE); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return context.getAttribute - - ((String) pKey, - - PageContext.SESSION_SCOPE); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return true; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that "wraps" application-scoped attributes - - **/ - - public static Map createApplicationScopeMap (PageContext pContext) - - { - - final PageContext context = pContext; - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return context.getAttributeNamesInScope - - (PageContext.APPLICATION_SCOPE); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return context.getAttribute - - ((String) pKey, - - PageContext.APPLICATION_SCOPE); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return true; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that maps parameter name to single parameter - - * value. - - **/ - - public static Map createParamMap (PageContext pContext) - - { - - final HttpServletRequest request = - - (HttpServletRequest) pContext.getRequest (); - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return request.getParameterNames (); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return request.getParameter ((String) pKey); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return false; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that maps parameter name to an array of parameter - - * values. - - **/ - - public static Map createParamsMap (PageContext pContext) - - { - - final HttpServletRequest request = - - (HttpServletRequest) pContext.getRequest (); - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return request.getParameterNames (); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return request.getParameterValues ((String) pKey); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return false; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that maps header name to single header - - * value. - - **/ - - public static Map createHeaderMap (PageContext pContext) - - { - - final HttpServletRequest request = - - (HttpServletRequest) pContext.getRequest (); - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return request.getHeaderNames (); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return request.getHeader ((String) pKey); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return false; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that maps header name to an array of header - - * values. - - **/ - - public static Map createHeadersMap (PageContext pContext) - - { - - final HttpServletRequest request = - - (HttpServletRequest) pContext.getRequest (); - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return request.getHeaderNames (); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - // Drain the header enumeration - - List l = new ArrayList<>(); - - Enumeration enum_ = request.getHeaders((String) pKey); - - if (enum_ != null) { - - while (enum_.hasMoreElements ()) { - - l.add (enum_.nextElement ()); - - } - - } - - String [] ret = l.toArray(new String [l.size()]); - - return ret; - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return false; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that maps init parameter name to single init - - * parameter value. - - **/ - - public static Map createInitParamMap (PageContext pContext) - - { - - final ServletContext context = pContext.getServletContext (); - - return new EnumeratedMap () - - { - - public Enumeration enumerateKeys () - - { - - return context.getInitParameterNames (); - - } - - - - public Object getValue (Object pKey) - - { - - if (pKey instanceof String) { - - return context.getInitParameter ((String) pKey); - - } - - else { - - return null; - - } - - } - - - - public boolean isMutable () - - { - - return false; - - } - - }; - - } - - - - //------------------------------------- - - /** - - * - - * Creates the Map that maps cookie name to the first matching - - * Cookie in request.getCookies(). - - **/ - public static Map createCookieMap (PageContext pContext) { - - // Read all the cookies and construct the entire map - - HttpServletRequest request = (HttpServletRequest) pContext.getRequest (); - - Cookie [] cookies = request.getCookies (); - - Map ret = new HashMap<>(); - - for (int i = 0; cookies != null && i < cookies.length; i++) { - - Cookie cookie = cookies [i]; - - if (cookie != null) { - - String name = cookie.getName (); - - if (!ret.containsKey (name)) { - - ret.put (name, cookie); - - } - - } - - } - - return ret; - - } - - - - //------------------------------------- - -} - diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerDivideOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerDivideOperator.java deleted file mode 100644 index 4050b96..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerDivideOperator.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the integer divide operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class IntegerDivideOperator - extends BinaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final IntegerDivideOperator SINGLETON = - new IntegerDivideOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public IntegerDivideOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "idiv"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == null && - pRight == null) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.ARITH_OP_NULL, - getOperatorSymbol ()); - } - return PrimitiveObjects.getInteger (0); - } - - long left = - Coercions.coerceToPrimitiveNumber (pLeft, Long.class, pLogger). - longValue (); - long right = - Coercions.coerceToPrimitiveNumber (pRight, Long.class, pLogger). - longValue (); - - try { - return PrimitiveObjects.getLong (left / right); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ARITH_ERROR, - getOperatorSymbol (), - "" + left, - "" + right); - } - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerLiteral.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerLiteral.java deleted file mode 100644 index 1c70fdf..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/IntegerLiteral.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

An expression representing an integer literal value. The value - * is stored internally as a long. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: jluehe $ - **/ - -public class IntegerLiteral - extends Literal -{ - //------------------------------------- - /** - * - * Constructor - **/ - public IntegerLiteral (String pToken) - { - super (getValueFromToken (pToken)); - } - - //------------------------------------- - /** - * - * Parses the given token into the literal value - **/ - static Object getValueFromToken (String pToken) - { - return Long.valueOf(pToken); - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return getValue ().toString (); - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver.java deleted file mode 100644 index d1c4dca..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import jakarta.servlet.jsp.PageContext; - -/** - * - *

This is the JSTL-specific implementation of VariableResolver. - * It looks up variable references in the PageContext, and also - * recognizes references to implicit objects. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class JSTLVariableResolver - implements VariableResolver -{ - //------------------------------------- - /** - * - * Resolves the specified variable within the given context. - * Returns null if the variable is not found. - **/ - public Object resolveVariable (String pName, - Object pContext) - throws ELException - { - PageContext ctx = (PageContext) pContext; - - // Check for implicit objects - if ("pageContext".equals (pName)) { - return ctx; - } - else if ("pageScope".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getPageScopeMap (); - } - else if ("requestScope".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getRequestScopeMap (); - } - else if ("sessionScope".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getSessionScopeMap (); - } - else if ("applicationScope".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getApplicationScopeMap (); - } - else if ("param".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getParamMap (); - } - else if ("paramValues".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getParamsMap (); - } - else if ("header".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getHeaderMap (); - } - else if ("headerValues".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getHeadersMap (); - } - else if ("initParam".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getInitParamMap (); - } - else if ("cookie".equals (pName)) { - return ImplicitObjects. - getImplicitObjects (ctx). - getCookieMap (); - } - - // Otherwise, just look it up in the page context - else { - return ctx.findAttribute (pName); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOperator.java deleted file mode 100644 index dfa6fca..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOperator.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the less than operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class LessThanOperator - extends RelationalOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final LessThanOperator SINGLETON = - new LessThanOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public LessThanOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "<"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == pRight) { - return Boolean.FALSE; - } - else if (pLeft == null || - pRight == null) { - return Boolean.FALSE; - } - else { - return super.apply (pLeft, pRight, pContext, pLogger); - } - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values - **/ - public boolean apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft < pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given long values - **/ - public boolean apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft < pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given String values - **/ - public boolean apply (String pLeft, - String pRight, - Logger pLogger) - { - return pLeft.compareTo (pRight) < 0; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOrEqualsOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOrEqualsOperator.java deleted file mode 100644 index bca028d..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/LessThanOrEqualsOperator.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the less than or equals operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class LessThanOrEqualsOperator - extends RelationalOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final LessThanOrEqualsOperator SINGLETON = - new LessThanOrEqualsOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public LessThanOrEqualsOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "<="; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == pRight) { - return Boolean.TRUE; - } - else if (pLeft == null || - pRight == null) { - return Boolean.FALSE; - } - else { - return super.apply (pLeft, pRight, pContext, pLogger); - } - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values - **/ - public boolean apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft <= pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given long values - **/ - public boolean apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft <= pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given String values - **/ - public boolean apply (String pLeft, - String pRight, - Logger pLogger) - { - return pLeft.compareTo (pRight) <= 0; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Literal.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Literal.java deleted file mode 100644 index e022d43..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Literal.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Map; - -/** - * - *

An expression representing a literal value - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class Literal - extends Expression -{ - //------------------------------------- - // Properties - //------------------------------------- - // property value - - Object mValue; - public Object getValue () - { return mValue; } - public void setValue (Object pValue) - { mValue = pValue; } - - //------------------------------------- - /** - * - * Constructor - **/ - public Literal (Object pValue) - { - mValue = pValue; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Evaluates to the literal value - **/ - public Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - return mValue; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Logger.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Logger.java deleted file mode 100644 index 33718a4..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Logger.java +++ /dev/null @@ -1,777 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.io.PrintStream; -import java.text.MessageFormat; - -/** - * - *

The evaluator may pass an instance of this class to operators - * and expressions during evaluation. They should use this to log any - * warning or error messages that might come up. This allows all of - * our logging policies to be concentrated in one class. - * - *

Errors are conditions that are severe enough to abort operation. - * Warnings are conditions through which the operation may continue, - * but which should be reported to the developer. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class Logger -{ - //------------------------------------- - // Member variables - //------------------------------------- - - PrintStream mOut; - - //------------------------------------- - /** - * - * Constructor - * - * @param pOut the PrintStream to which warnings should be printed - **/ - public Logger (PrintStream pOut) - { - mOut = pOut; - } - - //------------------------------------- - /** - * - * Returns true if the application should even bother to try logging - * a warning. - **/ - public boolean isLoggingWarning () - { - return false; - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pMessage, - Throwable pRootCause) - throws ELException - { - if (isLoggingWarning ()) { - if (pMessage == null) { - System.out.println (pRootCause); - } - else if (pRootCause == null) { - System.out.println (pMessage); - } - else { - System.out.println (pMessage + ": " + pRootCause); - } - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate) - throws ELException - { - if (isLoggingWarning ()) { - logWarning (pTemplate, null); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (Throwable pRootCause) - throws ELException - { - if (isLoggingWarning ()) { - logWarning (null, pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Object pArg0) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - })); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Throwable pRootCause, - Object pArg0) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Object pArg0, - Object pArg1) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - })); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - })); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - })); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - })); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4, - Object pArg5) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - "" + pArg5, - })); - } - } - - //------------------------------------- - /** - * - * Logs a warning - **/ - public void logWarning (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4, - Object pArg5) - throws ELException - { - if (isLoggingWarning ()) { - logWarning - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - "" + pArg5, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Returns true if the application should even bother to try logging - * an error. - **/ - public boolean isLoggingError () - { - return true; - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pMessage, - Throwable pRootCause) - throws ELException - { - if (isLoggingError ()) { - if (pMessage == null) { - throw new ELException (pRootCause); - } - else if (pRootCause == null) { - throw new ELException (pMessage); - } - else { - throw new ELException (pMessage, pRootCause); - } - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate) - throws ELException - { - if (isLoggingError ()) { - logError (pTemplate, null); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (Throwable pRootCause) - throws ELException - { - if (isLoggingError ()) { - logError (null, pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Object pArg0) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - })); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Throwable pRootCause, - Object pArg0) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Object pArg0, - Object pArg1) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - })); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - })); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - })); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - })); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - }), - pRootCause); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4, - Object pArg5) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - "" + pArg5, - })); - } - } - - //------------------------------------- - /** - * - * Logs an error - **/ - public void logError (String pTemplate, - Throwable pRootCause, - Object pArg0, - Object pArg1, - Object pArg2, - Object pArg3, - Object pArg4, - Object pArg5) - throws ELException - { - if (isLoggingError ()) { - logError - (MessageFormat.format - (pTemplate, - new Object [] { - "" + pArg0, - "" + pArg1, - "" + pArg2, - "" + pArg3, - "" + pArg4, - "" + pArg5, - }), - pRootCause); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MinusOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MinusOperator.java deleted file mode 100644 index 3858849..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MinusOperator.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the minus operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class MinusOperator - extends ArithmeticOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final MinusOperator SINGLETON = - new MinusOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public MinusOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "-"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public double apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft - pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public long apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft - pRight; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ModulusOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ModulusOperator.java deleted file mode 100644 index 66a96a1..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ModulusOperator.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the modulus operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ModulusOperator - extends BinaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final ModulusOperator SINGLETON = - new ModulusOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public ModulusOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "%"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - if (pLeft == null && - pRight == null) { - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.ARITH_OP_NULL, - getOperatorSymbol ()); - } - return PrimitiveObjects.getInteger (0); - } - - if ((pLeft != null && - (Coercions.isFloatingPointType (pLeft) || - Coercions.isFloatingPointString (pLeft))) || - (pRight != null && - (Coercions.isFloatingPointType (pRight) || - Coercions.isFloatingPointString (pRight)))) { - double left = - Coercions.coerceToPrimitiveNumber (pLeft, Double.class, pLogger). - doubleValue (); - double right = - Coercions.coerceToPrimitiveNumber (pRight, Double.class, pLogger). - doubleValue (); - - try { - return PrimitiveObjects.getDouble (left % right); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ARITH_ERROR, - getOperatorSymbol (), - "" + left, - "" + right); - } - return PrimitiveObjects.getInteger (0); - } - } - else { - long left = - Coercions.coerceToPrimitiveNumber (pLeft, Long.class, pLogger). - longValue (); - long right = - Coercions.coerceToPrimitiveNumber (pRight, Long.class, pLogger). - longValue (); - - try { - return PrimitiveObjects.getLong (left % right); - } - catch (Exception exc) { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.ARITH_ERROR, - getOperatorSymbol (), - "" + left, - "" + right); - } - return PrimitiveObjects.getInteger (0); - } - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MultiplyOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MultiplyOperator.java deleted file mode 100644 index 7c41502..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/MultiplyOperator.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the multiply operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class MultiplyOperator - extends ArithmeticOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final MultiplyOperator SINGLETON = - new MultiplyOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public MultiplyOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "*"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public double apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft * pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public long apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft * pRight; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NamedValue.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NamedValue.java deleted file mode 100644 index d5fa38a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NamedValue.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Map; - -/** - * - *

Represents a name that can be used as the first element of a - * value. - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class NamedValue - extends Expression -{ - //------------------------------------- - // Constants - //------------------------------------- - - //------------------------------------- - // Properties - //------------------------------------- - // property name - - String mName; - public String getName () - { return mName; } - - //------------------------------------- - /** - * - * Constructor - **/ - public NamedValue (String pName) - { - mName = pName; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return StringLiteral.toIdentifierToken (mName); - } - - //------------------------------------- - /** - * - * Evaluates by looking up the name in the VariableResolver - **/ - public Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - if (pResolver == null) { - return null; - } - else { - return pResolver.resolveVariable (mName, pContext); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotEqualsOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotEqualsOperator.java deleted file mode 100644 index df75580..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotEqualsOperator.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the not equals operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class NotEqualsOperator - extends EqualityOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final NotEqualsOperator SINGLETON = - new NotEqualsOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public NotEqualsOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "!="; - } - - //------------------------------------- - /** - * - * Applies the operator given the fact that the two elements are - * equal. - **/ - public boolean apply (boolean pAreEqual, - Logger pLogger) - { - return !pAreEqual; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotOperator.java deleted file mode 100644 index 0216717..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NotOperator.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the not operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class NotOperator - extends UnaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final NotOperator SINGLETON = - new NotOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public NotOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "not"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pValue, - Object pContext, - Logger pLogger) - throws ELException - { - // Coerce the value to a boolean - boolean val = Coercions.coerceToBoolean (pValue, pLogger).booleanValue (); - - return PrimitiveObjects.getBoolean (!val); - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NullLiteral.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NullLiteral.java deleted file mode 100644 index befc738..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/NullLiteral.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

An expression representing a null literal value - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class NullLiteral - extends Literal -{ - //------------------------------------- - // Member variables - //------------------------------------- - - public static final NullLiteral SINGLETON = new NullLiteral (); - - //------------------------------------- - /** - * - * Constructor - **/ - public NullLiteral () - { - super (null); - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return "null"; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/OrOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/OrOperator.java deleted file mode 100644 index 481a12b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/OrOperator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the or operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class OrOperator - extends BinaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final OrOperator SINGLETON = - new OrOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public OrOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "or"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - // Coerce the values to booleans - boolean left = - Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); - boolean right = - Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); - - return PrimitiveObjects.getBoolean (left || right); - } - - //------------------------------------- - /** - * - * Returns true if evaluation is necessary given the specified Left - * value. The And/OrOperators make use of this - **/ - public boolean shouldEvaluate (Object pLeft) - { - return - (pLeft instanceof Boolean) && - ((Boolean) pLeft).booleanValue () == false; - } - - //------------------------------------- - /** - * - * Returns true if the operator expects its arguments to be coerced - * to Booleans. The And/Or operators set this to true. - **/ - public boolean shouldCoerceToBoolean () - { - return true; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PlusOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PlusOperator.java deleted file mode 100644 index 1cf3ce9..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PlusOperator.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the plus operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class PlusOperator - extends ArithmeticOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final PlusOperator SINGLETON = - new PlusOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public PlusOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "+"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public double apply (double pLeft, - double pRight, - Logger pLogger) - { - return pLeft + pRight; - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values, returning a double - **/ - public long apply (long pLeft, - long pRight, - Logger pLogger) - { - return pLeft + pRight; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PrimitiveObjects.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PrimitiveObjects.java deleted file mode 100644 index d857e7e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PrimitiveObjects.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This converts primitive values to their Object counterparts. - * For bytes and chars, values from 0 to 255 are cached. For shorts, - * ints, and longs, values -1000 to 1000 are cached. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: jluehe $ - **/ - -class PrimitiveObjects -{ - //------------------------------------- - // Constants - //------------------------------------- - - static int BYTE_LOWER_BOUND = 0; - static int BYTE_UPPER_BOUND = 255; - static int CHARACTER_LOWER_BOUND = 0; - static int CHARACTER_UPPER_BOUND = 255; - static int SHORT_LOWER_BOUND = -1000; - static int SHORT_UPPER_BOUND = 1000; - static int INTEGER_LOWER_BOUND = -1000; - static int INTEGER_UPPER_BOUND = 1000; - static int LONG_LOWER_BOUND = -1000; - static int LONG_UPPER_BOUND = 1000; - - //------------------------------------- - // Member variables - //------------------------------------- - - static Byte [] mBytes = createBytes (); - static Character [] mCharacters = createCharacters (); - static Short [] mShorts = createShorts (); - static Integer [] mIntegers = createIntegers (); - static Long [] mLongs = createLongs (); - - //------------------------------------- - // Getting primitive values - //------------------------------------- - public static Boolean getBoolean (boolean pValue) - { - return - pValue ? - Boolean.TRUE : - Boolean.FALSE; - } - - //------------------------------------- - public static Byte getByte (byte pValue) - { - int iValue = pValue & 0xff; - if (iValue >= BYTE_LOWER_BOUND && - iValue <= BYTE_UPPER_BOUND) { - return mBytes [iValue - BYTE_LOWER_BOUND]; - } - else { - return Byte.valueOf(pValue); - } - } - - //------------------------------------- - public static Character getCharacter (char pValue) - { - if (pValue >= CHARACTER_LOWER_BOUND && - pValue <= CHARACTER_UPPER_BOUND) { - return mCharacters [((int) pValue) - CHARACTER_LOWER_BOUND]; - } - else { - return Character.valueOf(pValue); - } - } - - //------------------------------------- - public static Short getShort (short pValue) - { - if (pValue >= SHORT_LOWER_BOUND && - pValue <= SHORT_UPPER_BOUND) { - return mShorts [((int) pValue) - SHORT_LOWER_BOUND]; - } - else { - return Short.valueOf(pValue); - } - } - - //------------------------------------- - public static Integer getInteger (int pValue) - { - if (pValue >= INTEGER_LOWER_BOUND && - pValue <= INTEGER_UPPER_BOUND) { - return mIntegers [((int) pValue) - INTEGER_LOWER_BOUND]; - } - else { - return Integer.valueOf(pValue); - } - } - - //------------------------------------- - public static Long getLong (long pValue) - { - if (pValue >= LONG_LOWER_BOUND && - pValue <= LONG_UPPER_BOUND) { - return mLongs [((int) pValue) - LONG_LOWER_BOUND]; - } - else { - return Long.valueOf(pValue); - } - } - - //------------------------------------- - public static Float getFloat (float pValue) - { - return Float.valueOf(pValue); - } - - //------------------------------------- - public static Double getDouble (double pValue) - { - return Double.valueOf(pValue); - } - - //------------------------------------- - // Object class equivalents of primitive classes - //------------------------------------- - /** - * - * If the given class is a primitive class, returns the object - * version of that class. Otherwise, the class is just returned. - **/ - public static Class getPrimitiveObjectClass (Class pClass) - { - if (pClass == Boolean.TYPE) { - return Boolean.class; - } - else if (pClass == Byte.TYPE) { - return Byte.class; - } - else if (pClass == Short.TYPE) { - return Short.class; - } - else if (pClass == Character.TYPE) { - return Character.class; - } - else if (pClass == Integer.TYPE) { - return Integer.class; - } - else if (pClass == Long.TYPE) { - return Long.class; - } - else if (pClass == Float.TYPE) { - return Float.class; - } - else if (pClass == Double.TYPE) { - return Double.class; - } - else { - return pClass; - } - } - - //------------------------------------- - // Initializing the cached values - //------------------------------------- - static Byte [] createBytes () - { - int len = BYTE_UPPER_BOUND - BYTE_LOWER_BOUND + 1; - Byte [] ret = new Byte [len]; - byte val = (byte) BYTE_LOWER_BOUND; - for (int i = 0; i < len; i++, val++) { - ret [i] = Byte.valueOf(val); - } - return ret; - } - - //------------------------------------- - static Character [] createCharacters () - { - int len = CHARACTER_UPPER_BOUND - CHARACTER_LOWER_BOUND + 1; - Character [] ret = new Character [len]; - char val = (char) CHARACTER_LOWER_BOUND; - for (int i = 0; i < len; i++, val++) { - ret [i] = Character.valueOf(val); - } - return ret; - } - - //------------------------------------- - static Short [] createShorts () - { - int len = SHORT_UPPER_BOUND - SHORT_LOWER_BOUND + 1; - Short [] ret = new Short [len]; - short val = (short) SHORT_LOWER_BOUND; - for (int i = 0; i < len; i++, val++) { - ret [i] = Short.valueOf(val); - } - return ret; - } - - //------------------------------------- - static Integer [] createIntegers () - { - int len = INTEGER_UPPER_BOUND - INTEGER_LOWER_BOUND + 1; - Integer [] ret = new Integer [len]; - int val = (int) INTEGER_LOWER_BOUND; - for (int i = 0; i < len; i++, val++) { - ret [i] = Integer.valueOf(val); - } - return ret; - } - - //------------------------------------- - static Long [] createLongs () - { - int len = LONG_UPPER_BOUND - LONG_LOWER_BOUND + 1; - Long [] ret = new Long [len]; - long val = (long) LONG_LOWER_BOUND; - for (int i = 0; i < len; i++, val++) { - ret [i] = Long.valueOf(val); - } - return ret; - } - - //------------------------------------- - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PropertySuffix.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PropertySuffix.java deleted file mode 100644 index 5f3baa4..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/PropertySuffix.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Map; - -/** - * - *

Represents an operator that obtains the value of another value's - * property. This is a specialization of ArraySuffix - a.b is - * equivalent to a["b"] - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class PropertySuffix - extends ArraySuffix -{ - //------------------------------------- - // Properties - //------------------------------------- - // property name - - String mName; - public String getName () - { return mName; } - public void setName (String pName) - { mName = pName; } - - //------------------------------------- - /** - * - * Constructor - **/ - public PropertySuffix (String pName) - { - super (null); - mName = pName; - } - - //------------------------------------- - /** - * - * Gets the value of the index - **/ - Object evaluateIndex (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - return mName; - } - - //------------------------------------- - /** - * - * Returns the operator symbol - **/ - String getOperatorSymbol () - { - return "."; - } - - //------------------------------------- - // ValueSuffix methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return "." + StringLiteral.toIdentifierToken (mName); - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/RelationalOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/RelationalOperator.java deleted file mode 100644 index 30b1645..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/RelationalOperator.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This is the superclass for all relational operators (except == - * or !=) - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class RelationalOperator - extends BinaryOperator -{ - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pLeft, - Object pRight, - Object pContext, - Logger pLogger) - throws ELException - { - return Coercions.applyRelationalOperator (pLeft, pRight, this, pLogger); - } - - //------------------------------------- - /** - * - * Applies the operator to the given double values - **/ - public abstract boolean apply (double pLeft, - double pRight, - Logger pLogger); - - //------------------------------------- - /** - * - * Applies the operator to the given long values - **/ - public abstract boolean apply (long pLeft, - long pRight, - Logger pLogger); - - //------------------------------------- - /** - * - * Applies the operator to the given String values - **/ - public abstract boolean apply (String pLeft, - String pRight, - Logger pLogger); - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources.properties b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources.properties deleted file mode 100644 index 2dc7811..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources.properties +++ /dev/null @@ -1,158 +0,0 @@ -# -# Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -EXCEPTION_GETTING_BEANINFO=\ - An Exception occurred getting the BeanInfo for class {0} - -NULL_EXPRESSION_STRING=\ - A null expression string may not be passed to the \ - expression evaluator - -PARSE_EXCEPTION=\ - Encountered "{1}", expected one of [{0}] - -CANT_GET_PROPERTY_OF_NULL=\ - Attempt to get property "{0}" from a null value - -NO_SUCH_PROPERTY=\ - Class {0} does not have a property "{1}" - -NO_GETTER_METHOD=\ - Property "{0}" of class {1} does not have a public getter method - -ERROR_GETTING_PROPERTY=\ - An error occurred while getting property "{0}" from an instance \ - of class {1} - -CANT_GET_INDEXED_VALUE_OF_NULL=\ - Attempt to apply the "{0}" operator to a null value - -CANT_GET_NULL_INDEX=\ - Attempt to apply a null index to the "{0}" operator - -NULL_INDEX=\ - The index supplied to the "{0}" operator may not be null - -BAD_INDEX_VALUE=\ - The "{0}" operator was supplied with an index value of type \ - "{1}" to be applied to a List or array, but \ - that value cannot be converted to an integer. - -EXCEPTION_ACCESSING_LIST=\ - An exception occurred while trying to access index {0} of a \ - List - -EXCEPTION_ACCESSING_ARRAY=\ - An exception occurred while trying to access index {0} of an \ - Array - -CANT_FIND_INDEX=\ - Unable to find a value for "{0}" in object of class "{1}" using \ - operator "{2}" - -TOSTRING_EXCEPTION=\ - An object of type "{0}" threw an exception in its toString() \ - method while trying to be coerced to a String - -BOOLEAN_TO_NUMBER=\ - Attempt to coerce a boolean value "{0}" to type \ - "{1}" - -STRING_TO_NUMBER_EXCEPTION=\ - An exception occured trying to convert String "{0}" to type "{1}" - -COERCE_TO_NUMBER=\ - Attempt to coerce a value of type "{0}" to type "{1}" - -BOOLEAN_TO_CHARACTER=\ - Attempt to coerce a boolean value "{0}" to type Character - -EMPTY_STRING_TO_CHARACTER=\ - Attempt to coerce an empty String to type Character - -COERCE_TO_CHARACTER=\ - Attempt to coerce a value of type "{0}" to Character - -NULL_TO_BOOLEAN=\ - Attempt to coerce a null value to a Boolean - -STRING_TO_BOOLEAN=\ - An exception occurred trying to convert String "{0}" to type Boolean - -COERCE_TO_BOOLEAN=\ - Attempt to coerce a value of type "{0}" to Boolean - -COERCE_TO_OBJECT=\ - Attempt to coerce a value of type "{0}" to type "{1}" - -NO_PROPERTY_EDITOR=\ - Attempt to convert String "{0}" to type "{1}", but there is \ - no PropertyEditor for that type - -PROPERTY_EDITOR_ERROR=\ - Unable to parse value "{0}" into expected type "{1}" - -ARITH_OP_NULL=\ - Attempt to apply operator "{0}" to null value - -ARITH_OP_BAD_TYPE=\ - Attempt to apply operator "{0}" to arguments of type "{1}" \ - and "{2}" - -ARITH_ERROR=\ - An error occurred applying operator "{0}" to operands "{1}" \ - and "{2}" - -ERROR_IN_EQUALS= - An error occurred calling equals() on an object of type "{0}" \ - when comparing with an object of type "{1}" for operator "{2}" - -UNARY_OP_BAD_TYPE=\ - Attempt to apply operator "{0}" to arguments of type "{1}" - -NAMED_VALUE_NOT_FOUND=\ - Unable to find a value for name "{0}" - -CANT_GET_INDEXED_PROPERTY=\ - An error occurred obtaining the indexed property value of an \ - object of type "{0}" with index "{1}" - -COMPARABLE_ERROR=\ - An exception occurred while trying to compare a value of \ - Comparable type "{0}" with a value of type "{1}" for operator \ - "{2}" - -BAD_IMPLICIT_OBJECT=\ - No such implicit object "{0}" - the only implicit objects are: \ - {1} - -ATTRIBUTE_EVALUATION_EXCEPTION=\ - An error occurred while evaluating custom action attribute "{0}" \ - with value "{1}": {2} ({3}) - -ATTRIBUTE_PARSE_EXCEPTION=\ - An error occurred while parsing custom action attribute "{0}" \ - with value "{1}": {2} - -UNKNOWN_FUNCTION=\ - No function is mapped to the name "{1}" - -INAPPROPRIATE_FUNCTION_ARG_COUNT=\ - The function "{1}" requires {2} arguments but was passed {3} - -FUNCTION_INVOCATION_ERROR=\ - An error occurred while evaluating function "{0}" diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources_ja.properties b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources_ja.properties deleted file mode 100644 index 1c1f73d..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/Resources_ja.properties +++ /dev/null @@ -1,139 +0,0 @@ -# -# Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -EXCEPTION_GETTING_BEANINFO=\ - \u30af\u30e9\u30b9 {0} \u306e BeanInfo \u3092\u53d6\u5f97\u3059\u308b\u904e\u7a0b\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -NULL_EXPRESSION_STRING=\ - null \u306e\u5f0f\u6587\u5b57\u5217\u306f\u3001\u5f0f\u306e\u8a55\u4fa1\u3068\u3057\u3066\u901a\u3089\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093 - -PARSE_EXCEPTION=\ - [{0}] \u306e\uff11\u3064\u3092\u671f\u5f85\u3057\u307e\u3057\u305f\u304c\u3001"{1}" \u306b\u906d\u9047\u3057\u307e\u3057\u305f - -CANT_GET_PROPERTY_OF_NULL=\ - null \u5024\u3088\u308a\u30d7\u30ed\u30d1\u30c6\u30a3 "{0}" \u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -NO_SUCH_PROPERTY=\ - \u30af\u30e9\u30b9 {0} \u306b\u306f\u3001\u30d7\u30ed\u30d1\u30c6\u30a3 "{1}" \u304c\u5b58\u5728\u3057\u307e\u305b\u3093 - -NO_GETTER_METHOD=\ - \u30af\u30e9\u30b9 {1} \u306b\u3042\u308b\u30d7\u30ed\u30d1\u30c6\u30a3 "{0}" \u7528\u306e public \u3067\u5ba3\u8a00\u3055\u308c\u305f getter \u30e1\u30bd\u30c3\u30c9\u304c\u3042\u308a\u307e\u305b\u3093 - -ERROR_GETTING_PROPERTY=\ - \u30af\u30e9\u30b9 {1} \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304b\u3089\u30d7\u30ed\u30d1\u30c6\u30a3 "{0}" \u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -CANT_GET_INDEXED_VALUE_OF_NULL=\ - null \u5024\u306b\u5bfe\u3057\u3066 "{0}" \u30aa\u30da\u30ec\u30fc\u30bf\u3092\u9069\u7528\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -CANT_GET_NULL_INDEX=\ - "{0}" \u30aa\u30da\u30ec\u30fc\u30bf\u306b\u5bfe\u3057\u3066 null \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u9069\u7528\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -NULL_INDEX=\ - "{0}" \u30aa\u30da\u30ec\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u4f9b\u7d66\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f null \u3067\u3042\u3063\u3066\u306f\u3044\u3051\u307e\u305b\u3093 - -BAD_INDEX_VALUE=\ - "{0}" \u30aa\u30da\u30ec\u30fc\u30bf\u306b\u3088\u3063\u3066 List \u3082\u3057\u304f\u306f\u914d\u5217\u306b\u9069\u7528\u3055\u308c\u305f "{1}" \u578b\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u5024\u3092\u4f9b\u7d66\u3057\u307e\u3057\u305f\u304c\u3001\u305d\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u5024\u3092\u6574\u6570\u5024\u3078\u5909\u63db\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093 - -EXCEPTION_ACCESSING_LIST=\ - List \u306e\u4e2d\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9 {0} \u3078\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -EXCEPTION_ACCESSING_ARRAY=\ - Array \u306e\u4e2d\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9 {0} \u3078\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -CANT_FIND_INDEX=\ - \u30aa\u30da\u30ec\u30fc\u30bf "{2}" \u3092\u5229\u7528\u3057\u307e\u3057\u305f\u304c\u3001\u30af\u30e9\u30b9 "{1}" \u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u304a\u3044\u3066 "{0}" \u306b\u5bfe\u5fdc\u3059\u308b\u5024\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093 - -TOSTRING_EXCEPTION=\ - "{0}" \u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092 String \u306b\u5909\u63db\u3059\u308b\u904e\u7a0b\u306b\u304a\u3044\u3066\u3001\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e toString() \u30e1\u30bd\u30c3\u30c9\u304c\u4f8b\u5916\u3092\u30b9\u30ed\u30fc\u3057\u307e\u3057\u305f - -BOOLEAN_TO_NUMBER=\ - boolean \u5024 "{0}" \u3092 "{1}" \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -STRING_TO_NUMBER_EXCEPTION=\ - String "{0}" \u3092 "{1}" \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u305f\u969b\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -COERCE_TO_NUMBER=\ - "{0}" \u578b\u306e\u5024\u3092 "{1}" \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -BOOLEAN_TO_CHARACTER=\ - boolean \u5024 "{0}" \u3092 Character \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -EMPTY_STRING_TO_CHARACTER=\ - \u7a7a\u306e String \u3092 Character \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -COERCE_TO_CHARACTER=\ - "{0}" \u578b\u306e\u5024\u3092 Character \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -NULL_TO_BOOLEAN=\ - null \u5024\u3092 Boolean \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -STRING_TO_BOOLEAN=\ - String "{0}" \u3092 Boolean \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u305f\u969b\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -COERCE_TO_BOOLEAN=\ - "{0}" \u578b\u306e\u5024\u3092 Boolean \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -COERCE_TO_OBJECT=\ - "{0}" \u578b\u306e\u5024\u3092 "{1}" \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -NO_PROPERTY_EDITOR=\ - String "{0}" \u3092 "{1}" \u578b\u306b\u5909\u63db\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u304c\u3001\u305d\u306e\u578b\u306b\u5bfe\u5fdc\u3059\u308b PropertyEditor \u304c\u5b58\u5728\u3057\u307e\u305b\u3093 - -PROPERTY_EDITOR_ERROR=\ - \u5024 "{0}" \u3092\u69cb\u6587\u89e3\u6790\u3057\u307e\u3057\u305f\u304c\u3001\u671f\u5f85\u3055\u308c\u308b "{1}" \u578b\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093 - -ARITH_OP_NULL=\ - null \u5024\u306b\u5bfe\u3057\u3066\u30aa\u30da\u30ec\u30fc\u30bf "{0}" \u3092\u9069\u7528\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -ARITH_OP_BAD_TYPE=\ - "{1}" \u578b\u304a\u3088\u3073 "{2}" \u578b\u306e\u5909\u6570\u306b\u5bfe\u3057\u3066\u30aa\u30da\u30ec\u30fc\u30bf "{0}" \u3092\u9069\u7528\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -ARITH_ERROR=\ - \u30aa\u30da\u30e9\u30f3\u30c9 "{1}" \u304a\u3088\u3073 "{2}" \u306b\u5bfe\u3057\u3066\u30aa\u30da\u30ec\u30fc\u30bf {0} \u3092\u9069\u7528\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -ERROR_IN_EQUALS=\ - \u30aa\u30da\u30ec\u30fc\u30bf "{2}" \u306b\u5bfe\u3057\u3066 "{1}" \u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u6bd4\u8f03\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u304c\u3001"{0}" \u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e equals() \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -UNARY_OP_BAD_TYPE=\ - "{1}" \u578b\u306e\u5909\u6570\u306b\u5bfe\u3057\u3066\u30aa\u30da\u30ec\u30fc\u30bf "{0}" \u3092\u9069\u7528\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -NAMED_VALUE_NOT_FOUND=\ - \u540d\u79f0 "{0}" \u306b\u5bfe\u5fdc\u3059\u308b\u5024\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093 - -CANT_GET_INDEXED_PROPERTY=\ - \u30a4\u30f3\u30c7\u30c3\u30af\u30b9 "{1}" \u3092\u4ed8\u4e0e\u3057\u305f "{0}" \u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30fb\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u3092\u5f97\u3088\u3046\u3068\u3057\u305f\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -COMPARABLE_ERROR=\ - \u30aa\u30da\u30ec\u30fc\u30bf "{2}" \u306b\u5bfe\u3057\u3066 Comparable \u578b\u3067\u3042\u308b "{0}" \u306e\u5024\u3068 "{1}" \u578b\u306e\u5024\u3068\u3092\u6bd4\u8f03\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -BAD_IMPLICIT_OBJECT=\ - \u305d\u306e\u3088\u3046\u306a\u6697\u9ed9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 "{0}" \u306f\u5b58\u5728\u3057\u307e\u305b\u3093 - \u552f\u4e00\u306e\u6697\u9ed9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059: {1} - -ATTRIBUTE_EVALUATION_EXCEPTION=\ - \u5024 "{1}" \u306e\u30bb\u30c3\u30c8\u3055\u308c\u305f\u30ab\u30b9\u30bf\u30e0\u30fb\u30a2\u30af\u30b7\u30e7\u30f3\u5c5e\u6027 "{0}" \u3092\u8a55\u4fa1\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: {2} ({3}) - -ATTRIBUTE_PARSE_EXCEPTION=\ - \u5024 "{1}" \u306e\u30bb\u30c3\u30c8\u3055\u308c\u305f\u30ab\u30b9\u30bf\u30e0\u30fb\u30a2\u30af\u30b7\u30e7\u30f3\u5c5e\u6027 "{0}" \u3092\u69cb\u6587\u89e3\u6790\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: {2} - -UNKNOWN_FUNCTION=\ - "{1}" \u3068\u3044\u3046\u95a2\u6570\u540d\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002 - -INAPPROPRIATE_FUNCTION_ARG_COUNT=\ - \u95a2\u6570 "{1}" \u3067\u306f\u3001{2}\u500b\u306e\u5f15\u6570\u3092\u5fc5\u8981\u3068\u3057\u307e\u3059\u304c\u3001{3} \u3092\u901a\u3057\u307e\u3057\u305f\u3002 - -FUNCTION_INVOCATION_ERROR=\ - \u95a2\u6570 "{0}" \u3092\u8a55\u4fa1\u3057\u3066\u3044\u308b\u904e\u7a0b\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/StringLiteral.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/StringLiteral.java deleted file mode 100644 index d8c7b6e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/StringLiteral.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

An expression representing a String literal value. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class StringLiteral - extends Literal -{ - //------------------------------------- - /** - * - * Constructor - **/ - StringLiteral (Object pValue) - { - super (pValue); - } - - //------------------------------------- - /** - * - * Returns a StringLiteral parsed from the given token (enclosed by - * single or double quotes) - **/ - public static StringLiteral fromToken (String pToken) - { - return new StringLiteral (getValueFromToken (pToken)); - } - - //------------------------------------- - /** - * - * Returns a StringLiteral with the given string value - **/ - public static StringLiteral fromLiteralValue (String pValue) - { - return new StringLiteral (pValue); - } - - //------------------------------------- - /** - * - * Parses the given token into the literal value - **/ - public static String getValueFromToken (String pToken) { - StringBuilder buf = new StringBuilder (); - int len = pToken.length () - 1; - boolean escaping = false; - for (int i = 1; i < len; i++) { - char ch = pToken.charAt (i); - if (escaping) { - buf.append (ch); - escaping = false; - } - else if (ch == '\\') { - escaping = true; - } - else { - buf.append (ch); - } - } - return buf.toString (); - } - - //------------------------------------- - /** - * - * Converts the specified value to a String token, using " as the - * enclosing quotes and escaping any characters that need escaping. - **/ - public static String toStringToken (String pValue) - { - // See if any escaping is needed - if (pValue.indexOf ('\"') < 0 && - pValue.indexOf ('\\') < 0) { - return "\"" + pValue + "\""; - } - - // Escaping is needed - else { - StringBuilder buf = new StringBuilder (); - buf.append ('\"'); - int len = pValue.length (); - for (int i = 0; i < len; i++) { - char ch = pValue.charAt (i); - if (ch == '\\') { - buf.append ('\\'); - buf.append ('\\'); - } - else if (ch == '\"') { - buf.append ('\\'); - buf.append ('\"'); - } - else { - buf.append (ch); - } - } - buf.append ('\"'); - return buf.toString (); - } - } - - //------------------------------------- - /** - * - * Converts the specified value to an identifier token, escaping it - * as a string literal if necessary. - **/ - public static String toIdentifierToken (String pValue) - { - // See if it's a valid java identifier - if (isJavaIdentifier (pValue)) { - return pValue; - } - - // Return as a String literal - else { - return toStringToken (pValue); - } - } - - //------------------------------------- - /** - * - * Returns true if the specified value is a legal java identifier - **/ - static boolean isJavaIdentifier (String pValue) - { - int len = pValue.length (); - if (len == 0) { - return false; - } - else { - if (!Character.isJavaIdentifierStart (pValue.charAt (0))) { - return false; - } - else { - for (int i = 1; i < len; i++) { - if (!Character.isJavaIdentifierPart (pValue.charAt (i))) { - return false; - } - } - return true; - } - } - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public String getExpressionString () - { - return toStringToken ((String) getValue ()); - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryMinusOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryMinusOperator.java deleted file mode 100644 index fe4472d..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryMinusOperator.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

The implementation of the unary minus operator - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class UnaryMinusOperator - extends UnaryOperator -{ - //------------------------------------- - // Singleton - //------------------------------------- - - public static final UnaryMinusOperator SINGLETON = - new UnaryMinusOperator (); - - //------------------------------------- - /** - * - * Constructor - **/ - public UnaryMinusOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public String getOperatorSymbol () - { - return "-"; - } - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public Object apply (Object pValue, - Object pContext, - Logger pLogger) - throws ELException - { - if (pValue == null) { - /* - if (pLogger.isLoggingWarning ()) { - pLogger.logWarning - (Constants.ARITH_OP_NULL, - getOperatorSymbol ()); - } - */ - return PrimitiveObjects.getInteger (0); - } - - else if (pValue instanceof String) { - if (Coercions.isFloatingPointString (pValue)) { - double dval = - ((Number) - (Coercions.coerceToPrimitiveNumber - (pValue, Double.class, pLogger))). - doubleValue (); - return PrimitiveObjects.getDouble (-dval); - } - else { - long lval = - ((Number) - (Coercions.coerceToPrimitiveNumber - (pValue, Long.class, pLogger))). - longValue (); - return PrimitiveObjects.getLong (-lval); - } - } - - else if (pValue instanceof Byte) { - return PrimitiveObjects.getByte - ((byte) -(((Byte) pValue).byteValue ())); - } - else if (pValue instanceof Short) { - return PrimitiveObjects.getShort - ((short) -(((Short) pValue).shortValue ())); - } - else if (pValue instanceof Integer) { - return PrimitiveObjects.getInteger - ((int) -(((Integer) pValue).intValue ())); - } - else if (pValue instanceof Long) { - return PrimitiveObjects.getLong - ((long) -(((Long) pValue).longValue ())); - } - else if (pValue instanceof Float) { - return PrimitiveObjects.getFloat - ((float) -(((Float) pValue).floatValue ())); - } - else if (pValue instanceof Double) { - return PrimitiveObjects.getDouble - ((double) -(((Double) pValue).doubleValue ())); - } - - else { - if (pLogger.isLoggingError ()) { - pLogger.logError - (Constants.UNARY_OP_BAD_TYPE, - getOperatorSymbol (), - pValue.getClass ().getName ()); - } - return PrimitiveObjects.getInteger (0); - } - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperator.java deleted file mode 100644 index 60f441f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This is the superclass for all unary operators - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class UnaryOperator -{ - //------------------------------------- - /** - * - * Constructor - **/ - public UnaryOperator () - { - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the symbol representing the operator - **/ - public abstract String getOperatorSymbol (); - - //------------------------------------- - /** - * - * Applies the operator to the given value - **/ - public abstract Object apply (Object pValue, - Object pContext, - Logger pLogger) - throws ELException; - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperatorExpression.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperatorExpression.java deleted file mode 100644 index 2edd586..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/UnaryOperatorExpression.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.List; -import java.util.Map; - -/** - * - *

An expression representing one or more unary operators on a - * value - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class UnaryOperatorExpression - extends Expression -{ - //------------------------------------- - // Properties - //------------------------------------- - // property operator - - UnaryOperator mOperator; - public UnaryOperator getOperator () - { return mOperator; } - public void setOperator (UnaryOperator pOperator) - { mOperator = pOperator; } - - //------------------------------------- - // property operators - - List mOperators; - public List getOperators () - { return mOperators; } - public void setOperators (List pOperators) - { mOperators = pOperators; } - - //------------------------------------- - // property expression - - Expression mExpression; - public Expression getExpression () - { return mExpression; } - public void setExpression (Expression pExpression) - { mExpression = pExpression; } - - //------------------------------------- - /** - * - * Constructor - **/ - public UnaryOperatorExpression (UnaryOperator pOperator, - List pOperators, - Expression pExpression) - { - mOperator = pOperator; - mOperators = pOperators; - mExpression = pExpression; - } - - //------------------------------------- - // Expression methods - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - @Override - public String getExpressionString() { - - StringBuilder buf = new StringBuilder(); - buf.append("("); - if (mOperator != null) { - buf.append(mOperator.getOperatorSymbol()); - buf.append(" "); - } else { - for (int i = 0; i < mOperators.size(); i++) { - UnaryOperator operator = (UnaryOperator) mOperators.get(i); - buf.append(operator.getOperatorSymbol()); - buf.append(" "); - } - } - buf.append(mExpression.getExpressionString()); - buf.append(")"); - return buf.toString(); - } - - //------------------------------------- - /** - * - * Evaluates to the literal value - **/ - public Object evaluate (Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException - { - Object value = mExpression.evaluate (pContext, pResolver, functions, - defaultPrefix, pLogger); - if (mOperator != null) { - value = mOperator.apply (value, pContext, pLogger); - } - else { - for (int i = mOperators.size () - 1; i >= 0; i--) { - UnaryOperator operator = (UnaryOperator) mOperators.get (i); - value = operator.apply (value, pContext, pLogger); - } - } - return value; - } - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ValueSuffix.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ValueSuffix.java deleted file mode 100644 index ab38543..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/ValueSuffix.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -import java.util.Map; - -/** - * - *

Represents an element that can appear as a suffix in a complex - * value, such as a property or index operator, or a method call (should - * they ever need to be supported). - * - * @author Nathan Abramson - Art Technology Group - * @author Shawn Bayern - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public abstract class ValueSuffix -{ - //------------------------------------- - /** - * - * Returns the expression in the expression language syntax - **/ - public abstract String getExpressionString (); - - //------------------------------------- - /** - * - * Evaluates the expression in the given context, operating on the - * given value. - **/ - public abstract Object evaluate (Object pValue, - Object pContext, - VariableResolver pResolver, - Map functions, - String defaultPrefix, - Logger pLogger) - throws ELException; - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/VariableResolver.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/VariableResolver.java deleted file mode 100644 index 20952b2..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/VariableResolver.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl; - -/** - * - *

This class is used to customize the way the evaluator resolves - * variable references. For example, instances of this class can - * implement their own variable lookup mechanisms, or introduce the - * notion of "implicit variables" which override any other variables. - * An instance of this class should be passed to the evaluator's - * constructor. - * - *

Whenever the evaluator is invoked, it is passed a "context" - * Object from the application. For example, in a JSP environment, - * the "context" is a PageContext. That context object is eventually - * passed to this class, so that this class has a context in which to - * resolve variables. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public interface VariableResolver -{ - //------------------------------------- - /** - * - * Resolves the specified variable within the given context. - * Returns null if the variable is not found. - **/ - public Object resolveVariable (String pName, - Object pContext) - throws ELException; - - //------------------------------------- -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java deleted file mode 100644 index 0a9cec0..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java +++ /dev/null @@ -1,1242 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020 Payara Servicer Ltd. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import org.apache.taglibs.standard.lang.jstl.AndOperator; -import org.apache.taglibs.standard.lang.jstl.ArraySuffix; -import org.apache.taglibs.standard.lang.jstl.BinaryOperator; -import org.apache.taglibs.standard.lang.jstl.BinaryOperatorExpression; -import org.apache.taglibs.standard.lang.jstl.BooleanLiteral; -import org.apache.taglibs.standard.lang.jstl.ComplexValue; -import org.apache.taglibs.standard.lang.jstl.DivideOperator; -import org.apache.taglibs.standard.lang.jstl.EmptyOperator; -import org.apache.taglibs.standard.lang.jstl.EqualsOperator; -import org.apache.taglibs.standard.lang.jstl.Expression; -import org.apache.taglibs.standard.lang.jstl.ExpressionString; -import org.apache.taglibs.standard.lang.jstl.FloatingPointLiteral; -import org.apache.taglibs.standard.lang.jstl.FunctionInvocation; -import org.apache.taglibs.standard.lang.jstl.GreaterThanOperator; -import org.apache.taglibs.standard.lang.jstl.GreaterThanOrEqualsOperator; -import org.apache.taglibs.standard.lang.jstl.IntegerLiteral; -import org.apache.taglibs.standard.lang.jstl.LessThanOperator; -import org.apache.taglibs.standard.lang.jstl.LessThanOrEqualsOperator; -import org.apache.taglibs.standard.lang.jstl.Literal; -import org.apache.taglibs.standard.lang.jstl.MinusOperator; -import org.apache.taglibs.standard.lang.jstl.ModulusOperator; -import org.apache.taglibs.standard.lang.jstl.MultiplyOperator; -import org.apache.taglibs.standard.lang.jstl.NamedValue; -import org.apache.taglibs.standard.lang.jstl.NotEqualsOperator; -import org.apache.taglibs.standard.lang.jstl.NotOperator; -import org.apache.taglibs.standard.lang.jstl.NullLiteral; -import org.apache.taglibs.standard.lang.jstl.OrOperator; -import org.apache.taglibs.standard.lang.jstl.PlusOperator; -import org.apache.taglibs.standard.lang.jstl.PropertySuffix; -import org.apache.taglibs.standard.lang.jstl.StringLiteral; -import org.apache.taglibs.standard.lang.jstl.UnaryMinusOperator; -import org.apache.taglibs.standard.lang.jstl.UnaryOperator; -import org.apache.taglibs.standard.lang.jstl.UnaryOperatorExpression; -import org.apache.taglibs.standard.lang.jstl.ValueSuffix; - -/** - * Generated EL parser. - * - * @author Nathan Abramson - * @author Shawn Bayern - */ -public class ELParser implements ELParserConstants { - - public static void main(String args[]) throws ParseException { - ELParser parser = new ELParser(System.in); - parser.ExpressionString(); - } - - /** - * *************************************** - * GRAMMAR PRODUCTIONS * *************************************** - */ - /** - * - * Returns a String if the expression string is a single String, an Expression if the expression string is a single Expression, an ExpressionString if it's - * a mixture of both. - * - */ - final public Object ExpressionString() throws ParseException { - Object ret = ""; - List elems = null; - Object elem; - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NON_EXPRESSION_TEXT: - ret = AttrValueString(); - break; - case START_EXPRESSION: - ret = AttrValueExpression(); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - label_1: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NON_EXPRESSION_TEXT: - case START_EXPRESSION: - break; - default: - jj_la1[1] = jj_gen; - break label_1; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NON_EXPRESSION_TEXT: - elem = AttrValueString(); - break; - case START_EXPRESSION: - elem = AttrValueExpression(); - break; - default: - jj_la1[2] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (elems == null) { - elems = new ArrayList<>(); - elems.add(ret); - } - elems.add(elem); - } - if (elems != null) { - ret = new ExpressionString(elems.toArray()); - } - return ret; - } - - final public String AttrValueString() throws ParseException { - Token t = jj_consume_token(NON_EXPRESSION_TEXT); - return t.image; - } - - final public Expression AttrValueExpression() throws ParseException { - jj_consume_token(START_EXPRESSION); - Expression exp = Expression(); - jj_consume_token(END_EXPRESSION); - return exp; - } - - final public Expression Expression() throws ParseException { - return OrExpression(); - } - - final public Expression OrExpression() throws ParseException { - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; - startExpression = AndExpression(); - label_2: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case OR1: - case OR2: - break; - default: - jj_la1[3] = jj_gen; - break label_2; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case OR1: - jj_consume_token(OR1); - break; - case OR2: - jj_consume_token(OR2); - break; - default: - jj_la1[4] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = OrOperator.SINGLETON; - expression = AndExpression(); - if (operators == null) { - operators = new ArrayList<>(); - expressions = new ArrayList<>(); - } - operators.add(operator); - expressions.add(expression); - } - if (operators != null) { - return new BinaryOperatorExpression(startExpression, operators, expressions); - } else { - return startExpression; - } - } - - final public Expression AndExpression() throws ParseException { - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; - startExpression = EqualityExpression(); - label_3: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AND1: - case AND2: - break; - default: - jj_la1[5] = jj_gen; - break label_3; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AND1: - jj_consume_token(AND1); - break; - case AND2: - jj_consume_token(AND2); - break; - default: - jj_la1[6] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = AndOperator.SINGLETON; - expression = EqualityExpression(); - if (operators == null) { - operators = new ArrayList<>(); - expressions = new ArrayList<>(); - } - operators.add(operator); - expressions.add(expression); - } - if (operators != null) { - return new BinaryOperatorExpression(startExpression, operators, expressions); - } else { - return startExpression; - } - } - - final public Expression EqualityExpression() throws ParseException { - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; - startExpression = RelationalExpression(); - label_4: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQ1: - case EQ2: - case NE1: - case NE2: - break; - default: - jj_la1[7] = jj_gen; - break label_4; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQ1: - case EQ2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQ1: - jj_consume_token(EQ1); - break; - case EQ2: - jj_consume_token(EQ2); - break; - default: - jj_la1[8] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = EqualsOperator.SINGLETON; - break; - case NE1: - case NE2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NE1: - jj_consume_token(NE1); - break; - case NE2: - jj_consume_token(NE2); - break; - default: - jj_la1[9] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = NotEqualsOperator.SINGLETON; - break; - default: - jj_la1[10] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - expression = RelationalExpression(); - if (operators == null) { - operators = new ArrayList<>(); - expressions = new ArrayList<>(); - } - operators.add(operator); - expressions.add(expression); - } - if (operators != null) { - return new BinaryOperatorExpression(startExpression, operators, expressions); - } else { - return startExpression; - } - } - - final public Expression RelationalExpression() throws ParseException { - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; - startExpression = AddExpression(); - label_5: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case GT1: - case GT2: - case LT1: - case LT2: - case LE1: - case LE2: - case GE1: - case GE2: - break; - default: - jj_la1[11] = jj_gen; - break label_5; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT1: - case LT2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT1: - jj_consume_token(LT1); - break; - case LT2: - jj_consume_token(LT2); - break; - default: - jj_la1[12] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = LessThanOperator.SINGLETON; - break; - case GT1: - case GT2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case GT1: - jj_consume_token(GT1); - break; - case GT2: - jj_consume_token(GT2); - break; - default: - jj_la1[13] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = GreaterThanOperator.SINGLETON; - break; - case GE1: - case GE2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case GE1: - jj_consume_token(GE1); - break; - case GE2: - jj_consume_token(GE2); - break; - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = GreaterThanOrEqualsOperator.SINGLETON; - break; - case LE1: - case LE2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LE1: - jj_consume_token(LE1); - break; - case LE2: - jj_consume_token(LE2); - break; - default: - jj_la1[15] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = LessThanOrEqualsOperator.SINGLETON; - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - expression = AddExpression(); - if (operators == null) { - operators = new ArrayList<>(); - expressions = new ArrayList<>(); - } - operators.add(operator); - expressions.add(expression); - } - if (operators != null) { - return new BinaryOperatorExpression(startExpression, operators, expressions); - } else { - return startExpression; - } - } - - final public Expression AddExpression() throws ParseException { - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; - startExpression = MultiplyExpression(); - label_6: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - case MINUS: - break; - default: - jj_la1[17] = jj_gen; - break label_6; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - operator = PlusOperator.SINGLETON; - break; - case MINUS: - jj_consume_token(MINUS); - operator = MinusOperator.SINGLETON; - break; - default: - jj_la1[18] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - expression = MultiplyExpression(); - if (operators == null) { - operators = new ArrayList<>(); - expressions = new ArrayList<>(); - } - operators.add(operator); - expressions.add(expression); - } - if (operators != null) { - return new BinaryOperatorExpression(startExpression, operators, expressions); - } else { - return startExpression; - } - } - - final public Expression MultiplyExpression() throws ParseException { - Expression startExpression; - BinaryOperator operator; - Expression expression; - List operators = null; - List expressions = null; - startExpression = UnaryExpression(); - label_7: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case MULTIPLY: - case DIVIDE1: - case DIVIDE2: - case MODULUS1: - case MODULUS2: - break; - default: - jj_la1[19] = jj_gen; - break label_7; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case MULTIPLY: - jj_consume_token(MULTIPLY); - operator = MultiplyOperator.SINGLETON; - break; - case DIVIDE1: - case DIVIDE2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DIVIDE1: - jj_consume_token(DIVIDE1); - break; - case DIVIDE2: - jj_consume_token(DIVIDE2); - break; - default: - jj_la1[20] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = DivideOperator.SINGLETON; - break; - case MODULUS1: - case MODULUS2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case MODULUS1: - jj_consume_token(MODULUS1); - break; - case MODULUS2: - jj_consume_token(MODULUS2); - break; - default: - jj_la1[21] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = ModulusOperator.SINGLETON; - break; - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - expression = UnaryExpression(); - if (operators == null) { - operators = new ArrayList<>(); - expressions = new ArrayList<>(); - } - operators.add(operator); - expressions.add(expression); - } - if (operators != null) { - return new BinaryOperatorExpression(startExpression, operators, expressions); - } else { - return startExpression; - } - } - - final public Expression UnaryExpression() throws ParseException { - Expression expression; - UnaryOperator singleOperator = null; - UnaryOperator operator; - List operators = null; - label_8: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case MINUS: - case NOT1: - case NOT2: - case EMPTY: - break; - default: - jj_la1[23] = jj_gen; - break label_8; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT1: - case NOT2: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT1: - jj_consume_token(NOT1); - break; - case NOT2: - jj_consume_token(NOT2); - break; - default: - jj_la1[24] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = NotOperator.SINGLETON; - break; - case MINUS: - jj_consume_token(MINUS); - operator = UnaryMinusOperator.SINGLETON; - break; - case EMPTY: - jj_consume_token(EMPTY); - operator = EmptyOperator.SINGLETON; - break; - default: - jj_la1[25] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (singleOperator == null) { - singleOperator = operator; - } else if (operators == null) { - operators = new ArrayList<>(); - operators.add(singleOperator); - operators.add(operator); - } else { - operators.add(operator); - } - } - expression = Value(); - if (operators != null) { - return new UnaryOperatorExpression(null, operators, expression); - } else if (singleOperator != null) { - return new UnaryOperatorExpression(singleOperator, null, expression); - } else { - return expression; - } - } - - final public Expression Value() throws ParseException { - Expression prefix; - ValueSuffix suffix; - List suffixes = null; - prefix = ValuePrefix(); - label_9: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT: - case LBRACKET: - break; - default: - jj_la1[26] = jj_gen; - break label_9; - } - suffix = ValueSuffix(); - if (suffixes == null) { - suffixes = new ArrayList<>(); - } - suffixes.add(suffix); - } - if (suffixes == null) { - return prefix; - } else { - return new ComplexValue(prefix, suffixes); - } - } - - /** - * This is an element that can start a value - * - */ - final public Expression ValuePrefix() throws ParseException { - Expression ret; - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case STRING_LITERAL: - case TRUE: - case FALSE: - case NULL: - ret = Literal(); - break; - case LPAREN: - jj_consume_token(LPAREN); - ret = Expression(); - jj_consume_token(RPAREN); - break; - default: - jj_la1[27] = jj_gen; - if (jj_2_1(2147483647)) { - ret = FunctionInvocation(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - ret = NamedValue(); - break; - default: - jj_la1[28] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - return ret; - } - - final public NamedValue NamedValue() throws ParseException { - Token t = jj_consume_token(IDENTIFIER); - return new NamedValue(t.image); - } - - final public FunctionInvocation FunctionInvocation() throws ParseException { - String qualifiedName; - List argumentList = new ArrayList<>(); - Expression exp; - qualifiedName = QualifiedName(); - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case STRING_LITERAL: - case TRUE: - case FALSE: - case NULL: - case LPAREN: - case MINUS: - case NOT1: - case NOT2: - case EMPTY: - case IDENTIFIER: - exp = Expression(); - argumentList.add(exp); - label_10: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - break; - default: - jj_la1[29] = jj_gen; - break label_10; - } - jj_consume_token(COMMA); - exp = Expression(); - argumentList.add(exp); - } - break; - default: - jj_la1[30] = jj_gen; - break; - } - jj_consume_token(RPAREN); - String allowed = System.getProperty(ELParserConstants.SYSTEM_PROPERTY_ALLOW_FUNCTIONS); - if (allowed == null || !allowed.equalsIgnoreCase("true")) { - throw new ParseException("EL functions are not supported."); - } - return new FunctionInvocation(qualifiedName, argumentList); - } - - final public ValueSuffix ValueSuffix() throws ParseException { - ValueSuffix suffix; - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT: - suffix = PropertySuffix(); - break; - case LBRACKET: - suffix = ArraySuffix(); - break; - default: - jj_la1[31] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - return suffix; - } - - final public PropertySuffix PropertySuffix() throws ParseException { - jj_consume_token(DOT); - String property = Identifier(); - return new PropertySuffix(property); - } - - final public ArraySuffix ArraySuffix() throws ParseException { - jj_consume_token(LBRACKET); - Expression index = Expression(); - jj_consume_token(RBRACKET); - return new ArraySuffix(index); - } - - final public Literal Literal() throws ParseException { - Literal ret; - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case TRUE: - case FALSE: - ret = BooleanLiteral(); - break; - case INTEGER_LITERAL: - ret = IntegerLiteral(); - break; - case FLOATING_POINT_LITERAL: - ret = FloatingPointLiteral(); - break; - case STRING_LITERAL: - ret = StringLiteral(); - break; - case NULL: - ret = NullLiteral(); - break; - default: - jj_la1[32] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - return ret; - } - - final public BooleanLiteral BooleanLiteral() throws ParseException { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case TRUE: - jj_consume_token(TRUE); - return BooleanLiteral.TRUE; - case FALSE: - jj_consume_token(FALSE); - return BooleanLiteral.FALSE; - default: - jj_la1[33] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - - final public StringLiteral StringLiteral() throws ParseException { - Token t = jj_consume_token(STRING_LITERAL); - return StringLiteral.fromToken(t.image); - } - - final public IntegerLiteral IntegerLiteral() throws ParseException { - Token t = jj_consume_token(INTEGER_LITERAL); - return new IntegerLiteral(t.image); - } - - final public FloatingPointLiteral FloatingPointLiteral() throws ParseException { - Token t = jj_consume_token(FLOATING_POINT_LITERAL); - return new FloatingPointLiteral(t.image); - } - - final public NullLiteral NullLiteral() throws ParseException { - jj_consume_token(NULL); - return NullLiteral.SINGLETON; - } - - final public String Identifier() throws ParseException { - Token t = jj_consume_token(IDENTIFIER); - return t.image; - } - - final public String QualifiedName() throws ParseException { - String prefix = null, localPart = null; - if (jj_2_2(2147483647)) { - prefix = Identifier(); - jj_consume_token(COLON); - } - - localPart = Identifier(); - if (prefix == null) { - return localPart; - } else { - return prefix + ":" + localPart; - } - } - - private boolean jj_2_1(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - boolean retval = !jj_3_1(); - jj_save(0, xla); - return retval; - } - - private boolean jj_2_2(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - boolean retval = !jj_3_2(); - jj_save(1, xla); - return retval; - } - - private boolean jj_3R_13() { - if (jj_3R_12()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(COLON)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3_2() { - if (jj_3R_12()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(COLON)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3_1() { - if (jj_3R_11()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_scan_token(LPAREN)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_12() { - if (jj_scan_token(IDENTIFIER)) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - private boolean jj_3R_11() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_13()) { - jj_scanpos = xsp; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - if (jj_3R_12()) { - return true; - } - if (jj_la == 0 && jj_scanpos == jj_lastpos) { - return false; - } - return false; - } - - public ELParserTokenManager token_source; - SimpleCharStream jj_input_stream; - public Token token, jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - public boolean lookingAhead = false; - private int jj_gen; - final private int[] jj_la1 = new int[34]; - final private int[] jj_la1_0 = {0x6, 0x6, 0x6, 0x0, 0x0, 0x0, 0x0, 0x18600000, 0x600000, 0x18000000, 0x18600000, 0x79e0000, 0x180000, 0x60000, 0x6000000, 0x1800000, 0x79e0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x20007580, 0x0, 0x80000000, 0x20007580, 0x10000, 0x7580, 0x3000,}; - final private int[] jj_la1_1 = {0x0, 0x0, 0x0, 0xc000, 0xc000, 0x3000, 0x3000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x3e0, 0xc0, 0x300, 0x3e0, 0x10c10, 0xc00, 0x10c10, 0x2, 0x0, 0x20000, 0x0, 0x30c10, 0x2, 0x0, 0x0,}; - final private JJCalls[] jj_2_rtns = new JJCalls[2]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - public ELParser(java.io.InputStream stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ELParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public void ReInit(java.io.InputStream stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public ELParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ELParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public ELParser(ELParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - public void ReInit(ELParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 34; i++) { - jj_la1[i] = -1; - } - for (int i = 0; i < jj_2_rtns.length; i++) { - jj_2_rtns[i] = new JJCalls(); - } - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) { - token = token.next; - } else { - token = token.next = token_source.getNextToken(); - } - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (JJCalls c : jj_2_rtns) { - while (c != null) { - if (c.gen < jj_gen) { - c.first = null; - } - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; - Token tok = token; - while (tok != null && tok != jj_scanpos) { - i++; - tok = tok.next; - } - if (tok != null) { - jj_add_error_token(kind, i); - } - } - return (jj_scanpos.kind != kind); - } - - final public Token getNextToken() { - if (token.next != null) { - token = token.next; - } else { - token = token.next = token_source.getNextToken(); - } - jj_ntk = -1; - jj_gen++; - return token; - } - - final public Token getToken(int index) { - Token t = lookingAhead ? jj_scanpos : token; - for (int i = 0; i < index; i++) { - if (t.next != null) { - t = t.next; - } else { - t = t.next = token_source.getNextToken(); - } - } - return t; - } - - private int jj_ntk() { - if ((jj_nt = token.next) == null) { - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - } else { - return (jj_ntk = jj_nt.kind); - } - } - - private final Vector jj_expentries = new Vector<>(); - private int[] jj_expentry; - private int jj_kind = -1; - private final int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - System.arraycopy(jj_lasttokens, 0, jj_expentry, 0, jj_endpos); - boolean exists = false; - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - exists = true; - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - exists = false; - break; - } - } - if (exists) { - break; - } - } - } - if (!exists) { - jj_expentries.addElement(jj_expentry); - } - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - } - - final public ParseException generateParseException() { - jj_expentries.removeAllElements(); - boolean[] la1tokens = new boolean[54]; - for (int i = 0; i < 54; i++) { - la1tokens[i] = false; - } - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 34; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1 << j)) != 0) { - la1tokens[j] = true; - } - if ((jj_la1_1[i] & (1 << j)) != 0) { - la1tokens[32 + j] = true; - } - } - } - } - for (int i = 0; i < 54; i++) { - if (la1tokens[i]) { - jj_expentry = new int[1]; - jj_expentry[0] = i; - jj_expentries.addElement(jj_expentry); - } - } - jj_endpos = 0; - jj_rescan_token(); - jj_add_error_token(0, 0); - int[][] exptokseq = new int[jj_expentries.size()][]; - for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.elementAt(i); - } - return new ParseException(token, exptokseq, tokenImage); - } - - final public void enable_tracing() { - } - - final public void disable_tracing() { - } - - private void jj_rescan_token() { - jj_rescan = true; - for (int i = 0; i < 2; i++) { - JJCalls p = jj_2_rtns[i]; - do { - if (p.gen > jj_gen) { - jj_la = p.arg; - jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: - jj_3_1(); - break; - case 1: - jj_3_2(); - break; - } - } - p = p.next; - } while (p != null); - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { - p = p.next = new JJCalls(); - break; - } - p = p.next; - } - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; - } - - static final class JJCalls { - - int gen; - Token first; - int arg; - JJCalls next; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserConstants.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserConstants.java deleted file mode 100644 index 0e9aeaf..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserConstants.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -public interface ELParserConstants { - String SYSTEM_PROPERTY_ALLOW_FUNCTIONS = "jakarta.servlet.jsp.functions.allowed"; - - - int EOF = 0; - int NON_EXPRESSION_TEXT = 1; - int START_EXPRESSION = 2; - int INTEGER_LITERAL = 7; - int FLOATING_POINT_LITERAL = 8; - int EXPONENT = 9; - int STRING_LITERAL = 10; - int BADLY_ESCAPED_STRING_LITERAL = 11; - int TRUE = 12; - int FALSE = 13; - int NULL = 14; - int END_EXPRESSION = 15; - int DOT = 16; - int GT1 = 17; - int GT2 = 18; - int LT1 = 19; - int LT2 = 20; - int EQ1 = 21; - int EQ2 = 22; - int LE1 = 23; - int LE2 = 24; - int GE1 = 25; - int GE2 = 26; - int NE1 = 27; - int NE2 = 28; - int LPAREN = 29; - int RPAREN = 30; - int COMMA = 31; - int COLON = 32; - int LBRACKET = 33; - int RBRACKET = 34; - int PLUS = 35; - int MINUS = 36; - int MULTIPLY = 37; - int DIVIDE1 = 38; - int DIVIDE2 = 39; - int MODULUS1 = 40; - int MODULUS2 = 41; - int NOT1 = 42; - int NOT2 = 43; - int AND1 = 44; - int AND2 = 45; - int OR1 = 46; - int OR2 = 47; - int EMPTY = 48; - int IDENTIFIER = 49; - int IMPL_OBJ_START = 50; - int LETTER = 51; - int DIGIT = 52; - int ILLEGAL_CHARACTER = 53; - - int DEFAULT = 0; - int IN_EXPRESSION = 1; - - String[] tokenImage = { - "", - "", - "\"${\"", - "\" \"", - "\"\\t\"", - "\"\\n\"", - "\"\\r\"", - "", - "", - "", - "", - "", - "\"true\"", - "\"false\"", - "\"null\"", - "\"}\"", - "\".\"", - "\">\"", - "\"gt\"", - "\"<\"", - "\"lt\"", - "\"==\"", - "\"eq\"", - "\"<=\"", - "\"le\"", - "\">=\"", - "\"ge\"", - "\"!=\"", - "\"ne\"", - "\"(\"", - "\")\"", - "\",\"", - "\":\"", - "\"[\"", - "\"]\"", - "\"+\"", - "\"-\"", - "\"*\"", - "\"/\"", - "\"div\"", - "\"%\"", - "\"mod\"", - "\"not\"", - "\"!\"", - "\"and\"", - "\"&&\"", - "\"or\"", - "\"||\"", - "\"empty\"", - "", - "\"#\"", - "", - "", - "", - }; - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserTokenManager.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserTokenManager.java deleted file mode 100644 index afbb8fa..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ELParserTokenManager.java +++ /dev/null @@ -1,1057 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -public class ELParserTokenManager implements ELParserConstants -{ - public java.io.PrintStream debugStream = System.out; - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private final int jjStopStringLiteralDfa_0(int pos, long active0) -{ - switch (pos) - { - case 0: - if ((active0 & 0x4L) != 0L) - { - jjmatchedKind = 1; - return 2; - } - return -1; - default : - return -1; - } -} -private final int jjStartNfa_0(int pos, long active0) -{ - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); -} -private final int jjStopAtPos(int pos, int kind) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; -} -private final int jjStartNfaWithStates_0(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_0(state, pos + 1); -} -private final int jjMoveStringLiteralDfa0_0() -{ - switch(curChar) - { - case 36: - return jjMoveStringLiteralDfa1_0(0x4L); - default : - return jjMoveNfa_0(1, 0); - } -} -private final int jjMoveStringLiteralDfa1_0(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0); - return 1; - } - switch(curChar) - { - case 123: - if ((active0 & 0x4L) != 0L) - return jjStopAtPos(1, 2); - break; - default : - break; - } - return jjStartNfa_0(0, active0); -} -private final void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private final void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private final void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} -private final void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} -private final void jjCheckNAddStates(int start) -{ - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); -} -static final long[] jjbitVec0 = { - 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec2 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -private final int jjMoveNfa_0(int startState, int curPos) -{ - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 3; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 1: - if ((0xffffffefffffffffL & l) != 0L) - { - if (kind > 1) - kind = 1; - jjCheckNAdd(0); - } - else if (curChar == 36) - { - if (kind > 1) - kind = 1; - jjCheckNAdd(2); - } - break; - case 0: - if ((0xffffffefffffffffL & l) == 0L) - break; - if (kind > 1) - kind = 1; - jjCheckNAdd(0); - break; - case 2: - if ((0xffffffefffffffffL & l) == 0L) - break; - if (kind > 1) - kind = 1; - jjCheckNAdd(2); - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 1: - case 0: - if (kind > 1) - kind = 1; - jjCheckNAdd(0); - break; - case 2: - if ((0xf7ffffffffffffffL & l) == 0L) - break; - if (kind > 1) - kind = 1; - jjstateSet[jjnewStateCnt++] = 2; - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (int)(curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 1: - case 0: - if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) - break; - if (kind > 1) - kind = 1; - jjCheckNAdd(0); - break; - case 2: - if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) - break; - if (kind > 1) - kind = 1; - jjstateSet[jjnewStateCnt++] = 2; - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private final int jjStopStringLiteralDfa_1(int pos, long active0) -{ - switch (pos) - { - case 0: - if ((active0 & 0x1568015547000L) != 0L) - { - jjmatchedKind = 49; - return 6; - } - if ((active0 & 0x10000L) != 0L) - return 1; - return -1; - case 1: - if ((active0 & 0x400015540000L) != 0L) - return 6; - if ((active0 & 0x1168000007000L) != 0L) - { - jjmatchedKind = 49; - jjmatchedPos = 1; - return 6; - } - return -1; - case 2: - if ((active0 & 0x168000000000L) != 0L) - return 6; - if ((active0 & 0x1000000007000L) != 0L) - { - jjmatchedKind = 49; - jjmatchedPos = 2; - return 6; - } - return -1; - case 3: - if ((active0 & 0x5000L) != 0L) - return 6; - if ((active0 & 0x1000000002000L) != 0L) - { - jjmatchedKind = 49; - jjmatchedPos = 3; - return 6; - } - return -1; - default : - return -1; - } -} -private final int jjStartNfa_1(int pos, long active0) -{ - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); -} -private final int jjStartNfaWithStates_1(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_1(state, pos + 1); -} -private final int jjMoveStringLiteralDfa0_1() -{ - switch(curChar) - { - case 33: - jjmatchedKind = 43; - return jjMoveStringLiteralDfa1_1(0x8000000L); - case 37: - return jjStopAtPos(0, 40); - case 38: - return jjMoveStringLiteralDfa1_1(0x200000000000L); - case 40: - return jjStopAtPos(0, 29); - case 41: - return jjStopAtPos(0, 30); - case 42: - return jjStopAtPos(0, 37); - case 43: - return jjStopAtPos(0, 35); - case 44: - return jjStopAtPos(0, 31); - case 45: - return jjStopAtPos(0, 36); - case 46: - return jjStartNfaWithStates_1(0, 16, 1); - case 47: - return jjStopAtPos(0, 38); - case 58: - return jjStopAtPos(0, 32); - case 60: - jjmatchedKind = 19; - return jjMoveStringLiteralDfa1_1(0x800000L); - case 61: - return jjMoveStringLiteralDfa1_1(0x200000L); - case 62: - jjmatchedKind = 17; - return jjMoveStringLiteralDfa1_1(0x2000000L); - case 91: - return jjStopAtPos(0, 33); - case 93: - return jjStopAtPos(0, 34); - case 97: - return jjMoveStringLiteralDfa1_1(0x100000000000L); - case 100: - return jjMoveStringLiteralDfa1_1(0x8000000000L); - case 101: - return jjMoveStringLiteralDfa1_1(0x1000000400000L); - case 102: - return jjMoveStringLiteralDfa1_1(0x2000L); - case 103: - return jjMoveStringLiteralDfa1_1(0x4040000L); - case 108: - return jjMoveStringLiteralDfa1_1(0x1100000L); - case 109: - return jjMoveStringLiteralDfa1_1(0x20000000000L); - case 110: - return jjMoveStringLiteralDfa1_1(0x40010004000L); - case 111: - return jjMoveStringLiteralDfa1_1(0x400000000000L); - case 116: - return jjMoveStringLiteralDfa1_1(0x1000L); - case 124: - return jjMoveStringLiteralDfa1_1(0x800000000000L); - case 125: - return jjStopAtPos(0, 15); - default : - return jjMoveNfa_1(0, 0); - } -} -private final int jjMoveStringLiteralDfa1_1(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(0, active0); - return 1; - } - switch(curChar) - { - case 38: - if ((active0 & 0x200000000000L) != 0L) - return jjStopAtPos(1, 45); - break; - case 61: - if ((active0 & 0x200000L) != 0L) - return jjStopAtPos(1, 21); - else if ((active0 & 0x800000L) != 0L) - return jjStopAtPos(1, 23); - else if ((active0 & 0x2000000L) != 0L) - return jjStopAtPos(1, 25); - else if ((active0 & 0x8000000L) != 0L) - return jjStopAtPos(1, 27); - break; - case 97: - return jjMoveStringLiteralDfa2_1(active0, 0x2000L); - case 101: - if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_1(1, 24, 6); - else if ((active0 & 0x4000000L) != 0L) - return jjStartNfaWithStates_1(1, 26, 6); - else if ((active0 & 0x10000000L) != 0L) - return jjStartNfaWithStates_1(1, 28, 6); - break; - case 105: - return jjMoveStringLiteralDfa2_1(active0, 0x8000000000L); - case 109: - return jjMoveStringLiteralDfa2_1(active0, 0x1000000000000L); - case 110: - return jjMoveStringLiteralDfa2_1(active0, 0x100000000000L); - case 111: - return jjMoveStringLiteralDfa2_1(active0, 0x60000000000L); - case 113: - if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_1(1, 22, 6); - break; - case 114: - if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_1(1, 46, 6); - return jjMoveStringLiteralDfa2_1(active0, 0x1000L); - case 116: - if ((active0 & 0x40000L) != 0L) - return jjStartNfaWithStates_1(1, 18, 6); - else if ((active0 & 0x100000L) != 0L) - return jjStartNfaWithStates_1(1, 20, 6); - break; - case 117: - return jjMoveStringLiteralDfa2_1(active0, 0x4000L); - case 124: - if ((active0 & 0x800000000000L) != 0L) - return jjStopAtPos(1, 47); - break; - default : - break; - } - return jjStartNfa_1(0, active0); -} -private final int jjMoveStringLiteralDfa2_1(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(0, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(1, active0); - return 2; - } - switch(curChar) - { - case 100: - if ((active0 & 0x20000000000L) != 0L) - return jjStartNfaWithStates_1(2, 41, 6); - else if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_1(2, 44, 6); - break; - case 108: - return jjMoveStringLiteralDfa3_1(active0, 0x6000L); - case 112: - return jjMoveStringLiteralDfa3_1(active0, 0x1000000000000L); - case 116: - if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_1(2, 42, 6); - break; - case 117: - return jjMoveStringLiteralDfa3_1(active0, 0x1000L); - case 118: - if ((active0 & 0x8000000000L) != 0L) - return jjStartNfaWithStates_1(2, 39, 6); - break; - default : - break; - } - return jjStartNfa_1(1, active0); -} -private final int jjMoveStringLiteralDfa3_1(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(1, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(2, active0); - return 3; - } - switch(curChar) - { - case 101: - if ((active0 & 0x1000L) != 0L) - return jjStartNfaWithStates_1(3, 12, 6); - break; - case 108: - if ((active0 & 0x4000L) != 0L) - return jjStartNfaWithStates_1(3, 14, 6); - break; - case 115: - return jjMoveStringLiteralDfa4_1(active0, 0x2000L); - case 116: - return jjMoveStringLiteralDfa4_1(active0, 0x1000000000000L); - default : - break; - } - return jjStartNfa_1(2, active0); -} -private final int jjMoveStringLiteralDfa4_1(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(2, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(3, active0); - return 4; - } - switch(curChar) - { - case 101: - if ((active0 & 0x2000L) != 0L) - return jjStartNfaWithStates_1(4, 13, 6); - break; - case 121: - if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_1(4, 48, 6); - break; - default : - break; - } - return jjStartNfa_1(3, active0); -} -static final long[] jjbitVec3 = { - 0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L -}; -static final long[] jjbitVec4 = { - 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL -}; -static final long[] jjbitVec5 = { - 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec6 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L -}; -static final long[] jjbitVec7 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L -}; -static final long[] jjbitVec8 = { - 0x3fffffffffffL, 0x0L, 0x0L, 0x0L -}; -private final int jjMoveNfa_1(int startState, int curPos) -{ - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 35; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 7) - kind = 7; - jjCheckNAddStates(0, 4); - } - else if ((0x1800000000L & l) != 0L) - { - if (kind > 49) - kind = 49; - jjCheckNAdd(6); - } - else if (curChar == 39) - jjCheckNAddStates(5, 9); - else if (curChar == 34) - jjCheckNAddStates(10, 14); - else if (curChar == 46) - jjCheckNAdd(1); - break; - case 1: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 8) - kind = 8; - jjCheckNAddTwoStates(1, 2); - break; - case 3: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(4); - break; - case 4: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 8) - kind = 8; - jjCheckNAdd(4); - break; - case 5: - if ((0x1800000000L & l) == 0L) - break; - if (kind > 49) - kind = 49; - jjCheckNAdd(6); - break; - case 6: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 49) - kind = 49; - jjCheckNAdd(6); - break; - case 7: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddStates(0, 4); - break; - case 8: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(8); - break; - case 9: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(9, 10); - break; - case 10: - if (curChar != 46) - break; - if (kind > 8) - kind = 8; - jjCheckNAddTwoStates(11, 12); - break; - case 11: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 8) - kind = 8; - jjCheckNAddTwoStates(11, 12); - break; - case 13: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(14); - break; - case 14: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 8) - kind = 8; - jjCheckNAdd(14); - break; - case 15: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(15, 16); - break; - case 17: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(18); - break; - case 18: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 8) - kind = 8; - jjCheckNAdd(18); - break; - case 19: - if (curChar == 34) - jjCheckNAddStates(10, 14); - break; - case 20: - if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddStates(15, 17); - break; - case 22: - if (curChar == 34) - jjCheckNAddStates(15, 17); - break; - case 23: - if (curChar == 34 && kind > 10) - kind = 10; - break; - case 24: - if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddTwoStates(24, 25); - break; - case 26: - if ((0xfffffffbffffffffL & l) != 0L && kind > 11) - kind = 11; - break; - case 27: - if (curChar == 39) - jjCheckNAddStates(5, 9); - break; - case 28: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(18, 20); - break; - case 30: - if (curChar == 39) - jjCheckNAddStates(18, 20); - break; - case 31: - if (curChar == 39 && kind > 10) - kind = 10; - break; - case 32: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddTwoStates(32, 33); - break; - case 34: - if ((0xffffff7fffffffffL & l) != 0L && kind > 11) - kind = 11; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - case 6: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 49) - kind = 49; - jjCheckNAdd(6); - break; - case 2: - if ((0x2000000020L & l) != 0L) - jjAddStates(21, 22); - break; - case 12: - if ((0x2000000020L & l) != 0L) - jjAddStates(23, 24); - break; - case 16: - if ((0x2000000020L & l) != 0L) - jjAddStates(25, 26); - break; - case 20: - if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(15, 17); - break; - case 21: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 22; - break; - case 22: - if (curChar == 92) - jjCheckNAddStates(15, 17); - break; - case 24: - if ((0xffffffffefffffffL & l) != 0L) - jjAddStates(27, 28); - break; - case 25: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 26: - case 34: - if ((0xffffffffefffffffL & l) != 0L && kind > 11) - kind = 11; - break; - case 28: - if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(18, 20); - break; - case 29: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 30; - break; - case 30: - if (curChar == 92) - jjCheckNAddStates(18, 20); - break; - case 32: - if ((0xffffffffefffffffL & l) != 0L) - jjAddStates(29, 30); - break; - case 33: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 34; - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (int)(curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - case 6: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) - break; - if (kind > 49) - kind = 49; - jjCheckNAdd(6); - break; - case 20: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(15, 17); - break; - case 24: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(27, 28); - break; - case 26: - case 34: - if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 11) - kind = 11; - break; - case 28: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(18, 20); - break; - case 32: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(29, 30); - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 35 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -static final int[] jjnextStates = { - 8, 9, 10, 15, 16, 28, 29, 31, 32, 33, 20, 21, 23, 24, 25, 20, - 21, 23, 28, 29, 31, 3, 4, 13, 14, 17, 18, 24, 25, 32, 33, -}; -private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec2[i2] & l2) != 0L); - default : - if ((jjbitVec0[i1] & l1) != 0L) - return true; - return false; - } -} -private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec4[i2] & l2) != 0L); - case 48: - return ((jjbitVec5[i2] & l2) != 0L); - case 49: - return ((jjbitVec6[i2] & l2) != 0L); - case 51: - return ((jjbitVec7[i2] & l2) != 0L); - case 61: - return ((jjbitVec8[i2] & l2) != 0L); - default : - if ((jjbitVec3[i1] & l1) != 0L) - return true; - return false; - } -} -public static final String[] jjstrLiteralImages = { -"", null, "\44\173", null, null, null, null, null, null, null, null, null, -"\164\162\165\145", "\146\141\154\163\145", "\156\165\154\154", "\175", "\56", "\76", "\147\164", -"\74", "\154\164", "\75\75", "\145\161", "\74\75", "\154\145", "\76\75", "\147\145", -"\41\75", "\156\145", "\50", "\51", "\54", "\72", "\133", "\135", "\53", "\55", "\52", -"\57", "\144\151\166", "\45", "\155\157\144", "\156\157\164", "\41", "\141\156\144", -"\46\46", "\157\162", "\174\174", "\145\155\160\164\171", null, null, null, null, null, }; -public static final String[] lexStateNames = { - "DEFAULT", - "IN_EXPRESSION", -}; -public static final int[] jjnewLexState = { - -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -}; -static final long[] jjtoToken = { - 0x23fffffffffd87L, -}; -static final long[] jjtoSkip = { - 0x78L, -}; -private SimpleCharStream input_stream; -private final int[] jjrounds = new int[35]; -private final int[] jjstateSet = new int[70]; -protected char curChar; -public ELParserTokenManager(SimpleCharStream stream) -{ - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} -public ELParserTokenManager(SimpleCharStream stream, int lexState) -{ - this(stream); - SwitchTo(lexState); -} -public void ReInit(SimpleCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private final void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 35; i-- > 0;) - jjrounds[i] = 0x80000000; -} -public void ReInit(SimpleCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} -public void SwitchTo(int lexState) -{ - if (lexState >= 2 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - -private final Token jjFillToken() -{ - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; -} - -int curLexState = 0; -int defaultLexState = 0; -int jjnewStateCnt; -int jjround; -int jjmatchedPos; -int jjmatchedKind; - -public final Token getNextToken() -{ - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop : - for (;;) - { - try - { - curChar = input_stream.BeginToken(); - } - catch(java.io.IOException e) - { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - switch(curLexState) - { - case 0: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - try { input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { continue EOFLoop; } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - if (jjmatchedPos == 0 && jjmatchedKind > 53) - { - jjmatchedKind = 53; - } - break; - } - if (jjmatchedKind != 0x7fffffff) - { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } - else - { - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { input_stream.readChar(); input_stream.backup(1); } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } -} - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ParseException.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ParseException.java deleted file mode 100644 index 1cfb0fe..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/ParseException.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends Exception { - - /** - * This constructor is used by the method "generateParseException" - * in the generated parser. Calling this constructor generates - * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: - */ - public ParseException(Token currentTokenVal, - int[][] expectedTokenSequencesVal, - String[] tokenImageVal - ) - { - super(""); - specialConstructor = true; - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - specialConstructor = false; - } - - public ParseException(String message) { - super(message); - specialConstructor = false; - } - - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this object has been created - * due to a parse error, and you do not catch it (it gets thrown - * from the parser), then this method is called during the printing - * of the final stack trace, and hence the correct error message - * gets displayed. - */ - public String getMessage() { - if (!specialConstructor) { - return super.getMessage(); - } - String expected = ""; - int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected += tokenImage[expectedTokenSequences[i][j]] + " "; - } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected += "..."; - } - expected += eol + " "; - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += add_escapes(tok.image); - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - retval += expected; - return retval; - } - - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - */ - protected String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java deleted file mode 100644 index 6b81696..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (without unicode processing). - */ - -public final class SimpleCharStream -{ - public static final boolean staticFlag = false; - int bufsize; - int available; - int tokenBegin; - public int bufpos = -1; - private int bufline[]; - private int bufcolumn[]; - - private int column = 0; - private int line = 1; - - private boolean prevCharIsCR = false; - private boolean prevCharIsLF = false; - - private java.io.Reader inputStream; - - private char[] buffer; - private int maxNextCharInd = 0; - private int inBuf = 0; - - private final void ExpandBuff(boolean wrapAround) - { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos += (bufsize - tokenBegin)); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos -= tokenBegin); - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - - bufsize += 2048; - available = bufsize; - tokenBegin = 0; - } - - private final void FillBuff() throws java.io.IOException - { - if (maxNextCharInd == available) - { - if (available == bufsize) - { - if (tokenBegin > 2048) - { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } - else if (tokenBegin < 0) - bufpos = maxNextCharInd = 0; - else - ExpandBuff(false); - } - else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - int i; - try { - if ((i = inputStream.read(buffer, maxNextCharInd, - available - maxNextCharInd)) == -1) - { - inputStream.close(); - throw new java.io.IOException(); - } - else - maxNextCharInd += i; - return; - } - catch(java.io.IOException e) { - --bufpos; - backup(0); - if (tokenBegin == -1) - tokenBegin = bufpos; - throw e; - } - } - - public final char BeginToken() throws java.io.IOException - { - tokenBegin = -1; - char c = readChar(); - tokenBegin = bufpos; - - return c; - } - - private final void UpdateLineColumn(char c) - { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (8 - (column & 07)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public final char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - if (++bufpos >= maxNextCharInd) - FillBuff(); - - char c = buffer[bufpos]; - - UpdateLineColumn(c); - return (c); - } - - /** - * @deprecated - * @see #getEndColumn - */ - - public final int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @deprecated - * @see #getEndLine - */ - - public final int getLine() { - return bufline[bufpos]; - } - - public final int getEndColumn() { - return bufcolumn[bufpos]; - } - - public final int getEndLine() { - return bufline[bufpos]; - } - - public final int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public final int getBeginLine() { - return bufline[tokenBegin]; - } - - public final void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.Reader dstream) - { - this(dstream, 1, 1, 4096); - } - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.Reader dstream) - { - ReInit(dstream, 1, 1, 4096); - } - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream) - { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream) - { - ReInit(dstream, 1, 1, 4096); - } - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - public final String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public final char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() - { - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token.
- */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0, columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java deleted file mode 100644 index 276031b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -/** - * Describes the input token stream. - */ - -public class Token { - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * Returns the image. - */ - public final String toString() - { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : - * - * case MyParserConstants.ID : return new IDToken(); - * - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. - */ - public static final Token newToken(int ofKind) - { - switch(ofKind) - { - default : return new Token(); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java b/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java deleted file mode 100644 index 75b1655..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.parser; - -public class TokenMgrError extends Error -{ - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** - * Lexical error occured. - */ - static final int LEXICAL_ERROR = 0; - - /** - * An attempt wass made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; - - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; - - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - */ - protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - - /** - * Returns a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - * Parameters : - * EOFSeen : indicates if EOF caused the lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured - * curchar : the offending character - * Note: You can customize the lexical error message by modifying this method. - */ - private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * - * "Internal Error : Please file a bug report .... " - * - * from this method for such cases in the release version of your parser. - */ - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java b/impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java deleted file mode 100644 index 3927fdb..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.support; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.Tag; - -/** - *

The interface for an expression-language validator and evaluator. - * Classes that implement an expression language expose their functionality - * via this interface.

- * - *

The validate() and evaluate() methods must be thread-safe. That is, - * multiple threads may call these methods on the same ExpressionEvaluator - * object simultaneously. Implementations should synchronize access if - * they depend on transient state. Implementations should not, however, - * assume that only one object of each ExpressionEvaluator type will be - * instantiated; global caching should therefore be static. No release() - * mechanism or robust lifecycle is specified, for language-interpreter - * pluggability is experimental in EA2.

- * - *

WARNING: This class supports experimentation for the EA2 - * release of JSTL; it is not expected to be part of the final RI or - * specification.

- * - * @author Shawn Bayern (based exactly on rev1 draft) - */ -public interface ExpressionEvaluator { - - /** - * Translation time validation of an expression. - * This method will return a null String if the expression - * is valid; otherwise an error message. - */ - public String validate(String attributeName, - String expression); - - /** - * Evaluates the expression at request time. - */ - public Object evaluate(String attributeName, - String expression, - Class expectedType, - Tag tag, - PageContext pageContext) - throws JspException; -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java b/impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java deleted file mode 100644 index d974258..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.support; - -import java.util.HashMap; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.lang.jstl.Coercions; -import org.apache.taglibs.standard.lang.jstl.ELException; -import org.apache.taglibs.standard.lang.jstl.Logger; - -/** - *

A conduit to the JSTL EL. Based on...

- * - *

An implementation of the ExpressionEvaluatorManager called for by - * the JSTL rev1 draft. This class is responsible for delegating a - * request for expression evaluating to the particular, "active" - * ExpressionEvaluator for the given point in the PageContext object - * passed in.

- * - * @author Shawn Bayern - */ -public class ExpressionEvaluatorManager { - - //********************************************************************* - // Constants - - public static final String EVALUATOR_CLASS = - "org.apache.taglibs.standard.lang.jstl.Evaluator"; - // private static final String EVALUATOR_PARAMETER = - // "jakarta.servlet.jsp.jstl.temp.ExpressionEvaluatorClass"; - - //********************************************************************* - // Internal, static state - - private static final HashMap nameMap = new HashMap<>(); - private static final Logger logger = new Logger(System.out); - - //********************************************************************* - // Public static methods - - /** - * Invokes the evaluate() method on the "active" ExpressionEvaluator - * for the given pageContext. - */ - public static Object evaluate(String attributeName, - String expression, - Class expectedType, - Tag tag, - PageContext pageContext) - throws JspException - { - - // the evaluator we'll use - ExpressionEvaluator target = getEvaluatorByName(EVALUATOR_CLASS); - - // delegate the call - return (target.evaluate( - attributeName, expression, expectedType, tag, pageContext)); - } - - /** - * Invokes the evaluate() method on the "active" ExpressionEvaluator - * for the given pageContext. - */ - public static Object evaluate(String attributeName, - String expression, - Class expectedType, - PageContext pageContext) - throws JspException - { - - // the evaluator we'll use - ExpressionEvaluator target = getEvaluatorByName(EVALUATOR_CLASS); - - // delegate the call - return (target.evaluate( - attributeName, expression, expectedType, null, pageContext)); - } - - /** - * Gets an ExpressionEvaluator from the cache, or seeds the cache - * if we haven't seen a particular ExpressionEvaluator before. - */ - public static - ExpressionEvaluator getEvaluatorByName(String name) - throws JspException { - - Object oEvaluator = nameMap.get(name); - if (oEvaluator != null) { - return ((ExpressionEvaluator) oEvaluator); - } - try { - synchronized (nameMap) { - oEvaluator = nameMap.get(name); - if (oEvaluator != null) { - return ((ExpressionEvaluator) oEvaluator); - } - ExpressionEvaluator e = (ExpressionEvaluator) - Class.forName(name).newInstance(); - nameMap.put(name, e); - return (e); - } - } catch (ClassCastException ex) { - // just to display a better error message - throw new JspException("invalid ExpressionEvaluator: " + - ex.toString(), ex); - } catch (ClassNotFoundException ex) { - throw new JspException("couldn't find ExpressionEvaluator: " + - ex.toString(), ex); - } catch (IllegalAccessException ex) { - throw new JspException("couldn't access ExpressionEvaluator: " + - ex.toString(), ex); - } catch (InstantiationException ex) { - throw new JspException( - "couldn't instantiate ExpressionEvaluator: " + - ex.toString(), ex); - } - } - - /** Performs a type conversion according to the EL's rules. */ - public static Object coerce(Object value, Class classe) - throws JspException { - try { - // just delegate the call - return Coercions.coerce(value, classe, logger); - } catch (ELException ex) { - throw new JspException(ex); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/resources/Resources.java b/impl/src/main/java/org/apache/taglibs/standard/resources/Resources.java deleted file mode 100644 index e38ef02..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/resources/Resources.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.resources; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - *

Provides locale-neutral access to string resources. Only the - * documentation and code are in English. :-) - * - *

The major goal, aside from globalization, is convenience. - * Access to resources with no parameters is made in the form:

- *
- *     Resources.getMessage(MESSAGE_NAME);
- * 
- * - *

Access to resources with one parameter works like

- *
- *     Resources.getMessage(MESSAGE_NAME, arg1);
- * 
- * - *

... and so on.

- * - * @author Shawn Bayern - */ -public class Resources { - - //********************************************************************* - // Static data - - /** The location of our resources. */ - private static final String RESOURCE_LOCATION - = "org.apache.taglibs.standard.resources.Resources"; - - /** Our class-wide ResourceBundle. */ - private static ResourceBundle rb = - ResourceBundle.getBundle(RESOURCE_LOCATION); - - - //********************************************************************* - // Public static methods - - /** Retrieves a message with no arguments. */ - public static String getMessage(String name) - throws MissingResourceException { - return rb.getString(name); - } - - /** Retrieves a message with arbitrarily many arguments. */ - public static String getMessage(String name, Object[] a) - throws MissingResourceException { - String res = rb.getString(name); - return MessageFormat.format(res, a); - } - - /** Retrieves a message with one argument. */ - public static String getMessage(String name, Object a1) - throws MissingResourceException { - return getMessage(name, new Object[] { a1 }); - } - - /** Retrieves a message with two arguments. */ - public static String getMessage(String name, Object a1, Object a2) - throws MissingResourceException { - return getMessage(name, new Object[] { a1, a2 }); - } - - /** Retrieves a message with three arguments. */ - public static String getMessage(String name, - Object a1, - Object a2, - Object a3) - throws MissingResourceException { - return getMessage(name, new Object[] { a1, a2, a3 }); - } - - /** Retrieves a message with four arguments. */ - public static String getMessage(String name, - Object a1, - Object a2, - Object a3, - Object a4) - throws MissingResourceException { - return getMessage(name, new Object[] { a1, a2, a3, a4 }); - } - - /** Retrieves a message with five arguments. */ - public static String getMessage(String name, - Object a1, - Object a2, - Object a3, - Object a4, - Object a5) - throws MissingResourceException { - return getMessage(name, new Object[] { a1, a2, a3, a4, a5 }); - } - - /** Retrieves a message with six arguments. */ - public static String getMessage(String name, - Object a1, - Object a2, - Object a3, - Object a4, - Object a5, - Object a6) - throws MissingResourceException { - return getMessage(name, new Object[] { a1, a2, a3, a4, a5, a6 }); - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/resources/Resources.properties b/impl/src/main/java/org/apache/taglibs/standard/resources/Resources.properties deleted file mode 100644 index 82a0dd6..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/resources/Resources.properties +++ /dev/null @@ -1,330 +0,0 @@ -# -# Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -######################################################################### -# Conventions: -# - For error messages from particular tags, the resource should -# - (a) have a name beginning with TAGNAME_ -# - (b) contain the name of the tag within the message -# - Generic tag messages -- i.e., those used in more than one tag -- -# should begin with TAG_ -# - Errors for TagLibraryValidators should begin with TLV_ -######################################################################### - - -######################################################################### -# Generic tag error messages -######################################################################### - -TAG_NULL_ATTRIBUTE=\ - The "{0}" attribute illegally evaluated to "null" or "" in <{1}> - -######################################################################### -# Specific tag error messages -######################################################################### - -# CORE - -CHOOSE_EXCLUSIVITY=\ - Only one (or is it two?) <choose> subtag may evaluate its body - -EXPR_BAD_VALUE=\ - In <expr>, attribute value="{0}" didn't evaluate successfully, \ - but there was no "default" attribute and no non-whitespace content \ - for the tag. - -FOREACH_STEP_NO_RESULTSET=\ - Step cannot be > 1 when iterating over a ResultSet with <forEach> - -FOREACH_BAD_ITEMS=\ - Don't know how to iterate over supplied "items" in <forEach> - -FORTOKENS_BAD_ITEMS=\ - "items" in <forTokens> must be an instance of java.lang.String or \ - an instance of jakarta.el.ValueExpression that evaluates to a \ - java.lang.String; - -IMPORT_BAD_RELATIVE=\ - In URL tags, when the "context" attribute is specified, \ - values of both "context" and "url" must start with "/". - -IMPORT_REL_WITHOUT_HTTP=\ - Relative <import> from non-HTTP request not allowed - -IMPORT_REL_WITHOUT_DISPATCHER=\ - Unable to get RequestDispatcher for Context: "{0}" and URL: "{1}". \ - Verify values and/or enable cross context access. - -IMPORT_IO=\ - I/O error in <import> occurred reading "{0}" - -IMPORT_ILLEGAL_STREAM=\ - Unexpected internal error during <import>: \ - Target servlet called getWriter(), then getOutputStream() - -IMPORT_ILLEGAL_WRITER=\ - Unexpected internal error during <import>: \ - Target servlet called getOutputStream(), then getWriter() - -#IMPORT_ILLEGAL_GETSTRING=\ -# Unexpected internal error during <import>: \ -# Target servlet called neither getOutputStream() nor getWriter() - -PARAM_OUTSIDE_PARENT=\ - <param> outside <import> or <urlEncode> - -PARAM_ENCODE_BOOLEAN=\ - In <param>, "encode" must be "true" or "false". Got "{0}" instead. - -SET_BAD_SCOPE=\ - Invalid "scope" attribute for <set>: "{0}" - -SET_BAD_SCOPE_DEFERRED=\ - The "scope" attribute for <set> must be "page" when "value" attribute \ - is a deferred expression; - -SET_INVALID_PROPERTY=\ - Invalid property in <set>: "{0}" - -SET_INVALID_TARGET=\ - Attempt to set the property of an invalid object in <set>. - -SET_NO_VALUE=\ - Need either non-whitespace body or "value" attribute in <set> - -URLENCODE_NO_VALUE=\ - Need either non-whitespace body or "value" attribute in <urlEncode> - -WHEN_OUTSIDE_CHOOSE=\ - Illegal use of <when>-style tag without <choose> as its \ - direct parent - -# I18N - -LOCALE_NO_LANGUAGE=\ - Missing language component in 'value' attribute in <setLocale> - -LOCALE_EMPTY_COUNTRY=\ - Empty country component in 'value' attribute in <setLocale> - -PARAM_OUTSIDE_MESSAGE=\ - <param> outside <message> - -MESSAGE_NO_KEY=\ - <message> needs 'key' attribute or non-whitespace body - -FORMAT_NUMBER_INVALID_TYPE=\ - In <formatNumber>, invalid 'type' attribute: "{0}" - -FORMAT_NUMBER_NO_VALUE=\ - <formatNumber> needs 'value' attribute or non-whitespace body - -FORMAT_NUMBER_PARSE_ERROR=\ - In <formatNumber>, 'value' attribute can not be parsed into java.lang.Number: "{0}" - -FORMAT_NUMBER_CURRENCY_ERROR=\ - In <formatNumber>, unable to set currency - -PARSE_NUMBER_INVALID_TYPE=\ - In <parseNumber>, invalid 'type' attribute: "{0}" - -PARSE_NUMBER_NO_VALUE=\ - <parseNumber> needs 'value' attribute or non-whitespace body - -PARSE_NUMBER_NO_PARSE_LOCALE=\ - In <parseNumber>, a parse locale can not be established - -PARSE_NUMBER_PARSE_ERROR=\ - In <parseNumber>, 'value' attribute can not be parsed: "{0}" - -FORMAT_DATE_INVALID_TYPE=\ - In <formatDate>, invalid 'type' attribute: "{0}" - -FORMAT_DATE_BAD_TIMEZONE=\ - In <formatDate>, 'timeZone' must be an instance of java.lang.String or java.util.TimeZone - -FORMAT_DATE_INVALID_DATE_STYLE=\ - In <formatDate>, invalid 'dateStyle' attribute: "{0}" - -FORMAT_DATE_INVALID_TIME_STYLE=\ - In <formatDate>, invalid 'timeStyle' attribute: "{0}" - -PARSE_DATE_INVALID_TYPE=\ - In <parseDate>, invalid 'type' attribute: "{0}" - -PARSE_DATE_BAD_TIMEZONE=\ - In <parseDate>, 'timeZone' must be an instance of java.lang.String or java.util.TimeZone - -PARSE_DATE_INVALID_DATE_STYLE=\ - In <parseDate>, invalid 'dateStyle' attribute: "{0}" - -PARSE_DATE_INVALID_TIME_STYLE=\ - In <parseDate>, invalid 'timeStyle' attribute: "{0}" - -PARSE_DATE_NO_VALUE=\ - <parseDate> needs 'value' attribute or non-whitespace body - -PARSE_DATE_PARSE_ERROR=\ - In <parseDate>, 'value' attribute can not be parsed: "{0}" - -PARSE_DATE_NO_PARSE_LOCALE=\ - In <parseDate>, a parse locale can not be established - -# SQL - -DRIVER_INVALID_CLASS=\ - In <driver>, invalid driver class name: "{0}" - -DATASOURCE_INVALID=\ - Unable to get connection, DataSource invalid: "{0}" - -JDBC_PARAM_COUNT=\ - Invalid number of JDBC parameters specified. - -PARAM_BAD_VALUE=\ - Invalid or out of bounds value specified in parameter. - -TRANSACTION_NO_SUPPORT=\ - In <transaction>, datasource does not support transactions - -TRANSACTION_COMMIT_ERROR=\ - In <transaction>, error committing transaction: "{0}" - -TRANSACTION_INVALID_ISOLATION=\ - In <transaction>, invalid transaction isolation - -NOT_SUPPORTED=\ - Not supported - -ERROR_GET_CONNECTION=\ - Error getting connection: "{0}" - -ERROR_NESTED_DATASOURCE=\ - It is illegal to specify a DataSource when nested within a <transaction> - -SQL_PARAM_OUTSIDE_PARENT=\ - <param> or <dateParam> must be subtag of SQLExecutionTag actions like <query> or <update> - -SQL_NO_STATEMENT=\ - No SQL statement specified - -SQL_PROCESS_ERROR=\ - Error processing SQL: "{0}" - -SQL_DATASOURCE_INVALID_TYPE=\ - 'dataSource' is neither a String nor a javax.sql.DataSource - -SQL_DATASOURCE_NULL=\ - 'dataSource' is null - -SQL_MAXROWS_PARSE_ERROR=\ - Error parsing 'jakarta.servlet.jsp.jstl.sql.maxRows' configuration setting: "{0}" - -SQL_MAXROWS_INVALID=\ - 'jakarta.servlet.jsp.jstl.sql.maxRows' configuration setting neither an Integer nor a String - -SQL_DATE_PARAM_INVALID_TYPE=\ - In <dateParam>, invalid 'type' attribute: "{0}" - -# XML - -FOREACH_NOT_NODESET=\ - <forEach> can't iterate over XPath expressions that don't return a node-set - -PARAM_NO_VALUE=\ - <param> needs 'value' attribute or non-whitespace body - -PARAM_OUTSIDE_TRANSFORM=\ - <param> outside <transform> - -PARSE_INVALID_SOURCE=\ - Unrecognized object supplied as 'xml' attribute to <parse> - -PARSE_NO_SAXTRANSFORMER=\ - Filter supplied to <parse>, but default TransformerFactory \ - does not support SAX. - -TRANSFORM_NO_TRANSFORMER=\ - <transform> was not passed an XSLT stylesheet - -TRANSFORM_SOURCE_INVALID_LIST=\ - <transform> encountered an invalid java.util.List while processing 'xml' attribute. This error is typically caused if you pass a node-set with more than one node to <transform>'s 'xml' attribute. - -TRANSFORM_SOURCE_UNRECOGNIZED=\ - <transform> encountered an unknown type while processing 'xml' attribute - -TRANSFORM_XSLT_UNRECOGNIZED=\ - <transform> encountered an unknown type while processing 'xslt' attribute - -UNABLE_TO_RESOLVE_ENTITY=\ - Could not resolve entity reference: "{0}" - -######################################################################### -# JSTL core TLV messages -######################################################################### - -# Parameters - -TLV_PARAMETER_ERROR=\ - Invalid value for "{0}" validator parameter in TLD - -# Generic errors - -TLV_ILLEGAL_BODY=\ - Encountered illegal body of tag "{0}" tag, given its attributes. - -TLV_MISSING_BODY=\ - A body is necessary inside the "{0}" tag, given its attributes. - -TLV_ILLEGAL_CHILD_TAG=\ - Illegal child tag in "{0}:{1}" tag: "{2}" tag - -TLV_ILLEGAL_TEXT_BODY=\ - Illegal text inside "{0}:{1}" tag: "{2}...". - -TLV_INVALID_ATTRIBUTE=\ - Invalid "{0}" attribute in "{1}" tag: "{2}" - -TLV_ILLEGAL_ORPHAN=\ - Invalid use of "{0}" tag outside legitimate parent tag - -TLV_PARENT_WITHOUT_SUBTAG=\ - Illegal "{0}" without child "{1}" tag - -# Errors customized to particular tags (sort of) :-) - -TLV_ILLEGAL_ORDER=\ - Illegal "{0}" after "{1}:{2}" tag in "{1}:{3}" tag. - -TLV_ILLEGAL_PARAM=\ - Illegal "{0}:{1}" tag within "{0}:{2} {3}='...'" tag - -TLV_DANGLING_SCOPE=\ - Illegal 'scope' attribute without 'var' in "{0}" tag. - -TLV_EMPTY_VAR=\ - Empty 'var' attribute in "{0}" tag. - -SET_NO_SETTER_METHOD=No setter method in <set> for property "{0}" - -IMPORT_ABS_ERROR=Problem accessing the absolute URL "{0}". {1} - -XPATH_ERROR_EVALUATING_EXPR=Error evaluating XPath expression "{0}": {1} - -XPATH_ILLEGAL_ARG_EVALUATING_EXPR=Illegal argument evaluating XPath expression "{0}": {1} - -XPATH_ERROR_XOBJECT=Error accessing data in XObject: {0} diff --git a/impl/src/main/java/org/apache/taglibs/standard/resources/Resources_ja.properties b/impl/src/main/java/org/apache/taglibs/standard/resources/Resources_ja.properties deleted file mode 100644 index c0950db..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/resources/Resources_ja.properties +++ /dev/null @@ -1,314 +0,0 @@ -# -# Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -######################################################################### -# Conventions: -# - For error messages from particular tags, the resource should -# - (a) have a name beginning with TAGNAME_ -# - (b) contain the name of the tag within the message -# - Generic tag messages -- i.e., those used in more than one tag -- -# should begin with TAG_ -# - Errors for TagLibraryValidators should begin with TLV_ -######################################################################### - - -######################################################################### -# Generic tag error messages -######################################################################### - -TAG_NULL_ATTRIBUTE=\ - <{1}> \u5185\u306b\u3042\u308b "{0}" \u5c5e\u6027\u304c "null" \u3082\u3057\u304f\u306f "" \u3067\u3042\u308b\u3068\u4e0d\u6b63\u306b\u8a55\u4fa1\u3057\u307e\u3057\u305f\u3002 - -######################################################################### -# Specific tag error messages -######################################################################### - -# CORE - -CHOOSE_EXCLUSIVITY=\ - \uff11\u3064\u3057\u304b\u5b58\u5728\u306a\u3044 <choose> \u306e\u4e0b\u4f4d\u30bf\u30b0\u306f\u30dc\u30c7\u30a3\u306e\u4e2d\u8eab\u3092\u305d\u306e\u307e\u307e\u8a55\u4fa1\u3057\u307e\u3059 - -EXPR_BAD_VALUE=\ - <expr> \u5185\u3067\u3001\u5c5e\u6027\u5024="{0}" \u304c\u6b63\u3057\u304f\u8a55\u4fa1\u3055\u308c\u305a\u3001"default" \u5c5e\u6027\u3084\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u30bf\u30b0\u306e\u4e2d\u306b\u5b58\u5728\u3057\u307e\u305b\u3093 - -FOREACH_STEP_NO_RESULTSET=\ - <forEach> \u3067 ResultSet \u3092\u53cd\u5fa9\u51e6\u7406\u3057\u3088\u3046\u3068\u3057\u305f\u3068\u3053\u308d\u3001step \u306e\u5024\u3092 1 \u3088\u308a\u5927\u304d\u304f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093 - -FOREACH_BAD_ITEMS=\ - <forEach> \u5185\u3067\u4f9b\u7d66\u3055\u308c\u305f "items" \u3092\u53cd\u5fa9\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u304c\u4e0d\u660e\u3067\u3059 - -IMPORT_BAD_RELATIVE=\ - URL \u30bf\u30b0\u3067 "context" \u5c5e\u6027\u3092\u6307\u5b9a\u3059\u308b\u969b\u3001"context" \u304a\u3088\u3073 "url" \u306e\u4e21\u65b9\u306e\u5024\u306f "/" \u3067\u59cb\u307e\u3063\u3066\u3044\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093 - -IMPORT_REL_WITHOUT_HTTP=\ - \u975e HTTP \u8981\u6c42\u3067\u306f\u3001URL\u3092\u76f8\u5bfe\u6307\u5b9a\u3059\u308b <import> \u3092\u8a31\u53ef\u3057\u3066\u3044\u307e\u305b\u3093 - -IMPORT_REL_WITHOUT_DISPATCHER=\ - Context: "{0}" \u304a\u3088\u3073 URL: "{1}" \u306b\u5bfe\u3057\u3066 RequestDispatcher \u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002\u6307\u5b9a\u3057\u305f\u5024\u3092\u78ba\u8a8d\u3059\u308b\u304b\u3001\u3082\u3057\u304f\u306f\u3001Context \u3092\u76f8\u4e92\u7684\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044 - -IMPORT_IO=\ - <import> \u3067\u3001"{0}" \u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306b\u5165\u51fa\u529b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -IMPORT_ILLEGAL_STREAM=\ - <import> \u5185\u3067\u4e88\u671f\u305b\u306c\u5185\u90e8\u30a8\u30e9\u30fc: \u5bfe\u8c61\u3068\u306a\u3063\u305f Servlet \u3067 getWriter() \u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3073\u51fa\u3055\u308c\u3066\u3044\u308b\u306e\u306b getOutputStream() \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u305d\u3046\u3068\u3057\u307e\u3057\u305f - -IMPORT_ILLEGAL_WRITER=\ - <import> \u5185\u3067\u4e88\u671f\u305b\u306c\u5185\u90e8\u30a8\u30e9\u30fc: \u5bfe\u8c61\u3068\u306a\u3063\u305f Servlet \u3067 getOutputStream() \u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3073\u51fa\u3055\u308c\u3066\u3044\u308b\u306e\u306b getWriter() \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u305d\u3046\u3068\u3057\u307e\u3057\u305f - -#IMPORT_ILLEGAL_GETSTRING=\ -# Unexpected internal error during <import>: \ -# Target servlet called neither getOutputStream() nor getWriter() - -PARAM_OUTSIDE_PARENT=\ - <import> \u3082\u3057\u304f\u306f <urlEncode> \u306e\u5916\u5074\u306b <param> \u304c\u3042\u308a\u307e\u3059 - -PARAM_ENCODE_BOOLEAN=\ - <param> \u3067\u306f\u3001"encode" \u306f "true" \u3082\u3057\u304f\u306f "false" \u3067\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002\u4ee3\u308f\u308a\u306b "{0}" \u3092\u53d6\u5f97\u3057\u307e\u3057\u305f - -SET_BAD_SCOPE=\ - <set> \u306b\u5bfe\u3057\u3001\u7121\u52b9\u306a "scope" \u5c5e\u6027\u3067\u3059: "{0}" - -SET_INVALID_PROPERTY=\ - <set> \u306b\u5bfe\u3057\u3001\u7121\u52b9\u306a\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u3059: "{0}" - -SET_INVALID_TARGET=\ - <set> \u306b\u5bfe\u3057\u3001\u7121\u52b9\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u30bb\u30c3\u30c8\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059 - -SET_NO_VALUE=\ - <set> \u3067\u306f\u3001\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u3082\u3057\u304f\u306f "value" \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059 - -URLENCODE_NO_VALUE=\ - <urlEncode> \u3067\u306f\u3001\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u3082\u3057\u304f\u306f "value" \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059 - -WHEN_OUTSIDE_CHOOSE=\ - \u76f4\u8fd1\u306e\u89aa\u30bf\u30b0\u3067\u3042\u308b <choose> \u3092\u30bb\u30c3\u30c8\u305b\u305a\u306b <when> \u30b9\u30bf\u30a4\u30eb\u30fb\u30bf\u30b0\u3092\u4f7f\u3046\u3053\u3068\u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093 - -# I18N - -LOCALE_NO_LANGUAGE=\ - <setLocale> \u3067\u3001'value' \u5c5e\u6027\u306b\u6307\u5b9a\u3057\u305f\u8a00\u8a9e\u30b3\u30fc\u30c9\u304c\u307e\u3061\u304c\u3063\u3066\u3044\u307e\u3059 - -LOCALE_EMPTY_COUNTRY=\ - <setLocale> \u3067\u3001'value' \u5c5e\u6027\u306b\u6307\u5b9a\u3057\u305f\u56fd\u30b3\u30fc\u30c9\u304c\u5b58\u5728\u3057\u307e\u305b\u3093 - -PARAM_OUTSIDE_MESSAGE=\ - <message> \u306e\u5916\u5074\u306b <param> \u304c\u3042\u308a\u307e\u3059 - -MESSAGE_NO_KEY=\ - <message> \u3067\u306f 'key' \u5c5e\u6027\u3082\u3057\u304f\u306f\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u304c\u5fc5\u8981\u3067\u3059 - -FORMAT_NUMBER_INVALID_TYPE=\ - <formatNumber> \u3067\u3001\u7121\u52b9\u306a 'type' \u5c5e\u6027\u3067\u3059: "{0}" - -FORMAT_NUMBER_NO_VALUE=\ - <formatNumber> \u3067\u306f 'value' \u5c5e\u6027\u3082\u3057\u304f\u306f\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u304c\u5fc5\u8981\u3067\u3059 - -FORMAT_NUMBER_PARSE_ERROR=\ - <formatNumber> \u5185\u306b\u3042\u308b\u3001'value' \u5c5e\u6027\u3092 java.lang.Number \u578b\u3067\u89e3\u6790\u3067\u304d\u307e\u305b\u3093: "{0}" - -FORMAT_NUMBER_CURRENCY_ERROR=\ - <formatNumber> \u3067\u3001\u901a\u8ca8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u30bb\u30c3\u30c8\u3067\u304d\u307e\u305b\u3093 - -PARSE_NUMBER_INVALID_TYPE=\ - <parseNumber> \u3067\u3001\u7121\u52b9\u306a 'type' \u5c5e\u6027\u3067\u3059: "{0}" - -PARSE_NUMBER_NO_VALUE=\ - <parseNumber> \u3067\u306f 'value' \u5c5e\u6027\u3082\u3057\u304f\u306f\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u304c\u5fc5\u8981\u3067\u3059 - -PARSE_NUMBER_NO_PARSE_LOCALE=\ - <parseNumber> \u5185\u3067\u3001\u89e3\u6790\u3055\u308c\u305f\u30ed\u30b1\u30fc\u30eb\u3092\u78ba\u5b9a\u3067\u304d\u307e\u305b\u3093 - -PARSE_NUMBER_PARSE_ERROR=\ - <parseNumber> \u5185\u306b\u3042\u308b\u3001'value' \u5c5e\u6027\u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093: "{0}" - -FORMAT_DATE_INVALID_TYPE=\ - <formatDate> \u3067\u3001\u7121\u52b9\u306a 'type' \u5c5e\u6027\u3067\u3059: "{0}" - -FORMAT_DATE_BAD_TIMEZONE=\ - <formatDate> \u3067\u306f\u3001'timeZone' \u306f java.lang.String \u578b\u3082\u3057\u304f\u306f java.util.TimeZone \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093 - -FORMAT_DATE_INVALID_DATE_STYLE=\ - <formatDate> \u3067\u3001\u7121\u52b9\u306a 'dateStyle' \u5c5e\u6027\u3067\u3059: "{0}" - -FORMAT_DATE_INVALID_TIME_STYLE=\ - <formatDate> \u3067\u3001\u7121\u52b9\u306a 'timeStyle' \u5c5e\u6027\u3067\u3059: "{0}" - -PARSE_DATE_INVALID_TYPE=\ - <parseDate> \u3067\u3001\u7121\u52b9\u306a 'type' \u5c5e\u6027\u3067\u3059: "{0}" - -PARSE_DATE_BAD_TIMEZONE=\ - <parseDate> \u5185\u306b\u3042\u308b\u3001'timeZone' \u306f java.lang.String \u578b\u3082\u3057\u304f\u306f java.util.TimeZone \u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093 - -PARSE_DATE_INVALID_DATE_STYLE=\ - <parseDate> \u3067\u3001\u7121\u52b9\u306a 'dateStyle' \u5c5e\u6027\u3067\u3059: "{0}" - -PARSE_DATE_INVALID_TIME_STYLE=\ - <parseDate> \u3067\u3001\u7121\u52b9\u306a 'timeStyle' \u5c5e\u6027\u3067\u3059: "{0}" - -PARSE_DATE_NO_VALUE=\ - <parseDate> \u3067\u306f 'value' \u5c5e\u6027\u3082\u3057\u304f\u306f\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u304c\u5fc5\u8981\u3067\u3059 - -PARSE_DATE_PARSE_ERROR=\ - <parseDate> \u5185\u306b\u3042\u308b\u3001'value' \u5c5e\u6027\u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093: "{0}" - -PARSE_DATE_NO_PARSE_LOCALE=\ - <parseDate> \u5185\u3067\u3001\u89e3\u6790\u3055\u308c\u305f\u30ed\u30b1\u30fc\u30eb\u3092\u78ba\u5b9a\u3067\u304d\u307e\u305b\u3093 - -# SQL - -DRIVER_INVALID_CLASS=\ - <driver> \u3067\u3001\u7121\u52b9\u306a\u30c9\u30e9\u30a4\u30d0\u30fb\u30af\u30e9\u30b9\u540d\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f: "{0}" - -DATASOURCE_INVALID=\ - DataSource \u304c\u7121\u52b9\u3067\u3042\u308b\u305f\u3081\u3001Connection \u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093: "{0}" - -JDBC_PARAM_COUNT=\ - \u6307\u5b9a\u3057\u305f JDBC \u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u304c\u7121\u52b9\u3067\u3059 - -PARAM_BAD_VALUE=\ - \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u6307\u5b9a\u3057\u305f\u5024\u304c\u7121\u52b9\u3067\u3042\u308b\u304b\u7bc4\u56f2\u5916\u3067\u3059 - -TRANSACTION_NO_SUPPORT=\ - <transaction> \u5185\u306b\u3042\u308b\u3001DataSource \u306f\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093 - -TRANSACTION_COMMIT_ERROR=\ - <transaction> \u306b\u304a\u3044\u3066\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306e\u30b3\u30df\u30c3\u30c8\u6642\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: "{0}" - -TRANSACTION_INVALID_ISOLATION=\ - <transaction> \u306b\u304a\u3044\u3066\u3001\u7121\u52b9\u306a\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u906e\u65ad\u30ec\u30d9\u30eb\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f - -NOT_SUPPORTED=\ - \u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093 - -ERROR_GET_CONNECTION=\ - Connection \u306e\u53d6\u5f97\u6642\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: "{0}" - -ERROR_NESTED_DATASOURCE=\ - <transaction> \u306e\u4e2d\u3067\u5165\u308c\u5b50\u3068\u306a\u3063\u305f\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306f\u4e0d\u6b63\u3067\u3059 - -SQL_PARAM_OUTSIDE_PARENT=\ - <param> \u307e\u305f\u306f <dateParam> \u306f <query> \u3082\u3057\u304f\u306f <update> \u306e\u3088\u3046\u306b SQLExecutionTag \u547d\u4ee4\u306e\u4e0b\u4f4d\u30bf\u30b0\u3067\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093 - -SQL_NO_STATEMENT=\ - SQL \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 - -SQL_PROCESS_ERROR=\ - SQL \u306e\u51e6\u7406\u6642\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: "{0}" - -SQL_DATASOURCE_INVALID_TYPE=\ - 'dataSource' \u304c String \u578b \u3067\u3082 javax.sql.DataSource \u578b\u306e\u3069\u3061\u3089\u3067\u3082\u3042\u308a\u307e\u305b\u3093 - -SQL_DATASOURCE_NULL=\ - 'dataSource' \u304c null \u3067\u3059 - -SQL_MAXROWS_PARSE_ERROR=\ - 'jakarta.servlet.jsp.jstl.sql.maxRows' \u306e\u74b0\u5883\u8a2d\u5b9a\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: "{0}" - -SQL_MAXROWS_INVALID=\ - 'jakarta.servlet.jsp.jstl.sql.maxRows' \u3067\u74b0\u5883\u8a2d\u5b9a\u3057\u305f\u5024\u306f Integer \u578b \u3067\u3082 String \u578b\u306e\u3069\u3061\u3089\u3067\u3082\u3042\u308a\u307e\u305b\u3093 - -SQL_DATE_PARAM_INVALID_TYPE=\ - <dateParam> \u3067\u3001\u7121\u52b9\u306a 'type' \u5c5e\u6027\u3067\u3059: "{0}" - -# XML - -FOREACH_NOT_NODESET=\ - \u30ce\u30fc\u30c9\u30bb\u30c3\u30c8\u306e\u8fd4\u3055\u308c\u306a\u3044 XPath \u8868\u73fe\u306b\u5bfe\u3057 <forEach> \u306f\u53cd\u5fa9\u51e6\u7406\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093 - -PARAM_NO_VALUE=\ - <param> \u3067\u306f 'value' \u5c5e\u6027\u3082\u3057\u304f\u306f\u30db\u30ef\u30a4\u30c8\u30b9\u30da\u30fc\u30b9\u306e\u306a\u3044\u30dc\u30c7\u30a3\u304c\u5fc5\u8981\u3067\u3059 - -PARAM_OUTSIDE_TRANSFORM=\ - <transform> \u306e\u5916\u5074\u306b <param> \u304c\u3042\u308a\u307e\u3059 - -PARSE_INVALID_SOURCE=\ - <parse> \u306b\u5bfe\u3057 'xml' \u5c5e\u6027\u3068\u3057\u3066\u4f9b\u7d66\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8a8d\u8b58\u3067\u304d\u307e\u305b\u3093 - -PARSE_NO_SAXTRANSFORMER=\ - <parse> \u306b\u5bfe\u3057\u30d5\u30a3\u30eb\u30bf\u30fc\u304c\u4f9b\u7d66\u3055\u308c\u307e\u3057\u305f\u304c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e TransformerFactory \u304c SAX \u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093 - -TRANSFORM_NO_TRANSFORMER=\ - <transform> \u306b\u5bfe\u3057 XSLT \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u304c\u901a\u308a\u307e\u305b\u3093 - -TRANSFORM_SOURCE_INVALID_LIST=\ - <transform> \u5185\u3067 'xml' \u5c5e\u6027\u306e\u51e6\u7406\u4e2d\u306b\u7121\u52b9\u306a java.util.List \u3068\u906d\u9047\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u3001<transform> \u5185\u306e 'xml' \u5c5e\u6027\u306b\u5bfe\u3057\u3066 1 \u4ee5\u4e0a\u306e\u30ce\u30fc\u30c9\u3067\u69cb\u6210\u3055\u308c\u308b\u30ce\u30fc\u30c9\u30bb\u30c3\u30c8\u3092\u901a\u3055\u306a\u3044\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u5178\u578b\u7684\u306a\u30a8\u30e9\u30fc\u3067\u3059 - -TRANSFORM_SOURCE_UNRECOGNIZED=\ - <transform> \u5185\u3067 'xml' \u5c5e\u6027\u306e\u51e6\u7406\u4e2d\u306b\u672a\u77e5\u306e\u578b\u3068\u906d\u9047\u3057\u307e\u3057\u305f - -TRANSFORM_XSLT_UNRECOGNIZED=\ - <transform> \u5185\u3067 'xslt' \u5c5e\u6027\u306e\u51e6\u7406\u4e2d\u306b\u672a\u77e5\u306e\u578b\u3068\u906d\u9047\u3057\u307e\u3057\u305f - -UNABLE_TO_RESOLVE_ENTITY=\ - \u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u53c2\u7167\u3092\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093: "{0}" - -######################################################################### -# JSTL core TLV messages -######################################################################### - -# Parameters - -TLV_PARAMETER_ERROR=\ - TLD \u306b\u3088\u308b\u3068 "{0}" \u6709\u52b9\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u5bfe\u5fdc\u3059\u308b\u5024\u304c\u7121\u52b9\u3067\u3059 - -# Generic errors - -TLV_ILLEGAL_BODY=\ - \u5c5e\u6027\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u304c\u3001"{0}" \u30bf\u30b0\u3067\u4e0d\u6b63\u306a\u30dc\u30c7\u30a3\u306b\u906d\u9047\u3057\u307e\u3057\u305f - -TLV_MISSING_BODY=\ - \u5c5e\u6027\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u304c\u3001\u30dc\u30c7\u30a3\u306f "{0}" \u30bf\u30b0\u306e\u4e2d\u306b\u5fc5\u8981\u3067\u3059 - -TLV_ILLEGAL_CHILD_TAG=\ - "{0}:{1}" \u30bf\u30b0\u306b\u4e0d\u6b63\u306a\u4e0b\u4f4d\u30bf\u30b0\u304c\u3042\u308a\u307e\u3059: "{2}" \u30bf\u30b0 - -TLV_ILLEGAL_TEXT_BODY=\ - "{0}:{1}" \u30bf\u30b0\u306e\u4e2d\u306b\u4e0d\u6b63\u306a\u30c6\u30ad\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059: "{2}...". - -TLV_INVALID_ATTRIBUTE=\ - "{1}" \u306b\u7121\u52b9\u306a "{0}" \u5c5e\u6027\u304c\u3042\u308a\u307e\u3059: "{2}" - -TLV_ILLEGAL_ORPHAN=\ - \u9069\u5207\u306a\u89aa\u30bf\u30b0\u306e\u5916\u5074\u306b\u3042\u308b "{0}" \u30bf\u30b0\u306e\u4f7f\u3044\u65b9\u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093 - -TLV_PARENT_WITHOUT_SUBTAG=\ - \u4e0b\u4f4d\u3067\u3042\u308b "{1}" \u30bf\u30b0\u306e\u306a\u3044 "{0}" \u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093 - -# Errors customized to particular tags (sort of) :-) - -TLV_ILLEGAL_ORDER=\ - "{1}:{3}" \u30bf\u30b0\u3067\u306f\u3001"{1}:{2}" \u30bf\u30b0\u306e\u5f8c\u306b\u3042\u308b "{0}" \u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093 - -TLV_ILLEGAL_PARAM=\ - "{0}:{2} {3}='...'" \u30bf\u30b0\u306e\u4e2d\u306b\u3042\u308b "{0}:{1}" \u30bf\u30b0\u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093 - -TLV_DANGLING_SCOPE=\ - "{0}" \u30bf\u30b0\u3067 'var' \u304c\u5b58\u5728\u3057\u306a\u3044\u306e\u306b 'scope' \u5c5e\u6027\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093 - -TLV_EMPTY_VAR=\ - "{0}" \u30bf\u30b0\u3067 'var' \u5c5e\u6027\u304c\u7a7a\u3067\u3059 - -SET_NO_SETTER_METHOD=\ - <set> \u306b\u304a\u3044\u3066\u3001\u30d7\u30ed\u30d1\u30c6\u30a3 "{0}" \u306b\u5bfe\u5fdc\u3059\u308b setter \u30e1\u30bd\u30c3\u30c9\u304c\u5b58\u5728\u3057\u307e\u305b\u3093 - -IMPORT_ABS_ERROR=Problem accessing the absolute URL "{0}". {1} - -XPATH_ERROR_EVALUATING_EXPR=Error evaluating XPath expression "{0}": {1} - -XPATH_ILLEGAL_ARG_EVALUATING_EXPR=Illegal argument evaluating XPath expression "{0}": {1} - -XPATH_ERROR_XOBJECT=Error accessing data in XObject: {0} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/CatchTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/CatchTag.java deleted file mode 100644 index c33e5c0..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/CatchTag.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.TagSupport; -import jakarta.servlet.jsp.tagext.TryCatchFinally; - -/** - *

Tag handler for <catch> in JSTL 1.0.

- * - *

<catch> simply catches any Throwables that occur in its body - * and optionally exposes them. - * - * @author Shawn Bayern - */ - -public class CatchTag extends TagSupport implements TryCatchFinally { - - /* - * If all tags that I proposed were this simple, people might - * think I was just trying to avoid work. :-) - */ - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public CatchTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - private void init() { - var = null; - } - - - //********************************************************************* - // Private state - - private String var; // tag attribute - private boolean caught; // internal status - - - //********************************************************************* - // Tag logic - - public int doStartTag() { - caught = false; - return EVAL_BODY_INCLUDE; - } - - public void doCatch(Throwable t) { - if (var != null) - pageContext.setAttribute(var, t, PageContext.PAGE_SCOPE); - caught = true; - } - - public void doFinally() { - if (var != null && !caught) - pageContext.removeAttribute(var, PageContext.PAGE_SCOPE); - } - - - //********************************************************************* - // Attribute accessors - - public void setVar(String var) { - this.var = var; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ChooseTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ChooseTag.java deleted file mode 100644 index 57314be..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ChooseTag.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.tagext.TagSupport; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Tag handler for <choose> in JSTL.

- * - *

<choose> is a very simple tag that acts primarily as a container; - * it always includes its body and allows exactly one of its child - * <when> tags to run. Since this tag handler doesn't have any - * attributes, it is common.core to both the rtexprvalue and expression- - * evaluating versions of the JSTL library. - * - * @author Shawn Bayern - */ - -public class ChooseTag extends TagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public ChooseTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Private state - - private boolean subtagGateClosed; // has one subtag already executed? - - - //********************************************************************* - // Public methods implementing exclusivity checks - - /** - * Returns status indicating whether a subtag should run or not. - * - * @return true if the subtag should evaluate its condition - * and decide whether to run, false otherwise. - */ - public synchronized boolean gainPermission() { - return (!subtagGateClosed); - } - - /** - * Called by a subtag to indicate that it plans to evaluate its - * body. - */ - public synchronized void subtagSucceeded() { - if (subtagGateClosed) - throw new IllegalStateException( - Resources.getMessage("CHOOSE_EXCLUSIVITY")); - subtagGateClosed = true; - } - - - //********************************************************************* - // Tag logic - - // always include body - public int doStartTag() throws JspException { - subtagGateClosed = false; // when we start, no children have run - return EVAL_BODY_INCLUDE; - } - - - //********************************************************************* - // Private utility methods - - private void init() { - subtagGateClosed = false; // reset flag - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/DeclareTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/DeclareTag.java deleted file mode 100644 index 0315c2e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/DeclareTag.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.jsp.tagext.TagSupport; - -/** - *

Tag handler for <declaregt; in JSTL. This tag handler is - * essentially a runtime no-op as far as tag logic is concerned; the - * only important functionality of the tag is to expose a scripting - * variable for an existing scoped attribute.

- * - * @author Shawn Bayern - */ - -public class DeclareTag extends TagSupport { - - /* - * We're not identical to TagSupport only because we need to - * accept an additional "type" attribute. - */ - public void setType(String x) { } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java deleted file mode 100644 index 733bdeb..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Map; -import java.util.StringTokenizer; - -import jakarta.el.ValueExpression; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.LoopTagSupport; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for tag handlers for <forEach>, the core iteration - * tag in JSTL 1.0. This class extends LoopTagSupport and provides - * ForEach-specific functionality. The rtexprvalue library and the - * expression-evaluating library each have handlers that extend this - * class.

- * - *

Localized here is the logic for handling the veritable smorgasbord - * of types supported by <forEach>, including arrays, - * Collections, and others. To see how the actual iteration is controlled, - * review the jakarta.servlet.jsp.jstl.core.LoopTagSupport class instead. - *

- * - * @see jakarta.servlet.jsp.jstl.core.LoopTagSupport - * @author Shawn Bayern - */ - -public abstract class ForEachSupport extends LoopTagSupport { - - //********************************************************************* - // Implementation overview - - /* - * This particular handler is essentially a large switching mechanism - * to support the various types that the tag handles. The - * class is organized around the private ForEachIterator interface, - * which serves as the basis for relaying information to the iteration - * implementation we inherit from LoopTagSupport. - * - * We expect to receive our 'items' from one of our subclasses - * (presumably from the rtexprvalue or expression-evaluating libraries). - * If 'items' is missing, we construct an Integer[] array representing - * iteration indices, in line with the spec draft. From doStartTag(), - * we analyze and 'digest' the data we're passed. Then, we simply - * relay items as necessary to the iteration implementation that - * we inherit from LoopTagSupport. - */ - - - //********************************************************************* - // Internal, supporting classes and interfaces - - /* - * Acts as a focal point for converting the various types we support. - * It would have been ideal to use Iterator here except for one problem: - * Iterator.hasNext() and Iterator.next() can't throw the JspTagException - * we want to throw. So instead, we'll encapsulate the hasNext() and - * next() methods we want to provide inside this local class. - * (Other implementations are more than welcome to implement hasNext() - * and next() explicitly, not in terms of a back-end supporting class. - * For the forEach tag handler, however, this class acts as a convenient - * organizational mechanism, for we support so many different classes. - * This encapsulation makes it easier to localize implementations - * in support of particular types -- e.g., changing the implementation - * of primitive-array iteration to wrap primitives only on request, - * instead of in advance, would involve changing only those methods that - * handle primitive arrays. - */ - protected static interface ForEachIterator { - public boolean hasNext() throws JspTagException; - public Object next() throws JspTagException; - } - - /* - * Simple implementation of ForEachIterator that adapts from - * an Iterator. This is appropriate for cases where hasNext() and - * next() don't need to throw JspTagException. Such cases are common.core. - */ - protected class SimpleForEachIterator implements ForEachIterator { - private Iterator i; - public SimpleForEachIterator(Iterator i) { - this.i = i; - } - public boolean hasNext() { - return i.hasNext(); - } - public Object next() { - return i.next(); - } - } - - - //********************************************************************* - // ForEach-specifc state (protected) - - protected ForEachIterator items; // our 'digested' items - protected Object rawItems; // our 'raw' items - - - //********************************************************************* - // Iteration control methods (based on processed 'items' object) - - // (We inherit semantics and Javadoc from LoopTagSupport.) - - protected boolean hasNext() throws JspTagException { - return items.hasNext(); - } - - protected Object next() throws JspTagException { - return items.next(); - } - - protected void prepare() throws JspTagException { - // produce the right sort of ForEachIterator - if (rawItems != null) { - // If this is a deferred expression, make a note and get - // the 'items' instance. - if (rawItems instanceof ValueExpression) { - deferredExpression = (ValueExpression) rawItems; - rawItems = deferredExpression.getValue( - pageContext.getELContext()); - if (rawItems == null) { - // Simulate an empty list - rawItems = new ArrayList(); - } - } - // extract an iterator over the 'items' we've got - items = supportedTypeForEachIterator(rawItems); - } else { - // no 'items', so use 'begin' and 'end' - items = beginEndForEachIterator(); - } - - /* ResultSet no more supported in - // step must be 1 when ResultSet is passed in - if (rawItems instanceof ResultSet && step != 1) - throw new JspTagException( - Resources.getMessage("FOREACH_STEP_NO_RESULTSET")); - */ - } - - - //********************************************************************* - // Tag logic and lifecycle management - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - items = null; - rawItems = null; - deferredExpression = null; - } - - - //********************************************************************* - // Private generation methods for the ForEachIterators we produce - - /* Extracts a ForEachIterator given an object of a supported type. */ - protected ForEachIterator supportedTypeForEachIterator(Object o) - throws JspTagException { - - /* - * This is, of necessity, just a big, simple chain, matching in - * order. Since we are passed on Object because of all the - * various types we support, we cannot rely on the language's - * mechanism for resolving overloaded methods. (Method overloading - * resolves via early binding, so the type of the 'o' reference, - * not the type of the eventual value that 'o' references, is - * all that's available.) - * - * Currently, we 'match' on the object we have through an - * if/else chain that picks the first interface (or class match) - * found for an Object. - */ - - ForEachIterator items; - - if (o instanceof Object[]) - items = toForEachIterator((Object[]) o); - else if (o instanceof boolean[]) - items = toForEachIterator((boolean[]) o); - else if (o instanceof byte[]) - items = toForEachIterator((byte[]) o); - else if (o instanceof char[]) - items = toForEachIterator((char[]) o); - else if (o instanceof short[]) - items = toForEachIterator((short[]) o); - else if (o instanceof int[]) - items = toForEachIterator((int[]) o); - else if (o instanceof long[]) - items = toForEachIterator((long[]) o); - else if (o instanceof float[]) - items = toForEachIterator((float[]) o); - else if (o instanceof double[]) - items = toForEachIterator((double[]) o); - else if (o instanceof Collection) - items = toForEachIterator((Collection) o); - else if (o instanceof Iterator) - items = toForEachIterator((Iterator) o); - else if (o instanceof Enumeration) - items = toForEachIterator((Enumeration) o); - else if (o instanceof Map) - items = toForEachIterator((Map) o); - /* - else if (o instanceof ResultSet) - items = toForEachIterator((ResultSet) o); - */ - else if (o instanceof String) - items = toForEachIterator((String) o); - else - items = toForEachIterator(o); - - return (items); - } - - /* - * Creates a ForEachIterator of Integers from 'begin' to 'end' - * in support of cases where our tag handler isn't passed an - * explicit collection over which to iterate. - */ - private ForEachIterator beginEndForEachIterator() { - /* - * To plug into existing support, we need to keep 'begin', 'end', - * and 'step' as they are. So we'll simply create an Integer[] - * from 0 to 'end', inclusive, and let the existing implementation - * handle the subsetting and stepping operations. (Other than - * localizing the cost of creating this Integer[] to the start - * of the operation instead of spreading it out over the lifetime - * of the iteration, this implementation isn't worse than one that - * created new Integers() as needed from next(). Such an adapter - * to ForEachIterator could easily be written but, like I said, - * wouldn't provide much benefit.) - */ - Integer[] ia = new Integer[end + 1]; - for (int i = 0; i <= end; i++) - ia[i] = Integer.valueOf(i); - return new SimpleForEachIterator(Arrays.asList(ia).iterator()); - } - - - //********************************************************************* - // Private conversion methods to handle the various types we support - - // catch-all method whose invocation currently signals a 'matching error' - protected ForEachIterator toForEachIterator(Object o) - throws JspTagException { - throw new JspTagException(Resources.getMessage("FOREACH_BAD_ITEMS")); - } - - // returns an iterator over an Object array (via List) - protected ForEachIterator toForEachIterator(Object[] a) { - return new SimpleForEachIterator(Arrays.asList(a).iterator()); - } - - // returns an iterator over a boolean[] array, wrapping items in Boolean - protected ForEachIterator toForEachIterator(boolean[] a) { - Boolean[] wrapped = new Boolean[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = Boolean.valueOf(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over a byte[] array, wrapping items in Byte - protected ForEachIterator toForEachIterator(byte[] a) { - Byte[] wrapped = new Byte[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = Byte.valueOf(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over a char[] array, wrapping items in Character - protected ForEachIterator toForEachIterator(char[] a) { - Character[] wrapped = new Character[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = Character.valueOf(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over a short[] array, wrapping items in Short - protected ForEachIterator toForEachIterator(short[] a) { - Short[] wrapped = new Short[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = Short.valueOf(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over an int[] array, wrapping items in Integer - protected ForEachIterator toForEachIterator(int[] a) { - Integer[] wrapped = new Integer[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = Integer.valueOf(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over a long[] array, wrapping items in Long - protected ForEachIterator toForEachIterator(long[] a) { - Long[] wrapped = new Long[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = Long.valueOf(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over a float[] array, wrapping items in Float - protected ForEachIterator toForEachIterator(float[] a) { - Float[] wrapped = new Float[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = new Float(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // returns an iterator over a double[] array, wrapping items in Double - protected ForEachIterator toForEachIterator(double[] a) { - Double[] wrapped = new Double[a.length]; - for (int i = 0; i < a.length; i++) - wrapped[i] = new Double(a[i]); - return new SimpleForEachIterator(Arrays.asList(wrapped).iterator()); - } - - // retrieves an iterator from a Collection - protected ForEachIterator toForEachIterator(Collection c) { - return new SimpleForEachIterator(c.iterator()); - } - - // simply passes an Iterator through... - protected ForEachIterator toForEachIterator(Iterator i) { - return new SimpleForEachIterator(i); - } - - // converts an Enumeration to an Iterator via a local adapter - protected ForEachIterator toForEachIterator(Enumeration e) { - - // local adapter - class EnumerationAdapter implements ForEachIterator { - private Enumeration e; - public EnumerationAdapter(Enumeration e) { - this.e = e; - } - public boolean hasNext() { - return e.hasMoreElements(); - } - public Object next() { - return e.nextElement(); - } - } - - return new EnumerationAdapter(e); - } - - // retrieves an iterator over the Map.Entry items in a Map - protected ForEachIterator toForEachIterator(Map m) { - return new SimpleForEachIterator(m.entrySet().iterator()); - } - - /* No more supported in JSTL. See interface Result instead. - // thinly wraps a ResultSet in an appropriate Iterator - protected ForEachIterator toForEachIterator(ResultSet rs) - throws JspTagException { - - // local adapter - class ResultSetAdapter implements ForEachIterator { - private ResultSet rs; - public ResultSetAdapter(ResultSet rs) { - this.rs = rs; - } - public boolean hasNext() throws JspTagException { - try { - return !(rs.isLast()); // dependent on JDBC 2.0 - } catch (java.sql.SQLException ex) { - throw new JspTagException(ex.getMessage()); - } - } - public Object next() throws JspTagException { - try { - rs.next(); - return rs; - } catch (java.sql.SQLException ex) { - throw new JspTagException(ex.getMessage()); - } - } - } - - return new ResultSetAdapter(rs); - } - */ - - // tokenizes a String as a CSV and returns an iterator over it - protected ForEachIterator toForEachIterator(String s) { - StringTokenizer st = new StringTokenizer(s, ","); - return toForEachIterator(st); // convert from Enumeration - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java deleted file mode 100644 index 69705d1..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.util.StringTokenizer; -import jakarta.el.ValueExpression; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.LoopTagSupport; -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for tag handlers for <forTokens>, the tokenizing - * iteration tag in JSTL 1.0. This class extends LoopTagSupport and - * provides ForTokens-specific functionality. The rtexprvalue and - * expression-evaluating libraries each have handlers that extend this - * class.

- * - * @see jakarta.servlet.jsp.jstl.core.LoopTagSupport - * @author Shawn Bayern - */ - -public abstract class ForTokensSupport extends LoopTagSupport { - - //********************************************************************* - // Implementation overview - - /* - * This handler simply constructs a StringTokenizer based on its input - * and relays tokens to the iteration implementation that it inherits. - * The 'items' and 'delims' attributes are expected to be provided by - * a subtag (presumably in the rtexprvalue or expression-evaluating - * versions of the JSTL library). - */ - - - //********************************************************************* - // ForEachTokens-specific state (protected) - - protected Object items; // 'items' attribute - protected String delims; // 'delims' attribute - protected StringTokenizer st; // digested tokenizer - - - //********************************************************************* - // Iteration control methods - - /* - * These just create and use a StringTokenizer. - * We inherit semantics and Javadoc from LoopTagSupport. - */ - - protected void prepare() throws JspTagException { - if (items instanceof ValueExpression) { - deferredExpression = (ValueExpression) items; - items = deferredExpression.getValue(pageContext.getELContext()); - } - if (!(items instanceof String)) { - throw new JspTagException( - Resources.getMessage("FORTOKENS_BAD_ITEMS")); - } - st = new StringTokenizer((String)items, delims); - } - - protected boolean hasNext() throws JspTagException { - return st.hasMoreElements(); - } - - protected Object next() throws JspTagException { - return st.nextElement(); - } - - protected String getDelims() { - return delims; - } - - //********************************************************************* - // Tag logic and lifecycle management - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - items = delims = null; - st = null; - deferredExpression = null; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java deleted file mode 100644 index 9c61a78..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java +++ /dev/null @@ -1,582 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * Copyright (c) 2021-2021 Contributors to the Eclipse Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Writer; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.util.Locale; - -import jakarta.servlet.RequestDispatcher; -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletException; -import jakarta.servlet.ServletOutputStream; -import jakarta.servlet.WriteListener; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.http.HttpServletResponseWrapper; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.TryCatchFinally; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for tag handlers for <import>, the general-purpose - * text-importing mechanism for JSTL 1.0. The rtexprvalue and expression- - * evaluating libraries each have handlers that extend this class.

- * - * @author Shawn Bayern - */ - -public abstract class ImportSupport extends BodyTagSupport - implements TryCatchFinally, ParamParent { - - //********************************************************************* - // Public constants - - /**

Valid characters in a scheme.

- *

RFC 1738 says the following:

- *
- * Scheme names consist of a sequence of characters. The lower - * case letters "a"--"z", digits, and the characters plus ("+"), - * period ("."), and hyphen ("-") are allowed. For resiliency, - * programs interpreting URLs should treat upper case letters as - * equivalent to lower case in scheme names (e.g., allow "HTTP" as - * well as "http"). - *
- *

We treat as absolute any URL that begins with such a scheme name, - * followed by a colon.

- */ - public static final String VALID_SCHEME_CHARS = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+.-"; - - /** Default character encoding for response. */ - public static final String DEFAULT_ENCODING = "ISO-8859-1"; - - //********************************************************************* - // Protected state - - protected String url; // 'url' attribute - protected String context; // 'context' attribute - protected String charEncoding; // 'charEncoding' attrib. - - //********************************************************************* - // Private state (implementation details) - - private String var; // 'var' attribute - private int scope; // processed 'scope' attribute - private String varReader; // 'varReader' attribute - private Reader r; // exposed reader, if relevant - private boolean isAbsoluteUrl; // is our URL absolute? - private ParamSupport.ParamManager params; // parameters - private String urlWithParams; // URL with parameters, if applicable - - //********************************************************************* - // Constructor and initialization - - public ImportSupport() { - super(); - init(); - } - - private void init() { - url = var = varReader = context = charEncoding = urlWithParams = null; - params = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag logic - - // determines what kind of import and variable exposure to perform - public int doStartTag() throws JspException { - // Sanity check - if (context != null - && (!context.startsWith("/") || !url.startsWith("/"))) { - throw new JspTagException( - Resources.getMessage("IMPORT_BAD_RELATIVE")); - } - - // reset parameter-related state - urlWithParams = null; - params = new ParamSupport.ParamManager(); - - // check the URL - if (url == null || url.equals("")) - throw new NullAttributeException("import", "url"); - - // Record whether our URL is absolute or relative - isAbsoluteUrl = isAbsoluteUrl(); - - try { - // If we need to expose a Reader, we've got to do it right away - if (varReader != null) { - r = acquireReader(); - pageContext.setAttribute(varReader, r); - } - } catch (IOException ex) { - throw new JspTagException(ex.toString(), ex); - } - - return EVAL_BODY_INCLUDE; - } - - // manages connections as necessary (creating or destroying) - public int doEndTag() throws JspException { - try { - // If we didn't expose a Reader earlier... - if (varReader == null) { - // ... store it in 'var', if available ... - if (var != null) - pageContext.setAttribute(var, acquireString(), scope); - // ... or simply output it, if we have nowhere to expose it - else - pageContext.getOut().print(acquireString()); - } - return EVAL_PAGE; - } catch (IOException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - // simply rethrows its exception - public void doCatch(Throwable t) throws Throwable { - throw t; - } - - // cleans up if appropriate - public void doFinally() { - try { - // If we exposed a Reader in doStartTag(), close it. - if (varReader != null) { - // 'r' can be null if an exception was thrown... - if (r != null) - r.close(); - pageContext.removeAttribute(varReader, PageContext.PAGE_SCOPE); - } - } catch (IOException ex) { - // ignore it; close() failed, but there's nothing more we can do - } - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - super.release(); - } - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setVarReader(String varReader) { - this.varReader = varReader; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Collaboration with subtags - - // inherit Javadoc - public void addParameter(String name, String value) { - params.addParameter(name, value); - } - - //********************************************************************* - // Actual URL importation logic - - /* - * Overall strategy: we have two entry points, acquireString() and - * acquireReader(). The latter passes data through unbuffered if - * possible (but note that it is not always possible -- specifically - * for cases where we must use the RequestDispatcher. The remaining - * methods handle the common.core logic of loading either a URL or a local - * resource. - * - * We consider the 'natural' form of absolute URLs to be Readers and - * relative URLs to be Strings. Thus, to avoid doing extra work, - * acquireString() and acquireReader() delegate to one another as - * appropriate. (Perhaps I could have spelled things out more clearly, - * but I thought this implementation was instructive, not to mention - * somewhat cute...) - */ - - private String acquireString() throws IOException, JspException { - if (isAbsoluteUrl) { - // for absolute URLs, delegate to our peer - BufferedReader r = new BufferedReader(acquireReader()); - StringBuilder sb = new StringBuilder(); - int i; - - // under JIT, testing seems to show this simple loop is as fast - // as any of the alternatives - // - // gmurray71 : putting in try/catch/finally block to make sure the - // reader is closed to fix a bug with file descriptors being left open - try { - while ((i = r.read()) != -1) - sb.append((char)i); - } catch (IOException iox) { - throw iox; - } finally { - r.close(); - } - - return sb.toString(); - } else { - // handle relative URLs ourselves - - // URL is relative, so we must be an HTTP request - if (!(pageContext.getRequest() instanceof HttpServletRequest - && pageContext.getResponse() instanceof HttpServletResponse)) - throw new JspTagException( - Resources.getMessage("IMPORT_REL_WITHOUT_HTTP")); - - // retrieve an appropriate ServletContext - ServletContext c = null; - String targetUrl = targetUrl(); - if (context != null) - c = pageContext.getServletContext().getContext(context); - else { - c = pageContext.getServletContext(); - - // normalize the URL if we have an HttpServletRequest - if (!targetUrl.startsWith("/")) { - String sp = ((HttpServletRequest) - pageContext.getRequest()).getServletPath(); - targetUrl = sp.substring(0, sp.lastIndexOf('/')) - + '/' + targetUrl; - } - } - - if (c == null) { - throw new JspTagException( - Resources.getMessage( - "IMPORT_REL_WITHOUT_DISPATCHER", context, targetUrl)); - } - - // from this context, get a dispatcher - RequestDispatcher rd = - c.getRequestDispatcher(stripSession(targetUrl)); - if (rd == null) - throw new JspTagException(stripSession(targetUrl)); - - // include the resource, using our custom wrapper - ImportResponseWrapper irw = - new ImportResponseWrapper(pageContext); - - // spec mandates specific error handling form include() - try { - rd.include(pageContext.getRequest(), irw); - } catch (IOException ex) { - throw new JspException(ex); - } catch (RuntimeException ex) { - throw new JspException(ex); - } catch (ServletException ex) { - Throwable rc = ex.getRootCause(); - if (rc == null) - throw new JspException(ex); - else - throw new JspException(rc); - } - - // disallow inappropriate response codes per JSTL spec - if (irw.getStatus() < 200 || irw.getStatus() > 299) { - throw new JspTagException(irw.getStatus() + " " + - stripSession(targetUrl)); - } - - // recover the response String from our wrapper - return irw.getString(); - } - } - - private Reader acquireReader() throws IOException, JspException { - if (!isAbsoluteUrl) { - // for relative URLs, delegate to our peer - return new StringReader(acquireString()); - } else { - // absolute URL - String target = targetUrl(); - try { - // handle absolute URLs ourselves, using java.net.URL - URL u = new URL(target); - URLConnection uc = u.openConnection(); - InputStream i = uc.getInputStream(); - - // okay, we've got a stream; encode it appropriately - Reader r = null; - String charSet; - if (charEncoding != null && !charEncoding.equals("")) { - charSet = charEncoding; - } else { - // charSet extracted according to RFC 2045, section 5.1 - String contentType = uc.getContentType(); - if (contentType != null) { - charSet = Util.getContentTypeAttribute(contentType, "charset"); - if (charSet == null) charSet = DEFAULT_ENCODING; - } else { - charSet = DEFAULT_ENCODING; - } - } - try { - r = new InputStreamReader(i, charSet); - } catch (Exception ex) { - r = new InputStreamReader(i, DEFAULT_ENCODING); - } - - // check response code for HTTP URLs before returning, per spec, - // before returning - if (uc instanceof HttpURLConnection) { - int status = ((HttpURLConnection) uc).getResponseCode(); - if (status < 200 || status > 299) - throw new JspTagException(status + " " + target); - } - return r; - } catch (IOException ex) { - throw new JspException( - Resources.getMessage("IMPORT_ABS_ERROR", target, ex), ex); - } catch (RuntimeException ex) { // because the spec makes us - throw new JspException( - Resources.getMessage("IMPORT_ABS_ERROR", target, ex), ex); - } - } - } - - /** Wraps responses to allow us to retrieve results as Strings. */ - private class ImportResponseWrapper extends HttpServletResponseWrapper { - - //************************************************************ - // Overview - - /* - * We provide either a Writer or an OutputStream as requested. - * We actually have a true Writer and an OutputStream backing - * both, since we don't want to use a character encoding both - * ways (Writer -> OutputStream -> Writer). So we use no - * encoding at all (as none is relevant) when the target resource - * uses a Writer. And we decode the OutputStream's bytes - * using OUR tag's 'charEncoding' attribute, or ISO-8859-1 - * as the default. We thus ignore setLocale() and setContentType() - * in this wrapper. - * - * In other words, the target's asserted encoding is used - * to convert from a Writer to an OutputStream, which is typically - * the medium through with the target will communicate its - * ultimate response. Since we short-circuit that mechanism - * and read the target's characters directly if they're offered - * as such, we simply ignore the target's encoding assertion. - */ - - //************************************************************ - // Data - - /** The Writer we convey. */ - private StringWriter sw = new StringWriter(); - - /** A buffer, alternatively, to accumulate bytes. */ - private ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - /** A ServletOutputStream we convey, tied to this Writer. */ - private ServletOutputStream sos = new ServletOutputStream() { - @Override - public boolean isReady() { - return false; - } - - @Override - public void setWriteListener(WriteListener writeListener) { - - } - - public void write(int b) throws IOException { - bos.write(b); - } - - public void flush() throws IOException { - pageContext.getOut().write(getString()); - bos.reset(); - } - }; - - /** 'True' if getWriter() was called; false otherwise. */ - private boolean isWriterUsed; - - /** 'True if getOutputStream() was called; false otherwise. */ - private boolean isStreamUsed; - - /** The HTTP status set by the target. */ - private int status = 200; - - private PageContext pageContext; - - //************************************************************ - // Constructor and methods - - /** Constructs a new ImportResponseWrapper. */ - public ImportResponseWrapper(PageContext pageContext) { - super((HttpServletResponse)pageContext.getResponse()); - this.pageContext = pageContext; - } - - /** Returns a Writer designed to buffer the output. */ - public PrintWriter getWriter() throws IOException { - if (isStreamUsed) - throw new IllegalStateException( - Resources.getMessage("IMPORT_ILLEGAL_STREAM")); - isWriterUsed = true; - return new PrintWriter(sw); - } - - /** Returns a ServletOutputStream designed to buffer the output. */ - public ServletOutputStream getOutputStream() { - if (isWriterUsed) - throw new IllegalStateException( - Resources.getMessage("IMPORT_ILLEGAL_WRITER")); - isStreamUsed = true; - return sos; - } - - /** Has no effect. */ - public void setContentType(String x) { - // ignore - } - - /** Has no effect. */ - public void setLocale(Locale x) { - // ignore - } - - public void setStatus(int status) { - this.status = status; - } - - public int getStatus() { - return status; - } - - /** - * Retrieves the buffered output, using the containing tag's - * 'charEncoding' attribute, or the tag's default encoding, - * if necessary. - */ - // not simply toString() because we need to throw - // UnsupportedEncodingException - public String getString() throws UnsupportedEncodingException { - if (isWriterUsed) - return sw.toString(); - else if (isStreamUsed) { - if (charEncoding != null && !charEncoding.equals("")) - return bos.toString(charEncoding); - else - return bos.toString(DEFAULT_ENCODING); - } else - return ""; // target didn't write anything - } - } - - //********************************************************************* - // Some private utility methods - - /** Returns our URL (potentially with parameters) */ - private String targetUrl() { - if (urlWithParams == null) - urlWithParams = params.aggregateParams(url); - return urlWithParams; - } - - /** - * Returns true if our current URL is absolute, - * false otherwise. - */ - private boolean isAbsoluteUrl() throws JspTagException { - return isAbsoluteUrl(url); - } - - - //********************************************************************* - // Public utility methods - - /** - * Returns true if our current URL is absolute, - * false otherwise. - */ - public static boolean isAbsoluteUrl(String url) { - // a null URL is not absolute, by our definition - if (url == null) - return false; - - // do a fast, simple check first - int colonPos; - if ((colonPos = url.indexOf(":")) == -1) - return false; - - // if we DO have a colon, make sure that every character - // leading up to it is a valid scheme character - for (int i = 0; i < colonPos; i++) - if (VALID_SCHEME_CHARS.indexOf(url.charAt(i)) == -1) - return false; - - // if so, we've got an absolute url - return true; - } - - /** - * Strips a servlet session ID from url. The session ID - * is encoded as a URL "path parameter" beginning with "jsessionid=". - * We thus remove anything we find between ";jsessionid=" (inclusive) - * and either EOS or a subsequent ';' (exclusive). - */ - public static String stripSession(String url) { - StringBuilder u = new StringBuilder(url); - int sessionStart; - while ((sessionStart = u.toString().indexOf(";jsessionid=")) != -1) { - int sessionEnd = u.toString().indexOf(";", sessionStart + 1); - if (sessionEnd == -1) - sessionEnd = u.toString().indexOf("?", sessionStart + 1); - if (sessionEnd == -1) // still - sessionEnd = u.length(); - u.delete(sessionStart, sessionEnd); - } - return u.toString(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/NullAttributeException.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/NullAttributeException.java deleted file mode 100644 index 55e67c4..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/NullAttributeException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

NullAttributeException is a JspTagException that will be thrown - * by the JSTL RI handlers when a tag attribute illegally evaluates - * to 'null'.

- * - * @author Shawn Bayern - */ - -public class NullAttributeException extends JspTagException { - - /** - * Constructs a NullAttributeException with appropriate information. - * - * @param tag The name of the tag in which the error occurred. - * @param att The attribute value for which the error occurred. - */ - public NullAttributeException(String tag, String att) { - super(Resources.getMessage("TAG_NULL_ATTRIBUTE", att, tag)); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OtherwiseTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OtherwiseTag.java deleted file mode 100644 index 44526ee..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OtherwiseTag.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - - -/** - *

Tag handler for <otherwise> in JSTL.

- * - * @author Shawn Bayern - */ - -public class OtherwiseTag extends WhenTagSupport { - - /* - * is just a that always tries to evaluate its body - * if it has permission from its parent tag. - */ - - // Don't let the condition stop us... :-) - protected boolean condition() { - return true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OutSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OutSupport.java deleted file mode 100644 index df279a9..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/OutSupport.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.io.IOException; -import java.io.Reader; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspWriter; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -/** - *

Support for handlers of the <out> tag, which simply evalutes and - * prints the result of the expression it's passed. If the result is - * null, we print the value of the 'default' attribute's expression or - * our body (which two are mutually exclusive, although this constraint - * is enforced outside this handler, in our TagLibraryValidator).

- * - * @author Shawn Bayern - */ -public class OutSupport extends BodyTagSupport { - - /* - * (One almost wishes XML and JSP could support "anonymous tags," - * given the amount of trouble we had naming this one!) :-) - sb - */ - - //********************************************************************* - // Internal state - - protected Object value; // tag attribute - protected String def; // tag attribute - protected boolean escapeXml; // tag attribute - private boolean needBody; // non-space body needed? - - //********************************************************************* - // Construction and initialization - - /** - * Constructs a new handler. As with TagSupport, subclasses should - * not provide other constructors and are expected to call the - * superclass constructor. - */ - public OutSupport() { - super(); - init(); - } - - // resets local state - private void init() { - value = def = null; - escapeXml = true; - needBody = false; - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates 'value' and determines if the body should be evaluted - public int doStartTag() throws JspException { - - needBody = false; // reset state related to 'default' - this.bodyContent = null; // clean-up body (just in case container is pooling tag handlers) - - try { - // print value if available; otherwise, try 'default' - if (value != null) { - out(pageContext, escapeXml, value); - return SKIP_BODY; - } else { - // if we don't have a 'default' attribute, just go to the body - if (def == null) { - needBody = true; - return EVAL_BODY_BUFFERED; - } - - // if we do have 'default', print it - if (def != null) { - // good 'default' - out(pageContext, escapeXml, def); - } - return SKIP_BODY; - } - } catch (IOException ex) { - throw new JspException(ex.toString(), ex); - } - } - - // prints the body if necessary; reports errors - public int doEndTag() throws JspException { - try { - if (!needBody) - return EVAL_PAGE; // nothing more to do - - // trim and print out the body - if (bodyContent != null && bodyContent.getString() != null) - out(pageContext, escapeXml, bodyContent.getString().trim()); - return EVAL_PAGE; - } catch (IOException ex) { - throw new JspException(ex.toString(), ex); - } - } - - - //********************************************************************* - // Public utility methods - - /** - * Outputs text to pageContext's current JspWriter. - * If escapeXml is true, performs the following substring - * replacements (to facilitate output to XML/HTML pages): - * - * {@literal &} -{@literal >} {@literal &} - * {@literal <} -{@literal >} {@literal <} - * {@literal >} -{@literal >} {@literal >} - * {@literal "} -{@literal >} {@literal "} - * {@literal '} -{@literal >} {@literal '} - * - * See also Util.escapeXml(). - */ - public static void out(PageContext pageContext, - boolean escapeXml, - Object obj) throws IOException { - JspWriter w = pageContext.getOut(); - if (!escapeXml) { - // write chars as is - if (obj instanceof Reader) { - Reader reader = (Reader)obj; - char[] buf = new char[4096]; - int count; - while ((count=reader.read(buf, 0, 4096)) != -1) { - w.write(buf, 0, count); - } - } else { - w.write(obj.toString()); - } - } else { - // escape XML chars - if (obj instanceof Reader) { - Reader reader = (Reader)obj; - char[] buf = new char[4096]; - int count; - while ((count = reader.read(buf, 0, 4096)) != -1) { - writeEscapedXml(buf, count, w); - } - } else { - String text = obj.toString(); - writeEscapedXml(text.toCharArray(), text.length(), w); - } - } - } - - /** - * - * Optimized to create no extra objects and write directly - * to the JspWriter using blocks of escaped and unescaped characters - * - */ - private static void writeEscapedXml(char[] buffer, int length, JspWriter w) throws IOException{ - int start = 0; - - for (int i = 0; i < length; i++) { - char c = buffer[i]; - if (c <= Util.HIGHEST_SPECIAL) { - char[] escaped = Util.specialCharactersRepresentation[c]; - if (escaped != null) { - // add unescaped portion - if (start < i) { - w.write(buffer,start,i-start); - } - // add escaped xml - w.write(escaped); - start = i + 1; - } - } - } - // add rest of unescaped portion - if (start < length) { - w.write(buffer,start,length-start); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamParent.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamParent.java deleted file mode 100644 index 503d94a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamParent.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -/** - *

Interface for tag handlers implementing valid parent tags for - * <c:param>.

- * - * @author Shawn Bayern - */ - -public interface ParamParent { - - /** - * Adds a parameter to this tag's URL. The intent is that the - * <param> subtag will call this to register URL parameters. - * Assumes that 'name' and 'value' are appropriately encoded and do - * not contain any meaningful metacharacters; in order words, escaping - * is the responsibility of the caller. - * - * @see ParamSupport - */ - void addParameter(String name, String value); - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamSupport.java deleted file mode 100644 index 2b25f8f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ParamSupport.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.util.LinkedList; -import java.util.List; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for tag handlers for <param>, the URL parameter - * subtag for <import> in JSTL 1.0.

- * - * @see ParamParent - * @see ImportSupport - * @see UrlSupport - * @author Shawn Bayern - */ - -public abstract class ParamSupport extends BodyTagSupport { - - //********************************************************************* - // Protected state - - protected String name; // 'name' attribute - protected String value; // 'value' attribute - - /** - * There used to be an 'encode' attribute; I've left this as a - * vestige in case custom subclasses want to use our functionality - * but NOT encode parameters. - */ - protected boolean encode = true; - - //********************************************************************* - // Constructor and initialization - - public ParamSupport() { - super(); - init(); - } - - private void init() { - name = value = null; - } - - //********************************************************************* - // Tag logic - - // simply send our name and value to our appropriate ancestor - public int doEndTag() throws JspException { - Tag t = findAncestorWithClass(this, ParamParent.class); - if (t == null) - throw new JspTagException( - Resources.getMessage("PARAM_OUTSIDE_PARENT")); - - // take no action for null or empty names - if (name == null || name.equals("")) - return EVAL_PAGE; - - // send the parameter to the appropriate ancestor - ParamParent parent = (ParamParent) t; - String value = this.value; - if (value == null) { - if (bodyContent == null || bodyContent.getString() == null) - value = ""; - else - value = bodyContent.getString().trim(); - } - if (encode) { - // FIXME: revert to java.net.URLEncoder.encode(s, enc) once - // we have a dependency on J2SE 1.4+. - String enc = pageContext.getResponse().getCharacterEncoding(); - parent.addParameter( - Util.URLEncode(name, enc), Util.URLEncode(value, enc)); - } else { - parent.addParameter(name, value); - } - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - //********************************************************************* - // Support for parameter management - - /** - * Provides support for aggregating query parameters in URLs. - * Specifically, accepts a series of parameters, ensuring that - * - newer parameters will precede older ones in the output URL - * - all supplied parameters precede those in the input URL - */ - public static class ParamManager { - - //********************************* - // Private state - - private List names = new LinkedList<>(); - private List values = new LinkedList<>(); - private boolean done = false; - - //********************************* - // Public interface - - /** Adds a new parameter to the list. */ - public void addParameter(String name, String value) { - if (done) - throw new IllegalStateException(); - if (name != null) { - names.add(name); - if (value != null) { - values.add(value); - } else { - values.add(""); - } - } - } - - /** - * Produces a new URL with the stored parameters, in the appropriate - * order. - */ - public String aggregateParams(String url) { - /* - * Since for efficiency we're destructive to the param lists, - * we don't want to run multiple times. - */ - if (done) - throw new IllegalStateException(); - done = true; - - //// reverse the order of our two lists - // Collections.reverse(this.names); - // Collections.reverse(this.values); - - // build a string from the parameter list - StringBuffer newParams = new StringBuffer(); - for (int i = 0; i < names.size(); i++) { - newParams.append(names.get(i)).append("=").append(values.get(i)); - if (i < (names.size() - 1)) - newParams.append("&"); - } - - // insert these parameters into the URL as appropriate - if (newParams.length() > 0) { - int questionMark = url.indexOf('?'); - if (questionMark == -1) { - return (url + "?" + newParams); - } else { - StringBuilder workingUrl = new StringBuilder(url); - workingUrl.insert(questionMark + 1, (newParams + "&")); - return workingUrl.toString(); - } - } else { - return url; - } - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RedirectSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RedirectSupport.java deleted file mode 100644 index 6ca14e1..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RedirectSupport.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -/** - *

Support for tag handlers for <redirect>, JSTL 1.0's tag - * for redirecting to a new URL (with optional query parameters).

- * - * @author Shawn Bayern - */ - -public abstract class RedirectSupport extends BodyTagSupport - implements ParamParent { - - //********************************************************************* - // Protected state - - protected String url; // 'url' attribute - protected String context; // 'context' attribute - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // processed 'scope' attr - private ParamSupport.ParamManager params; // added parameters - - //********************************************************************* - // Constructor and initialization - - public RedirectSupport() { - super(); - init(); - } - - private void init() { - url = var = null; - params = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Collaboration with subtags - - // inherit Javadoc - public void addParameter(String name, String value) { - params.addParameter(name, value); - } - - - //********************************************************************* - // Tag logic - - // resets any parameters that might be sent - public int doStartTag() throws JspException { - params = new ParamSupport.ParamManager(); - return EVAL_BODY_BUFFERED; - } - - - // gets the right value, encodes it, and prints or stores it - public int doEndTag() throws JspException { - String result; // the eventual result - - // add (already encoded) parameters - String baseUrl = UrlSupport.resolveUrl(url, context, pageContext); - result = params.aggregateParams(baseUrl); - - // if the URL is relative, rewrite it with 'redirect' encoding rules - HttpServletResponse response = - ((HttpServletResponse) pageContext.getResponse()); - if (!ImportSupport.isAbsoluteUrl(result)) - result = response.encodeRedirectURL(result); - - // redirect! - try { - response.sendRedirect(result); - } catch (java.io.IOException ex) { - throw new JspTagException(ex.toString(), ex); - } - - return SKIP_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RemoveTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RemoveTag.java deleted file mode 100644 index 2a2bea6..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/RemoveTag.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.TagSupport; - -/** - *

A handler for the <remove> tag, which removes the variable - * identified by 'var' (and 'scope', if present). - * - * @author Shawn Bayern - */ -public class RemoveTag extends TagSupport { - - //********************************************************************* - // Constants - - /* We support these 'scopes'. */ - - private final String APPLICATION = "application"; - private final String SESSION = "session"; - private final String REQUEST = "request"; - private final String PAGE = "page"; - - //********************************************************************* - // Internal state - - private int scope; // tag attribute - private boolean scopeSpecified; // ... by tag attribute - private String var; // tag attribute - - - //********************************************************************* - // Construction and initialization - - /** - * Constructs a new handler. As with TagSupport, subclasses should - * not provide other constructors and are expected to call the - * superclass constructor. - */ - public RemoveTag() { - super(); - init(); - } - - // resets local state - private void init() { - var = null; - scope = PageContext.PAGE_SCOPE; - scopeSpecified = false; - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Tag logic - - // removes the variable (from a specific scope, if specified) - public int doEndTag() throws JspException { - if (!scopeSpecified) - pageContext.removeAttribute(var); - else - pageContext.removeAttribute(var, scope); - return EVAL_PAGE; - } - - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setVar(String var) { - this.var = var; - } - - // for tag attribute - public void setScope(String scope) { - this.scope = Util.getScope(scope); - scopeSpecified = true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java deleted file mode 100644 index 1d06171..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Map; - -import jakarta.el.ExpressionFactory; -import jakarta.el.ValueExpression; -import jakarta.el.VariableMapper; -import jakarta.el.ELException; - -import jakarta.servlet.jsp.JspApplicationContext; -import jakarta.servlet.jsp.JspFactory; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for handlers of the <set> tag.

- * - * @author Shawn Bayern - */ -public class SetSupport extends BodyTagSupport { - - //********************************************************************* - // Internal state - - protected Object value; // tag attribute - protected boolean valueSpecified; // status - protected Object target; // tag attribute - protected String property; // tag attribute - private String var; // tag attribute - private int scope; // tag attribute - private boolean scopeSpecified; // status - - //********************************************************************* - // Construction and initialization - - /** - * Constructs a new handler. As with TagSupport, subclasses should - * not provide other constructors and are expected to call the - * superclass constructor. - */ - public SetSupport() { - super(); - init(); - } - - // resets local state - private void init() { - value = var = null; - scopeSpecified = valueSpecified = false; - scope = PageContext.PAGE_SCOPE; - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - - Object result; // what we'll store in scope:var - - // determine the value by... - if (value != null) { - // ... reading our attribute - result = value; - } else if (valueSpecified) { - // ... accepting an explicit null - result = null; - } else { - // ... retrieving and trimming our body - if (bodyContent == null || bodyContent.getString() == null) - result = ""; - else - result = bodyContent.getString().trim(); - } - - // decide what to do with the result - if (var != null) { - - /* - * Store the result, letting an IllegalArgumentException - * propagate back if the scope is invalid (e.g., if an attempt - * is made to store something in the session without any - * HttpSession existing). - */ - if (result != null) { - if (result instanceof ValueExpression) { - if (scope != PageContext.PAGE_SCOPE) { - throw new JspException( - Resources.getMessage("SET_BAD_SCOPE_DEFERRED")); - } - VariableMapper vm = - pageContext.getELContext().getVariableMapper(); - if (vm != null) { - vm.setVariable(var, (ValueExpression)result); - } - } else { - // Make sure to clear any previous mapping for this - // variable in the variable mapper. - if (scope == PageContext.PAGE_SCOPE) { - VariableMapper vm = - pageContext.getELContext().getVariableMapper(); - if (vm != null) { - vm.setVariable(var, null); - } - } - pageContext.setAttribute(var, result, scope); - } - } else { - if (scopeSpecified) - pageContext.removeAttribute(var, scope); - else - pageContext.removeAttribute(var); - - if (scope == PageContext.PAGE_SCOPE) { - VariableMapper vm = - pageContext.getELContext().getVariableMapper(); - if (vm != null) { - vm.setVariable(var, null); - } - } - } - - } else if (target != null) { - - // save the result to target.property - if (target instanceof Map) { - // ... treating it as a Map entry - if (result == null) - ((Map) target).remove(property); - else - ((Map) target).put(property, result); - } else { - // ... treating it as a bean property - try { - PropertyDescriptor pd[] = - Introspector.getBeanInfo(target.getClass()) - .getPropertyDescriptors(); - boolean succeeded = false; - for (int i = 0; i < pd.length; i++) { - if (pd[i].getName().equals(property)) { - Method m = pd[i].getWriteMethod(); - if (m == null) { - throw new JspException( - Resources.getMessage("SET_NO_SETTER_METHOD", - property)); - } - if (result != null) { - try { - m.invoke(target, - new Object[] { - convertToExpectedType(result, m.getParameterTypes()[0])}); - } catch (jakarta.el.ELException ex) { - throw new JspTagException(ex); - } - } else { - m.invoke(target, new Object[] { null }); - } - succeeded = true; - } - } - if (!succeeded) { - throw new JspTagException( - Resources.getMessage("SET_INVALID_PROPERTY", - property)); - } - } catch (IllegalAccessException ex) { - throw new JspException(ex); - } catch (IntrospectionException ex) { - throw new JspException(ex); - } catch (InvocationTargetException ex) { - throw new JspException(ex); - } - } - } else { - // should't ever occur because of validation in TLV and setters - throw new JspTagException(); - } - - return EVAL_PAGE; - } - - /** - * Convert an object to an expected type according to the conversion - * rules of the Expression Language. - */ - private Object convertToExpectedType( final Object value, - Class expectedType ) { - - JspFactory jspFactory = JspFactory.getDefaultFactory(); - JspApplicationContext jspAppContext = - jspFactory.getJspApplicationContext(pageContext.getServletContext()); - ExpressionFactory exprFactory = jspAppContext.getExpressionFactory(); - return exprFactory.coerceToType(value, expectedType); - } - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setVar(String var) { - this.var = var; - } - - // for tag attribute - public void setScope(String scope) { - this.scope = Util.getScope(scope); - this.scopeSpecified = true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/UrlSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/UrlSupport.java deleted file mode 100644 index dc83e3b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/UrlSupport.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for tag handlers for <url>, the URL creation - * and rewriting tag in JSTL 1.0.

- * - * @author Shawn Bayern - */ - -public abstract class UrlSupport extends BodyTagSupport - implements ParamParent { - - //********************************************************************* - // Protected state - - protected String value; // 'value' attribute - protected String context; // 'context' attribute - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // processed 'scope' attr - private ParamSupport.ParamManager params; // added parameters - - //********************************************************************* - // Constructor and initialization - - public UrlSupport() { - super(); - init(); - } - - private void init() { - value = var = null; - params = null; - context = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Collaboration with subtags - - // inherit Javadoc - public void addParameter(String name, String value) { - params.addParameter(name, value); - } - - - //********************************************************************* - // Tag logic - - // resets any parameters that might be sent - public int doStartTag() throws JspException { - params = new ParamSupport.ParamManager(); - return EVAL_BODY_BUFFERED; - } - - - // gets the right value, encodes it, and prints or stores it - public int doEndTag() throws JspException { - String result; // the eventual result - - // add (already encoded) parameters - String baseUrl = resolveUrl(value, context, pageContext); - result = params.aggregateParams(baseUrl); - - // if the URL is relative, rewrite it - if (!ImportSupport.isAbsoluteUrl(result)) { - HttpServletResponse response = - ((HttpServletResponse) pageContext.getResponse()); - result = response.encodeURL(result); - } - - // store or print the output - if (var != null) - pageContext.setAttribute(var, result, scope); - else { - try { - pageContext.getOut().print(result); - } catch (java.io.IOException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - //********************************************************************* - // Utility methods - - public static String resolveUrl( - String url, String context, PageContext pageContext) - throws JspException { - // don't touch absolute URLs - if (ImportSupport.isAbsoluteUrl(url)) - return url; - - // normalize relative URLs against a context root - HttpServletRequest request = - (HttpServletRequest) pageContext.getRequest(); - if (context == null) { - if (url.startsWith("/")) - return (request.getContextPath() + url); - else - return url; - } else { - if (!context.startsWith("/") || !url.startsWith("/")) { - throw new JspTagException( - Resources.getMessage("IMPORT_BAD_RELATIVE")); - } - if (context.equals("/")) { - // Don't produce string starting with '//', many - // browsers interpret this as host name, not as - // path on same host. - return url; - } else { - return (context + url); - } - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java deleted file mode 100644 index 0ceb9b2..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.text.DateFormat; -import java.util.Enumeration; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Utilities in support of tag-handler classes.

- * - * @author Jan Luehe - */ -public class Util { - - private static final String REQUEST = "request"; - private static final String SESSION = "session"; - private static final String APPLICATION = "application"; - private static final String DEFAULT = "default"; - private static final String SHORT = "short"; - private static final String MEDIUM = "medium"; - private static final String LONG = "long"; - private static final String FULL = "full"; - - public static final int HIGHEST_SPECIAL = '>'; - public static char[][] specialCharactersRepresentation = new char[HIGHEST_SPECIAL + 1][]; - static { - specialCharactersRepresentation['&'] = "&".toCharArray(); - specialCharactersRepresentation['<'] = "<".toCharArray(); - specialCharactersRepresentation['>'] = ">".toCharArray(); - specialCharactersRepresentation['"'] = """.toCharArray(); - specialCharactersRepresentation['\''] = "'".toCharArray(); - } - - /* - * Converts the given string description of a scope to the corresponding - * PageContext constant. - * - * The validity of the given scope has already been checked by the - * appropriate TLV. - * - * @param scope String description of scope - * - * @return PageContext constant corresponding to given scope description - */ - public static int getScope(String scope) { - int ret = PageContext.PAGE_SCOPE; // default - - if (REQUEST.equalsIgnoreCase(scope)) - ret = PageContext.REQUEST_SCOPE; - else if (SESSION.equalsIgnoreCase(scope)) - ret = PageContext.SESSION_SCOPE; - else if (APPLICATION.equalsIgnoreCase(scope)) - ret = PageContext.APPLICATION_SCOPE; - - return ret; - } - - /* - * Converts the given string description of a formatting style for - * dates and times to the corresponding java.util.DateFormat constant. - * - * @param style String description of formatting style for dates and times - * @param errCode Error code to throw if given style is invalid - * - * @return java.util.DateFormat constant corresponding to given style - * - * @throws JspException if the given style is invalid - */ - public static int getStyle(String style, String errCode) - throws JspException { - int ret = DateFormat.DEFAULT; - - if (style != null) { - if (DEFAULT.equalsIgnoreCase(style)) { - ret = DateFormat.DEFAULT; - } else if (SHORT.equalsIgnoreCase(style)) { - ret = DateFormat.SHORT; - } else if (MEDIUM.equalsIgnoreCase(style)) { - ret = DateFormat.MEDIUM; - } else if (LONG.equalsIgnoreCase(style)) { - ret = DateFormat.LONG; - } else if (FULL.equalsIgnoreCase(style)) { - ret = DateFormat.FULL; - } else { - throw new JspException(Resources.getMessage(errCode, style)); - } - } - - return ret; - } - - - - /** - * Performs the following substring replacements - * (to facilitate output to XML/HTML pages): - * - * {@literal &} -{@literal >} {@literal &} - * {@literal <} -{@literal >} {@literal <} - * {@literal >} -{@literal >} {@literal >} - * {@literal "} -{@literal >} {@literal "} - * {@literal '} -{@literal >} {@literal '} - * - * See also OutSupport.writeEscapedXml(). - */ - public static String escapeXml(String buffer) { - int start = 0; - int length = buffer.length(); - char[] arrayBuffer = buffer.toCharArray(); - StringBuffer escapedBuffer = null; - - for (int i = 0; i < length; i++) { - char c = arrayBuffer[i]; - if (c <= HIGHEST_SPECIAL) { - char[] escaped = specialCharactersRepresentation[c]; - if (escaped != null) { - // create StringBuffer to hold escaped xml string - if (start == 0) { - escapedBuffer = new StringBuffer(length + 5); - } - // add unescaped portion - if (start < i) { - escapedBuffer.append(arrayBuffer,start,i-start); - } - start = i + 1; - // add escaped xml - escapedBuffer.append(escaped); - } - } - } - // no xml escaping was necessary - if (start == 0) { - return buffer; - } - // add rest of unescaped portion - if (start < length) { - escapedBuffer.append(arrayBuffer,start,length-start); - } - return escapedBuffer.toString(); - } - - /** - * Get the value associated with a content-type attribute. - * Syntax defined in RFC 2045, section 5.1. - */ - public static String getContentTypeAttribute(String input, String name) { - int begin; - int end; - int index = input.toUpperCase().indexOf(name.toUpperCase()); - if (index == -1) return null; - index = index + name.length(); // positioned after the attribute name - index = input.indexOf('=', index); // positioned at the '=' - if (index == -1) return null; - index += 1; // positioned after the '=' - input = input.substring(index).trim(); - - if (input.charAt(0) == '"') { - // attribute value is a quoted string - begin = 1; - end = input.indexOf('"', begin); - if (end == -1) return null; - } else { - begin = 0; - end = input.indexOf(';'); - if (end == -1) end = input.indexOf(' '); - if (end == -1) end = input.length(); - } - return input.substring(begin, end).trim(); - } - - /** - * URL encodes a string, based on the supplied character encoding. - * This performs the same function as java.next.URLEncode.encode - * in J2SDK1.4, and should be removed if the only platform supported - * is 1.4 or higher. - * @param s The String to be URL encoded. - * @param enc The character encoding - * @return The URL encoded String - * [taken from jakarta-tomcat-jasper/jasper2 - * org.apache.jasper.runtime.JspRuntimeLibrary.java] - */ - public static String URLEncode(String s, String enc) { - - if (s == null) { - return "null"; - } - - if (enc == null) { - enc = "UTF-8"; // Is this right? - } - - StringBuilder out = new StringBuilder(s.length()); - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - OutputStreamWriter writer = null; - try { - writer = new OutputStreamWriter(buf, enc); - } catch (java.io.UnsupportedEncodingException ex) { - // Use the default encoding? - writer = new OutputStreamWriter(buf); - } - - for (int i = 0; i < s.length(); i++) { - int c = s.charAt(i); - if (c == ' ') { - out.append('+'); - } else if (isSafeChar(c)) { - out.append((char)c); - } else { - // convert to external encoding before hex conversion - try { - writer.write(c); - writer.flush(); - } catch(IOException e) { - buf.reset(); - continue; - } - byte[] ba = buf.toByteArray(); - for (int j = 0; j < ba.length; j++) { - out.append('%'); - // Converting each byte in the buffer - out.append(Character.forDigit((ba[j]>>4) & 0xf, 16)); - out.append(Character.forDigit(ba[j] & 0xf, 16)); - } - buf.reset(); - } - } - return out.toString(); - } - - private static boolean isSafeChar(int c) { - if (c >= 'a' && c <= 'z') { - return true; - } - if (c >= 'A' && c <= 'Z') { - return true; - } - if (c >= '0' && c <= '9') { - return true; - } - if (c == '-' || c == '_' || c == '.' || c == '!' || - c == '~' || c == '*' || c == '\'' || c == '(' || c == ')') { - return true; - } - return false; - } - - /** - * HttpServletRequest.getLocales() returns the server's default locale - * if the request did not specify a preferred language. - * We do not want this behavior, because it prevents us from using - * the fallback locale. - * We therefore need to return an empty Enumeration if no preferred - * locale has been specified. This way, the logic for the fallback - * locale will be able to kick in. - */ - public static Enumeration getRequestLocales(HttpServletRequest request) { - Enumeration values = request.getHeaders("accept-language"); - if (values.hasMoreElements()) { - // At least one "accept-language". Simply return - // the enumeration returned by request.getLocales(). - // System.out.println("At least one accept-language"); - return request.getLocales(); - } else { - // No header for "accept-language". Simply return - // the empty enumeration. - // System.out.println("No accept-language"); - return values; - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/WhenTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/WhenTagSupport.java deleted file mode 100644 index 6efb447..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/WhenTagSupport.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.ConditionalTagSupport; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

WhenTagSupport is an abstract class that facilitates - * implementation of <when>-style tags in both the rtexprvalue - * and expression-evaluating libraries. It also supports - * <otherwise>.

- * - *

In particular, this base class does the following:

- * - *
    - *
  • overrides ConditionalTagSupport.doStartTag() to implement the - * appropriate semantics of subtags of <choose>
  • - *
- * - * @author Shawn Bayern - */ -public abstract class WhenTagSupport extends ConditionalTagSupport -{ - //********************************************************************* - // Implementation of exclusive-conditional behavior - - /* - * Includes its body if condition() evalutes to true AND its parent - * ChooseTag wants it to do so. The condition will not even be - * evaluated if ChooseTag instructs us not to run. - */ - public int doStartTag() throws JspException { - - Tag parent; - - // make sure we're contained properly - if (!((parent = getParent()) instanceof ChooseTag)) - throw new JspTagException( - Resources.getMessage("WHEN_OUTSIDE_CHOOSE")); - - // make sure our parent wants us to continue - if (!((ChooseTag) parent).gainPermission()) - return SKIP_BODY; // we've been reeled in - - // handle conditional behavior - if (condition()) { - ((ChooseTag) parent).subtagSucceeded(); - return EVAL_BODY_INCLUDE; - } else - return SKIP_BODY; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java deleted file mode 100644 index 62c4a52..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.core.Config; -import jakarta.servlet.jsp.jstl.fmt.LocalizationContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <bundle>, the resource bundle loading - * tag in JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class BundleSupport extends BodyTagSupport { - - - //********************************************************************* - // Private constants - - private static final Locale EMPTY_LOCALE = new Locale("", ""); - - - //********************************************************************* - // Protected state - - protected String basename; // 'basename' attribute - protected String prefix; // 'prefix' attribute - - - //********************************************************************* - // Private state - - private LocalizationContext locCtxt; - - - //********************************************************************* - // Constructor and initialization - - public BundleSupport() { - super(); - init(); - } - - private void init() { - basename = prefix = null; - locCtxt = null; - } - - - //********************************************************************* - // Collaboration with subtags - - public LocalizationContext getLocalizationContext() { - return locCtxt; - } - - public String getPrefix() { - return prefix; - } - - - //********************************************************************* - // Tag logic - - public int doStartTag() throws JspException { - locCtxt = getLocalizationContext(pageContext, basename); - return EVAL_BODY_BUFFERED; - } - - public int doEndTag() throws JspException { - if (bodyContent != null) { - try { - pageContext.getOut().print(bodyContent.getString()); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Public utility methods - - /** - * Gets the default I18N localization context. - * - * @param pc Page in which to look up the default I18N localization context - */ - public static LocalizationContext getLocalizationContext(PageContext pc) { - LocalizationContext locCtxt = null; - - Object obj = Config.find(pc, Config.FMT_LOCALIZATION_CONTEXT); - if (obj == null) { - return null; - } - - if (obj instanceof LocalizationContext) { - locCtxt = (LocalizationContext) obj; - } else { - // localization context is a bundle basename - locCtxt = getLocalizationContext(pc, (String) obj); - } - - return locCtxt; - } - - /** - * Gets the resource bundle with the given base name, whose locale is - * determined as follows: - * - * Check if a match exists between the ordered set of preferred - * locales and the available locales, for the given base name. - * The set of preferred locales consists of a single locale - * (if the jakarta.servlet.jsp.jstl.fmt.locale configuration - * setting is present) or is equal to the client's preferred locales - * determined from the client's browser settings. - * - *

If no match was found in the previous step, check if a match - * exists between the fallback locale (given by the - * jakarta.servlet.jsp.jstl.fmt.fallbackLocale configuration - * setting) and the available locales, for the given base name. - * - * @param pc Page in which the resource bundle with the - * given base name is requested - * @param basename Resource bundle base name - * - * @return Localization context containing the resource bundle with the - * given base name and the locale that led to the resource bundle match, - * or the empty localization context if no resource bundle match was found - */ - public static LocalizationContext getLocalizationContext(PageContext pc, - String basename) { - LocalizationContext locCtxt = null; - ResourceBundle bundle = null; - - if ((basename == null) || basename.equals("")) { - return new LocalizationContext(); - } - - // Try preferred locales - Locale pref = SetLocaleSupport.getLocale(pc, Config.FMT_LOCALE); - if (pref != null) { - // Preferred locale is application-based - bundle = findMatch(basename, pref); - if (bundle != null) { - locCtxt = new LocalizationContext(bundle, pref); - } - } else { - // Preferred locales are browser-based - locCtxt = findMatch(pc, basename); - } - - if (locCtxt == null) { - // No match found with preferred locales, try using fallback locale - pref = SetLocaleSupport.getLocale(pc, Config.FMT_FALLBACK_LOCALE); - if (pref != null) { - bundle = findMatch(basename, pref); - if (bundle != null) { - locCtxt = new LocalizationContext(bundle, pref); - } - } - } - - if (locCtxt == null) { - // try using the root resource bundle with the given basename - try { - bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE, - Thread.currentThread().getContextClassLoader()); - if (bundle != null) { - locCtxt = new LocalizationContext(bundle, null); - } - } catch (MissingResourceException mre) { - // do nothing - } - } - - if (locCtxt != null) { - // set response locale - if (locCtxt.getLocale() != null) { - SetLocaleSupport.setResponseLocale(pc, locCtxt.getLocale()); - } - } else { - // create empty localization context - locCtxt = new LocalizationContext(); - } - - return locCtxt; - } - - - //********************************************************************* - // Private utility methods - - /* - * Determines the client's preferred locales from the request, and compares - * each of the locales (in order of preference) against the available - * locales in order to determine the best matching locale. - * - * @param pageContext the page in which the resource bundle with the - * given base name is requested - * @param basename the resource bundle's base name - * - * @return the localization context containing the resource bundle with - * the given base name and best matching locale, or null if no - * resource bundle match was found - */ - private static LocalizationContext findMatch(PageContext pageContext, - String basename) { - LocalizationContext locCtxt = null; - - // Determine locale from client's browser settings. - - for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest()); - enum_.hasMoreElements(); ) { - Locale pref = (Locale) enum_.nextElement(); - ResourceBundle match = findMatch(basename, pref); - if (match != null) { - locCtxt = new LocalizationContext(match, pref); - break; - } - } - - return locCtxt; - } - - /* - * Gets the resource bundle with the given base name and preferred locale. - * - * This method calls java.util.ResourceBundle.getBundle(), but ignores - * its return value unless its locale represents an exact or language match - * with the given preferred locale. - * - * @param basename the resource bundle base name - * @param pref the preferred locale - * - * @return the requested resource bundle, or null if no resource - * bundle with the given base name exists or if there is no exact- or - * language-match between the preferred locale and the locale of - * the bundle returned by java.util.ResourceBundle.getBundle(). - */ - private static ResourceBundle findMatch(String basename, Locale pref) { - ResourceBundle match = null; - - try { - ResourceBundle bundle = - ResourceBundle.getBundle(basename, pref, - Thread.currentThread().getContextClassLoader()); - Locale avail = bundle.getLocale(); - if (pref.equals(avail)) { - // Exact match - match = bundle; - } else { - /* - * We have to make sure that the match we got is for - * the specified locale. The way ResourceBundle.getBundle() - * works, if a match is not found with (1) the specified locale, - * it tries to match with (2) the current default locale as - * returned by Locale.getDefault() or (3) the root resource - * bundle (basename). - * We must ignore any match that could have worked with (2) or (3). - * So if an exact match is not found, we make the following extra - * tests: - * - avail locale must be equal to preferred locale - * - avail country must be empty or equal to preferred country - * (the equality match might have failed on the variant) - */ - if (pref.getLanguage().equals(avail.getLanguage()) - && ("".equals(avail.getCountry()) || pref.getCountry().equals(avail.getCountry()))) { - /* - * Language match. - * By making sure the available locale does not have a - * country and matches the preferred locale's language, we - * rule out "matches" based on the container's default - * locale. For example, if the preferred locale is - * "en-US", the container's default locale is "en-UK", and - * there is a resource bundle (with the requested base - * name) available for "en-UK", ResourceBundle.getBundle() - * will return it, but even though its language matches - * that of the preferred locale, we must ignore it, - * because matches based on the container's default locale - * are not portable across different containers with - * different default locales. - */ - match = bundle; - } - } - } catch (MissingResourceException mre) { - } - - return match; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java deleted file mode 100644 index cfa16cf..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.TagSupport; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <formatDate>, the date and time - * formatting tag in JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class FormatDateSupport extends TagSupport { - - //********************************************************************* - // Private constants - - private static final String DATE = "date"; - private static final String TIME = "time"; - private static final String DATETIME = "both"; - - - //********************************************************************* - // Protected state - - protected Date value; // 'value' attribute - protected String type; // 'type' attribute - protected String pattern; // 'pattern' attribute - protected Object timeZone; // 'timeZone' attribute - protected String dateStyle; // 'dateStyle' attribute - protected String timeStyle; // 'timeStyle' attribute - - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // 'scope' attribute - - - //********************************************************************* - // Constructor and initialization - - public FormatDateSupport() { - super(); - init(); - } - - private void init() { - type = dateStyle = timeStyle = null; - pattern = var = null; - value = null; - timeZone = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Tag logic - - /* - * Formats the given date and time. - */ - public int doEndTag() throws JspException { - - String formatted = null; - - if (value == null) { - if (var != null) { - pageContext.removeAttribute(var, scope); - } - return EVAL_PAGE; - } - - // Create formatter - Locale locale = SetLocaleSupport.getFormattingLocale(pageContext, - this, - true, - true); - if (locale != null) { - DateFormat formatter = createFormatter(locale); - - // Apply pattern, if present - if (pattern != null) { - try { - ((SimpleDateFormat) formatter).applyPattern(pattern); - } catch (ClassCastException cce) { - formatter = new SimpleDateFormat(pattern, locale); - } - } - - // Set time zone - TimeZone tz = null; - if ((timeZone instanceof String) - && ((String) timeZone).equals("")) { - timeZone = null; - } - if (timeZone != null) { - if (timeZone instanceof String) { - tz = TimeZone.getTimeZone((String) timeZone); - } else if (timeZone instanceof TimeZone) { - tz = (TimeZone) timeZone; - } else { - throw new JspTagException( - Resources.getMessage("FORMAT_DATE_BAD_TIMEZONE")); - } - } else { - tz = TimeZoneSupport.getTimeZone(pageContext, this); - } - if (tz != null) { - formatter.setTimeZone(tz); - } - formatted = formatter.format(value); - } else { - // no formatting locale available, use Date.toString() - formatted = value.toString(); - } - - if (var != null) { - pageContext.setAttribute(var, formatted, scope); - } else { - try { - pageContext.getOut().print(formatted); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Private utility methods - - private DateFormat createFormatter(Locale loc) throws JspException { - DateFormat formatter = null; - - if ((type == null) || DATE.equalsIgnoreCase(type)) { - formatter = DateFormat.getDateInstance( - Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE"), - loc); - } else if (TIME.equalsIgnoreCase(type)) { - formatter = DateFormat.getTimeInstance( - Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE"), - loc); - } else if (DATETIME.equalsIgnoreCase(type)) { - formatter = DateFormat.getDateTimeInstance( - Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE"), - Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE"), - loc); - } else { - throw new JspException( - Resources.getMessage("FORMAT_DATE_INVALID_TYPE", - type)); - } - - return formatter; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java deleted file mode 100644 index 9178037..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.util.Locale; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <formatNumber>, the number - * formatting tag in JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class FormatNumberSupport extends BodyTagSupport { - - //********************************************************************* - // Private constants - - private static final Class[] GET_INSTANCE_PARAM_TYPES = new Class[] { String.class }; - private static final String NUMBER = "number"; - private static final String CURRENCY = "currency"; - private static final String PERCENT = "percent"; - - - //********************************************************************* - // Protected state - - protected Object value; // 'value' attribute - protected boolean valueSpecified; // status - protected String type; // 'type' attribute - protected String pattern; // 'pattern' attribute - protected String currencyCode; // 'currencyCode' attribute - protected String currencySymbol; // 'currencySymbol' attribute - protected boolean isGroupingUsed; // 'groupingUsed' attribute - protected boolean groupingUsedSpecified; - protected int maxIntegerDigits; // 'maxIntegerDigits' attribute - protected boolean maxIntegerDigitsSpecified; - protected int minIntegerDigits; // 'minIntegerDigits' attribute - protected boolean minIntegerDigitsSpecified; - protected int maxFractionDigits; // 'maxFractionDigits' attribute - protected boolean maxFractionDigitsSpecified; - protected int minFractionDigits; // 'minFractionDigits' attribute - protected boolean minFractionDigitsSpecified; - - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // 'scope' attribute - private static Class currencyClass; - - - //********************************************************************* - // Constructor and initialization - - static { - try { - currencyClass = Class.forName("java.util.Currency"); - // container's runtime is J2SE 1.4 or greater - } catch (Exception cnfe) { - } - } - - public FormatNumberSupport() { - super(); - init(); - } - - private void init() { - value = type = null; - valueSpecified = false; - pattern = var = currencyCode = currencySymbol = null; - groupingUsedSpecified = false; - maxIntegerDigitsSpecified = minIntegerDigitsSpecified = false; - maxFractionDigitsSpecified = minFractionDigitsSpecified = false; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - String formatted = null; - Object input = null; - - // determine the input by... - if (valueSpecified) { - // ... reading 'value' attribute - input = value; - } else { - // ... retrieving and trimming our body - if (bodyContent != null && bodyContent.getString() != null) - input = bodyContent.getString().trim(); - } - - if ((input == null) || input.equals("")) { - // Spec says: - // If value is null or empty, remove the scoped variable - // if it is specified (see attributes var and scope). - if (var != null) { - pageContext.removeAttribute(var, scope); - } - return EVAL_PAGE; - } - - /* - * If 'value' is a String, it is first parsed into an instance of - * java.lang.Number - */ - if (input instanceof String) { - try { - if (((String) input).indexOf('.') != -1) { - input = Double.valueOf((String) input); - } else { - input = Long.valueOf((String) input); - } - } catch (NumberFormatException nfe) { - throw new JspException( - Resources.getMessage("FORMAT_NUMBER_PARSE_ERROR", input), - nfe); - } - } - - // Determine formatting locale - Locale loc = SetLocaleSupport.getFormattingLocale(pageContext, - this, - false, - true); - if (loc != null) { - // Create formatter - NumberFormat formatter = null; - if ((pattern != null) && !pattern.equals("")) { - // if 'pattern' is specified, 'type' is ignored - DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc); - formatter = new DecimalFormat(pattern, symbols); - } else { - formatter = createFormatter(loc); - } - if (((pattern != null) && !pattern.equals("")) - || CURRENCY.equalsIgnoreCase(type)) { - try { - setCurrency(formatter); - } catch (Exception e) { - throw new JspException( - Resources.getMessage("FORMAT_NUMBER_CURRENCY_ERROR"), - e); - } - } - configureFormatter(formatter); - formatted = formatter.format(input); - } else { - // no formatting locale available, use toString() - formatted = input.toString(); - } - - if (var != null) { - pageContext.setAttribute(var, formatted, scope); - } else { - try { - pageContext.getOut().print(formatted); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Private utility methods - - private NumberFormat createFormatter(Locale loc) throws JspException { - NumberFormat formatter = null; - - if ((type == null) || NUMBER.equalsIgnoreCase(type)) { - formatter = NumberFormat.getNumberInstance(loc); - } else if (CURRENCY.equalsIgnoreCase(type)) { - formatter = NumberFormat.getCurrencyInstance(loc); - } else if (PERCENT.equalsIgnoreCase(type)) { - formatter = NumberFormat.getPercentInstance(loc); - } else { - throw new JspException( - Resources.getMessage("FORMAT_NUMBER_INVALID_TYPE", type)); - } - - return formatter; - } - - /* - * Applies the 'groupingUsed', 'maxIntegerDigits', 'minIntegerDigits', - * 'maxFractionDigits', and 'minFractionDigits' attributes to the given - * formatter. - */ - private void configureFormatter(NumberFormat formatter) { - if (groupingUsedSpecified) - formatter.setGroupingUsed(isGroupingUsed); - if (maxIntegerDigitsSpecified) - formatter.setMaximumIntegerDigits(maxIntegerDigits); - if (minIntegerDigitsSpecified) - formatter.setMinimumIntegerDigits(minIntegerDigits); - if (maxFractionDigitsSpecified) - formatter.setMaximumFractionDigits(maxFractionDigits); - if (minFractionDigitsSpecified) - formatter.setMinimumFractionDigits(minFractionDigits); - } - - /* - * Override the formatting locale's default currency symbol with the - * specified currency code (specified via the "currencyCode" attribute) or - * currency symbol (specified via the "currencySymbol" attribute). - * - * If both "currencyCode" and "currencySymbol" are present, - * "currencyCode" takes precedence over "currencySymbol" if the - * java.util.Currency class is defined in the container's runtime (that - * is, if the container's runtime is J2SE 1.4 or greater), and - * "currencySymbol" takes precendence over "currencyCode" otherwise. - * - * If only "currencyCode" is given, it is used as a currency symbol if - * java.util.Currency is not defined. - * - * Example: - * - * JDK "currencyCode" "currencySymbol" Currency symbol being displayed - * ----------------------------------------------------------------------- - * all --- --- Locale's default currency symbol - * - * <1.4 EUR --- EUR - * >=1.4 EUR --- Locale's currency symbol for Euro - * - * all --- \u20AC \u20AC - * - * <1.4 EUR \u20AC \u20AC - * >=1.4 EUR \u20AC Locale's currency symbol for Euro - */ - private void setCurrency(NumberFormat formatter) throws Exception { - String code = null; - String symbol = null; - - if ((currencyCode == null) && (currencySymbol == null)) { - return; - } - - if ((currencyCode != null) && (currencySymbol != null)) { - if (currencyClass != null) - code = currencyCode; - else - symbol = currencySymbol; - } else if (currencyCode == null) { - symbol = currencySymbol; - } else { - if (currencyClass != null) - code = currencyCode; - else - symbol = currencyCode; - } - - if (code != null) { - Object[] methodArgs = new Object[1]; - - /* - * java.util.Currency.getInstance() - */ - Method m = currencyClass.getMethod("getInstance", GET_INSTANCE_PARAM_TYPES); - methodArgs[0] = code; - Object currency = m.invoke(null, methodArgs); - - /* - * java.text.NumberFormat.setCurrency() - */ - Class[] paramTypes = new Class[1]; - paramTypes[0] = currencyClass; - Class numberFormatClass = Class.forName("java.text.NumberFormat"); - m = numberFormatClass.getMethod("setCurrency", paramTypes); - methodArgs[0] = currency; - m.invoke(formatter, methodArgs); - } else { - /* - * Let potential ClassCastException propagate up (will almost - * never happen) - */ - DecimalFormat df = (DecimalFormat) formatter; - DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); - dfs.setCurrencySymbol(symbol); - df.setDecimalFormatSymbols(dfs); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java deleted file mode 100644 index 504a700..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.IOException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.fmt.LocalizationContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <message>, the message formatting tag - * in JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class MessageSupport extends BodyTagSupport { - - //********************************************************************* - // Public constants - - public static final String UNDEFINED_KEY = "???"; - - - //********************************************************************* - // Protected state - - protected String keyAttrValue; // 'key' attribute value - protected boolean keySpecified; // 'key' attribute specified - protected LocalizationContext bundleAttrValue; // 'bundle' attribute value - protected boolean bundleSpecified; // 'bundle' attribute specified? - - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // 'scope' attribute - private List params; - - - //********************************************************************* - // Constructor and initialization - - public MessageSupport() { - super(); - params = new ArrayList<>(); - init(); - } - - private void init() { - var = null; - scope = PageContext.PAGE_SCOPE; - keyAttrValue = null; - keySpecified = false; - bundleAttrValue = null; - bundleSpecified = false; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Collaboration with subtags - - /** - * Adds an argument (for parametric replacement) to this tag's message. - * - * @see ParamSupport - */ - public void addParam(Object arg) { - params.add(arg); - } - - - //********************************************************************* - // Tag logic - - public int doStartTag() throws JspException { - params.clear(); - return EVAL_BODY_BUFFERED; - } - - public int doEndTag() throws JspException { - - String key = null; - LocalizationContext locCtxt = null; - - // determine the message key by... - if (keySpecified) { - // ... reading 'key' attribute - key = keyAttrValue; - } else { - // ... retrieving and trimming our body - if (bodyContent != null && bodyContent.getString() != null) - key = bodyContent.getString().trim(); - } - - if ((key == null) || key.equals("")) { - try { - pageContext.getOut().print("??????"); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - return EVAL_PAGE; - } - - String prefix = null; - if (!bundleSpecified) { - Tag t = findAncestorWithClass(this, BundleSupport.class); - if (t != null) { - // use resource bundle from parent tag - BundleSupport parent = (BundleSupport) t; - locCtxt = parent.getLocalizationContext(); - prefix = parent.getPrefix(); - } else { - locCtxt = BundleSupport.getLocalizationContext(pageContext); - } - } else { - // localization context taken from 'bundle' attribute - locCtxt = bundleAttrValue; - if (locCtxt.getLocale() != null) { - SetLocaleSupport.setResponseLocale(pageContext, - locCtxt.getLocale()); - } - } - - String message = UNDEFINED_KEY + key + UNDEFINED_KEY; - if (locCtxt != null) { - ResourceBundle bundle = locCtxt.getResourceBundle(); - if (bundle != null) { - try { - // prepend 'prefix' attribute from parent bundle - if (prefix != null) - key = prefix + key; - message = bundle.getString(key); - // Perform parametric replacement if required - if (!params.isEmpty()) { - Object[] messageArgs = params.toArray(); - MessageFormat formatter = new MessageFormat(""); // empty pattern, default Locale - if (locCtxt.getLocale() != null) { - formatter.setLocale(locCtxt.getLocale()); - } else { - // For consistency with the actions, - // we try to get a locale that matches the user's preferences - // as well as the locales supported by 'date' and 'number'. - //System.out.println("LOCALE-LESS LOCCTXT: GETTING FORMATTING LOCALE"); - Locale locale = SetLocaleSupport.getFormattingLocale(pageContext); - //System.out.println("LOCALE: " + locale); - if (locale != null) { - formatter.setLocale(locale); - } - } - formatter.applyPattern(message); - message = formatter.format(messageArgs); - } - } catch (MissingResourceException mre) { - message = UNDEFINED_KEY + key + UNDEFINED_KEY; - } - } - } - - if (var != null) { - pageContext.setAttribute(var, message, scope); - } else { - try { - pageContext.getOut().print(message); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParamSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParamSupport.java deleted file mode 100755 index 78a3309..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParamSupport.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.resources.Resources; - -/** - * Support for tag handlers for <param>, the message argument - * subtag in JSTL 1.0 which supplies an argument for parametric replacement - * to its parent <message> tag. - * - * @see MessageSupport - * @author Jan Luehe - */ - -public abstract class ParamSupport extends BodyTagSupport { - - //********************************************************************* - // Protected state - - protected Object value; // 'value' attribute - protected boolean valueSpecified; // status - - - //********************************************************************* - // Constructor and initialization - - public ParamSupport() { - super(); - init(); - } - - private void init() { - value = null; - valueSpecified = false; - } - - - //********************************************************************* - // Tag logic - - // Supply our value to our parent tag - public int doEndTag() throws JspException { - Tag t = findAncestorWithClass(this, MessageSupport.class); - if (t == null) { - throw new JspTagException(Resources.getMessage( - "PARAM_OUTSIDE_MESSAGE")); - } - MessageSupport parent = (MessageSupport) t; - - /* - * Get argument from 'value' attribute or body, as appropriate, and - * add it to enclosing tag, even if it is null or equal - * to "". - */ - Object input = null; - // determine the input by... - if (valueSpecified) { - // ... reading 'value' attribute - input = value; - } else { - // ... retrieving and trimming our body (TLV has ensured that it's - // non-empty) - input = bodyContent.getString().trim(); - } - parent.addParam(input); - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java deleted file mode 100644 index b2b296b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <parseDate>, the date and time - * parsing tag in JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class ParseDateSupport extends BodyTagSupport { - - //********************************************************************* - // Private constants - - private static final String DATE = "date"; - private static final String TIME = "time"; - private static final String DATETIME = "both"; - - - //********************************************************************* - // Protected state - - protected String value; // 'value' attribute - protected boolean valueSpecified; // status - protected String type; // 'type' attribute - protected String pattern; // 'pattern' attribute - protected Object timeZone; // 'timeZone' attribute - protected Locale parseLocale; // 'parseLocale' attribute - protected String dateStyle; // 'dateStyle' attribute - protected String timeStyle; // 'timeStyle' attribute - - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // 'scope' attribute - - - //********************************************************************* - // Constructor and initialization - - public ParseDateSupport() { - super(); - init(); - } - - private void init() { - type = dateStyle = timeStyle = null; - value = pattern = var = null; - valueSpecified = false; - timeZone = null; - scope = PageContext.PAGE_SCOPE; - parseLocale = null; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - - String input = null; - - // determine the input by... - if (valueSpecified) { - // ... reading 'value' attribute - input = value; - } else { - // ... retrieving and trimming our body - if (bodyContent != null && bodyContent.getString() != null) - input = bodyContent.getString().trim(); - } - - if ((input == null) || input.equals("")) { - if (var != null) { - pageContext.removeAttribute(var, scope); - } - return EVAL_PAGE; - } - - /* - * Set up parsing locale: Use locale specified via the 'parseLocale' - * attribute (if present), or else determine page's locale. - */ - Locale locale = parseLocale; - if (locale == null) - locale = SetLocaleSupport.getFormattingLocale(pageContext, - this, - true, - false); - if (locale == null) { - throw new JspException( - Resources.getMessage("PARSE_DATE_NO_PARSE_LOCALE")); - } - - // Create parser - DateFormat parser = createParser(locale); - - // Apply pattern, if present - if (pattern != null) { - try { - ((SimpleDateFormat) parser).applyPattern(pattern); - } catch (ClassCastException cce) { - parser = new SimpleDateFormat(pattern, locale); - } - } - - // Set time zone - TimeZone tz = null; - if ((timeZone instanceof String) && ((String) timeZone).equals("")) { - timeZone = null; - } - if (timeZone != null) { - if (timeZone instanceof String) { - tz = TimeZone.getTimeZone((String) timeZone); - } else if (timeZone instanceof TimeZone) { - tz = (TimeZone) timeZone; - } else { - throw new JspException( - Resources.getMessage("PARSE_DATE_BAD_TIMEZONE")); - } - } else { - tz = TimeZoneSupport.getTimeZone(pageContext, this); - } - if (tz != null) { - parser.setTimeZone(tz); - } - - // Parse date - Date parsed = null; - try { - parsed = parser.parse(input); - } catch (ParseException pe) { - throw new JspException( - Resources.getMessage("PARSE_DATE_PARSE_ERROR", input), - pe); - } - - if (var != null) { - pageContext.setAttribute(var, parsed, scope); - } else { - try { - pageContext.getOut().print(parsed); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Private utility methods - - private DateFormat createParser(Locale loc) throws JspException { - DateFormat parser = null; - - if ((type == null) || DATE.equalsIgnoreCase(type)) { - parser = DateFormat.getDateInstance( - Util.getStyle(dateStyle, "PARSE_DATE_INVALID_DATE_STYLE"), - loc); - } else if (TIME.equalsIgnoreCase(type)) { - parser = DateFormat.getTimeInstance( - Util.getStyle(timeStyle, "PARSE_DATE_INVALID_TIME_STYLE"), - loc); - } else if (DATETIME.equalsIgnoreCase(type)) { - parser = DateFormat.getDateTimeInstance( - Util.getStyle(dateStyle, "PARSE_DATE_INVALID_DATE_STYLE"), - Util.getStyle(timeStyle, "PARSE_DATE_INVALID_TIME_STYLE"), - loc); - } else { - throw new JspException( - Resources.getMessage("PARSE_DATE_INVALID_TYPE", type)); - } - - parser.setLenient(false); - - return parser; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java deleted file mode 100644 index ba549ba..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.IOException; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.text.ParseException; -import java.util.Locale; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <parseNumber>, the number parsing tag - * in JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class ParseNumberSupport extends BodyTagSupport { - - //********************************************************************* - // Private constants - - private static final String NUMBER = "number"; - private static final String CURRENCY = "currency"; - private static final String PERCENT = "percent"; - - - //********************************************************************* - // Protected state - - protected String value; // 'value' attribute - protected boolean valueSpecified; // status - protected String type; // 'type' attribute - protected String pattern; // 'pattern' attribute - protected Locale parseLocale; // 'parseLocale' attribute - protected boolean isIntegerOnly; // 'integerOnly' attribute - protected boolean integerOnlySpecified; - - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // 'scope' attribute - - - //********************************************************************* - // Constructor and initialization - - public ParseNumberSupport() { - super(); - init(); - } - - private void init() { - value = type = pattern = var = null; - valueSpecified = false; - parseLocale = null; - integerOnlySpecified = false; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - String input = null; - - // determine the input by... - if (valueSpecified) { - // ... reading 'value' attribute - input = value; - } else { - // ... retrieving and trimming our body - if (bodyContent != null && bodyContent.getString() != null) - input = bodyContent.getString().trim(); - } - - if ((input == null) || input.equals("")) { - if (var != null) { - pageContext.removeAttribute(var, scope); - } - return EVAL_PAGE; - } - - /* - * Set up parsing locale: Use locale specified via the 'parseLocale' - * attribute (if present), or else determine page's locale. - */ - Locale loc = parseLocale; - if (loc == null) - loc = SetLocaleSupport.getFormattingLocale(pageContext, - this, - false, - false); - if (loc == null) { - throw new JspException( - Resources.getMessage("PARSE_NUMBER_NO_PARSE_LOCALE")); - } - - // Create parser - NumberFormat parser = null; - if ((pattern != null) && !pattern.equals("")) { - // if 'pattern' is specified, 'type' is ignored - DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc); - parser = new DecimalFormat(pattern, symbols); - } else { - parser = createParser(loc); - } - - // Configure parser - if (integerOnlySpecified) - parser.setParseIntegerOnly(isIntegerOnly); - - // Parse number - Number parsed = null; - try { - parsed = parser.parse(input); - } catch (ParseException pe) { - throw new JspException( - Resources.getMessage("PARSE_NUMBER_PARSE_ERROR", input), - pe); - } - - if (var != null) { - pageContext.setAttribute(var, parsed, scope); - } else { - try { - pageContext.getOut().print(parsed); - } catch (IOException ioe) { - throw new JspTagException(ioe.toString(), ioe); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Private utility methods - - private NumberFormat createParser(Locale loc) throws JspException { - NumberFormat parser = null; - - if ((type == null) || NUMBER.equalsIgnoreCase(type)) { - parser = NumberFormat.getNumberInstance(loc); - } else if (CURRENCY.equalsIgnoreCase(type)) { - parser = NumberFormat.getCurrencyInstance(loc); - } else if (PERCENT.equalsIgnoreCase(type)) { - parser = NumberFormat.getPercentInstance(loc); - } else { - throw new JspException( - Resources.getMessage("PARSE_NUMBER_INVALID_TYPE", - type)); - } - - return parser; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java deleted file mode 100644 index 7271f62..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.io.UnsupportedEncodingException; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.TagSupport; - -/** - * Support for tag handlers for <requestEncoding>, the tag for setting - * the request character encoding in JSTL 1.0. - * - * @author Jan Luehe - * @author Pierre Delisle - */ - -public abstract class RequestEncodingSupport extends TagSupport { - - //********************************************************************* - // Package-scoped constants - - static final String REQUEST_CHAR_SET = - "jakarta.servlet.jsp.jstl.fmt.request.charset"; - - - //********************************************************************* - // Private constants - - private static final String DEFAULT_ENCODING = "ISO-8859-1"; - - - //********************************************************************* - // Tag attributes - - protected String value; // 'value' attribute - - - //********************************************************************* - // Derived information - - protected String charEncoding; // derived from 'value' attribute - - - //********************************************************************* - // Constructor and initialization - - public RequestEncodingSupport() { - super(); - init(); - } - - private void init() { - value = null; - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - charEncoding = value; - if ((charEncoding == null) - && (pageContext.getRequest().getCharacterEncoding() == null)) { - // Use charset from session-scoped attribute - charEncoding = (String) - pageContext.getAttribute(REQUEST_CHAR_SET, - PageContext.SESSION_SCOPE); - if (charEncoding == null) { - // Use default encoding - charEncoding = DEFAULT_ENCODING; - } - } - - /* - * If char encoding was already set in the request, we don't need to - * set it again. - */ - if (charEncoding != null) { - try { - pageContext.getRequest().setCharacterEncoding(charEncoding); - } catch (UnsupportedEncodingException uee) { - throw new JspTagException(uee.toString(), uee); - } - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java deleted file mode 100644 index 6c64368..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.core.Config; -import jakarta.servlet.jsp.jstl.fmt.LocalizationContext; -import jakarta.servlet.jsp.tagext.TagSupport; - -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <setBundle>, the JSTL 1.0 tag that loads - * a resource bundle and stores it in a scoped variable. - * - * @author Jan Luehe - */ - -public abstract class SetBundleSupport extends TagSupport { - - - //********************************************************************* - // Protected state - - protected String basename; // 'basename' attribute - - - //********************************************************************* - // Private state - - private int scope; // 'scope' attribute - private String var; // 'var' attribute - - - //********************************************************************* - // Constructor and initialization - - public SetBundleSupport() { - super(); - init(); - } - - private void init() { - basename = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag attributes known at translation time - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - LocalizationContext locCtxt = - BundleSupport.getLocalizationContext(pageContext, basename); - - if (var != null) { - pageContext.setAttribute(var, locCtxt, scope); - } else { - Config.set(pageContext, Config.FMT_LOCALIZATION_CONTEXT, locCtxt, - scope); - } - - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java deleted file mode 100644 index 93b5fb3..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.fmt; - -import java.text.DateFormat; -import java.text.NumberFormat; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Vector; - -import jakarta.servlet.ServletResponse; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.core.Config; -import jakarta.servlet.jsp.jstl.fmt.LocalizationContext; -import jakarta.servlet.jsp.tagext.Tag; -import jakarta.servlet.jsp.tagext.TagSupport; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - * Support for tag handlers for <setLocale>, the locale setting tag in - * JSTL 1.0. - * - * @author Jan Luehe - */ - -public abstract class SetLocaleSupport extends TagSupport { - - - //********************************************************************* - // Private constants - - private static final char HYPHEN = '-'; - private static final char UNDERSCORE = '_'; - private static Locale[] availableFormattingLocales; - private static final Locale[] dateLocales = - DateFormat.getAvailableLocales(); - private static final Locale[] numberLocales = - NumberFormat.getAvailableLocales(); - - - //********************************************************************* - // Protected state - - protected Object value; // 'value' attribute - protected String variant; // 'variant' attribute - - - //********************************************************************* - // Private state - - private int scope; // 'scope' attribute - - - //********************************************************************* - // Constructor and initialization - - /** - * Sets up the available formatting locales that will be used - * by getFormattingLocale(PageContext). - */ - static { - Vector vec = new Vector<>(dateLocales.length); - for (int i=0; ijava.util.Locale object. - * - * If the given locale string is null or empty, the runtime's default - * locale is returned. - * - * @param locale the locale string to parse - * @param variant the variant - * - * @return java.util.Locale object corresponding to the given - * locale string, or the runtime's default locale if the locale string is - * null or empty - * - * @throws IllegalArgumentException if the given locale does not have a - * language component or has an empty country component - */ - public static Locale parseLocale(String locale, String variant) { - - Locale ret = null; - String language = locale; - String country = null; - int index = -1; - - if (((index = locale.indexOf(HYPHEN)) > -1) - || ((index = locale.indexOf(UNDERSCORE)) > -1)) { - language = locale.substring(0, index); - country = locale.substring(index+1); - } - - if ((language == null) || (language.length() == 0)) { - throw new IllegalArgumentException( - Resources.getMessage("LOCALE_NO_LANGUAGE")); - } - - if (country == null) { - if (variant != null) - ret = new Locale(language, "", variant); - else - ret = new Locale(language, ""); - } else if (country.length() > 0) { - if (variant != null) - ret = new Locale(language, country, variant); - else - ret = new Locale(language, country); - } else { - throw new IllegalArgumentException( - Resources.getMessage("LOCALE_EMPTY_COUNTRY")); - } - - return ret; - } - - - //********************************************************************* - // Package-scoped utility methods - - /* - * Stores the given locale in the response object of the given page - * context, and stores the locale's associated charset in the - * jakarta.servlet.jsp.jstl.fmt.request.charset session attribute, which - * may be used by the action in a page invoked by a - * form included in the response to set the request charset to the same as - * the response charset (this makes it possible for the container to - * decode the form parameter values properly, since browsers typically - * encode form field values using the response's charset). - * - * @param pageContext the page context whose response object is assigned - * the given locale - * @param locale the response locale - */ - static void setResponseLocale(PageContext pc, Locale locale) { - // set response locale - ServletResponse response = pc.getResponse(); - response.setLocale(locale); - - // get response character encoding and store it in session attribute - if (pc.getSession() != null) { - try { - pc.setAttribute(RequestEncodingSupport.REQUEST_CHAR_SET, - response.getCharacterEncoding(), - PageContext.SESSION_SCOPE); - } catch (IllegalStateException ex) {} // invalidated session ignored - } - } - - /* - * Returns the formatting locale to use with the given formatting action - * in the given page. - * - * @param pc The page context containing the formatting action - * @param fromTag The formatting action - * @param isDate true if the locale is needed for date formatting, false - * otherwise (i.e., the locale is needed for number formatting) - * @param format true if the formatting action is of type - * (as opposed to ), and false otherwise - * (if set to true, the formatting locale that is returned by - * this method is used to set the response locale). - * - * @return the formatting locale to use - */ - static Locale getFormattingLocale(PageContext pc, - Tag fromTag, - boolean isDate, - boolean format) { - - LocalizationContext locCtxt = null; - - // Get formatting locale from enclosing - Tag parent = findAncestorWithClass(fromTag, BundleSupport.class); - if (parent != null) { - /* - * use locale from localization context established by parent - * action, unless that locale is null - */ - locCtxt = ((BundleSupport) parent).getLocalizationContext(); - if (locCtxt.getLocale() != null) { - if (format) { - setResponseLocale(pc, locCtxt.getLocale()); - } - return locCtxt.getLocale(); - } - } - - // Use locale from default I18N localization context, unless it is null - if ((locCtxt = BundleSupport.getLocalizationContext(pc)) != null) { - if (locCtxt.getLocale() != null) { - if (format) { - setResponseLocale(pc, locCtxt.getLocale()); - } - return locCtxt.getLocale(); - } - } - - /* - * Establish formatting locale by comparing the preferred locales - * (in order of preference) against the available formatting - * locales, and determining the best matching locale. - */ - Locale match = null; - Locale pref = getLocale(pc, Config.FMT_LOCALE); - Locale[] avail = null; - if (isDate) { - avail = dateLocales; - } else { - avail = numberLocales; - } - if (pref != null) { - // Preferred locale is application-based - match = findFormattingMatch(pref, avail); - } else { - // Preferred locales are browser-based - match = findFormattingMatch(pc, avail); - } - if (match == null) { - //Use fallback locale. - pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); - if (pref != null) { - match = findFormattingMatch(pref, avail); - } - } - if (format && (match != null)) { - setResponseLocale(pc, match); - } - - return match; - } - - /* - * Returns the formatting locale to use when is used - * with a locale-less localization context. - * - * @param pc The page context containing the formatting action - * @return the formatting locale to use - */ - static Locale getFormattingLocale(PageContext pc) { - /* - * Establish formatting locale by comparing the preferred locales - * (in order of preference) against the available formatting - * locales, and determining the best matching locale. - */ - Locale match = null; - Locale pref = getLocale(pc, Config.FMT_LOCALE); - if (pref != null) { - // Preferred locale is application-based - match = findFormattingMatch(pref, availableFormattingLocales); - } else { - // Preferred locales are browser-based - match = findFormattingMatch(pc, availableFormattingLocales); - } - if (match == null) { - //Use fallback locale. - pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); - if (pref != null) { - match = findFormattingMatch(pref, availableFormattingLocales); - } - } - if (match != null) { - setResponseLocale(pc, match); - } - - return match; - } - - /* - * Returns the locale specified by the named scoped attribute or context - * configuration parameter. - * - *

The named scoped attribute is searched in the page, request, - * session (if valid), and application scope(s) (in this order). If no such - * attribute exists in any of the scopes, the locale is taken from the - * named context configuration parameter. - * - * @param pageContext the page in which to search for the named scoped - * attribute or context configuration parameter - * @param name the name of the scoped attribute or context configuration - * parameter - * - * @return the locale specified by the named scoped attribute or context - * configuration parameter, or null if no scoped attribute or - * configuration parameter with the given name exists - */ - static Locale getLocale(PageContext pageContext, String name) { - Locale loc = null; - - Object obj = Config.find(pageContext, name); - if (obj != null) { - if (obj instanceof Locale) { - loc = (Locale) obj; - } else { - loc = parseLocale((String) obj); - } - } - - return loc; - } - - - //********************************************************************* - // Private utility methods - - /* - * Determines the client's preferred locales from the request, and compares - * each of the locales (in order of preference) against the available - * locales in order to determine the best matching locale. - * - * @param pageContext Page containing the formatting action - * @param avail Available formatting locales - * - * @return Best matching locale, or null if no match was found - */ - private static Locale findFormattingMatch(PageContext pageContext, - Locale[] avail) { - Locale match = null; - for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest()); - enum_.hasMoreElements(); ) { - Locale locale = (Locale)enum_.nextElement(); - match = findFormattingMatch(locale, avail); - if (match != null) { - break; - } - } - - return match; - } - - /* - * Returns the best match between the given preferred locale and the - * given available locales. - * - * The best match is given as the first available locale that exactly - * matches the given preferred locale ("exact match"). If no exact match - * exists, the best match is given to an available locale that meets - * the following criteria (in order of priority): - * - available locale's variant is empty and exact match for both - * language and country - * - available locale's variant and country are empty, and exact match - * for language. - * - * @param pref the preferred locale - * @param avail the available formatting locales - * - * @return Available locale that best matches the given preferred locale, - * or null if no match exists - */ - private static Locale findFormattingMatch(Locale pref, Locale[] avail) { - Locale match = null; - boolean langAndCountryMatch = false; - for (int i=0; i If the given action is nested inside a <timeZone> action, - * the time zone is taken from the enclosing <timeZone> action. - * - *

Otherwise, the time zone configuration setting - * jakarta.servlet.jsp.jstl.core.Config.FMT_TIME_ZONE - * is used. - * - * @param pageContext the page containing the action for which the - * time zone needs to be determined - * @param fromTag the action for which the time zone needs to be - * determined - * - * @return the time zone, or null if the given action is not - * nested inside a <timeZone> action and no time zone configuration - * setting exists - */ - static TimeZone getTimeZone(PageContext pc, Tag fromTag) { - TimeZone tz = null; - - Tag t = findAncestorWithClass(fromTag, TimeZoneSupport.class); - if (t != null) { - // use time zone from parent tag - TimeZoneSupport parent = (TimeZoneSupport) t; - tz = parent.getTimeZone(); - } else { - // get time zone from configuration setting - Object obj = Config.find(pc, Config.FMT_TIME_ZONE); - if (obj != null) { - if (obj instanceof TimeZone) { - tz = (TimeZone) obj; - } else { - tz = TimeZone.getTimeZone((String) obj); - } - } - } - - return tz; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java deleted file mode 100644 index 3b7a8c6..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.core.Config; -import javax.sql.DataSource; - -import org.apache.taglibs.standard.resources.Resources; - - -/** - *

A simple DataSource utility for the standard - * DriverManager class. - * - * TO DO: need to cache DataSource - * - * @author Justyna Horwat - */ -public class DataSourceUtil { - - private static final String ESCAPE = "\\"; - private static final String TOKEN = ","; - - /** - * If dataSource is a String first do JNDI lookup. - * If lookup fails parse String like it was a set of JDBC parameters - * Otherwise check to see if dataSource is a DataSource object and use as - * is - */ - static DataSource getDataSource(Object rawDataSource, PageContext pc) - throws JspException - { - DataSource dataSource = null; - - if (rawDataSource == null) { - rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE); - } - - if (rawDataSource == null) { - return null; - } - - /* - * If the 'dataSource' attribute's value resolves to a String - * after rtexpr/EL evaluation, use the string as JNDI path to - * a DataSource - */ - if (rawDataSource instanceof String) { - try { - Context ctx = new InitialContext(); - // relative to standard JNDI root for J2EE app - Context envCtx = (Context) ctx.lookup("java:comp/env"); - dataSource = (DataSource) envCtx.lookup((String) rawDataSource); - } catch (NamingException ex) { - dataSource = getDataSource((String) rawDataSource); - } - } else if (rawDataSource instanceof DataSource) { - dataSource = (DataSource) rawDataSource; - } else { - throw new JspException( - Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE")); - } - - return dataSource; - } - - /** - * Parse JDBC parameters and setup dataSource appropriately - */ - private static DataSource getDataSource(String params) - throws JspException - { - DataSourceWrapper dataSource = new DataSourceWrapper(); - - String[] paramString = new String[4]; - int escCount = 0; - int aryCount = 0; - int begin = 0; - - for(int index=0; index < params.length(); index++) { - char nextChar = params.charAt(index); - if (TOKEN.indexOf(nextChar) != -1) { - if (escCount == 0) { - paramString[aryCount] = params.substring(begin,index).trim(); - begin = index + 1; - if (++aryCount > 4) { - throw new JspTagException( - Resources.getMessage("JDBC_PARAM_COUNT")); - } - } - } - if (ESCAPE.indexOf(nextChar) != -1) { - escCount++; - } - else { - escCount = 0; - } - } - paramString[aryCount] = params.substring(begin).trim(); - - // use the JDBC URL from the parameter string - dataSource.setJdbcURL(paramString[0]); - - // try to load a driver if it's present - if (paramString[1] != null) { - try { - dataSource.setDriverClassName(paramString[1]); - } catch (Exception ex) { - throw new JspTagException( - Resources.getMessage("DRIVER_INVALID_CLASS", - ex.toString()), ex); - } - } - - // set the username and password - dataSource.setUserName(paramString[2]); - dataSource.setPassword(paramString[3]); - - return dataSource; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java deleted file mode 100644 index 51550cc..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.Properties; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -import org.apache.taglibs.standard.resources.Resources; - - -/** - *

A simple DataSource wrapper for the standard - * DriverManager class. - * - * @author Hans Bergsten - */ -public class DataSourceWrapper implements DataSource { - private Driver driver; - private String jdbcURL; - private String userName; - private String password; - - public void setDriverClassName(String driverClassName) - throws ClassNotFoundException, InstantiationException, - IllegalAccessException { - - Object instance = Class.forName(driverClassName, true, - Thread.currentThread().getContextClassLoader()).newInstance(); - if (instance instanceof Driver) { - driver = (Driver) instance; - } - } - - public void setJdbcURL(String jdbcURL) { - this.jdbcURL = jdbcURL; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public void setPassword(String password) { - this.password = password; - } - - /** - * Returns a Connection using the DriverManager and all - * set properties. - */ - public Connection getConnection() throws SQLException { - Connection conn = null; - if (driver != null) { - Properties props = new Properties(); - if (userName != null) { - props.put("user", userName); - } - if (password != null) { - props.put("password", password); - } - conn = driver.connect(jdbcURL, props); - } - if (conn == null) { - if (userName != null) { - conn = DriverManager.getConnection(jdbcURL, userName, password); - } else { - conn = DriverManager.getConnection(jdbcURL); - } - } - return conn; - } - - /** - * Always throws a SQLException. Username and password are set - * in the constructor and can not be changed. - */ - public Connection getConnection(String username, String password) - throws SQLException { - throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); - } - - /** - * Always throws a SQLException. Not supported. - */ - public int getLoginTimeout() throws SQLException { - throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); - } - - /** - * Always throws a SQLException. Not supported. - */ - public PrintWriter getLogWriter() throws SQLException { - throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); - } - - /** - * Always throws a SQLException. Not supported. - */ - public void setLoginTimeout(int seconds) throws SQLException { - throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); - } - - /** - * Always throws a SQLException. Not supported. - */ - public synchronized void setLogWriter(PrintWriter out) throws SQLException { - throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); - } - - /** - * Always return false. - */ - public boolean isWrapperFor(Class iface) throws SQLException { - return false; - } - - /** - * Always throws a SQLException. Not supported. - */ - public T unwrap(Class iface) throws SQLException { - throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); - } - - /** - * Always throws a SQLFeatureNotSupportedException. Not supported. - * @since jdk1.7 - */ - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - throw new SQLFeatureNotSupportedException( - Resources.getMessage("NOT_SUPPORTED")); - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DateParamTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DateParamTagSupport.java deleted file mode 100644 index 5ae09bc..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DateParamTagSupport.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.sql.SQLExecutionTag; -import jakarta.servlet.jsp.tagext.TagSupport; - -import org.apache.taglibs.standard.resources.Resources; - - -/** - *

Tag handler for <Param> in JSTL, used to set - * parameter values for a SQL statement.

- * - * @author Justyna Horwat - */ - -public abstract class DateParamTagSupport extends TagSupport { - - //********************************************************************* - // Private constants - - private static final String TIMESTAMP_TYPE = "timestamp"; - private static final String TIME_TYPE = "time"; - private static final String DATE_TYPE = "date"; - - - //********************************************************************* - // Protected state - - protected String type; - protected java.util.Date value; - - - //********************************************************************* - // Constructor - - public DateParamTagSupport() { - super(); - init(); - } - - private void init() { - value = null; - type = null; - } - - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - SQLExecutionTag parent = (SQLExecutionTag) - findAncestorWithClass(this, SQLExecutionTag.class); - if (parent == null) { - throw new JspTagException( - Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT")); - } - - if (value != null) { - convertValue(); - } - - parent.addSQLParameter(value); - return EVAL_PAGE; - } - - - //********************************************************************* - // Private utility methods - - private void convertValue() throws JspException { - - if ((type == null) || (type.equalsIgnoreCase(TIMESTAMP_TYPE))) { - if (!(value instanceof java.sql.Timestamp)) { - value = new java.sql.Timestamp(value.getTime()); - } - } else if (type.equalsIgnoreCase(TIME_TYPE)) { - if (!(value instanceof java.sql.Time)) { - value = new java.sql.Time(value.getTime()); - } - } else if (type.equalsIgnoreCase(DATE_TYPE)) { - if (!(value instanceof java.sql.Date)) { - value = new java.sql.Date(value.getTime()); - } - } else { - throw new JspException( - Resources.getMessage("SQL_DATE_PARAM_INVALID_TYPE", type)); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverTag.java deleted file mode 100644 index 84ff811..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DriverTag.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import jakarta.servlet.ServletContext; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.TagSupport; - -/** - *

Tag handler for <Driver> in JSTL, used to create - * a simple DataSource for prototyping.

- * - * @author Hans Bergsten - */ -public class DriverTag extends TagSupport { - private static final String DRIVER_CLASS_NAME = - "jakarta.servlet.jsp.jstl.sql.driver"; - private static final String JDBC_URL = - "jakarta.servlet.jsp.jstl.sql.jdbcURL"; - private static final String USER_NAME = - "jakarta.servlet.jsp.jstl.sql.userName"; - private static final String PASSWORD = - "jakarta.servlet.jsp.jstl.sql.password"; - - private String driverClassName; - private String jdbcURL; - private int scope = PageContext.PAGE_SCOPE; - private String userName; - private String var; - - //********************************************************************* - // Accessor methods - - public void setDriver(String driverClassName) { - this.driverClassName = driverClassName; - } - - public void setJdbcURL(String jdbcURL) { - this.jdbcURL = jdbcURL; - } - - /** - * Setter method for the scope of the variable to hold the - * result. - * - */ - public void setScope(String scopeName) { - if ("page".equals(scopeName)) { - scope = PageContext.PAGE_SCOPE; - } - else if ("request".equals(scopeName)) { - scope = PageContext.REQUEST_SCOPE; - } - else if ("session".equals(scopeName)) { - scope = PageContext.SESSION_SCOPE; - } - else if ("application".equals(scopeName)) { - scope = PageContext.APPLICATION_SCOPE; - } - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public void setVar(String var) { - this.var = var; - } - - //********************************************************************* - // Tag logic - - public int doStartTag() throws JspException { - DataSourceWrapper ds = new DataSourceWrapper(); - try { - ds.setDriverClassName(getDriverClassName()); - } - catch (Exception e) { - throw new JspTagException("Invalid driver class name: " + - e.toString(), e); - } - ds.setJdbcURL(getJdbcURL()); - ds.setUserName(getUserName()); - ds.setPassword(getPassword()); - pageContext.setAttribute(var, ds, scope); - return SKIP_BODY; - } - - - //********************************************************************* - // Private utility methods - - private String getDriverClassName() { - if (driverClassName != null) { - return driverClassName; - } - ServletContext application = pageContext.getServletContext(); - return application.getInitParameter(DRIVER_CLASS_NAME); - } - - private String getJdbcURL() { - if (jdbcURL != null) { - return jdbcURL; - } - ServletContext application = pageContext.getServletContext(); - return application.getInitParameter(JDBC_URL); - } - - private String getUserName() { - if (userName != null) { - return userName; - } - ServletContext application = pageContext.getServletContext(); - return application.getInitParameter(USER_NAME); - } - - private String getPassword() { - ServletContext application = pageContext.getServletContext(); - return application.getInitParameter(PASSWORD); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ParamTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ParamTagSupport.java deleted file mode 100644 index fe7dd9f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ParamTagSupport.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.sql.SQLExecutionTag; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import org.apache.taglibs.standard.resources.Resources; - - -/** - *

Tag handler for <Param> in JSTL, used to set - * parameter values for a SQL statement.

- * - * @author Hans Bergsten - */ - -public abstract class ParamTagSupport extends BodyTagSupport { - protected Object value; - - //********************************************************************* - // Tag logic - - public int doEndTag() throws JspException { - SQLExecutionTag parent = (SQLExecutionTag) - findAncestorWithClass(this, SQLExecutionTag.class); - if (parent == null) { - throw new JspTagException( - Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT")); - } - - Object paramValue = null; - if (value != null) { - paramValue = value; - } - else if (bodyContent != null) { - paramValue = bodyContent.getString().trim(); - if (((String) paramValue).trim().length() == 0) { - paramValue = null; - } - } - - parent.addSQLParameter(paramValue); - return EVAL_PAGE; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java deleted file mode 100644 index 4890f0a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.core.Config; -import jakarta.servlet.jsp.jstl.sql.Result; -import jakarta.servlet.jsp.jstl.sql.SQLExecutionTag; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.TryCatchFinally; -import javax.sql.DataSource; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - - -/** - *

Tag handler for <Query> in JSTL. - * - * @author Hans Bergsten - * @author Justyna Horwat - */ - -public abstract class QueryTagSupport extends BodyTagSupport - implements TryCatchFinally, SQLExecutionTag { - - private String var; - private int scope; - - /* - * The following properties take expression values, so the - * setter methods are implemented by the expression type - * specific subclasses. - */ - protected Object rawDataSource; - protected boolean dataSourceSpecified; - protected String sql; - protected int maxRows; - protected boolean maxRowsSpecified; - protected int startRow; - - /* - * Instance variables that are not for attributes - */ - private Connection conn; - private List parameters; - private boolean isPartOfTransaction; - - - //********************************************************************* - // Constructor and initialization - - public QueryTagSupport() { - super(); - init(); - } - - private void init() { - startRow = 0; - maxRows = -1; - maxRowsSpecified = dataSourceSpecified = false; - isPartOfTransaction = false; - conn = null; - rawDataSource = null; - parameters = null; - sql = null; - var = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Accessor methods - - /** - * Setter method for the name of the variable to hold the - * result. - */ - public void setVar(String var) { - this.var = var; - } - - /** - * Setter method for the scope of the variable to hold the - * result. - */ - public void setScope(String scopeName) { - scope = Util.getScope(scopeName); - } - - //********************************************************************* - // Public utility methods - - /** - * Called by nested parameter elements to add PreparedStatement - * parameter values. - */ - @Override - public void addSQLParameter(Object o) { - if (parameters == null) { - parameters = new ArrayList<>(); - } - parameters.add(o); - } - - //********************************************************************* - // Tag logic - - /** - * Prepares for execution by setting the initial state, such as - * getting the Connection - */ - public int doStartTag() throws JspException { - - if (!maxRowsSpecified) { - Object obj = Config.find(pageContext, Config.SQL_MAX_ROWS); - if (obj != null) { - if (obj instanceof Integer) { - maxRows = ((Integer) obj).intValue(); - } else if (obj instanceof String) { - try { - maxRows = Integer.parseInt((String) obj); - } catch (NumberFormatException nfe) { - throw new JspException( - Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", - (String) obj), - nfe); - } - } else { - throw new JspException( - Resources.getMessage("SQL_MAXROWS_INVALID")); - } - } - } - - try { - conn = getConnection(); - } catch (SQLException e) { - throw new JspException(sql + ": " + e.getMessage(), e); - } - - return EVAL_BODY_BUFFERED; - } - - /** - *

Execute the SQL statement, set either through the sql - * attribute or as the body, and save the result as a variable - * named by the var attribute in the scope specified - * by the scope attribute, as an object that implements - * the Result interface. - * - *

The connection used to execute the statement comes either - * from the DataSource specified by the - * dataSource attribute, provided by a parent action - * element, or is retrieved from a JSP scope attribute - * named jakarta.servlet.jstl.sql.dataSource. - */ - public int doEndTag() throws JspException { - /* - * Use the SQL statement specified by the sql attribute, if any, - * otherwise use the body as the statement. - */ - String sqlStatement = null; - if (sql != null) { - sqlStatement = sql; - } - else if (bodyContent != null) { - sqlStatement = bodyContent.getString(); - } - if (sqlStatement == null || sqlStatement.trim().length() == 0) { - throw new JspTagException( - Resources.getMessage("SQL_NO_STATEMENT")); - } - /* - * We shouldn't have a negative startRow or illegal maxrows - */ - if ((startRow < 0) || (maxRows < -1)) { - throw new JspException( - Resources.getMessage("PARAM_BAD_VALUE")); - } - - Result result = null; - /* - * Note! We must not use the setMaxRows() method on the - * the statement to limit the number of rows, since the - * Result factory must be able to figure out the correct - * value for isLimitedByMaxRows(); there's no way to check - * if it was from the ResultSet. - */ - try { - PreparedStatement ps = conn.prepareStatement(sqlStatement); - setParameters(ps, parameters); - ResultSet rs = ps.executeQuery(); - result = new ResultImpl(rs, startRow, maxRows); - ps.close(); - } - catch (Throwable e) { - throw new JspException(sqlStatement + ": " + e.getMessage(), e); - } - pageContext.setAttribute(var, result, scope); - return EVAL_PAGE; - } - - /** - * Just rethrows the Throwable. - */ - public void doCatch(Throwable t) throws Throwable { - throw t; - } - - /** - * Close the Connection, unless this action is used - * as part of a transaction. - */ - public void doFinally() { - if (conn != null && !isPartOfTransaction) { - try { - conn.close(); - } catch (SQLException e) {} // Not much we can do - } - - conn = null; - parameters = null; - } - - - //********************************************************************* - // Private utility methods - - private Connection getConnection() throws JspException, SQLException { - // Fix: Add all other mechanisms - Connection conn = null; - isPartOfTransaction = false; - - TransactionTagSupport parent = (TransactionTagSupport) - findAncestorWithClass(this, TransactionTagSupport.class); - if (parent != null) { - if (dataSourceSpecified) { - throw new JspTagException( - Resources.getMessage("ERROR_NESTED_DATASOURCE")); - } - conn = parent.getSharedConnection(); - isPartOfTransaction = true; - } else { - if ((rawDataSource == null) && dataSourceSpecified) { - throw new JspException( - Resources.getMessage("SQL_DATASOURCE_NULL")); - } - DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource, - pageContext); - try { - conn = dataSource.getConnection(); - } catch (Exception ex) { - throw new JspException( - Resources.getMessage("DATASOURCE_INVALID", - ex.toString())); - } - } - - return conn; - } - - private void setParameters(PreparedStatement ps, List parameters) - throws SQLException - { - if (parameters != null) { - for (int i = 0; i < parameters.size(); i++) { - /* The first parameter has index 1. If a null - * is passed to setObject the parameter will be - * set to JDBC null so an explicit call to - * ps.setNull is not required. - */ - ps.setObject(i + 1, parameters.get(i)); - } - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ResultImpl.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ResultImpl.java deleted file mode 100644 index f4b4ca7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/ResultImpl.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.SortedMap; -import java.util.TreeMap; - -import jakarta.servlet.jsp.jstl.sql.Result; - -/** - *

This class creates a cached version of a ResultSet. - * It's represented as a Result implementation, capable of - * returing an array of Row objects containing a Column - * instance for each column in the row.

- * - *

Note -- this is a private copy for the RI to avoid making the - * corresponding class in jakarta.servlet.* public.

- * - * @author Hans Bergsten - * @author Justyna Horwat - */ - -public class ResultImpl implements Result { - private List> rowMap; - private List rowByIndex; - private String[] columnNames; - private boolean isLimited; - - /** - * This constructor reads the ResultSet and saves a cached - * copy. - * - * @param rs an open ResultSet, positioned before the first - * row - * @param startRow beginning row to be cached - * @param maxRows query maximum rows limit - * @exception if a database error occurs - */ - public ResultImpl(ResultSet rs, int startRow, int maxRows) - throws SQLException - { - rowMap = new ArrayList<>(); - rowByIndex = new ArrayList<>(); - - ResultSetMetaData rsmd = rs.getMetaData(); - int noOfColumns = rsmd.getColumnCount(); - - // Create the column name array - columnNames = new String[noOfColumns]; - for (int i = 1; i <= noOfColumns; i++) { - columnNames[i-1] = rsmd.getColumnName(i); - } - - // Throw away all rows upto startRow - for (int i = 0; i < startRow; i++) { - rs.next(); - } - - // Process the remaining rows upto maxRows - int processedRows = 0; - while (rs.next()) { - if ((maxRows != -1) && (processedRows == maxRows)) { - isLimited = true; - break; - } - Object[] columns = new Object[noOfColumns]; - SortedMap columnMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - - // JDBC uses 1 as the lowest index! - for (int i = 1; i <= noOfColumns; i++) { - Object value = rs.getObject(i); - if (rs.wasNull()) { - value = null; - } - columns[i-1] = value; - columnMap.put(columnNames[i-1], value); - } - rowMap.add(columnMap); - rowByIndex.add(columns); - processedRows++; - } - } - - /** - * Returns an array of SortedMap objects. The SortedMap - * object key is the ColumnName and the value is the ColumnValue. - * SortedMap was created using the CASE_INSENSITIVE_ORDER - * Comparator so the key is the case insensitive representation - * of the ColumnName. - * - * @return an array of Map, or null if there are no rows - */ - @Override - public SortedMap[] getRows() { - if (rowMap == null) { - return null; - } - - //should just be able to return SortedMap[] object - return rowMap.toArray(new SortedMap[0]); - } - - - /** - * Returns an array of Object[] objects. The first index - * designates the Row, the second the Column. The array - * stores the value at the specified row and column. - * - * @return an array of Object[], or null if there are no rows - */ - @Override - public Object[][] getRowsByIndex() { - if (rowByIndex == null) { - return null; - } - - //should just be able to return Object[][] object - return rowByIndex.toArray(new Object[0][0]); - } - - /** - * Returns an array of String objects. The array represents - * the names of the columns arranged in the same order as in - * the getRowsByIndex() method. - * - * @return an array of String[] - */ - public String[] getColumnNames() { - return columnNames; - } - - /** - * Returns the number of rows in the cached ResultSet - * - * @return the number of cached rows, or -1 if the Result could - * not be initialized due to SQLExceptions - */ - public int getRowCount() { - if (rowMap == null) { - return -1; - } - return rowMap.size(); - } - - /** - * Returns true of the query was limited by a maximum row setting - * - * @return true if the query was limited by a MaxRows attribute - */ - public boolean isLimitedByMaxRows() { - return isLimited; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/SetDataSourceTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/SetDataSourceTagSupport.java deleted file mode 100644 index ef6d34e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/SetDataSourceTagSupport.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.core.Config; -import jakarta.servlet.jsp.tagext.TagSupport; -import javax.sql.DataSource; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - - -/** - *

Tag handler for <SetDataSource> in JSTL, used to create - * a simple DataSource for prototyping.

- * - * @author Hans Bergsten - * @author Justyna Horwat - */ -public class SetDataSourceTagSupport extends TagSupport { - - protected Object dataSource; - protected boolean dataSourceSpecified; - protected String jdbcURL; - protected String driverClassName; - protected String userName; - protected String password; - - private int scope; - private String var; - - - //********************************************************************* - // Constructor and initialization - - public SetDataSourceTagSupport() { - super(); - init(); - } - - private void init() { - dataSource = null; - dataSourceSpecified = false; - jdbcURL = driverClassName = userName = password = null; - var = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Accessor methods - - /** - * Setter method for the scope of the variable to hold the - * result. - * - */ - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - public void setVar(String var) { - this.var = var; - } - - - //********************************************************************* - // Tag logic - - public int doStartTag() throws JspException { - DataSource ds; - - if (dataSource != null) { - ds = DataSourceUtil.getDataSource(dataSource, pageContext); - } else { - if (dataSourceSpecified) { - throw new JspException( - Resources.getMessage("SQL_DATASOURCE_NULL")); - } - - DataSourceWrapper dsw = new DataSourceWrapper(); - try { - // set driver class iff provided by the tag - if (driverClassName != null) { - dsw.setDriverClassName(driverClassName); - } - } - catch (Exception e) { - throw new JspTagException( - Resources.getMessage("DRIVER_INVALID_CLASS", - e.toString()), e); - } - dsw.setJdbcURL(jdbcURL); - dsw.setUserName(userName); - dsw.setPassword(password); - ds = (DataSource) dsw; - } - - if (var != null) { - pageContext.setAttribute(var, ds, scope); - } else { - Config.set(pageContext, Config.SQL_DATA_SOURCE, ds, scope); - } - - return SKIP_BODY; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/TransactionTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/TransactionTagSupport.java deleted file mode 100644 index f6cec1f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/TransactionTagSupport.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import java.sql.Connection; -import java.sql.SQLException; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.tagext.TagSupport; -import jakarta.servlet.jsp.tagext.TryCatchFinally; -import javax.sql.DataSource; - -import org.apache.taglibs.standard.resources.Resources; - - -/** - *

Tag handler for <Transaction> in JSTL. - * - * @author Hans Bergsten - */ - -public abstract class TransactionTagSupport extends TagSupport - implements TryCatchFinally { - - //********************************************************************* - // Private constants - - private static final String TRANSACTION_READ_COMMITTED - = "read_committed"; - private static final String TRANSACTION_READ_UNCOMMITTED - = "read_uncommitted"; - private static final String TRANSACTION_REPEATABLE_READ - = "repeatable_read"; - private static final String TRANSACTION_SERIALIZABLE - = "serializable"; - - - //********************************************************************* - // Protected state - - protected Object rawDataSource; - protected boolean dataSourceSpecified; - - - //********************************************************************* - // Private state - - private Connection conn; - private int isolation; - private int origIsolation; - - - //********************************************************************* - // Constructor and initialization - - public TransactionTagSupport() { - super(); - init(); - } - - private void init() { - conn = null; - dataSourceSpecified = false; - rawDataSource = null; - isolation = Connection.TRANSACTION_NONE; - } - - - //********************************************************************* - // Tag logic - - /** - * Prepares for execution by setting the initial state, such as - * getting the Connection and preparing it for - * the transaction. - */ - public int doStartTag() throws JspException { - - if ((rawDataSource == null) && dataSourceSpecified) { - throw new JspException( - Resources.getMessage("SQL_DATASOURCE_NULL")); - } - - DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource, - pageContext); - - try { - conn = dataSource.getConnection(); - origIsolation = conn.getTransactionIsolation(); - if (origIsolation == Connection.TRANSACTION_NONE) { - throw new JspTagException( - Resources.getMessage("TRANSACTION_NO_SUPPORT")); - } - if ((isolation != Connection.TRANSACTION_NONE) - && (isolation != origIsolation)) { - conn.setTransactionIsolation(isolation); - } - conn.setAutoCommit(false); - } catch (SQLException e) { - throw new JspTagException( - Resources.getMessage("ERROR_GET_CONNECTION", - e.toString()), e); - } - - return EVAL_BODY_INCLUDE; - } - - /** - * Commits the transaction. - */ - public int doEndTag() throws JspException { - try { - conn.commit(); - } catch (SQLException e) { - throw new JspTagException( - Resources.getMessage("TRANSACTION_COMMIT_ERROR", - e.toString()), e); - } - return EVAL_PAGE; - } - - /** - * Rollbacks the transaction and rethrows the Throwable. - */ - public void doCatch(Throwable t) throws Throwable { - if (conn != null) { - try { - conn.rollback(); - } catch (SQLException e) { - // Ignore to not hide orignal exception - } - } - throw t; - } - - /** - * Restores the Connection to its initial state and - * closes it. - */ - public void doFinally() { - if (conn != null) { - try { - if ((isolation != Connection.TRANSACTION_NONE) - && (isolation != origIsolation)) { - conn.setTransactionIsolation(origIsolation); - } - conn.setAutoCommit(true); - conn.close(); - } catch (SQLException e) { - // Not much we can do - } - } - conn = null; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Public utility methods - - /** - * Setter method for the transaction isolation level. - */ - public void setIsolation(String iso) throws JspTagException { - - if (TRANSACTION_READ_COMMITTED.equals(iso)) { - isolation = Connection.TRANSACTION_READ_COMMITTED; - } else if (TRANSACTION_READ_UNCOMMITTED.equals(iso)) { - isolation = Connection.TRANSACTION_READ_UNCOMMITTED; - } else if (TRANSACTION_REPEATABLE_READ.equals(iso)) { - isolation = Connection.TRANSACTION_REPEATABLE_READ; - } else if (TRANSACTION_SERIALIZABLE.equals(iso)) { - isolation = Connection.TRANSACTION_SERIALIZABLE; - } else { - throw new JspTagException( - Resources.getMessage("TRANSACTION_INVALID_ISOLATION")); - } - } - - /** - * Called by nested parameter elements to get a reference to - * the Connection. - */ - public Connection getSharedConnection() { - return conn; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java deleted file mode 100644 index 42f7580..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.sql; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.jstl.sql.SQLExecutionTag; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.TryCatchFinally; -import javax.sql.DataSource; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - *

Tag handler for <Update> in JSTL. - * - * @author Hans Bergsten - * @author Justyna Horwat - */ - -public abstract class UpdateTagSupport extends BodyTagSupport - implements TryCatchFinally, SQLExecutionTag { - - private String var; - private int scope; - - /* - * The following properties take expression values, so the - * setter methods are implemented by the expression type - * specific subclasses. - */ - protected Object rawDataSource; - protected boolean dataSourceSpecified; - protected String sql; - - /* - * Instance variables that are not for attributes - */ - private Connection conn; - private List parameters; - private boolean isPartOfTransaction; - - - //********************************************************************* - // Constructor and initialization - - public UpdateTagSupport() { - super(); - init(); - } - - private void init() { - rawDataSource = null; - sql = null; - conn = null; - parameters = null; - isPartOfTransaction = dataSourceSpecified = false; - scope = PageContext.PAGE_SCOPE; - var = null; - } - - - //********************************************************************* - // Accessor methods - - /** - * Setter method for the name of the variable to hold the - * result. - */ - public void setVar(String var) { - this.var = var; - } - - /** - * Setter method for the scope of the variable to hold the - * result. - */ - public void setScope(String scopeName) { - scope = Util.getScope(scopeName); - } - - - //********************************************************************* - // Tag logic - - /** - * Prepares for execution by setting the initial state, such as - * getting the Connection - */ - public int doStartTag() throws JspException { - - try { - conn = getConnection(); - } catch (SQLException e) { - throw new JspException(sql + ": " + e.getMessage(), e); - } - - return EVAL_BODY_BUFFERED; - } - - /** - *

Execute the SQL statement, set either through the sql - * attribute or as the body, and save the result as a variable - * named by the var attribute in the scope specified - * by the scope attribute, as an object that implements - * the Result interface. - * - *

The connection used to execute the statement comes either - * from the DataSource specified by the - * dataSource attribute, provided by a parent action - * element, or is retrieved from a JSP scope attribute - * named jakarta.servlet.jsp.jstl.sql.dataSource. - */ - public int doEndTag() throws JspException { - /* - * Use the SQL statement specified by the sql attribute, if any, - * otherwise use the body as the statement. - */ - String sqlStatement = null; - if (sql != null) { - sqlStatement = sql; - } - else if (bodyContent != null) { - sqlStatement = bodyContent.getString(); - } - if (sqlStatement == null || sqlStatement.trim().length() == 0) { - throw new JspTagException( - Resources.getMessage("SQL_NO_STATEMENT")); - } - - int result = 0; - try { - PreparedStatement ps = conn.prepareStatement(sqlStatement); - setParameters(ps, parameters); - result = ps.executeUpdate(); - } - catch (Throwable e) { - throw new JspException(sqlStatement + ": " + e.getMessage(), e); - } - if (var != null) - pageContext.setAttribute(var, Integer.valueOf(result), scope); - return EVAL_PAGE; - } - - /** - * Just rethrows the Throwable. - */ - public void doCatch(Throwable t) throws Throwable { - throw t; - } - - /** - * Close the Connection, unless this action is used - * as part of a transaction. - */ - public void doFinally() { - if (conn != null && !isPartOfTransaction) { - try { - conn.close(); - } catch (SQLException e) { - // Not much we can do - } - } - - parameters = null; - conn = null; - } - - - //********************************************************************* - // Public utility methods - - /** - * Called by nested parameter elements to add PreparedStatement - * parameter values. - */ - @Override - public void addSQLParameter(Object o) { - if (parameters == null) { - parameters = new ArrayList<>(); - } - parameters.add(o); - } - - - //********************************************************************* - // Private utility methods - - private Connection getConnection() throws JspException, SQLException { - // Fix: Add all other mechanisms - Connection conn = null; - isPartOfTransaction = false; - - TransactionTagSupport parent = (TransactionTagSupport) - findAncestorWithClass(this, TransactionTagSupport.class); - if (parent != null) { - if (dataSourceSpecified) { - throw new JspTagException( - Resources.getMessage("ERROR_NESTED_DATASOURCE")); - } - conn = parent.getSharedConnection(); - isPartOfTransaction = true; - } else { - if ((rawDataSource == null) && dataSourceSpecified) { - throw new JspException( - Resources.getMessage("SQL_DATASOURCE_NULL")); - } - DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource, - pageContext); - try { - conn = dataSource.getConnection(); - } catch (Exception ex) { - throw new JspException( - Resources.getMessage("DATASOURCE_INVALID", - ex.toString())); - } - } - - return conn; - } - - private void setParameters(PreparedStatement ps, List parameters) - throws SQLException - { - if (parameters != null) { - for (int i = 0; i < parameters.size(); i++) { - /* The first parameter has index 1. If a null - * is passed to setObject the parameter will be - * set to JDBC null so an explicit call to - * ps.setNull is not required. - */ - ps.setObject(i + 1, parameters.get(i)); - } - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/DocumentBuilderProvider.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/DocumentBuilderProvider.java deleted file mode 100644 index f7ae781..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/DocumentBuilderProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -/** - * Provides preconfigured {@link DocumentBuilder} instances. - * - * @author David Matejcek - */ -public class DocumentBuilderProvider { - - private static final DocumentBuilderFactory DBF; - private static final DocumentBuilderFactory DBF_SECURE; - static { - DBF = DocumentBuilderFactory.newInstance(); - DBF.setNamespaceAware(true); - DBF.setValidating(false); - - DBF_SECURE = DocumentBuilderFactory.newInstance(); - DBF_SECURE.setNamespaceAware(true); - DBF_SECURE.setValidating(false); - try { - DBF_SECURE.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (ParserConfigurationException e) { - throw new Error("Parser does not support secure processing"); - } - } - - /** - * Creates a namespace-aware {@link DocumentBuilder} with disabled validation. - *

- * Note that {@link DocumentBuilder} instances are not thread-safe and their implementation can - * be chosen as described in {@link DocumentBuilderFactory} documentation. - * - * @return new {@link DocumentBuilder} instance. - */ - public static DocumentBuilder createDocumentBuilder() { - try { - return DBF.newDocumentBuilder(); - } catch (ParserConfigurationException e) { - throw new Error("Could not initialize the DocumentBuilder!", e); - } - } - - - /** - * Creates a namespace-aware {@link DocumentBuilder} with disabled validation and enabled - * {@link XMLConstants#FEATURE_SECURE_PROCESSING}. - *

- * Note that {@link DocumentBuilder} instances are not thread-safe and their implementation can - * be chosen as described in {@link DocumentBuilderFactory} documentation. - * - * @return new {@link DocumentBuilder} instance. - */ - public static DocumentBuilder createSecureDocumentBuilder() { - try { - return DBF_SECURE.newDocumentBuilder(); - } catch (ParserConfigurationException e) { - throw new Error("Could not initialize the DocumentBuilder!", e); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java deleted file mode 100644 index 3ce98ee..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.tagext.TagSupport; - -/** - *

Tag handler for <expr> in JSTL's XML library.

- * - * @author Shawn Bayern - */ - -public abstract class ExprSupport extends TagSupport { - - //********************************************************************* - // Internal state - - private String select; // tag attribute - protected boolean escapeXml; // tag attribute - - //********************************************************************* - // Construction and initialization - - /** - * Constructs a new handler. As with TagSupport, subclasses should - * not provide other constructors and are expected to call the - * superclass constructor. - */ - public ExprSupport() { - super(); - init(); - } - - // resets local state - private void init() { - select = null; - escapeXml = true; - } - - - //********************************************************************* - // Tag logic - - // applies XPath expression from 'select' and prints the result - public int doStartTag() throws JspException { - try { - XPathUtil xu = new XPathUtil(pageContext); - String result = xu.valueOf(XPathUtil.getContext(this), select); - org.apache.taglibs.standard.tag.common.core.OutSupport.out( - pageContext, escapeXml, result); - return SKIP_BODY; - } catch (java.io.IOException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Attribute accessors - - public void setSelect(String select) { - this.select = select; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java deleted file mode 100644 index fd0adef..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import java.util.List; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.LoopTagSupport; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for the XML library's <forEach> tag.

- * - * @see jakarta.servlet.jsp.jstl.core.LoopTagSupport - * @author Shawn Bayern - */ -public class ForEachTag extends LoopTagSupport { - - //********************************************************************* - // Private state - - private String select; // tag attribute - private List nodes; // XPath result - private int nodesIndex; // current index - private org.w3c.dom.Node current; // current node - - //********************************************************************* - // Iteration control methods - - // (We inherit semantics and Javadoc from LoopTagSupport.) - - protected void prepare() throws JspTagException { - nodesIndex = 0; - XPathUtil xu = new XPathUtil(pageContext); - nodes = xu.selectNodes(XPathUtil.getContext(this), select); - } - - protected boolean hasNext() throws JspTagException { - return (nodesIndex < nodes.size()); - } - - protected Object next() throws JspTagException { - Object o = nodes.get(nodesIndex++); - if (!(o instanceof org.w3c.dom.Node)) - throw new JspTagException( - Resources.getMessage("FOREACH_NOT_NODESET")); - current = (org.w3c.dom.Node) o; - return current; - } - - - //********************************************************************* - // Tag logic and lifecycle management - - // Releases any resources we may have (or inherit) - public void release() { - init(); - super.release(); - } - - - //********************************************************************* - // Attribute accessors - - public void setSelect(String select) { - this.select = select; - } - - public void setBegin(int begin) throws JspTagException { - this.beginSpecified = true; - this.begin = begin; - validateBegin(); - } - - public void setEnd(int end) throws JspTagException { - this.endSpecified = true; - this.end = end; - validateEnd(); - } - - public void setStep(int step) throws JspTagException { - this.stepSpecified = true; - this.step = step; - validateStep(); - } - - //********************************************************************* - // Public methods for subtags - - /* Retrieves the current context. */ - public org.w3c.dom.Node getContext() throws JspTagException { - // expose the current node as the context - return current; - } - - - //********************************************************************* - // Private utility methods - - private void init() { - select = null; - nodes = null; - nodesIndex = 0; - current = null; - } -} - diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/IfTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/IfTag.java deleted file mode 100644 index 243bbe5..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/IfTag.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.ConditionalTagSupport; - -/** - *

Tag handler for <if> in JSTL's XML library.

- * - * @author Shawn Bayern - */ - -public class IfTag extends ConditionalTagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public IfTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Supplied conditional logic - - protected boolean condition() throws JspTagException { - XPathUtil xu = new XPathUtil(pageContext); - return (xu.booleanValueOf(XPathUtil.getContext(this), select)); - } - - - //********************************************************************* - // Private state - - private String select; // the value of the 'test' attribute - - - //********************************************************************* - // Attribute accessors - - public void setSelect(String select) { - this.select = select; - } - - - //********************************************************************* - // Private utility methods - - // resets internal state - private void init() { - select = null; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLNodeList.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLNodeList.java deleted file mode 100644 index f6312ed..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLNodeList.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import java.util.Vector; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -class JSTLNodeList extends Vector implements NodeList { - - private static final long serialVersionUID = -1217630367839271134L; - - Vector nodeVector; - - JSTLNodeList(Vector nodeVector) { - this.nodeVector = nodeVector; - } - - - JSTLNodeList(NodeList nl) { - nodeVector = new Vector<>(); - // p("[JSTLNodeList] nodelist details"); - for (int i = 0; i < nl.getLength(); i++) { - Node currNode = nl.item(i); - // XPathUtil.printDetails ( currNode ); - nodeVector.add(i, currNode); - } - } - - - JSTLNodeList(Node n) { - nodeVector = new Vector<>(); - nodeVector.addElement(n); - } - - - JSTLNodeList(Object o) { - nodeVector = new Vector<>(); - - if (o instanceof NodeList) { - NodeList nl = (NodeList) o; - for (int i = 0; i < nl.getLength(); i++) { - Node currNode = nl.item(i); - // XPathUtil.printDetails ( currNode ); - nodeVector.add(i, currNode); - } - } else { - nodeVector.addElement(o); - } - } - - - @Override - public Node item(int index) { - return (Node) nodeVector.elementAt(index); - } - - - @Override - public Object elementAt(int index) { - return nodeVector.elementAt(index); - } - - - @Override - public Object get(int index) { - return nodeVector.get(index); - } - - - @Override - public int getLength() { - return nodeVector.size(); - } - - - @Override - public int size() { - return nodeVector.size(); - } - - // Can implement other Vector methods to redirect those methods to - // the vector in the variable param. As we are not using them as part - // of this implementation we are not doing that here. If this changes - // then we need to override those methods accordingly -} \ No newline at end of file diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathConstants.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathConstants.java deleted file mode 100644 index da5824f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - - -import javax.xml.namespace.QName; - -/** - * This class is added to provide support for a generic Object type in return type - * arguement for XPath's evaluate instance method. - * - * @author dhirup - */ -public class JSTLXPathConstants { - - /** - *

Private constructor to prevent instantiation.

- */ - private JSTLXPathConstants() { - } - - // To support generic Object types - public static final QName OBJECT = new QName("http://www.w3.org/1999/XSL/Transform", "OBJECT"); - - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathFactory.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathFactory.java deleted file mode 100644 index 0db4ba5..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import javax.xml.xpath.XPath; - -import org.apache.xpath.jaxp.XPathFactoryImpl; - -/** - * This factory class is added to provide access to our own implementation - * of XPath, so that we can support a generic Object type in return type - * arguement for XPath's evaluate instance method. - * - * @author dhirup - */ -public class JSTLXPathFactory extends XPathFactoryImpl { - - @Override - public XPath newXPath() { - return new JSTLXPathImpl(null, null); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathImpl.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathImpl.java deleted file mode 100644 index 624ea1f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathImpl.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import java.io.IOException; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.namespace.QName; -import javax.xml.transform.TransformerException; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFunctionException; -import javax.xml.xpath.XPathFunctionResolver; -import javax.xml.xpath.XPathVariableResolver; - -import org.apache.xml.dtm.DTM; -import org.apache.xpath.XPath; -import org.apache.xpath.XPathContext; -import org.apache.xpath.jaxp.JAXPExtensionsProvider; -import org.apache.xpath.jaxp.JAXPPrefixResolver; -import org.apache.xpath.jaxp.JAXPVariableStack; -import org.apache.xpath.objects.XNodeSet; -import org.apache.xpath.objects.XObject; -import org.apache.xpath.res.XPATHErrorResources; -import org.apache.xpath.res.XPATHMessages; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.traversal.NodeIterator; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * The JSTLXPathImpl class provides implementation for the methods defined in - * javax.xml.xpath.XPath interface. This provide simple access to the results - * of an XPath expression. - * - * This class provides our own implementation of XPath, so that we can support - * a generic Object type in returnType arguement for XPath's evaluate instance - * method. - * - * Most of the implementation is exactly similar to what is already provided in - * com.sun.org.apache.xpath.internal.jaxp.XPathImpl.java - */ -class JSTLXPathImpl implements javax.xml.xpath.XPath { - - private final XPathVariableResolver origVariableResolver; - private final XPathFunctionResolver origFunctionResolver; - - private XPathVariableResolver variableResolver; - private XPathFunctionResolver functionResolver; - private NamespaceContext namespaceContext; - private JAXPPrefixResolver prefixResolver; - - // By default Extension Functions are allowed in XPath Expressions. If - // Secure Processing Feature is set on XPathFactory then the invocation of - // extensions function need to throw XPathFunctionException - private boolean featureSecureProcessing; - - JSTLXPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr) { - this.origVariableResolver = this.variableResolver = vr; - this.origFunctionResolver = this.functionResolver = fr; - } - - - JSTLXPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr, boolean featureSecureProcessing) { - this.origVariableResolver = this.variableResolver = vr; - this.origFunctionResolver = this.functionResolver = fr; - this.featureSecureProcessing = featureSecureProcessing; - } - - - @Override - public void reset() { - this.variableResolver = this.origVariableResolver; - this.functionResolver = this.origFunctionResolver; - this.namespaceContext = null; - } - - - @Override - public void setXPathVariableResolver(XPathVariableResolver resolver) { - if (resolver == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"XPathVariableResolver"}); - throw new NullPointerException(fmsg); - } - this.variableResolver = resolver; - } - - - @Override - public XPathVariableResolver getXPathVariableResolver() { - return variableResolver; - } - - - @Override - public void setXPathFunctionResolver(XPathFunctionResolver resolver) { - if (resolver == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"XPathFunctionResolver"}); - throw new NullPointerException(fmsg); - } - this.functionResolver = resolver; - } - - - @Override - public XPathFunctionResolver getXPathFunctionResolver() { - return functionResolver; - } - - - @Override - public void setNamespaceContext(NamespaceContext nsContext) { - if (nsContext == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"NamespaceContext"}); - throw new NullPointerException(fmsg); - } - this.namespaceContext = nsContext; - this.prefixResolver = new JAXPPrefixResolver(nsContext); - } - - - @Override - public NamespaceContext getNamespaceContext() { - return namespaceContext; - } - - - @Override - public XPathExpression compile(String expression) - throws XPathExpressionException { - // This is never used in JSTL - if (expression == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"XPath expression"}); - throw new NullPointerException(fmsg); - } - return null; - } - - - @Override - public Object evaluate(String expression, Object item, QName returnType) throws XPathExpressionException { - if (expression == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"XPath expression"}); - throw new NullPointerException(fmsg); - } - if (returnType == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"returnType"}); - throw new NullPointerException(fmsg); - } - // Checking if requested returnType is supported. returnType need to - // be defined in XPathConstants or JSTLXPathConstants - if (!isSupported(returnType)) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, - new Object[] {returnType.toString()}); - throw new IllegalArgumentException(fmsg); - } - - try { - XObject resultObject = eval(expression, item); - return getResultAsType(resultObject, returnType); - } catch (NullPointerException npe) { - // If VariableResolver returns null Or if we get - // NullPointerException at this stage for some other reason - // then we have to reurn XPathException - throw new XPathExpressionException(npe); - } catch (TransformerException te) { - Throwable nestedException = te.getException(); - if (nestedException instanceof XPathFunctionException) { - throw (XPathFunctionException) nestedException; - } - // For any other exceptions we need to throw - // XPathExpressionException ( as per spec ) - throw new XPathExpressionException(te); - } - } - - - @Override - public String evaluate(String expression, Object item) throws XPathExpressionException { - return (String) this.evaluate(expression, item, XPathConstants.STRING); - } - - - @Override - public Object evaluate(String expression, InputSource source, QName returnType) throws XPathExpressionException { - // Checking validity of different parameters - if (source == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"source"}); - throw new NullPointerException(fmsg); - } - if (expression == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"XPath expression"}); - throw new NullPointerException(fmsg); - } - if (returnType == null) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, - new Object[] {"returnType"}); - throw new NullPointerException(fmsg); - } - - // Checking if requested returnType is supported. - // returnType need to be defined in XPathConstants - if (!isSupported(returnType)) { - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, - new Object[] {returnType.toString()}); - throw new IllegalArgumentException(fmsg); - } - - try { - Document document = DocumentBuilderProvider.createDocumentBuilder().parse(source); - XObject resultObject = eval(expression, document); - return getResultAsType(resultObject, returnType); - } catch (SAXException e) { - throw new XPathExpressionException(e); - } catch (IOException e) { - throw new XPathExpressionException(e); - } catch (TransformerException te) { - Throwable nestedException = te.getException(); - if (nestedException instanceof XPathFunctionException) { - throw (XPathFunctionException) nestedException; - } - throw new XPathExpressionException(te); - } - } - - - @Override - public String evaluate(String expression, InputSource source) throws XPathExpressionException { - return (String) this.evaluate(expression, source, XPathConstants.STRING); - } - - - private XObject eval(String expression, Object contextItem) throws TransformerException { - XPath xpath = new XPath(expression, null, prefixResolver, XPath.SELECT); - final XPathContext xpathSupport; - if (functionResolver != null) { - JAXPExtensionsProvider jep = new JAXPExtensionsProvider(functionResolver, featureSecureProcessing); - xpathSupport = new XPathContext(jep); - } else { - xpathSupport = new XPathContext(); - } - - xpathSupport.setVarStack(new JAXPVariableStack(variableResolver)); - - // If item is null, then we will create a a Dummy contextNode - if (contextItem instanceof Node) { - return xpath.execute(xpathSupport, (Node) contextItem, prefixResolver); - } - return xpath.execute(xpathSupport, DTM.NULL, prefixResolver); - } - - - private boolean isSupported(QName returnType) { - return returnType.equals(XPathConstants.STRING) || returnType.equals(XPathConstants.NUMBER) - || returnType.equals(XPathConstants.BOOLEAN) || returnType.equals(XPathConstants.NODE) - || returnType.equals(XPathConstants.NODESET) || returnType.equals(JSTLXPathConstants.OBJECT); - } - - - private Object getResultAsType(XObject resultObject, QName returnType) throws TransformerException { - if (returnType.equals(XPathConstants.STRING)) { - return resultObject.str(); - } - if (returnType.equals(XPathConstants.NUMBER)) { - return Double.valueOf(resultObject.num()); - } - if (returnType.equals(XPathConstants.BOOLEAN)) { - return Boolean.valueOf(resultObject.bool()); - } - // XPathConstants.NODESET ---ORdered, UNOrdered??? - if (returnType.equals(XPathConstants.NODESET)) { - return resultObject.nodelist(); - } - if (returnType.equals(XPathConstants.NODE)) { - NodeIterator ni = resultObject.nodeset(); - // Return the first node, or null - return ni.nextNode(); - } - if (returnType.equals(JSTLXPathConstants.OBJECT)) { - if (resultObject instanceof XNodeSet) { - return resultObject.nodelist(); - } - return resultObject.object(); - } - String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, - new Object[] {returnType.toString()}); - throw new IllegalArgumentException(fmsg); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathNamespaceContext.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathNamespaceContext.java deleted file mode 100644 index 28f836c..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathNamespaceContext.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import java.util.Arrays; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.XMLConstants; - -/** - * Implemenation of XML Namespace context processing given a URI or prefix - */ -public class JSTLXPathNamespaceContext implements NamespaceContext { - - //********************************************************************* - // Constructor - - /** - * No-arg constructor which would create empty HashMap of namespaces - */ - public JSTLXPathNamespaceContext() { - namespaces = new HashMap<>(); - } - - public JSTLXPathNamespaceContext(HashMap nses) { - namespaces = nses; - } - - /** - * The context to resolve the prefix from, if the context - * is not given. - */ - HashMap namespaces; - - /** - * Get Namespace URI bound to a prefix in the current scope - * - * @param prefix Parameter - * - * @return Namespace URI bound to prefix - * - * @throws IllegalArgumentException if prefix is null - */ - public String getNamespaceURI(String prefix) - throws IllegalArgumentException { - // p("[getNamespaceURI] prefix: " + prefix); - if (prefix == null) { - throw new IllegalArgumentException("Cannot get Namespace URI for null prefix"); - } - - if (prefix.equals(XMLConstants.XML_NS_PREFIX)) { - return XMLConstants.XML_NS_URI; - } - if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) { - return XMLConstants.XMLNS_ATTRIBUTE_NS_URI; - } - - String namespaceURI = namespaces.get(prefix); - // p("[getNamespaceURI] namespaceURI: " + namespaceURI); - if (namespaceURI != null) { - return namespaceURI; - } - - return XMLConstants.NULL_NS_URI; - } - - /** - * Get Prefix bound to Namespace URI in the current scope - * - * @param namespaceURI Namespace URI - * - * @return Prefix bound to Namespace URI - * - * @throws IllegalArgumentException if Namespace URI is null - */ - public String getPrefix(String namespaceURI) { - // p("[getPrefix] namespaceURI: " + namespaceURI); - if (namespaceURI == null) { - throw new IllegalArgumentException("Cannot get prefix for null NamespaceURI"); - } - - if (namespaceURI.equals(XMLConstants.XML_NS_URI)) { - return XMLConstants.XML_NS_PREFIX; - } - if (namespaceURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { - return XMLConstants.XMLNS_ATTRIBUTE; - } - - for (String key : namespaces.keySet()) { - String value = namespaces.get(key); - if (value.equals(namespaceURI)) { - // p("[getPrefix] value: " + value); - return value; - } - } - - // p("[getPrefix] returning null"); - return null; - } - - /** - * Get all Prefixes bound to Namespace URI in the current scope - * - * @param namespaceURI Namespace URI - * - * @return Iterator of Prefixes bound to Namespace URI - * - * @throws IllegalArgumentException if Namespace URI is null - */ - @Override - public Iterator getPrefixes(String namespaceURI) { - // p("[getPrefixes] namespaceURI: " + namespaceURI); - if (namespaceURI == null) { - throw new IllegalArgumentException("Cannot get prefix for null NamespaceURI"); - } - - if (namespaceURI.equals(XMLConstants.XML_NS_URI)) { - return Arrays.asList(new String[] {XMLConstants.XML_NS_PREFIX}).iterator(); - } - if (namespaceURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { - return Arrays.asList(new String[] {XMLConstants.XMLNS_ATTRIBUTE}).iterator(); - } - - ArrayList prefixList = new ArrayList<>(); - for (String key : namespaces.keySet()) { - String value = namespaces.get(key); - if (value.equals(namespaceURI)) { - prefixList.add(key); - } - } - - // p("[getPrefixes] prefixList: " + prefixList); - return prefixList.iterator(); - } - - /** - * Populate map of Prefix and NameSpace URI's entries - */ - protected void addNamespace(String prefix, String uri ) { - namespaces.put(prefix, uri ); - } - - //********************************************************************* - // Utility methods - - private static void p(String s) { - System.out.println("[JSTLXPathNameContext] " + s); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathVariableResolver.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathVariableResolver.java deleted file mode 100644 index 0b318e8..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathVariableResolver.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import javax.xml.xpath.XPathVariableResolver; -import javax.xml.namespace.QName; - -import jakarta.servlet.http.Cookie; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.jsp.PageContext; - - -/** - * The XPathVariableResolver implementation provides access to user - * XPath variables. - */ -public class JSTLXPathVariableResolver implements XPathVariableResolver { - - //********************************************************************* - // Support for XPath evaluation - - private PageContext pageContext; - - // The URLs - private static final String PAGE_NS_URL = - "http://java.sun.com/jstl/xpath/page"; - private static final String REQUEST_NS_URL = - "http://java.sun.com/jstl/xpath/request"; - private static final String SESSION_NS_URL = - "http://java.sun.com/jstl/xpath/session"; - private static final String APP_NS_URL = - "http://java.sun.com/jstl/xpath/app"; - private static final String PARAM_NS_URL = - "http://java.sun.com/jstl/xpath/param"; - private static final String INITPARAM_NS_URL = - "http://java.sun.com/jstl/xpath/initParam"; - private static final String COOKIE_NS_URL = - "http://java.sun.com/jstl/xpath/cookie"; - private static final String HEADER_NS_URL = - "http://java.sun.com/jstl/xpath/header"; - - //********************************************************************* - // Constructor - - public JSTLXPathVariableResolver(PageContext pc) { - pageContext = pc; - } - - /** - * Find variable in set of variables - * - * @param qname QName variable name - * - * @return QName variables value - * - * @throws NullPointerException if variable name is null - */ - public Object resolveVariable(QName qname) throws NullPointerException { - - Object varObject = null; - - if (qname == null) { - throw new NullPointerException("Cannot resolve null variable"); - } - - String namespace = qname.getNamespaceURI(); - String prefix = qname.getPrefix(); - String localName = qname.getLocalPart(); - // p("[resolveVariable] namespace: " + namespace + " prefix: " + prefix + " localName: " + localName); - - try { - varObject = getVariableValue(namespace, prefix, localName); - } catch (UnresolvableException ue) { - System.out.println("JSTLXpathVariableResolver.resolveVariable threw UnresolvableException: " + ue); - } - - // p("[resolveVariable] varObject: " + varObject); - return varObject; - } - - /** - * Retrieve an XPath's variable value using JSTL's custom - * variable-mapping rules - */ - protected Object getVariableValue(String namespace, - String prefix, - String localName) - throws UnresolvableException { - // p("resolving: ns=" + namespace + " prefix=" + prefix + " localName=" + localName); - // We can match on namespace with Xalan but leaving as is - // [ I 'd prefer to match on namespace, but this doesn't appear - // to work in Jaxen] - if (namespace == null || namespace.equals("")) { - return notNull( - pageContext.findAttribute(localName), - namespace, - localName); - } else if (namespace.equals(PAGE_NS_URL)) { - return notNull( - pageContext.getAttribute(localName,PageContext.PAGE_SCOPE), - namespace, - localName); - } else if (namespace.equals(REQUEST_NS_URL)) { - return notNull( - pageContext.getAttribute(localName, - PageContext.REQUEST_SCOPE), - namespace, - localName); - } else if (namespace.equals(SESSION_NS_URL)) { - return notNull( - pageContext.getAttribute(localName, - PageContext.SESSION_SCOPE), - namespace, - localName); - } else if (namespace.equals(APP_NS_URL)) { - return notNull( - pageContext.getAttribute(localName, - PageContext.APPLICATION_SCOPE), - namespace, - localName); - } else if (namespace.equals(PARAM_NS_URL)) { - return notNull( - pageContext.getRequest().getParameter(localName), - namespace, - localName); - } else if (namespace.equals(INITPARAM_NS_URL)) { - return notNull( - pageContext.getServletContext(). - getInitParameter(localName), - namespace, - localName); - } else if (namespace.equals(HEADER_NS_URL)) { - HttpServletRequest hsr = - (HttpServletRequest) pageContext.getRequest(); - return notNull( - hsr.getHeader(localName), - namespace, - localName); - } else if (namespace.equals(COOKIE_NS_URL)) { - HttpServletRequest hsr = - (HttpServletRequest) pageContext.getRequest(); - Cookie[] c = hsr.getCookies(); - for (int i = 0; i < c.length; i++) - if (c[i].getName().equals(localName)) - return c[i].getValue(); - throw new UnresolvableException("$" + namespace + ":" + localName); - } else { - throw new UnresolvableException("$" + namespace + ":" + localName); - } - } - - /** - * Validate that the Object returned is not null. If it is - * null, throw an exception. - */ - private Object notNull(Object o, String namespace, String localName) - throws UnresolvableException { - if (o == null) { - throw new UnresolvableException("$" + (namespace==null?"":namespace+":") + localName); - } - // p("resolved to: " + o); - return o; - } - - //********************************************************************* - // Utility methods - - private static void p(String s) { - System.out.println("[JSTLXPathVariableResolver] " + s); - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java deleted file mode 100644 index 4f1d216..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.tagext.BodyTagSupport; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.resources.Resources; - -/** - *

Support for tag handlers for <param>, the XML parameter - * subtag for <transformt<.

- * - * @see TransformSupport - * @author Shawn Bayern - */ - -public abstract class ParamSupport extends BodyTagSupport { - - //********************************************************************* - // Protected state - - protected String name; // 'name' attribute - protected Object value; // 'value' attribute - - //********************************************************************* - // Constructor and initialization - - public ParamSupport() { - super(); - init(); - } - - private void init() { - name = null; - value = null; - } - - - //********************************************************************* - // Tag logic - - // simply send our name and value to our parent tag - public int doEndTag() throws JspException { - Tag t = findAncestorWithClass(this, TransformSupport.class); - if (t == null) - throw new JspTagException( - Resources.getMessage("PARAM_OUTSIDE_TRANSFORM")); - TransformSupport parent = (TransformSupport) t; - - Object value = this.value; - if (value == null) { - if (bodyContent == null || bodyContent.getString() == null) - value = ""; - else - value = bodyContent.getString().trim(); - } - parent.addParameter(name, value); - return EVAL_PAGE; - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java deleted file mode 100644 index ed1c15e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.ImportSupport; -import org.apache.taglibs.standard.tag.common.core.Util; -import org.w3c.dom.Document; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLFilter; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; - -/** - *

Support for tag handlers for <parse>, the XML parsing tag.

- * - * @author Shawn Bayern - */ -public abstract class ParseSupport extends BodyTagSupport { - - //********************************************************************* - // Protected state - - protected Object xml; // 'xml' attribute - protected String systemId; // 'systemId' attribute - protected XMLFilter filter; // 'filter' attribute - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private String varDom; // 'varDom' attribute - private int scope; // processed 'scope' attr - private int scopeDom; // processed 'scopeDom' attr - - // state in support of XML parsing... - private DocumentBuilder db; - private TransformerFactory tf; - private TransformerHandler th; - - - //********************************************************************* - // Constructor and initialization - - public ParseSupport() { - super(); - init(); - } - - private void init() { - var = varDom = null; - xml = null; - systemId = null; - filter = null; - db = null; - tf = null; - th = null; - scope = PageContext.PAGE_SCOPE; - scopeDom = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag logic - - // parse 'source' or body, storing result in 'var' - public int doEndTag() throws JspException { - try { - - db = DocumentBuilderProvider.createSecureDocumentBuilder(); - - // if we've gotten a filter, set up a transformer to support it - if (filter != null) { - if (tf == null) - tf = TransformerFactory.newInstance(); - if (!tf.getFeature(SAXTransformerFactory.FEATURE)) - throw new JspTagException( - Resources.getMessage("PARSE_NO_SAXTRANSFORMER")); - try { - tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (TransformerConfigurationException e) { - throw new AssertionError( - "TransformerFactory does not support secure processing"); - } - SAXTransformerFactory stf = (SAXTransformerFactory) tf; - th = stf.newTransformerHandler(); - } - - // produce a Document by parsing whatever the attributes tell us to use - Document d; - Object xmlText = this.xml; - if (xmlText == null) { - // if the attribute was specified, use the body as 'xml' - if (bodyContent != null && bodyContent.getString() != null) - xmlText = bodyContent.getString().trim(); - else - xmlText = ""; - } - if (xmlText instanceof String) - d = parseStringWithFilter((String) xmlText, filter); - else if (xmlText instanceof Reader) - d = parseReaderWithFilter((Reader) xmlText, filter); - else - throw new JspTagException( - Resources.getMessage("PARSE_INVALID_SOURCE")); - - // we've got a Document object; store it out as appropriate - // (let any exclusivity or other constraints be enforced by TEI/TLV) - if (var != null) - pageContext.setAttribute(var, d, scope); - if (varDom != null) - pageContext.setAttribute(varDom, d, scopeDom); - - return EVAL_PAGE; - } catch (SAXException ex) { - throw new JspException(ex); - } catch (IOException ex) { - throw new JspException(ex); - } catch (TransformerConfigurationException ex) { - throw new JspException(ex); - } - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Private utility methods - - /** Parses the given InputSource after, applying the given XMLFilter. */ - private Document parseInputSourceWithFilter(InputSource s, XMLFilter f) - throws SAXException, IOException { - if (f != null) { - // prepare an output Document - Document o = db.newDocument(); - - // use TrAX to adapt SAX events to a Document object - th.setResult(new DOMResult(o)); - XMLReader xr = XMLReaderFactory.createXMLReader(); - xr.setEntityResolver(new JstlEntityResolver(pageContext)); - // (note that we overwrite the filter's parent. this seems - // to be expected usage. we could cache and reset the old - // parent, but you can't setParent(null), so this wouldn't - // be perfect.) - f.setParent(xr); - f.setContentHandler(th); - f.parse(s); - return o; - } else - return parseInputSource(s); - } - - /** Parses the given Reader after applying the given XMLFilter. */ - private Document parseReaderWithFilter(Reader r, XMLFilter f) - throws SAXException, IOException { - return parseInputSourceWithFilter(new InputSource(r), f); - } - - /** Parses the given String after applying the given XMLFilter. */ - private Document parseStringWithFilter(String s, XMLFilter f) - throws SAXException, IOException { - StringReader r = new StringReader(s); - return parseReaderWithFilter(r, f); - } - - /** Parses the given Reader after applying the given XMLFilter. */ - private Document parseURLWithFilter(String url, XMLFilter f) - throws SAXException, IOException { - return parseInputSourceWithFilter(new InputSource(url), f); - } - - /** Parses the given InputSource into a Document. */ - private Document parseInputSource(InputSource s) - throws SAXException, IOException { - db.setEntityResolver(new JstlEntityResolver(pageContext)); - - // normalize URIs so they can be processed consistently by resolver - if (systemId == null) - s.setSystemId("jstl:"); - else if (ImportSupport.isAbsoluteUrl(systemId)) - s.setSystemId(systemId); - else - s.setSystemId("jstl:" + systemId); - return db.parse(s); - } - - /** Parses the given Reader into a Document. */ - private Document parseReader(Reader r) throws SAXException, IOException { - return parseInputSource(new InputSource(r)); - } - - /** Parses the given String into a Document. */ - private Document parseString(String s) throws SAXException, IOException { - StringReader r = new StringReader(s); - return parseReader(r); - } - - /** Parses the URL (passed as a String) into a Document. */ - private Document parseURL(String url) throws SAXException, IOException { - return parseInputSource(new InputSource(url)); - } - - //********************************************************************* - // JSTL-specific EntityResolver class - - /** Lets us resolve relative external entities. */ - public static class JstlEntityResolver implements EntityResolver { - private final PageContext ctx; - public JstlEntityResolver(PageContext ctx) { - this.ctx = ctx; - } - public InputSource resolveEntity(String publicId, String systemId) - throws FileNotFoundException { - - // pass if we don't have a systemId - if (systemId == null) - return null; - - // strip leading "jstl:" off URL if applicable - if (systemId.startsWith("jstl:")) - systemId = systemId.substring(5); - - // we're only concerned with relative URLs - if (ImportSupport.isAbsoluteUrl(systemId)) - return null; - - // for relative URLs, load and wrap the resource. - // don't bother checking for 'null' since we specifically want - // the parser to fail if the resource doesn't exist - InputStream s; - if (systemId.startsWith("/")) { - s = ctx.getServletContext().getResourceAsStream(systemId); - if (s == null) - throw new FileNotFoundException( - Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY", - systemId)); - } else { - String pagePath = - ((HttpServletRequest) ctx.getRequest()).getServletPath(); - String basePath = - pagePath.substring(0, pagePath.lastIndexOf("/")); - s = ctx.getServletContext().getResourceAsStream( - basePath + "/" + systemId); - if (s == null) - throw new FileNotFoundException( - Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY", - systemId)); - } - return new InputSource(s); - } - } - - //********************************************************************* - // Tag attributes - - public void setVar(String var) { - this.var = var; - } - - public void setVarDom(String varDom) { - this.varDom = varDom; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - public void setScopeDom(String scopeDom) { - this.scopeDom = Util.getScope(scopeDom); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java deleted file mode 100644 index 108b7f3..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import java.util.List; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.TagSupport; - -import org.apache.taglibs.standard.tag.common.core.Util; - -/** - *

Tag handler for <set> in JSTL's XML library.

- * - * @author Shawn Bayern - */ -public class SetTag extends TagSupport { - - //********************************************************************* - // Internal state - - private String select; // tag attribute - private String var; // tag attribute - private int scope; // processed tag attribute - - //********************************************************************* - // Construction and initialization - - /** - * Constructs a new handler. As with TagSupport, subclasses should - * not provide other constructors and are expected to call the - * superclass constructor. - */ - public SetTag() { - super(); - init(); - } - - // resets local state - private void init() { - var = null; - select = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag logic - - // applies XPath expression from 'select' and stores the result in 'var' - public int doStartTag() throws JspException { - // process the query - XPathUtil xu = new XPathUtil(pageContext); - List result = - xu.selectNodes(XPathUtil.getContext(this), select); - Object ret = result; - - // unwrap primitive types if that's what we received - if (result.size() == 1) { - Object o = result.get(0); - if (o instanceof String || o instanceof Boolean - || o instanceof Number) - ret = o; - } - - // expose the final result - pageContext.setAttribute(var, ret, scope); - return SKIP_BODY; - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Attribute accessors - - public void setSelect(String select) { - this.select = select; - } - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java deleted file mode 100644 index aca5059..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.BodyTagSupport; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.Writer; -import java.util.List; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.URIResolver; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.core.ImportSupport; -import org.apache.taglibs.standard.tag.common.core.Util; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; - -/** - *

Support for tag handlers for <transform>, the XML transformation - * tag.

- * - * @author Shawn Bayern - */ -public abstract class TransformSupport extends BodyTagSupport { - - //********************************************************************* - // Protected state - - protected Object xml; // attribute - protected String xmlSystemId; // attribute - protected Object xslt; // attribute - protected String xsltSystemId; // attribute - protected Result result; // attribute - - //********************************************************************* - // Private state - - private String var; // 'var' attribute - private int scope; // processed 'scope' attr - private Transformer t; // actual Transformer - private TransformerFactory tf; // reusable factory - private DocumentBuilder db; // reusable factory - - - //********************************************************************* - // Constructor and initialization - - public TransformSupport() { - super(); - init(); - } - - private void init() { - xml = xslt = null; - xmlSystemId = xsltSystemId = null; - var = null; - result = null; - tf = null; - scope = PageContext.PAGE_SCOPE; - } - - - //********************************************************************* - // Tag logic - - public int doStartTag() throws JspException { - /* - * We can set up our Transformer here, so we do so, and we let - * it receive parameters directly from subtags (instead of - * caching them. - */ - try { - - //************************************ - // Initialize - if (db == null) { - db = DocumentBuilderProvider.createSecureDocumentBuilder(); - } - // set up the TransformerFactory if necessary - if (tf == null) { - tf = TransformerFactory.newInstance(); - try { - tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (TransformerConfigurationException e) { - throw new AssertionError( - "TransformerFactory does not support secure processing"); - } - } - - //************************************ - // Produce transformer - - Source s; - if (xslt != null) { - if (!(xslt instanceof String) && !(xslt instanceof Reader) - && !(xslt instanceof javax.xml.transform.Source)) - throw new JspTagException( - Resources.getMessage("TRANSFORM_XSLT_UNRECOGNIZED")); - s = getSource(xslt, xsltSystemId); - } else { - throw new JspTagException( - Resources.getMessage("TRANSFORM_NO_TRANSFORMER")); - } - tf.setURIResolver(new JstlUriResolver(pageContext)); - t = tf.newTransformer(s); - - return EVAL_BODY_BUFFERED; - - } catch (SAXException ex) { - throw new JspException(ex); - } catch (ParserConfigurationException ex) { - throw new JspException(ex); - } catch (IOException ex) { - throw new JspException(ex); - } catch (TransformerConfigurationException ex) { - throw new JspException(ex); - } - } - - // parse 'xml' or body, transform via our Transformer, - // and store as 'var' or through 'result' - public int doEndTag() throws JspException { - try { - - //************************************ - // Determine source XML - - // if we haven't gotten a source, use the body (which may be empty) - Object xml = this.xml; - if (xml == null) // still equal - if (bodyContent != null && bodyContent.getString() != null) - xml = bodyContent.getString().trim(); - else - xml = ""; - - // let the Source be with you - Source source = getSource(xml, xmlSystemId); - - //************************************ - // Conduct the transformation - - // we can assume at most one of 'var' or 'result' is specified - if (result != null) - // we can write directly to the Result - t.transform(source, result); - else if (var != null) { - // we need a Document - Document d = db.newDocument(); - Result doc = new DOMResult(d); - t.transform(source, doc); - pageContext.setAttribute(var, d, scope); - } else { - Result page = - new StreamResult(new SafeWriter(pageContext.getOut())); - t.transform(source, page); - } - - return EVAL_PAGE; - } catch (SAXException ex) { - throw new JspException(ex); - } catch (ParserConfigurationException ex) { - throw new JspException(ex); - } catch (IOException ex) { - throw new JspException(ex); - } catch (TransformerException ex) { - throw new JspException(ex); - } - } - - // Releases any resources we may have (or inherit) - public void release() { - init(); - } - - - //********************************************************************* - // Public methods for subtags - - /** Sets (adds) a transformation parameter on our transformer. */ - public void addParameter(String name, Object value) { - t.setParameter(name, value); - } - - - //********************************************************************* - // Utility methods - - /** - * Wraps systemId with a "jstl:" prefix to prevent the parser from - * thinking that the URI is truly relative and resolving it against - * the current directory in the filesystem. - */ - private static String wrapSystemId(String systemId) { - if (systemId == null) - return "jstl:"; - else if (ImportSupport.isAbsoluteUrl(systemId)) - return systemId; - else - return ("jstl:" + systemId); - } - - /** - * Retrieves a Source from the given Object, whether it be a String, - * Reader, Node, or other supported types (even a Source already). - * If 'url' is true, then we must be passed a String and will interpret - * it as a URL. A null input always results in a null output. - */ - private Source getSource(Object o, String systemId) - throws SAXException, ParserConfigurationException, IOException { - if (o == null) - return null; - else if (o instanceof Source) { - return (Source) o; - } else if (o instanceof String) { - // if we've got a string, chain to Reader below - return getSource(new StringReader((String) o), systemId); - } else if (o instanceof Reader) { - // explicitly go through SAX to maintain control - // over how relative external entities resolve - XMLReader xr = XMLReaderFactory.createXMLReader(); - xr.setEntityResolver( - new ParseSupport.JstlEntityResolver(pageContext)); - InputSource s = new InputSource((Reader) o); - s.setSystemId(wrapSystemId(systemId)); - Source result = new SAXSource(xr, s); - result.setSystemId(wrapSystemId(systemId)); - return result; - } else if (o instanceof Node) { - return new DOMSource((Node) o); - } else if (o instanceof List) { - // support 1-item List because our XPath processor outputs them - List l = (List) o; - if (l.size() == 1) { - return getSource(l.get(0), systemId); // unwrap List - } else { - throw new IllegalArgumentException( - Resources.getMessage("TRANSFORM_SOURCE_INVALID_LIST")); - } - } else { - throw new IllegalArgumentException( - Resources.getMessage("TRANSFORM_SOURCE_UNRECOGNIZED") - + o.getClass()); - } - } - - - //********************************************************************* - // Tag attributes - - public void setVar(String var) { - this.var = var; - } - - public void setScope(String scope) { - this.scope = Util.getScope(scope); - } - - - //********************************************************************* - // Private utility classes - - /** - * A Writer based on a wrapped Writer but ignoring requests to - * close() and flush() it. (Someone must have wrapped the - * toilet in my office similarly...) - */ - private static class SafeWriter extends Writer { - private Writer w; - public SafeWriter(Writer w) { this.w = w; } - public void close() { } - public void flush() { } - public void write(char[] cbuf, int off, int len) throws IOException { - w.write(cbuf, off, len); - } - } - - //********************************************************************* - // JSTL-specific URIResolver class - - /** Lets us resolve relative external entities. */ - private static class JstlUriResolver implements URIResolver { - private final PageContext ctx; - public JstlUriResolver(PageContext ctx) { - this.ctx = ctx; - } - public Source resolve(String href, String base) - throws TransformerException { - - // pass if we don't have a systemId - if (href == null) - return null; - - // remove "jstl" marker from 'base' - // NOTE: how 'base' is determined varies among different Xalan - // xsltc implementations - int index; - if (base != null && (index = base.indexOf("jstl:")) != -1) { - base = base.substring(index + 5); - } - - // we're only concerned with relative URLs - if (ImportSupport.isAbsoluteUrl(href) - || (base != null && ImportSupport.isAbsoluteUrl(base))) - return null; - - // base is relative; remove everything after trailing '/' - if (base == null || base.lastIndexOf("/") == -1) - base = ""; - else - base = base.substring(0, base.lastIndexOf("/") + 1); - - // concatenate to produce the real URL we're interested in - String target = base + href; - - // for relative URLs, load and wrap the resource. - // don't bother checking for 'null' since we specifically want - // the parser to fail if the resource doesn't exist - InputStream s; - if (target.startsWith("/")) { - s = ctx.getServletContext().getResourceAsStream(target); - if (s == null) - throw new TransformerException( - Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY", - href)); - } else { - String pagePath = - ((HttpServletRequest) ctx.getRequest()).getServletPath(); - String basePath = - pagePath.substring(0, pagePath.lastIndexOf("/")); - s = ctx.getServletContext().getResourceAsStream( - basePath + "/" + target); - if (s == null) - throw new TransformerException( - Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY", - href)); - } - return new StreamSource(s); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java deleted file mode 100644 index 0390b73..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import javax.xml.xpath.XPathException; - -/** - * - * Derived from XPathException in order that XPath processor - * exceptions may be specifically caught. - */ -public class UnresolvableException extends XPathException { - /** - * Create an UnresolvableException object that holds - * an error message. - * @param message The error message. - */ - public UnresolvableException(String message) { - super(message); - } - - /** - * Create an UnresolvableException object that holds - * an error message, and another exception - * that caused this exception. - * @param cause The exception that caused this exception. - */ - public UnresolvableException(Throwable cause) { - super(cause); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java deleted file mode 100644 index c65f5ab..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.core.WhenTagSupport; - -/** - *

Tag handler for <if> in JSTL's XML library.

- * - * @author Shawn Bayern - */ - -public class WhenTag extends WhenTagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public WhenTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Supplied conditional logic - - protected boolean condition() throws JspTagException { - XPathUtil xu = new XPathUtil(pageContext); - return (xu.booleanValueOf(XPathUtil.getContext(this), select)); - } - - //********************************************************************* - // Private state - - private String select; // the value of the 'test' attribute - - - //********************************************************************* - // Attribute accessors - - public void setSelect(String select) { - this.select = select; - } - - - //********************************************************************* - // Private utility methods - - // resets internal state - private void init() { - select = null; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java b/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java deleted file mode 100644 index 60d0238..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020 Payara Services Ltd. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.common.xml; - -import java.util.List; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.Tag; -import jakarta.servlet.jsp.tagext.TagSupport; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import javax.xml.xpath.XPathVariableResolver; -import org.apache.taglibs.standard.resources.Resources; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - * Support for tag handlers that evaluate XPath expressions. - * - * @author Shawn Bayern - * @author Ramesh Mandava ( ramesh.mandava@sun.com ) - * @author Pierre Delisle ( pierre.delisle@sun.com ) - * @author Dongbin Nie - * @author David Matejcek - */ -public class XPathUtil { - - private static final String PAGE_NS_URL = "http://java.sun.com/jstl/xpath/page"; - private static final String REQUEST_NS_URL = "http://java.sun.com/jstl/xpath/request"; - private static final String SESSION_NS_URL = "http://java.sun.com/jstl/xpath/session"; - private static final String APP_NS_URL = "http://java.sun.com/jstl/xpath/app"; - private static final String PARAM_NS_URL = "http://java.sun.com/jstl/xpath/param"; - private static final String INITPARAM_NS_URL = "http://java.sun.com/jstl/xpath/initParam"; - private static final String COOKIE_NS_URL = "http://java.sun.com/jstl/xpath/cookie"; - private static final String HEADER_NS_URL = "http://java.sun.com/jstl/xpath/header"; - - private static final XPathFactory XPATH_FACTORY = new JSTLXPathFactory(); - private static final JSTLXPathNamespaceContext JSTL_XPATH_NS_CTX = initXPathNamespaceContext(); - - private final PageContext pageContext; - - /** - * Constructs a new XPathUtil object associated with the given - * PageContext. - */ - public XPathUtil(PageContext pc) { - pageContext = pc; - } - - - /** - * Evaluate an XPath expression to a String value. - */ - public String valueOf(Node contextNode, String xpathString) throws JspTagException { - XPath xpath = XPATH_FACTORY.newXPath(); - xpath.setNamespaceContext(JSTL_XPATH_NS_CTX); - xpath.setXPathVariableResolver(new JSTLXPathVariableResolver(pageContext)); - try { - return xpath.evaluate(xpathString, contextNode); - } catch (XPathExpressionException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - - /** - * Evaluate an XPath expression to a boolean value. - */ - public boolean booleanValueOf(Node contextNode, String xpathString) throws JspTagException { - XPath xpath = XPATH_FACTORY.newXPath(); - xpath.setNamespaceContext(JSTL_XPATH_NS_CTX); - xpath.setXPathVariableResolver(new JSTLXPathVariableResolver(pageContext)); - try { - return ((Boolean) xpath.evaluate(xpathString, contextNode, XPathConstants.BOOLEAN)).booleanValue(); - } catch (XPathExpressionException ex) { - throw new JspTagException(Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex); - } - } - - - /** - * Evaluate an XPath expression to a List of nodes. - */ - public List selectNodes(Node contextNode, String xpathString) throws JspTagException { - try { - XPath xpath = XPATH_FACTORY.newXPath(); - xpath.setNamespaceContext(JSTL_XPATH_NS_CTX); - xpath.setXPathVariableResolver(new JSTLXPathVariableResolver(pageContext)); - Object nl = xpath.evaluate(xpathString, contextNode, JSTLXPathConstants.OBJECT); - return new JSTLNodeList(nl); - } catch (XPathExpressionException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - - /** - * Evaluate an XPath expression to a single node. - */ - public Node selectSingleNode(Node contextNode, String xpathString) throws JspTagException { - XPathVariableResolver jxvr = new JSTLXPathVariableResolver(pageContext); - try { - XPath xpath = XPATH_FACTORY.newXPath(); - xpath.setNamespaceContext(JSTL_XPATH_NS_CTX); - xpath.setXPathVariableResolver(jxvr); - return (Node) xpath.evaluate(xpathString, contextNode, XPathConstants.NODE); - } catch (XPathExpressionException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - - public static Node getContext(Tag t) throws JspTagException { - ForEachTag xt = (ForEachTag) TagSupport.findAncestorWithClass(t, ForEachTag.class); - if (xt == null) { - return newEmptyDocument(); - } - return xt.getContext(); - } - - - /** - * Initialize globally useful data. - */ - private static JSTLXPathNamespaceContext initXPathNamespaceContext() { - // register supported namespaces - JSTLXPathNamespaceContext context = new JSTLXPathNamespaceContext(); - context.addNamespace("pageScope", PAGE_NS_URL); - context.addNamespace("requestScope", REQUEST_NS_URL); - context.addNamespace("sessionScope", SESSION_NS_URL); - context.addNamespace("applicationScope", APP_NS_URL); - context.addNamespace("param", PARAM_NS_URL); - context.addNamespace("initParam", INITPARAM_NS_URL); - context.addNamespace("header", HEADER_NS_URL); - context.addNamespace("cookie", COOKIE_NS_URL); - return context; - } - - /** - * Create a new empty document. - * - * This method always allocates a new document as its root node might be - * exposed to other tags and potentially be mutated. - * - * @return a new empty document - */ - private static Document newEmptyDocument() { - return DocumentBuilderProvider.createDocumentBuilder().newDocument(); - } -} - - - - diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java deleted file mode 100644 index 28f7f32..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.tagext.Tag; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; - -/** - *

Contains some static utilities to facilitate common forms of - * expression evaluation.

- * - * @author Shawn Bayern - */ - -public class ExpressionUtil { - - /** Evaluates an expression if present, but does not allow the expression - * to evaluate to 'null', throwing a NullAttributeException if it - * does. The function can return null, however, if the - * expression itself is null. - */ - public static Object evalNotNull(String tagName, - String attributeName, - String expression, - Class expectedType, - Tag tag, - PageContext pageContext) - throws JspException { - if (expression != null) { - Object r = ExpressionEvaluatorManager.evaluate( - attributeName, expression, expectedType, tag, pageContext); - if (r == null) - throw new NullAttributeException(tagName, attributeName); - return r; - } else - return null; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java deleted file mode 100644 index d16c06c..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import java.util.ArrayList; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.jstl.core.LoopTag; -import jakarta.servlet.jsp.tagext.IterationTag; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.core.ForEachSupport; -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; - -/** - *

A handler for <forEach> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ - -public class ForEachTag - extends ForEachSupport - implements LoopTag, IterationTag -{ - - //********************************************************************* - // 'Private' state (implementation details) - - private String begin_; // stores EL-based property - private String end_; // stores EL-based property - private String step_; // stores EL-based property - private String items_; // stores EL-based property - - - //********************************************************************* - // Constructor - - public ForEachTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - /* Begins iterating by processing the first item. */ - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setBegin(String begin_) { - this.begin_ = begin_; - this.beginSpecified = true; - } - - // for EL-based attribute - public void setEnd(String end_) { - this.end_ = end_; - this.endSpecified = true; - } - - // for EL-based attribute - public void setStep(String step_) { - this.step_ = step_; - this.stepSpecified = true; - } - - public void setItems(String items_) { - this.items_ = items_; - } - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // defaults for interface with page author - begin_ = null; // (no expression) - end_ = null; // (no expression) - step_ = null; // (no expression) - items_ = null; // (no expression) - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - if (begin_ != null) { - Object r = ExpressionEvaluatorManager.evaluate( - "begin", begin_, Integer.class, this, pageContext); - if (r == null) - throw new NullAttributeException("forEach", "begin"); - begin = ((Integer) r).intValue(); - validateBegin(); - } - - if (end_ != null) { - Object r = ExpressionEvaluatorManager.evaluate( - "end", end_, Integer.class, this, pageContext); - if (r == null) - throw new NullAttributeException("forEach", "end"); - end = ((Integer) r).intValue(); - validateEnd(); - } - - if (step_ != null) { - Object r = ExpressionEvaluatorManager.evaluate( - "step", step_, Integer.class, this, pageContext); - if (r == null) - throw new NullAttributeException("forEach", "step"); - step = ((Integer) r).intValue(); - validateStep(); - } - - if (items_ != null) { - rawItems = ExpressionEvaluatorManager.evaluate( - "items", items_, Object.class, this, pageContext); - // use an empty list to indicate "no iteration", if relevant - if (rawItems == null) - rawItems = new ArrayList(); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java deleted file mode 100644 index bbbf958..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.jstl.core.LoopTag; -import jakarta.servlet.jsp.tagext.IterationTag; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.core.ForTokensSupport; -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; - -/** - *

A handler for <forTokens> that accepts attributes as Strings - * and evaluates them as expressions at runtime. - * - * @author Shawn Bayern - */ -public class ForTokensTag - extends ForTokensSupport - implements LoopTag, IterationTag -{ - - //********************************************************************* - // 'Private' state (implementation details) - - private String begin_; // raw EL-based property - private String end_; // raw EL-based property - private String step_; // raw EL-based property - private String items_; // raw EL-based property - private String delims_; // raw EL-based property - - - //********************************************************************* - // Constructor - - public ForTokensTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - /* Begins iterating by processing the first item. */ - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setBegin(String begin_) { - this.begin_ = begin_; - this.beginSpecified = true; - } - - // for EL-based attribute - public void setEnd(String end_) { - this.end_ = end_; - this.endSpecified = true; - } - - // for EL-based attribute - public void setStep(String step_) { - this.step_ = step_; - this.stepSpecified = true; - } - - // for EL-based attribute - public void setItems(String items_) { - this.items_ = items_; - } - - // for EL-based attribute - public void setDelims(String delims_) { - this.delims_ = delims_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // defaults for interface with page author - begin_ = null; // (no expression) - end_ = null; // (no expression) - step_ = null; // (no expression) - items_ = null; // (no expression) - delims_ = null; // (no expression) - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - if (begin_ != null) { - Object r = ExpressionEvaluatorManager.evaluate( - "begin", begin_, Integer.class, this, pageContext); - if (r == null) - throw new NullAttributeException("forTokens", "begin"); - begin = ((Integer) r).intValue(); - validateBegin(); - } - - if (end_ != null) { - Object r = ExpressionEvaluatorManager.evaluate( - "end", end_, Integer.class, this, pageContext); - if (r == null) - throw new NullAttributeException("forTokens", "end"); - end = ((Integer) r).intValue(); - validateEnd(); - } - - if (step_ != null) { - Object r = ExpressionEvaluatorManager.evaluate( - "step", step_, Integer.class, this, pageContext); - if (r == null) - throw new NullAttributeException("forTokens", "step"); - step = ((Integer) r).intValue(); - validateStep(); - } - - if (items_ != null) { - items = (String) ExpressionEvaluatorManager.evaluate( - "items", items_, String.class, this, pageContext); - // use the empty string to indicate "no iteration" - if (items == null) - items = ""; - } - - if (delims_ != null) { - delims = (String) ExpressionEvaluatorManager.evaluate( - "delims", delims_, String.class, this, pageContext); - // use the empty string to cause monolithic tokenization - if (delims == null) - delims = ""; - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java deleted file mode 100644 index a6b9b90..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.ConditionalTagSupport; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; - -/** - *

Tag handler for <if> in JSTL's expression-evaluating library. - * Because of the support provided by the ConditionalTagSupport class, - * thistag is trivial enough not to require a separate base supporting - * class common to both libraries.

- * - * @author Shawn Bayern - */ - -public class IfTag extends ConditionalTagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public IfTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Supplied conditional logic - - protected boolean condition() throws JspTagException { - try { - Object r = ExpressionEvaluatorManager.evaluate( - "test", test, Boolean.class, this, pageContext); - if (r == null) - throw new NullAttributeException("if", "test"); - else - return (((Boolean) r).booleanValue()); - } catch (JspException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - - //********************************************************************* - // Private state - - private String test; // the value of the 'test' attribute - - - //********************************************************************* - // Accessors - - // receives the tag's 'test' attribute - public void setTest(String test) { - this.test = test; - } - - - //********************************************************************* - // Private utility methods - - // resets internal state - private void init() { - test = null; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java deleted file mode 100644 index bf6ad7f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.ImportSupport; -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; - -/** - *

A handler for <import> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ - -public class ImportTag extends ImportSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String context_; // stores EL-based property - private String charEncoding_; // stores EL-based property - private String url_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new ImportTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ImportTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setUrl(String url_) { - this.url_ = url_; - } - - public void setContext(String context_) { - this.context_ = context_; - } - - public void setCharEncoding(String charEncoding_) { - this.charEncoding_ = charEncoding_; - } - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - url_ = context_ = charEncoding_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - url = (String) ExpressionUtil.evalNotNull( - "import", "url", url_, String.class, this, pageContext); - if (url == null || url.equals("")) - throw new NullAttributeException("import", "url"); - - context = (String) ExpressionUtil.evalNotNull( - "import", "context", context_, String.class, this, pageContext); - charEncoding = (String) ExpressionUtil.evalNotNull( - "import", "charEncoding", charEncoding_, String.class, this, - pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java deleted file mode 100644 index 97e1269..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; -import org.apache.taglibs.standard.tag.common.core.OutSupport; - -/** - *

A handler for <out>, which redirects the browser to a - * new URL. - * - * @author Shawn Bayern - */ - -public class OutTag extends OutSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String default_; // stores EL-based property - private String escapeXml_; // stores EL-based property - - - //********************************************************************* - // Constructor - - public OutTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - public void setValue(String value_) { - this.value_ = value_; - } - - public void setDefault(String default_) { - this.default_ = default_; - } - - public void setEscapeXml(String escapeXml_) { - this.escapeXml_ = escapeXml_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = default_ = escapeXml_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - try { - value = ExpressionUtil.evalNotNull( - "out", "value", value_, Object.class, this, pageContext); - } catch (NullAttributeException ex) { - // explicitly allow 'null' for value - value = null; - } - try { - def = (String) ExpressionUtil.evalNotNull( - "out", "default", default_, String.class, this, pageContext); - } catch (NullAttributeException ex) { - // explicitly allow 'null' for def - def = null; - } - escapeXml = true; - Boolean escape = ((Boolean) ExpressionUtil.evalNotNull( - "out", "escapeXml", escapeXml_, Boolean.class, this, pageContext)); - if (escape != null) - escapeXml = escape.booleanValue(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java deleted file mode 100644 index a048413..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.ParamSupport; - -/** - *

A handler for <param> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ - -public class ParamTag extends ParamSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String name_; // stores EL-based property - private String value_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new ParamTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ParamTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setName(String name_) { - this.name_ = name_; - } - - public void setValue(String value_) { - this.value_ = value_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - name_ = value_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - name = (String) ExpressionUtil.evalNotNull( - "import", "name", name_, String.class, this, pageContext); - value = (String) ExpressionUtil.evalNotNull( - "import", "value", value_, String.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java deleted file mode 100644 index 11e9a01..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.RedirectSupport; - -/** - *

A handler for <redirect>, which redirects the browser to a - * new URL. - * - * @author Shawn Bayern - */ - -public class RedirectTag extends RedirectSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String url_; // stores EL-based property - private String context_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new URLEncodeTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public RedirectTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - public void setUrl(String url_) { - this.url_ = url_; - } - - public void setContext(String context_) { - this.context_ = context_; - } - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - url_ = context_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - url = (String) ExpressionUtil.evalNotNull( - "redirect", "url", url_, String.class, this, pageContext); - context = (String) ExpressionUtil.evalNotNull( - "redirect", "context", context_, String.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/SetTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/SetTag.java deleted file mode 100644 index c8cf5bd..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/SetTag.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; -import org.apache.taglibs.standard.tag.common.core.SetSupport; - -/** - *

A handler for <set>, which redirects the browser to a - * new URL. - * - * @author Shawn Bayern - */ - -public class SetTag extends SetSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String target_; // stores EL-based property - private String property_; // stores EL-based property - - - //********************************************************************* - // Constructor - - public SetTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - public void setValue(String value_) { - this.value_ = value_; - this.valueSpecified = true; - } - - public void setTarget(String target_) { - this.target_ = target_; - } - - public void setProperty(String property_) { - this.property_ = property_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = target_ = property_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - // 'value' - try { - value = ExpressionUtil.evalNotNull( - "set", "value", value_, Object.class, this, pageContext); - } catch (NullAttributeException ex) { - // explicitly let 'value' be null - value = null; - } - - // 'target' - target = ExpressionUtil.evalNotNull( - "set", "target", target_, Object.class, this, pageContext); - - // 'property' - try { - property = (String) ExpressionUtil.evalNotNull( - "set", "property", property_, String.class, this, pageContext); - } catch (NullAttributeException ex) { - // explicitly let 'property' be null - property = null; - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java deleted file mode 100644 index 4d4d539..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.UrlSupport; - -/** - *

A handler for <urlEncode> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ - -public class UrlTag extends UrlSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String context_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new URLEncodeTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public UrlTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - public void setValue(String value_) { - this.value_ = value_; - } - - public void setContext(String context_) { - this.context_ = context_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - value = (String) ExpressionUtil.evalNotNull( - "url", "value", value_, String.class, this, pageContext); - context = (String) ExpressionUtil.evalNotNull( - "url", "context", context_, String.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java deleted file mode 100644 index 0d0de5a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.core; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; -import org.apache.taglibs.standard.tag.common.core.WhenTagSupport; - -/** - *

Tag handler for <when> in JSTL's expression-evaluating - * library.

- * - * @author Shawn Bayern - */ - -public class WhenTag extends WhenTagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public WhenTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Supplied conditional logic - - protected boolean condition() throws JspTagException { - try { - Object r = ExpressionEvaluatorManager.evaluate( - "test", test, Boolean.class, this, pageContext); - if (r == null) - throw new NullAttributeException("when", "test"); - else - return (((Boolean) r).booleanValue()); - } catch (JspException ex) { - throw new JspTagException(ex.toString(), ex); - } - } - - - //********************************************************************* - // Private state - - private String test; // the value of the 'test' attribute - - - //********************************************************************* - // Accessors - - // receives the tag's 'test' attribute - public void setTest(String test) { - this.test = test; - } - - - //********************************************************************* - // Private utility methods - - // resets internal state - private void init() { - test = null; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java deleted file mode 100644 index 6a574c7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.BundleSupport; - -/** - *

A handler for <bundle> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - * @author Jan Luehe - */ - -public class BundleTag extends BundleSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String basename_; // stores EL-based property - private String prefix_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new BundleTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public BundleTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setBasename(String basename_) { - this.basename_ = basename_; - } - - // for EL-based attribute - public void setPrefix(String prefix_) { - this.prefix_ = prefix_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - basename_ = prefix_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - - // 'basename' attribute (mandatory) - basename = (String) ExpressionEvaluatorManager.evaluate( - "basename", basename_, String.class, this, pageContext); - - // 'prefix' attribute (optional) - if (prefix_ != null) { - prefix = (String) ExpressionEvaluatorManager.evaluate( - "prefix", prefix_, String.class, this, pageContext); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java deleted file mode 100644 index ea605f3..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatDateTag.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import java.util.Date; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport; - -/** - *

A handler for <formatDate> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class FormatDateTag extends FormatDateSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String type_; // stores EL-based property - private String dateStyle_; // stores EL-based property - private String timeStyle_; // stores EL-based property - private String pattern_; // stores EL-based property - private String timeZone_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new FormatDateTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public FormatDateTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - } - - // for EL-based attribute - public void setType(String type_) { - this.type_ = type_; - } - - // for EL-based attribute - public void setDateStyle(String dateStyle_) { - this.dateStyle_ = dateStyle_; - } - - // for EL-based attribute - public void setTimeStyle(String timeStyle_) { - this.timeStyle_ = timeStyle_; - } - - // for EL-based attribute - public void setPattern(String pattern_) { - this.pattern_ = pattern_; - } - - // for EL-based attribute - public void setTimeZone(String timeZone_) { - this.timeZone_ = timeZone_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = type_ = dateStyle_ = timeStyle_ = pattern_ = timeZone_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - // 'value' attribute (mandatory) - value = (Date) ExpressionEvaluatorManager.evaluate( - "value", value_, Date.class, this, pageContext); - - // 'type' attribute - if (type_ != null) { - type = (String) ExpressionEvaluatorManager.evaluate( - "type", type_, String.class, this, pageContext); - } - - // 'dateStyle' attribute - if (dateStyle_ != null) { - dateStyle = (String) ExpressionEvaluatorManager.evaluate( - "dateStyle", dateStyle_, String.class, this, pageContext); - } - - // 'timeStyle' attribute - if (timeStyle_ != null) { - timeStyle = (String) ExpressionEvaluatorManager.evaluate( - "timeStyle", timeStyle_, String.class, this, pageContext); - } - - // 'pattern' attribute - if (pattern_ != null) { - pattern = (String) ExpressionEvaluatorManager.evaluate( - "pattern", pattern_, String.class, this, pageContext); - } - - // 'timeZone' attribute - if (timeZone_ != null) { - timeZone = ExpressionEvaluatorManager.evaluate( - "timeZone", timeZone_, Object.class, this, pageContext); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java deleted file mode 100644 index 3fa9a63..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/FormatNumberTag.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.FormatNumberSupport; - -/** - *

A handler for <formatNumber> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class FormatNumberTag extends FormatNumberSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String type_; // stores EL-based property - private String pattern_; // stores EL-based property - private String currencyCode_; // stores EL-based property - private String currencySymbol_; // stores EL-based property - private String groupingUsed_; // stores EL-based property - private String maxIntegerDigits_; // stores EL-based property - private String minIntegerDigits_; // stores EL-based property - private String maxFractionDigits_; // stores EL-based property - private String minFractionDigits_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new FormatNumberTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public FormatNumberTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - this.valueSpecified = true; - } - - // for EL-based attribute - public void setType(String type_) { - this.type_ = type_; - } - - // for EL-based attribute - public void setPattern(String pattern_) { - this.pattern_ = pattern_; - } - - // for EL-based attribute - public void setCurrencyCode(String currencyCode_) { - this.currencyCode_ = currencyCode_; - } - - // for EL-based attribute - public void setCurrencySymbol(String currencySymbol_) { - this.currencySymbol_ = currencySymbol_; - } - - // for EL-based attribute - public void setGroupingUsed(String groupingUsed_) { - this.groupingUsed_ = groupingUsed_; - this.groupingUsedSpecified = true; - } - - // for EL-based attribute - public void setMaxIntegerDigits(String maxIntegerDigits_) { - this.maxIntegerDigits_ = maxIntegerDigits_; - this.maxIntegerDigitsSpecified = true; - } - - // for EL-based attribute - public void setMinIntegerDigits(String minIntegerDigits_) { - this.minIntegerDigits_ = minIntegerDigits_; - this.minIntegerDigitsSpecified = true; - } - - // for EL-based attribute - public void setMaxFractionDigits(String maxFractionDigits_) { - this.maxFractionDigits_ = maxFractionDigits_; - this.maxFractionDigitsSpecified = true; - } - - // for EL-based attribute - public void setMinFractionDigits(String minFractionDigits_) { - this.minFractionDigits_ = minFractionDigits_; - this.minFractionDigitsSpecified = true; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = type_ = pattern_ = null; - currencyCode_ = currencySymbol_ = null; - groupingUsed_ = null; - maxIntegerDigits_ = minIntegerDigits_ = null; - maxFractionDigits_ = minFractionDigits_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - Object obj = null; - - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - // 'value' attribute - if (value_ != null) { - value = ExpressionEvaluatorManager.evaluate( - "value", value_, Object.class, this, pageContext); - } - - // 'type' attribute - if (type_ != null) { - type = (String) ExpressionEvaluatorManager.evaluate( - "type", type_, String.class, this, pageContext); - } - - // 'pattern' attribute - if (pattern_ != null) { - pattern = (String) ExpressionEvaluatorManager.evaluate( - "pattern", pattern_, String.class, this, pageContext); - } - - // 'currencyCode' attribute - if (currencyCode_ != null) { - currencyCode = (String) ExpressionEvaluatorManager.evaluate( - "currencyCode", currencyCode_, String.class, this, - pageContext); - } - - // 'currencySymbol' attribute - if (currencySymbol_ != null) { - currencySymbol = (String) ExpressionEvaluatorManager.evaluate( - "currencySymbol", currencySymbol_, String.class, this, - pageContext); - } - - // 'groupingUsed' attribute - if (groupingUsed_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "groupingUsed", groupingUsed_, Boolean.class, this, - pageContext); - if (obj != null) { - isGroupingUsed = ((Boolean) obj).booleanValue(); - } - } - - // 'maxIntegerDigits' attribute - if (maxIntegerDigits_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "maxIntegerDigits", maxIntegerDigits_, Integer.class, this, - pageContext); - if (obj != null) { - maxIntegerDigits = ((Integer) obj).intValue(); - } - } - - // 'minIntegerDigits' attribute - if (minIntegerDigits_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "minIntegerDigits", minIntegerDigits_, Integer.class, this, - pageContext); - if (obj != null) { - minIntegerDigits = ((Integer) obj).intValue(); - } - } - - // 'maxFractionDigits' attribute - if (maxFractionDigits_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "maxFractionDigits", maxFractionDigits_, Integer.class, this, - pageContext); - if (obj != null) { - maxFractionDigits = ((Integer) obj).intValue(); - } - } - - // 'minFractionDigits' attribute - if (minFractionDigits_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "minFractionDigits", minFractionDigits_, Integer.class, this, - pageContext); - if (obj != null) { - minFractionDigits = ((Integer) obj).intValue(); - } - } - } -} - diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java deleted file mode 100644 index 55220e8..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/MessageTag.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.jstl.fmt.LocalizationContext; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.MessageSupport; - -/** - *

A handler for <message> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class MessageTag extends MessageSupport { - - //********************************************************************* - // Private state (implementation details) - - private String key_; // stores EL-based property - private String bundle_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new MessageTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public MessageTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setKey(String key_) { - this.key_ = key_; - this.keySpecified = true; - } - - // for EL-based attribute - public void setBundle(String bundle_) { - this.bundle_ = bundle_; - this.bundleSpecified = true; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - key_ = bundle_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - if (keySpecified) { - keyAttrValue = (String) ExpressionEvaluatorManager.evaluate( - "key", key_, String.class, this, pageContext); - } - - if (bundleSpecified) { - bundleAttrValue = (LocalizationContext) - ExpressionEvaluatorManager.evaluate( - "bundle", bundle_, LocalizationContext.class, this, - pageContext); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParamTag.java deleted file mode 100644 index b0cda3b..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParamTag.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.ParamSupport; - -/** - *

A handler for <param> that accepts message arguments as - * Strings and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class ParamTag extends ParamSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new ParamTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ParamTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - this.valueSpecified = true; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - if (value_ != null) { - value = ExpressionEvaluatorManager.evaluate( - "value", value_, Object.class, this, pageContext); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java deleted file mode 100644 index 71e34d7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import java.util.Locale; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.ParseDateSupport; -import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; - -/** - *

A handler for <parseDate> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class ParseDateTag extends ParseDateSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String type_; // stores EL-based property - private String dateStyle_; // stores EL-based property - private String timeStyle_; // stores EL-based property - private String pattern_; // stores EL-based property - private String timeZone_; // stores EL-based property - private String parseLocale_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new ParseDateTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ParseDateTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - this.valueSpecified = true; - } - - // for EL-based attribute - public void setType(String type_) { - this.type_ = type_; - } - - // for EL-based attribute - public void setDateStyle(String dateStyle_) { - this.dateStyle_ = dateStyle_; - } - - // for EL-based attribute - public void setTimeStyle(String timeStyle_) { - this.timeStyle_ = timeStyle_; - } - - // for EL-based attribute - public void setPattern(String pattern_) { - this.pattern_ = pattern_; - } - - // for EL-based attribute - public void setTimeZone(String timeZone_) { - this.timeZone_ = timeZone_; - } - - // for EL-based attribute - public void setParseLocale(String parseLocale_) { - this.parseLocale_ = parseLocale_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = type_ = dateStyle_ = timeStyle_ = pattern_ = timeZone_ = null; - parseLocale_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - // 'value' attribute - if (value_ != null) { - value = (String) ExpressionEvaluatorManager.evaluate( - "value", value_, String.class, this, pageContext); - } - - // 'type' attribute - if (type_ != null) { - type = (String) ExpressionEvaluatorManager.evaluate( - "type", type_, String.class, this, pageContext); - } - - // 'dateStyle' attribute - if (dateStyle_ != null) { - dateStyle = (String) ExpressionEvaluatorManager.evaluate( - "dateStyle", dateStyle_, String.class, this, pageContext); - } - - // 'timeStyle' attribute - if (timeStyle_ != null) { - timeStyle = (String) ExpressionEvaluatorManager.evaluate( - "timeStyle", timeStyle_, String.class, this, pageContext); - } - - // 'pattern' attribute - if (pattern_ != null) { - pattern = (String) ExpressionEvaluatorManager.evaluate( - "pattern", pattern_, String.class, this, pageContext); - } - - // 'timeZone' attribute - if (timeZone_ != null) { - timeZone = ExpressionEvaluatorManager.evaluate( - "timeZone", timeZone_, Object.class, this, pageContext); - } - - // 'parseLocale' attribute - if (parseLocale_ != null) { - Object obj = ExpressionEvaluatorManager.evaluate( - "parseLocale", parseLocale_, Object.class, this, pageContext); - if (obj != null) { - if (obj instanceof Locale) { - parseLocale = (Locale) obj; - } else { - String localeStr = (String) obj; - if (!"".equals(localeStr)) { - parseLocale = SetLocaleSupport.parseLocale(localeStr); - } - } - } - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java deleted file mode 100644 index 7c37b33..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import java.util.Locale; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.ParseNumberSupport; -import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; - -/** - *

A handler for <parseNumber> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class ParseNumberTag extends ParseNumberSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String type_; // stores EL-based property - private String pattern_; // stores EL-based property - private String parseLocale_; // stores EL-based property - private String integerOnly_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new ParseNumberTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ParseNumberTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - this.valueSpecified = true; - } - - // for EL-based attribute - public void setType(String type_) { - this.type_ = type_; - } - - // for EL-based attribute - public void setPattern(String pattern_) { - this.pattern_ = pattern_; - } - - // for EL-based attribute - public void setParseLocale(String parseLocale_) { - this.parseLocale_ = parseLocale_; - } - - // for EL-based attribute - public void setIntegerOnly(String integerOnly_) { - this.integerOnly_ = integerOnly_; - this.integerOnlySpecified = true; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = type_ = pattern_ = parseLocale_ = integerOnly_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - Object obj = null; - - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - // 'value' attribute - if (value_ != null) { - value = (String) ExpressionEvaluatorManager.evaluate( - "value", value_, String.class, this, pageContext); - } - - // 'type' attribute - if (type_ != null) { - type = (String) ExpressionEvaluatorManager.evaluate( - "type", type_, String.class, this, pageContext); - } - - // 'pattern' attribute - if (pattern_ != null) { - pattern = (String) ExpressionEvaluatorManager.evaluate( - "pattern", pattern_, String.class, this, pageContext); - } - - // 'parseLocale' attribute - if (parseLocale_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "parseLocale", parseLocale_, Object.class, this, pageContext); - if (obj != null) { - if (obj instanceof Locale) { - parseLocale = (Locale) obj; - } else { - String localeStr = (String) obj; - if (!"".equals(localeStr)) { - parseLocale = SetLocaleSupport.parseLocale(localeStr); - } - } - } - } - - // 'integerOnly' attribute - if (integerOnly_ != null) { - obj = ExpressionEvaluatorManager.evaluate( - "integerOnly", integerOnly_, Boolean.class, this, pageContext); - if (obj != null) { - isIntegerOnly = ((Boolean) obj).booleanValue(); - } - } - } -} - diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/RequestEncodingTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/RequestEncodingTag.java deleted file mode 100644 index b9035ff..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/RequestEncodingTag.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.RequestEncodingSupport; - -/** - *

A handler for <requestEncoding> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class RequestEncodingTag extends RequestEncodingSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new RequestEncodingTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public RequestEncodingTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - if (value_ != null) { - value = (String) ExpressionEvaluatorManager.evaluate( - "value", value_, String.class, this, pageContext); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetBundleTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetBundleTag.java deleted file mode 100644 index dee40c3..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetBundleTag.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.SetBundleSupport; - -/** - *

A handler for <setBundle> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - * @author Jan Luehe - */ - -public class SetBundleTag extends SetBundleSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String basename_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new SetBundleTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public SetBundleTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setBasename(String basename_) { - this.basename_ = basename_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - basename_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - - // 'basename' attribute (mandatory) - basename = (String) ExpressionEvaluatorManager.evaluate( - "basename", basename_, String.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetLocaleTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetLocaleTag.java deleted file mode 100644 index 9f09a1d..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetLocaleTag.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; - -/** - *

A handler for <setLocale> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Jan Luehe - */ - -public class SetLocaleTag extends SetLocaleSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - private String variant_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new LocaleTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public SetLocaleTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - } - - // for EL-based attribute - public void setVariant(String variant_) { - this.variant_ = variant_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = variant_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - - // 'value' attribute (mandatory) - value = ExpressionEvaluatorManager.evaluate( - "value", value_, Object.class, this, pageContext); - - // 'variant' attribute (optional) - if (variant_ != null) { - variant = (String) ExpressionEvaluatorManager.evaluate( - "variant", variant_, String.class, this, pageContext); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetTimeZoneTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetTimeZoneTag.java deleted file mode 100644 index ad28022..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/SetTimeZoneTag.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.SetTimeZoneSupport; - -/** - *

A handler for <setTimeZone> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - * @author Jan Luehe - */ - -public class SetTimeZoneTag extends SetTimeZoneSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new TimeZoneTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public SetTimeZoneTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - - // 'value' attribute (mandatory) - value = ExpressionEvaluatorManager.evaluate( - "value", value_, Object.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java deleted file mode 100644 index 77eedcc..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/fmt/TimeZoneTag.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.fmt; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.fmt.TimeZoneSupport; - -/** - *

A handler for <timeZone> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - * @author Jan Luehe - */ - -public class TimeZoneTag extends TimeZoneSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String value_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new TimeZoneTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public TimeZoneTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setValue(String value_) { - this.value_ = value_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - value_ = null; - } - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - - // 'value' attribute (mandatory) - value = ExpressionEvaluatorManager.evaluate( - "value", value_, Object.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/DateParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/DateParamTag.java deleted file mode 100644 index b48fcf7..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/DateParamTag.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.sql; - -import java.util.Date; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.sql.DateParamTagSupport; - -/** - * Subclass for the JSTL library with EL support. - * - * @author Justyna Horwat - */ -public class DateParamTag extends DateParamTagSupport { - - private String valueEL; - private String typeEL; - - public void setValue(String valueEL) { - this.valueEL = valueEL; - } - - public void setType(String typeEL) { - this.typeEL = typeEL; - } - - public int doStartTag() throws JspException { - evaluateExpressions(); - return super.doStartTag(); - } - - //********************************************************************* - // Private utility methods - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - if (valueEL != null) { - value = (Date) ExpressionEvaluatorManager.evaluate( - "value", valueEL, Date.class, this, pageContext); - } - - if (typeEL != null) { - type = (String) ExpressionEvaluatorManager.evaluate( - "type", typeEL, String.class, this, pageContext); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/ParamTag.java deleted file mode 100644 index bfcfb55..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/ParamTag.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.sql; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.sql.ParamTagSupport; - -/** - * Subclass for the JSTL library with EL support. - * - * @author Hans Bergsten - */ -public class ParamTag extends ParamTagSupport { - - private String valueEL; - - public void setValue(String valueEL) { - this.valueEL = valueEL; - } - - public int doStartTag() throws JspException { - if (valueEL != null) { - value = (Object) - ExpressionEvaluatorManager.evaluate("value", valueEL, - Object.class, this, pageContext); - } - return super.doStartTag(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/QueryTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/QueryTag.java deleted file mode 100644 index fef68b3..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/QueryTag.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.sql; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.sql.QueryTagSupport; - -/** - * Subclass for the JSTL library with EL support. - * - * @author Hans Bergsten - * @author Justyna Horwat - */ -public class QueryTag extends QueryTagSupport { - - private String dataSourceEL; - private String sqlEL; - private String startRowEL; - private String maxRowsEL; - - //********************************************************************* - // Constructor - - /** - * Constructs a new QueryTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public QueryTag() { - super(); - } - - //********************************************************************* - // Accessor methods - - public void setDataSource(String dataSourceEL) { - this.dataSourceEL = dataSourceEL; - this.dataSourceSpecified = true; - } - - /** - * The index of the first row returned can be - * specified using startRow. - */ - public void setStartRow(String startRowEL) { - this.startRowEL = startRowEL; - } - - /** - * Query result can be limited by specifying - * the maximum number of rows returned. - */ - public void setMaxRows(String maxRowsEL) { - this.maxRowsEL = maxRowsEL; - this.maxRowsSpecified = true; - } - - /** - * Setter method for the SQL statement to use for the - * query. The statement may contain parameter markers - * (question marks, ?). If so, the parameter values must - * be set using nested value elements. - */ - public void setSql(String sqlEL) { - this.sqlEL = sqlEL; - } - - public int doStartTag() throws JspException { - evaluateExpressions(); - return super.doStartTag(); - } - - //********************************************************************* - // Private utility methods - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - Integer tempInt = null; - - if (dataSourceEL != null) { - rawDataSource = (Object) ExpressionEvaluatorManager.evaluate( - "dataSource", dataSourceEL, Object.class, this, pageContext); - } - - if (sqlEL != null) { - sql = (String) ExpressionEvaluatorManager.evaluate("sql", sqlEL, - String.class, this, pageContext); - } - - if (startRowEL != null) { - tempInt = (Integer) ExpressionEvaluatorManager.evaluate( - "startRow", startRowEL, Integer.class, this, pageContext); - if (tempInt != null) - startRow = tempInt.intValue(); - } - - if (maxRowsEL != null) { - tempInt = (Integer) ExpressionEvaluatorManager.evaluate( - "maxRows", maxRowsEL, Integer.class, this, pageContext); - if (tempInt != null) - maxRows = tempInt.intValue(); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/SetDataSourceTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/SetDataSourceTag.java deleted file mode 100644 index 1ef0758..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/SetDataSourceTag.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.sql; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport; - -/** - *

Tag handler for <SetDataSource> in JSTL, used to create - * a simple DataSource for prototyping.

- * - */ -public class SetDataSourceTag extends SetDataSourceTagSupport { - - private String dataSourceEL; - private String driverClassNameEL; - private String jdbcURLEL; - private String userNameEL; - private String passwordEL; - - //********************************************************************* - // Accessor methods - - public void setDataSource(String dataSourceEL) { - this.dataSourceEL = dataSourceEL; - this.dataSourceSpecified = true; - } - - public void setDriver(String driverClassNameEL) { - this.driverClassNameEL = driverClassNameEL; - } - - public void setUrl(String jdbcURLEL) { - this.jdbcURLEL = jdbcURLEL; - } - - public void setUser(String userNameEL) { - this.userNameEL = userNameEL; - } - - public void setPassword(String passwordEL) { - this.passwordEL = passwordEL; - } - - //********************************************************************* - // Tag logic - - public int doStartTag() throws JspException { - evaluateExpressions(); - - return super.doStartTag(); - } - - - //********************************************************************* - // Private utility methods - - // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - if (dataSourceEL != null) { - dataSource = ExpressionEvaluatorManager.evaluate - ("dataSource", dataSourceEL, Object.class, this, pageContext); - } - - if (driverClassNameEL != null) { - driverClassName = (String) ExpressionEvaluatorManager.evaluate - ("driver", driverClassNameEL, String.class, this, pageContext); - } - - if (jdbcURLEL != null) { - jdbcURL = (String) ExpressionEvaluatorManager.evaluate - ("url", jdbcURLEL, String.class, this, pageContext); - } - - if (userNameEL != null) { - userName = (String) ExpressionEvaluatorManager.evaluate - ("user", userNameEL, String.class, this, pageContext); - } - - if (passwordEL != null) { - password = (String) ExpressionEvaluatorManager.evaluate - ("password", passwordEL, String.class, this, pageContext); - } - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/TransactionTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/TransactionTag.java deleted file mode 100644 index 2e8c122..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/TransactionTag.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.sql; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.sql.TransactionTagSupport; - -/** - * Subclass for the JSTL library with EL support. - * - * @author Hans Bergsten - * @author Justyna Horwat - */ -public class TransactionTag extends TransactionTagSupport { - - private String dataSourceEL; - private String isolationEL; - - public void setDataSource(String dataSourceEL) { - this.dataSourceEL = dataSourceEL; - this.dataSourceSpecified = true; - } - - public void setIsolation(String isolationEL) { - this.isolationEL = isolationEL; - } - - public int doStartTag() throws JspException { - if (dataSourceEL != null) { - rawDataSource = (Object) - ExpressionEvaluatorManager.evaluate("dataSource", - dataSourceEL, Object.class, this, pageContext); - } - - if (isolationEL != null) { - isolationEL = (String) - ExpressionEvaluatorManager.evaluate("isolation", - isolationEL, String.class, this, pageContext); - super.setIsolation(isolationEL); - } - - return super.doStartTag(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/UpdateTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/UpdateTag.java deleted file mode 100644 index daaea57..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/sql/UpdateTag.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.sql; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport; - -/** - * Subclass for the JSTL library with EL support. - * - * @author Hans Bergsten - */ -public class UpdateTag extends UpdateTagSupport { - - private String dataSourceEL; - private String sqlEL; - - public void setDataSource(String dataSourceEL) { - this.dataSourceEL = dataSourceEL; - this.dataSourceSpecified = true; - } - - /** - * Setter method for the SQL statement to use for the - * query. The statement may contain parameter markers - * (question marks, ?). If so, the parameter values must - * be set using nested value elements. - */ - public void setSql(String sqlEL) { - this.sqlEL = sqlEL; - } - - public int doStartTag() throws JspException { - if (dataSourceEL != null) { - rawDataSource = (Object) - ExpressionEvaluatorManager.evaluate("dataSource", - dataSourceEL, Object.class, this, pageContext); - } - if (sqlEL != null) { - sql = (String) ExpressionEvaluatorManager.evaluate("sql", sqlEL, - String.class, this, pageContext); - } - return super.doStartTag(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ExprTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ExprTag.java deleted file mode 100644 index 23770fb..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ExprTag.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.xml; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.xml.ExprSupport; -import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; - -/** - *

A handler for <out> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ -public class ExprTag extends ExprSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String escapeXml_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new handler. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ExprTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setEscapeXml(String escapeXml_) { - this.escapeXml_ = escapeXml_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - escapeXml_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - if (escapeXml_ != null) { - Boolean b = (Boolean) ExpressionUtil.evalNotNull( - "out", - "escapeXml", - escapeXml_, - Boolean.class, - this, - pageContext); - if (b == null) - escapeXml = false; - else - escapeXml = b.booleanValue(); - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParamTag.java deleted file mode 100644 index 0022cc0..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParamTag.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.xml; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.xml.ParamSupport; -import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; - -/** - *

A handler for <param> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ - -public class ParamTag extends ParamSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String name_; // stores EL-based property - private String value_; // stores EL-based property - - - //********************************************************************* - // Constructor - - public ParamTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setName(String name_) { - this.name_ = name_; - } - - public void setValue(String value_) { - this.value_ = value_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - name_ = value_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - name = (String) ExpressionUtil.evalNotNull( - "param", "name", name_, String.class, this, pageContext); - value = ExpressionUtil.evalNotNull( - "param", "value", value_, Object.class, this, pageContext); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParseTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParseTag.java deleted file mode 100644 index 6149714..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/ParseTag.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.xml; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.core.NullAttributeException; -import org.apache.taglibs.standard.tag.common.xml.ParseSupport; -import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; -import org.xml.sax.XMLFilter; - -/** - *

A handler for <parse> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ -public class ParseTag extends ParseSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String xml_; // stores EL-based property - private String systemId_; // stores EL-based property - private String filter_; // stores EL-based property - - - //********************************************************************* - // Constructor - - /** - * Constructs a new ParseTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public ParseTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setFilter(String filter_) { - this.filter_ = filter_; - } - - public void setXml(String xml_) { - this.xml_ = xml_; - } - - public void setSystemId(String systemId_) { - this.systemId_ = systemId_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - filter_ = xml_ = systemId_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - xml = ExpressionUtil.evalNotNull( - "parse", "xml", xml_, Object.class, this, pageContext); - systemId = (String) ExpressionUtil.evalNotNull( - "parse", "systemId", systemId_, String.class, this, pageContext); - - try { - filter = (XMLFilter) ExpressionUtil.evalNotNull( - "parse", "filter", filter_, XMLFilter.class, this, pageContext); - } catch (NullAttributeException ex) { - // explicitly let 'filter' be null - filter = null; - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/TransformTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/TransformTag.java deleted file mode 100644 index 93ae850..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/el/xml/TransformTag.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.el.xml; - -import jakarta.servlet.jsp.JspException; -import javax.xml.transform.Result; - -import org.apache.taglibs.standard.tag.common.xml.TransformSupport; -import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; - -/** - *

A handler for <transform> that accepts attributes as Strings - * and evaluates them as expressions at runtime.

- * - * @author Shawn Bayern - */ -public class TransformTag extends TransformSupport { - - //********************************************************************* - // 'Private' state (implementation details) - - private String xml_; // stores EL-based property - private String xmlSystemId_; // stores EL-based property - private String xslt_; // stores EL-based property - private String xsltSystemId_; // stores EL-based property - private String result_; // stores EL-based property - - - //********************************************************************* - // Constructor - - public TransformTag() { - super(); - init(); - } - - - //********************************************************************* - // Tag logic - - // evaluates expression and chains to parent - public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); - } - - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Accessor methods - - // for EL-based attribute - public void setXml(String xml_) { - this.xml_ = xml_; - } - - // for EL-based attribute - public void setXmlSystemId(String xmlSystemId_) { - this.xmlSystemId_ = xmlSystemId_; - } - - // for EL-based attribute - public void setXslt(String xslt_) { - this.xslt_ = xslt_; - } - - // for EL-based attribute - public void setXsltSystemId(String xsltSystemId_) { - this.xsltSystemId_ = xsltSystemId_; - } - - /* Removed for RI 0.5 - // for EL-based attribute - public void setTransformer(String transformer_) { - this.transformer_ = transformer_; - } - */ - - // for EL-based attribute - public void setResult(String result_) { - this.result_ = result_; - } - - - //********************************************************************* - // Private (utility) methods - - // (re)initializes state (during release() or construction) - private void init() { - // null implies "no expression" - xml_ = xmlSystemId = xslt_ = xsltSystemId_ = result_ = null; - } - - /* Evaluates expressions as necessary */ - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume - * the expression evaluator will return the expected type - * (by virtue of knowledge we give it about what that type is). - * A ClassCastException here is truly unexpected, so we let it - * propagate up. - */ - - xml = ExpressionUtil.evalNotNull( - "transform", "xml", xml_, Object.class, this, pageContext); - xmlSystemId = (String) ExpressionUtil.evalNotNull( - "transform", "xmlSystemId", xmlSystemId_, String.class, - this, pageContext); - xslt= ExpressionUtil.evalNotNull( - "transform", "xslt", xslt_, Object.class, this, - pageContext); - xsltSystemId = (String) ExpressionUtil.evalNotNull( - "transform", "xsltSystemId", xsltSystemId_, String.class, - this, pageContext); - result = (Result) ExpressionUtil.evalNotNull( - "transform", "result", result_, Result.class, this, pageContext); - - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java deleted file mode 100644 index d55be2f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import java.util.ArrayList; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.LoopTag; -import jakarta.servlet.jsp.tagext.IterationTag; - -import org.apache.taglibs.standard.tag.common.core.ForEachSupport; - -/** - *

A handler for <forEach> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ForEachTag - extends ForEachSupport - implements LoopTag, IterationTag -{ - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setBegin(int begin) throws JspTagException { - this.beginSpecified = true; - this.begin = begin; - validateBegin(); - } - - // for tag attribute - public void setEnd(int end) throws JspTagException { - this.endSpecified = true; - this.end = end; - validateEnd(); - } - - // for tag attribute - public void setStep(int step) throws JspTagException { - this.stepSpecified = true; - this.step = step; - validateStep(); - } - - public void setItems(Object o) throws JspTagException { - // for null items, simulate an empty list - if (o == null) - rawItems = new ArrayList(); - else - rawItems = o; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java deleted file mode 100644 index ca0e126..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.core.LoopTag; -import jakarta.servlet.jsp.tagext.IterationTag; - -import org.apache.taglibs.standard.tag.common.core.ForTokensSupport; - -/** - *

A handler for <forTokens> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ForTokensTag - extends ForTokensSupport - implements LoopTag, IterationTag -{ - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setBegin(int begin) throws JspTagException { - this.beginSpecified = true; - this.begin = begin; - validateBegin(); - } - - // for tag attribute - public void setEnd(int end) throws JspTagException { - this.endSpecified = true; - this.end = end; - validateEnd(); - } - - // for tag attribute - public void setStep(int step) throws JspTagException { - this.stepSpecified = true; - this.step = step; - validateStep(); - } - - // stores the 'items' String we're passed - public void setItems(Object s) throws JspTagException { - items = s; - // use the empty string to indicate "no iteration" - if (s == null) - items = ""; - } - - // stores the 'delims' String we're passed - public void setDelims(String s) throws JspTagException { - delims = s; - // use the empty string to cause monolithic tokenization - if (s == null) - delims = ""; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java deleted file mode 100644 index e708f75..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import jakarta.servlet.jsp.jstl.core.ConditionalTagSupport; - -/** - *

Tag handler for <if> in JSTL's rtexprvalue library. Because - * of the support provided by the ConditionalTagSupport class, this - * tag is trivial enough not to require a separate base supporting class - * common to both libraries.

- * - * @author Shawn Bayern - */ - -public class IfTag extends ConditionalTagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public IfTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Supplied conditional logic - - protected boolean condition() { - return test; - } - - - //********************************************************************* - // Private state - - private boolean test; // the value of the 'test' attribute - - - //********************************************************************* - // Accessors - - // receives the tag's 'test' attribute - public void setTest(boolean test) { - this.test = test; - } - - - //********************************************************************* - // Private utility methods - - // resets internal state - private void init() { - test = false; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java deleted file mode 100644 index 7ac925f..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.core.ImportSupport; - -/** - *

A handler for <import> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ImportTag extends ImportSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setUrl(String url) throws JspTagException { - this.url = url; - } - - // for tag attribute - public void setContext(String context) throws JspTagException { - this.context = context; - } - - // for tag attribute - public void setCharEncoding(String charEncoding) throws JspTagException { - this.charEncoding = charEncoding; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java deleted file mode 100644 index 2c665ad..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import org.apache.taglibs.standard.tag.common.core.OutSupport; - -/** - *

Tag handler for <out> in JSTL's rtexprvalue library.

- * - * @author Shawn Bayern - */ - -public class OutTag extends OutSupport { - - //********************************************************************* - // Accessors - - // for tag attribute - public void setValue(Object value) { - this.value = value; - } - - // for tag attribute - public void setDefault(String def) { - this.def = def; - } - - // for tag attribute - public void setEscapeXml(boolean escapeXml) { - this.escapeXml = escapeXml; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java deleted file mode 100644 index 295546d..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.core.ParamSupport; - -/** - *

A handler for <param> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ParamTag extends ParamSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setName(String name) throws JspTagException { - this.name = name; - } - - // for tag attribute - public void setValue(String value) throws JspTagException { - this.value = value; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/RedirectTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/RedirectTag.java deleted file mode 100644 index bbc6551..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/RedirectTag.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.core.RedirectSupport; - -/** - *

A handler for <redirect> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class RedirectTag extends RedirectSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setUrl(String url) throws JspTagException { - this.url = url; - } - - // for tag attribute - public void setContext(String context) throws JspTagException { - this.context = context; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/SetTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/SetTag.java deleted file mode 100644 index 0a3cf6a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/SetTag.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import org.apache.taglibs.standard.tag.common.core.SetSupport; - -/** - *

Tag handler for <set> in JSTL's rtexprvalue library.

- * - * @author Shawn Bayern - */ - -public class SetTag extends SetSupport { - - //********************************************************************* - // Accessors - - // for tag attribute - public void setValue(Object value) { - this.value = value; - this.valueSpecified = true; - } - - // for tag attribute - public void setTarget(Object target) { - this.target = target; - } - - // for tag attribute - public void setProperty(String property) { - this.property = property; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/UrlTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/UrlTag.java deleted file mode 100644 index 28a0938..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/UrlTag.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.core.UrlSupport; - -/** - *

A handler for <urlEncode> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class UrlTag extends UrlSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setValue(String value) throws JspTagException { - this.value = value; - } - - // for tag attribute - public void setContext(String context) throws JspTagException { - this.context = context; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/WhenTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/WhenTag.java deleted file mode 100644 index 4fe7965..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/core/WhenTag.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.core; - -import org.apache.taglibs.standard.tag.common.core.WhenTagSupport; - -/** - *

Tag handler for <when> in JSTL's rtexprvalue library.

- * - * @author Shawn Bayern - */ - -public class WhenTag extends WhenTagSupport { - - //********************************************************************* - // Constructor and lifecycle management - - // initialize inherited and local state - public WhenTag() { - super(); - init(); - } - - // Releases any resources we may have (or inherit) - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Supplied conditional logic - - protected boolean condition() { - return test; - } - - - //********************************************************************* - // Private state - - private boolean test; // the value of the 'test' attribute - - - //********************************************************************* - // Accessors - - // receives the tag's 'test' attribute - public void setTest(boolean test) { - this.test = test; - } - - - //********************************************************************* - // Private utility methods - - // resets internal state - private void init() { - test = false; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java deleted file mode 100644 index f322eff..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.BundleSupport; - -/** - *

A handler for <bundle> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class BundleTag extends BundleSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setBasename(String basename) throws JspTagException { - this.basename = basename; - } - - // for tag attribute - public void setPrefix(String prefix) throws JspTagException { - this.prefix = prefix; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java deleted file mode 100644 index b41f26e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import java.util.Date; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.FormatDateSupport; - -/** - *

A handler for <formatDate> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class FormatDateTag extends FormatDateSupport { - - //********************************************************************* - // Accessor methods - - // 'value' attribute - public void setValue(Date value) throws JspTagException { - this.value = value; - } - - // 'type' attribute - public void setType(String type) throws JspTagException { - this.type = type; - } - - // 'dateStyle' attribute - public void setDateStyle(String dateStyle) throws JspTagException { - this.dateStyle = dateStyle; - } - - // 'timeStyle' attribute - public void setTimeStyle(String timeStyle) throws JspTagException { - this.timeStyle = timeStyle; - } - - // 'pattern' attribute - public void setPattern(String pattern) throws JspTagException { - this.pattern = pattern; - } - - // 'timeZone' attribute - public void setTimeZone(Object timeZone) throws JspTagException { - this.timeZone = timeZone; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java deleted file mode 100644 index 27c2fda..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.FormatNumberSupport; - -/** - *

A handler for <formatNumber> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class FormatNumberTag extends FormatNumberSupport { - - //********************************************************************* - // Accessor methods - - // 'value' attribute - public void setValue(Object value) throws JspTagException { - this.value = value; - this.valueSpecified = true; - } - - // 'type' attribute - public void setType(String type) throws JspTagException { - this.type = type; - } - - // 'pattern' attribute - public void setPattern(String pattern) throws JspTagException { - this.pattern = pattern; - } - - // 'currencyCode' attribute - public void setCurrencyCode(String currencyCode) throws JspTagException { - this.currencyCode = currencyCode; - } - - // 'currencySymbol' attribute - public void setCurrencySymbol(String currencySymbol) - throws JspTagException { - this.currencySymbol = currencySymbol; - } - - // 'groupingUsed' attribute - public void setGroupingUsed(boolean isGroupingUsed) - throws JspTagException { - this.isGroupingUsed = isGroupingUsed; - this.groupingUsedSpecified = true; - } - - // 'maxIntegerDigits' attribute - public void setMaxIntegerDigits(int maxDigits) throws JspTagException { - this.maxIntegerDigits = maxDigits; - this.maxIntegerDigitsSpecified = true; - } - - // 'minIntegerDigits' attribute - public void setMinIntegerDigits(int minDigits) throws JspTagException { - this.minIntegerDigits = minDigits; - this.minIntegerDigitsSpecified = true; - } - - // 'maxFractionDigits' attribute - public void setMaxFractionDigits(int maxDigits) throws JspTagException { - this.maxFractionDigits = maxDigits; - this.maxFractionDigitsSpecified = true; - } - - // 'minFractionDigits' attribute - public void setMinFractionDigits(int minDigits) throws JspTagException { - this.minFractionDigits = minDigits; - this.minFractionDigitsSpecified = true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java deleted file mode 100644 index 8f6d9b0..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; -import jakarta.servlet.jsp.jstl.fmt.LocalizationContext; - -import org.apache.taglibs.standard.tag.common.fmt.MessageSupport; - -/** - *

A handler for <message> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class MessageTag extends MessageSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setKey(String key) throws JspTagException { - this.keyAttrValue = key; - this.keySpecified = true; - } - - // for tag attribute - public void setBundle(LocalizationContext locCtxt) throws JspTagException { - this.bundleAttrValue = locCtxt; - this.bundleSpecified = true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParamTag.java deleted file mode 100644 index 05c1134..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParamTag.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.ParamSupport; - -/** - *

A handler for <param> that supports rtexprvalue-based - * message arguments.

- * - * @author Jan Luehe - */ - -public class ParamTag extends ParamSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setValue(Object value) throws JspTagException { - this.value = value; - this.valueSpecified = true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java deleted file mode 100644 index fdbd126..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import java.util.Locale; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.ParseDateSupport; -import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; - -/** - *

A handler for <parseDate> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class ParseDateTag extends ParseDateSupport { - - //********************************************************************* - // Accessor methods - - // 'value' attribute - public void setValue(String value) throws JspTagException { - this.value = value; - this.valueSpecified = true; - } - - // 'type' attribute - public void setType(String type) throws JspTagException { - this.type = type; - } - - // 'dateStyle' attribute - public void setDateStyle(String dateStyle) throws JspTagException { - this.dateStyle = dateStyle; - } - - // 'timeStyle' attribute - public void setTimeStyle(String timeStyle) throws JspTagException { - this.timeStyle = timeStyle; - } - - // 'pattern' attribute - public void setPattern(String pattern) throws JspTagException { - this.pattern = pattern; - } - - // 'timeZone' attribute - public void setTimeZone(Object timeZone) throws JspTagException { - this.timeZone = timeZone; - } - - // 'parseLocale' attribute - public void setParseLocale(Object loc) throws JspTagException { - if (loc != null) { - if (loc instanceof Locale) { - this.parseLocale = (Locale) loc; - } else { - if (!"".equals((String) loc)) { - this.parseLocale = SetLocaleSupport.parseLocale((String) - loc); - } - } - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java deleted file mode 100644 index 56e8852..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import java.util.Locale; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.ParseNumberSupport; -import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; - -/** - *

A handler for <parseNumber> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class ParseNumberTag extends ParseNumberSupport { - - //********************************************************************* - // Accessor methods - - // 'value' attribute - public void setValue(String value) throws JspTagException { - this.value = value; - this.valueSpecified = true; - } - - // 'type' attribute - public void setType(String type) throws JspTagException { - this.type = type; - } - - // 'pattern' attribute - public void setPattern(String pattern) throws JspTagException { - this.pattern = pattern; - } - - // 'parseLocale' attribute - public void setParseLocale(Object loc) throws JspTagException { - if (loc != null) { - if (loc instanceof Locale) { - this.parseLocale = (Locale) loc; - } else { - if (!"".equals((String) loc)) { - this.parseLocale = SetLocaleSupport.parseLocale((String) - loc); - } - } - } - } - - // 'integerOnly' attribute - public void setIntegerOnly(boolean isIntegerOnly) throws JspTagException { - this.isIntegerOnly = isIntegerOnly; - this.integerOnlySpecified = true; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/RequestEncodingTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/RequestEncodingTag.java deleted file mode 100644 index fde4de0..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/RequestEncodingTag.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.RequestEncodingSupport; - -/** - *

A handler for <requestEncoding> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class RequestEncodingTag extends RequestEncodingSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setValue(String value) throws JspTagException { - this.value = value; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java deleted file mode 100644 index da19413..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.SetBundleSupport; - -/** - *

A handler for <setBundle> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class SetBundleTag extends SetBundleSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setBasename(String basename) throws JspTagException { - this.basename = basename; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetLocaleTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetLocaleTag.java deleted file mode 100644 index f5aa965..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetLocaleTag.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; - -/** - *

A handler for <setLocale> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class SetLocaleTag extends SetLocaleSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setValue(Object value) throws JspTagException { - this.value = value; - } - - // for tag attribute - public void setVariant(String variant) throws JspTagException { - this.variant = variant; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetTimeZoneTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetTimeZoneTag.java deleted file mode 100644 index 1951806..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetTimeZoneTag.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.SetTimeZoneSupport; - -/** - *

A handler for <setTimeZone> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class SetTimeZoneTag extends SetTimeZoneSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setValue(Object value) throws JspTagException { - this.value = value; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java deleted file mode 100644 index 95e64fe..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.fmt; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.fmt.TimeZoneSupport; - -/** - *

A handler for <timeZone> that supports rtexprvalue-based - * attributes.

- * - * @author Jan Luehe - */ - -public class TimeZoneTag extends TimeZoneSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setValue(Object value) throws JspTagException { - this.value = value; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/DateParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/DateParamTag.java deleted file mode 100644 index 621db37..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/DateParamTag.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.sql; - -import java.util.Date; - -import org.apache.taglibs.standard.tag.common.sql.DateParamTagSupport; - -/** - * Subclass for the JSTL library with rtexprvalue support. - * - * @author Justyna Horwat - */ -public class DateParamTag extends DateParamTagSupport { - - public void setValue(Date value) { - this.value = value; - } - - public void setType(String type) { - this.type = type; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/ParamTag.java deleted file mode 100644 index c7df015..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/ParamTag.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.sql; - -import org.apache.taglibs.standard.tag.common.sql.ParamTagSupport; - -/** - * Subclass for the JSTL library with rtexprvalue support. - * - * @author Hans Bergsten - */ -public class ParamTag extends ParamTagSupport { - - public void setValue(Object value) { - this.value = value; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/QueryTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/QueryTag.java deleted file mode 100644 index 79dcd53..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/QueryTag.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.sql; - -import org.apache.taglibs.standard.tag.common.sql.QueryTagSupport; - -/** - * Subclass for the JSTL library with rtexprvalue support. - * - * @author Hans Bergsten - * @author Justyna Horwat - */ -public class QueryTag extends QueryTagSupport { - - //********************************************************************* - // Constructor - - /** - * Constructs a new QueryTag. As with TagSupport, subclasses - * should not provide other constructors and are expected to call - * the superclass constructor - */ - public QueryTag() { - super(); - } - - //********************************************************************* - // Accessor methods - - public void setDataSource(Object dataSource) { - this.rawDataSource = dataSource; - this.dataSourceSpecified = true; - } - - /** - * The index of the first row returned can be - * specified using startRow. - */ - public void setStartRow(int startRow) { - this.startRow = startRow; - } - - /** - * Query result can be limited by specifying - * the maximum number of rows returned. - */ - public void setMaxRows(int maxRows) { - this.maxRows = maxRows; - this.maxRowsSpecified = true; - } - - /** - * Setter method for the SQL statement to use for the - * query. The statement may contain parameter markers - * (question marks, ?). If so, the parameter values must - * be set using nested value elements. - */ - public void setSql(String sql) { - this.sql = sql; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/SetDataSourceTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/SetDataSourceTag.java deleted file mode 100644 index 41058c6..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/SetDataSourceTag.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.sql; - -import org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport; - -/** - *

Tag handler for <Driver> in JSTL, used to create - * a simple DataSource for prototyping.

- * - */ -public class SetDataSourceTag extends SetDataSourceTagSupport { - - //********************************************************************* - // Accessor methods - - public void setDataSource(Object dataSource) { - this.dataSource = dataSource; - this.dataSourceSpecified = true; - } - - public void setDriver(String driverClassName) { - this.driverClassName = driverClassName; - } - - public void setUrl(String jdbcURL) { - this.jdbcURL = jdbcURL; - } - - public void setUser(String userName) { - this.userName = userName; - } - - public void setPassword(String password) { - this.password = password; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/TransactionTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/TransactionTag.java deleted file mode 100644 index 72e1b3e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/TransactionTag.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.sql; - -import jakarta.servlet.jsp.JspException; - -import org.apache.taglibs.standard.tag.common.sql.TransactionTagSupport; - -/** - * Subclass for the JSTL library with rtexprvalue support. - * - * @author Hans Bergsten - */ -public class TransactionTag extends TransactionTagSupport { - private String isolationRT; - - //********************************************************************* - // Accessor methods - - - /** - * Setter method for the SQL DataSource. DataSource can be - * a String or a DataSource object. - */ - public void setDataSource(Object dataSource) { - this.rawDataSource = dataSource; - this.dataSourceSpecified = true; - } - - /** - * Setter method for the Transaction Isolation level. - */ - public void setIsolation(String isolation) { - this.isolationRT = isolation; - } - - public int doStartTag() throws JspException { - if (isolationRT != null) - super.setIsolation(isolationRT); - return super.doStartTag(); - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/UpdateTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/UpdateTag.java deleted file mode 100644 index deee2f9..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/sql/UpdateTag.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.sql; - -import org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport; - -/** - * Subclass for the JSTL library with rtexprvalue support. - * - * @author Hans Bergsten - */ -public class UpdateTag extends UpdateTagSupport { - - //********************************************************************* - // Accessor methods - - - /** - * Setter method for the SQL DataSource. DataSource can be - * a String or a DataSource object. - */ - public void setDataSource(Object dataSource) { - this.rawDataSource = dataSource; - this.dataSourceSpecified = true; - } - - /** - * Setter method for the SQL statement to use for the - * query. The statement may contain parameter markers - * (question marks, ?). If so, the parameter values must - * be set using nested value elements. - */ - public void setSql(String sql) { - this.sql = sql; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ExprTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ExprTag.java deleted file mode 100644 index 21bbcdd..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ExprTag.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.xml; - -import org.apache.taglibs.standard.tag.common.xml.ExprSupport; - -/** - *

A handler for <out> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ExprTag extends ExprSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setEscapeXml(boolean escapeXml) { - this.escapeXml = escapeXml; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java deleted file mode 100644 index f648237..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.xml; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.xml.ParamSupport; - -/** - *

A handler for <param> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ParamTag extends ParamSupport { - - //********************************************************************* - // Accessor methods - - // for tag attribute - public void setName(String name) throws JspTagException { - this.name = name; - } - - // for tag attribute - public void setValue(Object value) throws JspTagException { - this.value = value; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java deleted file mode 100644 index b2ce3b4..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.xml; - -import jakarta.servlet.jsp.JspTagException; - -import org.apache.taglibs.standard.tag.common.xml.ParseSupport; -import org.xml.sax.XMLFilter; - -/** - *

A handler for <parse> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class ParseTag extends ParseSupport { - - //********************************************************************* - // Accessor methods - - // Deprecated as of JSTL 1.1 - // for tag attribute - public void setXml(Object xml) throws JspTagException { - this.xml = xml; - } - - // 'doc' replaces 'xml' as of JSTL 1.1 - public void setDoc(Object xml) throws JspTagException { - this.xml = xml; - } - - public void setSystemId(String systemId) throws JspTagException { - this.systemId = systemId; - } - - // for tag attribute - public void setFilter(XMLFilter filter) throws JspTagException { - this.filter = filter; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java b/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java deleted file mode 100644 index 24bb59e..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tag.rt.xml; - -import jakarta.servlet.jsp.JspTagException; -import javax.xml.transform.Result; - -import org.apache.taglibs.standard.tag.common.xml.TransformSupport; - -/** - *

A handler for <transform> that supports rtexprvalue-based - * attributes.

- * - * @author Shawn Bayern - */ - -public class TransformTag extends TransformSupport { - - //********************************************************************* - // Accessor methods - - // Deprecated as of JSTL 1.1 - // for tag attribute - public void setXml(Object xml) throws JspTagException { - this.xml = xml; - } - - // 'doc' replaces 'xml' as of JSTL 1.1 - public void setDoc(Object xml) throws JspTagException { - this.xml = xml; - } - - // Deprecated as of JSTL 1.1 - // for tag attribute - public void setXmlSystemId(String xmlSystemId) throws JspTagException { - this.xmlSystemId = xmlSystemId; - } - - // 'docSystemId' replaces 'xmlSystemId' as of JSTL 1.1 - public void setDocSystemId(String xmlSystemId) throws JspTagException { - this.xmlSystemId = xmlSystemId; - } - - // for tag attribute - public void setXslt(Object xslt) throws JspTagException { - this.xslt = xslt; - } - - // for tag attribute - public void setXsltSystemId(String xsltSystemId) throws JspTagException { - this.xsltSystemId = xsltSystemId; - } - - // for tag attribute - public void setResult(Result result) throws JspTagException { - this.result = result; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java b/impl/src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java deleted file mode 100644 index 806b636..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tei; - -import jakarta.servlet.jsp.tagext.TagData; -import jakarta.servlet.jsp.tagext.TagExtraInfo; -import jakarta.servlet.jsp.tagext.VariableInfo; - -/** - *

An implementation of TagExtraInfo provided for <declare>. - * We simply set up a scripting variable for the ID and value that - * <declare> already stored. For EA2, DefineTEI *always* declares - * the variable; no option is given via a tag attribute. Visibility is - * always AT_END.

- * - * @author Shawn Bayern - */ -public class DeclareTEI extends TagExtraInfo { - - // purposely inherit JavaDoc and semantics from TagExtraInfo - public VariableInfo[] getVariableInfo(TagData data) { - // construct the relevant VariableInfo object - VariableInfo id = new VariableInfo( - data.getAttributeString("id"), - data.getAttributeString("type") == null ? - "java.lang.Object" : data.getAttributeString("type"), - true, - VariableInfo.AT_END); - return new VariableInfo[] { id }; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tei/ForEachTEI.java b/impl/src/main/java/org/apache/taglibs/standard/tei/ForEachTEI.java deleted file mode 100644 index bb63161..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tei/ForEachTEI.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tei; - -import jakarta.servlet.jsp.tagext.TagData; -import jakarta.servlet.jsp.tagext.TagExtraInfo; - -/** - *

An implementation of TagExtraInfo that implements validation for - * ForEachTag's attributes

- * - * @author Shawn Bayern - */ -public class ForEachTEI extends TagExtraInfo { - - final private static String ITEMS = "items"; - final private static String BEGIN = "begin"; - final private static String END = "end"; - - /* - * Currently implements the following rules: - * - * - If 'items' is not specified, 'begin' and 'end' must be - */ - public boolean isValid(TagData us) { - if (!Util.isSpecified(us, ITEMS)) - if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END))) - return false; - return true; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tei/ImportTEI.java b/impl/src/main/java/org/apache/taglibs/standard/tei/ImportTEI.java deleted file mode 100644 index 820cb4c..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tei/ImportTEI.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tei; - -import jakarta.servlet.jsp.tagext.TagData; -import jakarta.servlet.jsp.tagext.TagExtraInfo; - -/** - *

An implementation of TagExtraInfo that implements validation for - * <c:import>'s attributes

- * - * @author Shawn Bayern - */ -public class ImportTEI extends TagExtraInfo { - - final private static String VAR = "var"; - final private static String VAR_READER = "varReader"; - - public boolean isValid(TagData us) { - // don't allow both VAR and VAR_READER, together - if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_READER)) - return false; - - return true; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tei/Util.java b/impl/src/main/java/org/apache/taglibs/standard/tei/Util.java deleted file mode 100644 index 766bb67..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tei/Util.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tei; - -import jakarta.servlet.jsp.tagext.TagData; - -/** - *

Utilities in support of TagExtraInfo classes.

- * - * @author Shawn Bayern - */ -public class Util { - - /** - * Returns true if the given attribute name is specified, false otherwise. - */ - public static boolean isSpecified(TagData data, String attributeName) { - return (data.getAttribute(attributeName) != null); - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tei/XmlParseTEI.java b/impl/src/main/java/org/apache/taglibs/standard/tei/XmlParseTEI.java deleted file mode 100644 index f3cd10c..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tei/XmlParseTEI.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tei; - -import jakarta.servlet.jsp.tagext.TagData; -import jakarta.servlet.jsp.tagext.TagExtraInfo; - -/** - *

An implementation of TagExtraInfo that implements validation for - * {@literal <}x:parse{@literal >}'s attributes

- * - * @author Shawn Bayern - */ -public class XmlParseTEI extends TagExtraInfo { - - final private static String VAR = "var"; - final private static String VAR_DOM = "varDom"; - final private static String SCOPE = "scope"; - final private static String SCOPE_DOM = "scopeDom"; - - public boolean isValid(TagData us) { - // must have no more than one of VAR and VAR_DOM ... - if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_DOM)) - return false; - - // ... and must have no less than one of VAR and VAR_DOM - if (!(Util.isSpecified(us, VAR) || Util.isSpecified(us, VAR_DOM))) - return false; - - // When either 'scope' is specified, its 'var' must be specified - if (Util.isSpecified(us, SCOPE) && !Util.isSpecified(us, VAR)) - return false; - if (Util.isSpecified(us, SCOPE_DOM) && !Util.isSpecified(us, VAR_DOM)) - return false; - - return true; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tei/XmlTransformTEI.java b/impl/src/main/java/org/apache/taglibs/standard/tei/XmlTransformTEI.java deleted file mode 100644 index b2c0d9a..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tei/XmlTransformTEI.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tei; - -import jakarta.servlet.jsp.tagext.TagData; -import jakarta.servlet.jsp.tagext.TagExtraInfo; - -/** - *

An implementation of TagExtraInfo that implements validation for - * <x:transform>'s attributes

- * - * @author Shawn Bayern - */ -public class XmlTransformTEI extends TagExtraInfo { - - final private static String XSLT = "xslt"; - final private static String RESULT = "result"; - final private static String VAR = "var"; - - public boolean isValid(TagData us) { - // require XSLT - if (!Util.isSpecified(us, XSLT)) - return false; - - // disallow both VAR and RESULT - if (Util.isSpecified(us, VAR) && Util.isSpecified(us, RESULT)) - return false; - return true; - } - -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java b/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java deleted file mode 100644 index ae71395..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tlv; - -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.Vector; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.tagext.PageData; -import jakarta.servlet.jsp.tagext.TagData; -import jakarta.servlet.jsp.tagext.TagLibraryValidator; -import jakarta.servlet.jsp.tagext.ValidationMessage; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluator; -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.resources.Resources; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - *

A base class to support SAX-based validation in JSTL.

- * - * @author Shawn Bayern - */ -public abstract class JstlBaseTLV extends TagLibraryValidator { - - //********************************************************************* - // Implementation Overview - - /* - * We essentially just run the page through a SAX parser, handling - * the callbacks that interest us. The SAX parser is supplied by - * subclasses using the protected getHandler() method. - */ - - protected abstract DefaultHandler getHandler(); - - - //********************************************************************* - // Constants - - // parameter names - private final String EXP_ATT_PARAM = "expressionAttributes"; - - // attributes - protected static final String VAR = "var"; - protected static final String SCOPE = "scope"; - - //scopes - protected static final String PAGE_SCOPE = "page"; - protected static final String REQUEST_SCOPE = "request"; - protected static final String SESSION_SCOPE = "session"; - protected static final String APPLICATION_SCOPE = "application"; - - // Relevant URIs - protected final String JSP = "http://java.sun.com/JSP/Page"; - - // types of sub-classes - used on method validate() - private static final int TYPE_UNDEFINED = 0; - protected static final int TYPE_CORE = 1; - protected static final int TYPE_FMT = 2; - protected static final int TYPE_SQL = 3; - protected static final int TYPE_XML = 4; - - // which tlv is being validated - private int tlvType = TYPE_UNDEFINED; - - //********************************************************************* - // Validation and configuration state (protected) - - protected String uri; // our taglib's uri (as passed by JSP container on XML View) - protected String prefix; // our taglib's prefix - protected Vector messageVector; // temporary error messages - protected Map> config; // configuration (Map of Sets) - protected boolean failed; // have we failed >0 times? - protected String lastElementId; // the last element we've seen - - //********************************************************************* - // Constructor and lifecycle management - - public JstlBaseTLV() { - super(); - init(); - } - - private synchronized void init() { - messageVector = null; - prefix = null; - config = null; - } - - public void release() { - super.release(); - init(); - } - - - //********************************************************************* - // Validation entry point - this method is called by the sub-classes to - // do the validation. - - public synchronized ValidationMessage[] validate( - int type, String prefix, String uri, PageData page) { - try { - this.tlvType = type; - this.uri = uri; - // initialize - messageVector = new Vector<>(); - - // save the prefix - this.prefix = prefix; - - // parse parameters if necessary - try { - if (config == null) - configure((String) getInitParameters().get(EXP_ATT_PARAM)); - } catch (NoSuchElementException ex) { - // parsing error - return vmFromString( - Resources.getMessage("TLV_PARAMETER_ERROR", - EXP_ATT_PARAM)); - } - - // get a handler - DefaultHandler h = getHandler(); - - // parse the page - SAXParserFactory f = SAXParserFactory.newInstance(); - f.setValidating(false); - f.setNamespaceAware(true); - SAXParser p = f.newSAXParser(); - p.parse(page.getInputStream(), h); - - if (messageVector.size() == 0) - return null; - else - return vmFromVector(messageVector); - - } catch (SAXException ex) { - return vmFromString(ex.toString()); - } catch (ParserConfigurationException ex) { - return vmFromString(ex.toString()); - } catch (IOException ex) { - return vmFromString(ex.toString()); - } - } - - //********************************************************************* - // Protected utility functions - - // delegate validation to the appropriate expression language - protected String validateExpression( - String elem, String att, String expr) { - - // let's just use the cache kept by the ExpressionEvaluatorManager - ExpressionEvaluator current; - try { - current = - ExpressionEvaluatorManager.getEvaluatorByName( - ExpressionEvaluatorManager.EVALUATOR_CLASS); - } catch (JspException ex) { - // (using JspException here feels ugly, but it's what EEM uses) - return ex.getMessage(); - } - - String response = current.validate(att, expr); - if (response == null) - return response; - else - return "tag = '" + elem + "' / attribute = '" + att + "': " - + response; - } - - // utility methods to help us match elements in our tagset - protected boolean isTag(String tagUri, - String tagLn, - String matchUri, - String matchLn) { - if (tagUri == null - || tagUri.length() == 0 - || tagLn == null - || matchUri == null - || matchLn == null) - return false; - // match beginning of URI since some suffix *_rt tags can - // be nested in EL enabled tags as defined by the spec - if (tagUri.length() > matchUri.length()) { - return (tagUri.startsWith(matchUri) && tagLn.equals(matchLn)); - } else { - return (matchUri.startsWith(tagUri) && tagLn.equals(matchLn)); - } - } - - protected boolean isJspTag(String tagUri, String tagLn, String target) { - return isTag(tagUri, tagLn, JSP, target); - } - - private boolean isTag( int type, String tagUri, String tagLn, String target) { - return ( this.tlvType == type && isTag(tagUri, tagLn, this.uri, target) ); - } - - protected boolean isCoreTag(String tagUri, String tagLn, String target) { - return isTag( TYPE_CORE, tagUri, tagLn, target ); - } - - protected boolean isFmtTag(String tagUri, String tagLn, String target) { - return isTag( TYPE_FMT, tagUri, tagLn, target ); - } - - protected boolean isSqlTag(String tagUri, String tagLn, String target) { - return isTag( TYPE_SQL, tagUri, tagLn, target ); - } - - protected boolean isXmlTag(String tagUri, String tagLn, String target) { - return isTag( TYPE_XML, tagUri, tagLn, target ); - } - - // utility method to determine if an attribute exists - protected boolean hasAttribute(Attributes a, String att) { - return (a.getValue(att) != null); - } - - /* - * method to assist with failure [ as if it's not easy enough - * already :-) ] - */ - protected synchronized void fail(String message) { - failed = true; - messageVector.add(new ValidationMessage(lastElementId, message)); - } - - // returns true if the given attribute name is specified, false otherwise - protected boolean isSpecified(TagData data, String attributeName) { - return (data.getAttribute(attributeName) != null); - } - - // returns true if the 'scope' attribute is valid - protected boolean hasNoInvalidScope(Attributes a) { - String scope = a.getValue(SCOPE); - - if ((scope != null) - && !scope.equals(PAGE_SCOPE) - && !scope.equals(REQUEST_SCOPE) - && !scope.equals(SESSION_SCOPE) - && !scope.equals(APPLICATION_SCOPE)) - return false; - - return true; - } - - // returns true if the 'var' attribute is empty - protected boolean hasEmptyVar(Attributes a) { - if ("".equals(a.getValue(VAR))) - return true; - return false; - } - - // returns true if the 'scope' attribute is present without 'var' - protected boolean hasDanglingScope(Attributes a) { - return (a.getValue(SCOPE) != null && a.getValue(VAR) == null); - } - - // retrieves the local part of a QName - protected String getLocalPart(String qname) { - int colon = qname.indexOf(":"); - if (colon == -1) - return qname; - else - return qname.substring(colon + 1); - } - - //********************************************************************* - // Miscellaneous utility functions - - // parses our configuration parameter for element:attribute pairs - private void configure(String info) { - // construct our configuration map - config = new HashMap<>(); - - // leave the map empty if we have nothing to configure - if (info == null) - return; - - // separate parameter into space-separated tokens and store them - StringTokenizer st = new StringTokenizer(info); - while (st.hasMoreTokens()) { - String pair = st.nextToken(); - StringTokenizer pairTokens = new StringTokenizer(pair, ":"); - String element = pairTokens.nextToken(); - String attribute = pairTokens.nextToken(); - Set atts = config.get(element); - if (atts == null) { - atts = new HashSet<>(); - config.put(element, atts); - } - atts.add(attribute); - } - } - - // constructs a ValidationMessage[] from a single String and no ID - static ValidationMessage[] vmFromString(String message) { - return new ValidationMessage[] { - new ValidationMessage(null, message) - }; - } - - // constructs a ValidationMessage[] from a ValidationMessage Vector - static ValidationMessage[] vmFromVector(Vector v) { - ValidationMessage[] vm = new ValidationMessage[v.size()]; - for (int i = 0; i < vm.length; i++) { - vm[i] = v.get(i); - } - return vm; - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java b/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java deleted file mode 100644 index 090d604..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tlv; - -import java.util.Set; -import java.util.Stack; - -import jakarta.servlet.jsp.tagext.PageData; -import jakarta.servlet.jsp.tagext.ValidationMessage; - -import org.apache.taglibs.standard.resources.Resources; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; - -/** - *

A SAX-based TagLibraryValidator for the core JSTL tag library. - * Currently implements the following checks:

- * - *
    - *
  • Expression syntax validation. - *
  • Choose / when / otherwise constraints
  • - *
  • Tag bodies that must either be empty or non-empty given - * particular attributes. (E.g., cannot have a body when - * 'value' is specified; it *must* have a body otherwise.) For - * these purposes, "having a body" refers to non-whitespace - * content inside the tag.
  • - *
  • Other minor constraints.
  • - *
- * - * @author Shawn Bayern - */ -public class JstlCoreTLV extends JstlBaseTLV { - - //********************************************************************* - // Implementation Overview - - /* - * We essentially just run the page through a SAX parser, handling - * the callbacks that interest us. We collapse elements - * into the text they contain, since this simplifies processing - * somewhat. Even a quick glance at the implementation shows its - * necessary, tree-oriented nature: multiple Stacks, an understanding - * of 'depth', and so on all are important as we recover necessary - * state upon each callback. This TLV demonstrates various techniques, - * from the general "how do I use a SAX parser for a TLV?" to - * "how do I read my init parameters and then validate?" But also, - * the specific SAX methodology was kept as general as possible to - * allow for experimentation and flexibility. - */ - - - //********************************************************************* - // Constants - - // tag names - private final String CHOOSE = "choose"; - private final String WHEN = "when"; - private final String OTHERWISE = "otherwise"; - private final String EXPR = "out"; - private final String SET = "set"; - private final String IMPORT = "import"; - private final String URL = "url"; - private final String REDIRECT = "redirect"; - private final String PARAM = "param"; - // private final String EXPLANG = "expressionLanguage"; - private final String TEXT = "text"; - - // attribute names - private final String VALUE = "value"; - private final String DEFAULT = "default"; - private final String VAR_READER = "varReader"; - - // alternative identifiers for tags - private final String IMPORT_WITH_READER = "import varReader=''"; - private final String IMPORT_WITHOUT_READER = "import var=''"; - - - //********************************************************************* - // set its type and delegate validation to super-class - public ValidationMessage[] validate( - String prefix, String uri, PageData page) { - return super.validate( TYPE_CORE, prefix, uri, page ); - } - - - //********************************************************************* - // Contract fulfillment - - protected DefaultHandler getHandler() { - return new Handler(); - } - - - //********************************************************************* - // SAX event handler - - /** The handler that provides the base of our implementation. */ - private class Handler extends DefaultHandler { - - // parser state - private int depth = 0; - private final Stack chooseDepths = new Stack<>(); - private final Stack chooseHasOtherwise = new Stack<>(); - private final Stack chooseHasWhen = new Stack<>(); - private final Stack urlTags = new Stack<>(); - private String lastElementName = null; - private boolean bodyNecessary = false; - private boolean bodyIllegal = false; - - // process under the existing context (state), then modify it - @Override - public void startElement(String ns, String ln, String qn, Attributes a) { - - // substitute our own parsed 'ln' if it's not provided - if (ln == null) - ln = getLocalPart(qn); - - // for simplicity, we can ignore for our purposes - // (don't bother distinguishing between it and its characters) - if (isJspTag(ns, ln, TEXT)) - return; - - // check body-related constraint - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName)); - - // validate expression syntax if we need to - Set expAtts; - if (qn.startsWith(prefix + ":") - && (expAtts = (Set) config.get(ln)) != null) { - for (int i = 0; i < a.getLength(); i++) { - String attName = a.getLocalName(i); - if (expAtts.contains(attName)) { - String vMsg = - validateExpression( - ln, - attName, - a.getValue(i)); - if (vMsg != null) - fail(vMsg); - } - } - } - - // validate attributes - if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) - fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE", - SCOPE, qn, a.getValue(SCOPE))); - if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) - fail(Resources.getMessage("TLV_EMPTY_VAR", qn)); - if (qn.startsWith(prefix + ":") && hasDanglingScope(a)) - fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn)); - - // check invariants for - if (chooseChild()) { - // mark for the first the first - if (isCoreTag(ns, ln, WHEN)) { - chooseHasWhen.pop(); - chooseHasWhen.push(Boolean.TRUE); - } - - // ensure has the right children - if(!isCoreTag(ns, ln, WHEN) && !isCoreTag(ns, ln, OTHERWISE)) { - fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG", - prefix, CHOOSE, qn)); - } - - // make sure is the last tag - if (chooseHasOtherwise.peek()) { - fail(Resources.getMessage("TLV_ILLEGAL_ORDER", qn, prefix, OTHERWISE, CHOOSE)); - } - if (isCoreTag(ns, ln, OTHERWISE)) { - chooseHasOtherwise.pop(); - chooseHasOtherwise.push(Boolean.TRUE); - } - - } - - // check constraints for vis-a-vis URL-related tags - if (isCoreTag(ns, ln, PARAM)) { - // no outside URL tags. - if (urlTags.empty() || urlTags.peek().equals(PARAM)) - fail(Resources.getMessage("TLV_ILLEGAL_ORPHAN", PARAM)); - - // no where the most recent has a reader - if (!urlTags.empty() && - urlTags.peek().equals(IMPORT_WITH_READER)) - fail(Resources.getMessage("TLV_ILLEGAL_PARAM", - prefix, PARAM, IMPORT, VAR_READER)); - } else { - // tag ISN'T , so it's illegal under non-reader - if (!urlTags.empty() - && urlTags.peek().equals(IMPORT_WITHOUT_READER)) - fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG", - prefix, IMPORT, qn)); - } - - // now, modify state - - // we're a choose, so record new choose-specific state - if (isCoreTag(ns, ln, CHOOSE)) { - chooseDepths.push(depth); - chooseHasWhen.push(Boolean.FALSE); - chooseHasOtherwise.push(Boolean.FALSE); - } - - // if we're introducing a URL-related tag, record it - if (isCoreTag(ns, ln, IMPORT)) { - if (hasAttribute(a, VAR_READER)) - urlTags.push(IMPORT_WITH_READER); - else - urlTags.push(IMPORT_WITHOUT_READER); - } else if (isCoreTag(ns, ln, PARAM)) - urlTags.push(PARAM); - else if (isCoreTag(ns, ln, REDIRECT)) - urlTags.push(REDIRECT); - else if (isCoreTag(ns, ln, URL)) - urlTags.push(URL); - - // set up a check against illegal attribute/body combinations - bodyIllegal = false; - bodyNecessary = false; - if (isCoreTag(ns, ln, EXPR)) { - if (hasAttribute(a, DEFAULT)) - bodyIllegal = true; - } else if (isCoreTag(ns, ln, SET)) { - if (hasAttribute(a, VALUE)) - bodyIllegal = true; - // else - // bodyNecessary = true; - } - - // record the most recent tag (for error reporting) - lastElementName = qn; - lastElementId = a.getValue(JSP, "id"); - - // we're a new element, so increase depth - depth++; - } - - public void characters(char[] ch, int start, int length) { - - bodyNecessary = false; // body is no longer necessary! - - // ignore strings that are just whitespace - String s = new String(ch, start, length).trim(); - if (s.equals("")) - return; - - // check and update body-related constraints - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName)); - if (!urlTags.empty() - && urlTags.peek().equals(IMPORT_WITHOUT_READER)) { - // we're in an without a Reader; nothing but - // is allowed - fail(Resources.getMessage("TLV_ILLEGAL_BODY", - prefix + ":" + IMPORT)); - } - - // make sure has no non-whitespace text - if (chooseChild()) { - String msg = - Resources.getMessage("TLV_ILLEGAL_TEXT_BODY", - prefix, CHOOSE, - (s.length() < 7 ? s : s.substring(0,7))); - fail(msg); - } - } - - public void endElement(String ns, String ln, String qn) { - - // consistently, we ignore JSP_TEXT - if (isJspTag(ns, ln, TEXT)) - return; - - // handle body-related invariant - if (bodyNecessary) - fail(Resources.getMessage("TLV_MISSING_BODY", - lastElementName)); - bodyIllegal = false; // reset: we've left the tag - - // update -related state - if (isCoreTag(ns, ln, CHOOSE)) { - Boolean b = chooseHasWhen.pop(); - if (!b) - fail(Resources.getMessage("TLV_PARENT_WITHOUT_SUBTAG", - CHOOSE, WHEN)); - chooseDepths.pop(); - chooseHasOtherwise.pop(); - } - - // update state related to URL tags - if (isCoreTag(ns, ln, IMPORT) - || isCoreTag(ns, ln, PARAM) - || isCoreTag(ns, ln, REDIRECT) - || isCoreTag(ns, ln, URL)) - urlTags.pop(); - - // update our depth - depth--; - } - - // are we directly under a ? - private boolean chooseChild() { - return (!chooseDepths.empty() && (depth - 1) == chooseDepths.peek()); - } - - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlFmtTLV.java b/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlFmtTLV.java deleted file mode 100644 index d533c51..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlFmtTLV.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tlv; - -import java.util.Set; -import java.util.Stack; - -import jakarta.servlet.jsp.tagext.PageData; -import jakarta.servlet.jsp.tagext.ValidationMessage; - -import org.apache.taglibs.standard.resources.Resources; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; - -/** - *

A SAX-based TagLibraryValidator for the JSTL i18n-capable formatting - * library. Currently implements the following checks:

- * - *
    - *
  • Expression syntax validation. - *
  • Tag bodies that must either be empty or non-empty given - * particular attributes.
  • - *
- * - * @author Shawn Bayern - * @author Jan Luehe - */ -public class JstlFmtTLV extends JstlBaseTLV { - - //********************************************************************* - // Implementation Overview - - /* - * We essentially just run the page through a SAX parser, handling - * the callbacks that interest us. We collapse elements - * into the text they contain, since this simplifies processing - * somewhat. Even a quick glance at the implementation shows its - * necessary, tree-oriented nature: multiple Stacks, an understanding - * of 'depth', and so on all are important as we recover necessary - * state upon each callback. This TLV demonstrates various techniques, - * from the general "how do I use a SAX parser for a TLV?" to - * "how do I read my init parameters and then validate?" But also, - * the specific SAX methodology was kept as general as possible to - * allow for experimentation and flexibility. - * - * Much of the code and structure is duplicated from JstlCoreTLV. - * An effort has been made to re-use code where unambiguously useful. - * However, splitting logic among parent/child classes isn't - * necessarily the cleanest approach when writing a parser like the - * one we need. I'd like to reorganize this somewhat, but it's not - * a priority. - */ - - - //********************************************************************* - // Constants - - // tag names - private final String SETLOCALE = "setLocale"; - private final String SETBUNDLE = "setBundle"; - private final String SETTIMEZONE = "setTimeZone"; - private final String BUNDLE = "bundle"; - private final String MESSAGE = "message"; - private final String MESSAGE_PARAM = "param"; - private final String FORMAT_NUMBER = "formatNumber"; - private final String PARSE_NUMBER = "parseNumber"; - private final String PARSE_DATE = "parseDate"; - // private final String EXPLANG = "expressionLanguage"; - private final String JSP_TEXT = "jsp:text"; - - // attribute names - private final String EVAL = "evaluator"; - private final String MESSAGE_KEY = "key"; - private final String BUNDLE_PREFIX = "prefix"; - private final String VALUE = "value"; - - - //********************************************************************* - // set its type and delegate validation to super-class - public ValidationMessage[] validate( - String prefix, String uri, PageData page) { - return super.validate( TYPE_FMT, prefix, uri, page ); - } - - - //********************************************************************* - // Contract fulfillment - - protected DefaultHandler getHandler() { - return new Handler(); - } - - - //********************************************************************* - // SAX event handler - - /** The handler that provides the base of our implementation. */ - private class Handler extends DefaultHandler { - - // parser state - private int depth = 0; - private Stack messageDepths = new Stack<>(); - private String lastElementName = null; - private boolean bodyNecessary = false; - private boolean bodyIllegal = false; - - // process under the existing context (state), then modify it - public void startElement( - String ns, String ln, String qn, Attributes a) { - - // substitute our own parsed 'ln' if it's not provided - if (ln == null) - ln = getLocalPart(qn); - - // for simplicity, we can ignore for our purposes - // (don't bother distinguishing between it and its characters) - if (qn.equals(JSP_TEXT)) - return; - - // check body-related constraint - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", - lastElementName)); - - // validate expression syntax if we need to - Set expAtts; - if (qn.startsWith(prefix + ":") - && (expAtts = (Set) config.get(ln)) != null) { - for (int i = 0; i < a.getLength(); i++) { - String attName = a.getLocalName(i); - if (expAtts.contains(attName)) { - String vMsg = - validateExpression( - ln, - attName, - a.getValue(i)); - if (vMsg != null) - fail(vMsg); - } - } - } - - // validate attributes - if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) - fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE", - SCOPE, qn, a.getValue(SCOPE))); - if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) - fail(Resources.getMessage("TLV_EMPTY_VAR", qn)); - if (qn.startsWith(prefix + ":") - && !isFmtTag(ns, ln, SETLOCALE) - && !isFmtTag(ns, ln, SETBUNDLE) - && !isFmtTag(ns, ln, SETTIMEZONE) - && hasDanglingScope(a)) - fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn)); - - /* - * Make sure is nested inside . Note that - * does not need to be a direct child of . - * Otherwise, the following would not work: - * - * - * - * - * - * - */ - if (isFmtTag(ns, ln, MESSAGE_PARAM) && messageDepths.empty()) { - fail(Resources.getMessage("PARAM_OUTSIDE_MESSAGE")); - } - - // now, modify state - - // If we're in a , record relevant state - if (isFmtTag(ns, ln, MESSAGE)) { - messageDepths.push(Integer.valueOf(depth)); - } - - // set up a check against illegal attribute/body combinations - bodyIllegal = false; - bodyNecessary = false; - if (isFmtTag(ns, ln, MESSAGE_PARAM) - || isFmtTag(ns, ln, FORMAT_NUMBER) - || isFmtTag(ns, ln, PARSE_NUMBER) - || isFmtTag(ns, ln, PARSE_DATE)) { - if (hasAttribute(a, VALUE)) - bodyIllegal = true; - else - bodyNecessary = true; - } else if (isFmtTag(ns, ln, MESSAGE) - && !hasAttribute(a, MESSAGE_KEY)) { - bodyNecessary = true; - } else if (isFmtTag(ns, ln, BUNDLE) - && hasAttribute(a, BUNDLE_PREFIX)) { - bodyNecessary = true; - } - - // record the most recent tag (for error reporting) - lastElementName = qn; - lastElementId = a.getValue(JSP, "id"); - - // we're a new element, so increase depth - depth++; - } - - public void characters(char[] ch, int start, int length) { - - bodyNecessary = false; // body is no longer necessary! - - // ignore strings that are just whitespace - String s = new String(ch, start, length).trim(); - if (s.equals("")) - return; - - // check and update body-related constraints - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", - lastElementName)); - } - - public void endElement(String ns, String ln, String qn) { - - // consistently, we ignore JSP_TEXT - if (qn.equals(JSP_TEXT)) - return; - - // handle body-related invariant - if (bodyNecessary) - fail(Resources.getMessage("TLV_MISSING_BODY", - lastElementName)); - bodyIllegal = false; // reset: we've left the tag - - // update -related state - if (isFmtTag(ns, ln, MESSAGE)) { - messageDepths.pop(); - } - - // update our depth - depth--; - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlSqlTLV.java b/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlSqlTLV.java deleted file mode 100644 index a8c4945..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlSqlTLV.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tlv; - -import java.util.Set; -import java.util.Stack; - -import jakarta.servlet.jsp.tagext.PageData; -import jakarta.servlet.jsp.tagext.ValidationMessage; - -import org.apache.taglibs.standard.resources.Resources; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; - -/** - *

A SAX-based TagLibraryValidator for the JSTL SQL tag library. - * - * @author Shawn Bayern - */ -public class JstlSqlTLV extends JstlBaseTLV { - - //********************************************************************* - // Constants - - // tag names - private final String SETDATASOURCE = "setDataSource"; - private final String QUERY = "query"; - private final String UPDATE = "update"; - private final String TRANSACTION = "transaction"; - private final String PARAM = "param"; - private final String DATEPARAM = "dateParam"; - - private final String JSP_TEXT = "jsp:text"; - - // attribute names - private final String SQL = "sql"; - private final String DATASOURCE = "dataSource"; - - - //********************************************************************* - // set its type and delegate validation to super-class - public ValidationMessage[] validate( - String prefix, String uri, PageData page) { - return super.validate( TYPE_SQL, prefix, uri, page ); - } - - - //********************************************************************* - // Contract fulfillment - - protected DefaultHandler getHandler() { - return new Handler(); - } - - - //********************************************************************* - // SAX event handler - - /** The handler that provides the base of our implementation. */ - private class Handler extends DefaultHandler { - - // parser state - private int depth = 0; - private Stack queryDepths = new Stack<>(); - private Stack updateDepths = new Stack<>(); - private Stack transactionDepths = new Stack<>(); - private String lastElementName = null; - private boolean bodyNecessary = false; - private boolean bodyIllegal = false; - - // process under the existing context (state), then modify it - public void startElement( - String ns, String ln, String qn, Attributes a) { - - // substitute our own parsed 'ln' if it's not provided - if (ln == null) - ln = getLocalPart(qn); - - // for simplicity, we can ignore for our purposes - // (don't bother distinguishing between it and its characters) - if (qn.equals(JSP_TEXT)) - return; - - // check body-related constraint - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName)); - - // validate expression syntax if we need to - Set expAtts; - if (qn.startsWith(prefix + ":") - && (expAtts = (Set) config.get(ln)) != null) { - for (int i = 0; i < a.getLength(); i++) { - String attName = a.getLocalName(i); - if (expAtts.contains(attName)) { - String vMsg = - validateExpression( - ln, - attName, - a.getValue(i)); - if (vMsg != null) - fail(vMsg); - } - } - } - - // validate attributes - if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) - fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE", - SCOPE, qn, a.getValue(SCOPE))); - if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) - fail(Resources.getMessage("TLV_EMPTY_VAR", qn)); - if (qn.startsWith(prefix + ":") && hasDanglingScope(a) && - !qn.startsWith(prefix + ":" + SETDATASOURCE)) - fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn)); - - // now, modify state - - /* - * Make sure is nested inside or - * . Note that does not need to - * be a direct child of or . - * Otherwise, the following would not work: - * - * - * - * - * - * - */ - if ( (isSqlTag(ns, ln, PARAM) || isSqlTag(ns, ln, DATEPARAM)) - && (queryDepths.empty() && updateDepths.empty()) ) { - fail(Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT")); - } - - // If we're in a , record relevant state - if (isSqlTag(ns, ln, QUERY)) { - queryDepths.push(Integer.valueOf(depth)); - } - // If we're in a , record relevant state - if (isSqlTag(ns, ln, UPDATE)) { - updateDepths.push(Integer.valueOf(depth)); - } - // If we're in a , record relevant state - if (isSqlTag(ns, ln, TRANSACTION)) { - transactionDepths.push(Integer.valueOf(depth)); - } - - // set up a check against illegal attribute/body combinations - bodyIllegal = false; - bodyNecessary = false; - - if (isSqlTag(ns, ln, QUERY) || isSqlTag(ns, ln, UPDATE)) { - if (!hasAttribute(a, SQL)) { - bodyNecessary = true; - } - if (hasAttribute(a, DATASOURCE) && !transactionDepths.empty()) { - fail(Resources.getMessage("ERROR_NESTED_DATASOURCE")); - } - } - - if (isSqlTag(ns, ln, DATEPARAM)) { - bodyIllegal = true; - } - - // record the most recent tag (for error reporting) - lastElementName = qn; - lastElementId = a.getValue("http://java.sun.com/JSP/Page", "id"); - - // we're a new element, so increase depth - depth++; - } - - public void characters(char[] ch, int start, int length) { - - bodyNecessary = false; // body is no longer necessary! - - // ignore strings that are just whitespace - String s = new String(ch, start, length).trim(); - if (s.equals("")) - return; - - // check and update body-related constraints - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName)); - } - - public void endElement(String ns, String ln, String qn) { - - // consistently, we ignore JSP_TEXT - if (qn.equals(JSP_TEXT)) - return; - - // handle body-related invariant - if (bodyNecessary) - fail(Resources.getMessage("TLV_MISSING_BODY", - lastElementName)); - bodyIllegal = false; // reset: we've left the tag - - // update -related state - if (isSqlTag(ns, ln, QUERY)) { - queryDepths.pop(); - } - // update -related state - if (isSqlTag(ns, ln, UPDATE)) { - updateDepths.pop(); - } - // update -related state - if (isSqlTag(ns, ln, TRANSACTION)) { - transactionDepths.pop(); - } - - // update our depth - depth--; - } - } -} diff --git a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlXmlTLV.java b/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlXmlTLV.java deleted file mode 100644 index ab33290..0000000 --- a/impl/src/main/java/org/apache/taglibs/standard/tlv/JstlXmlTLV.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * Copyright (c) 2020 Payara Services Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.tlv; - -import java.util.Set; -import java.util.Stack; - -import jakarta.servlet.jsp.tagext.PageData; -import jakarta.servlet.jsp.tagext.ValidationMessage; - -import org.apache.taglibs.standard.resources.Resources; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; - -/** - *

A SAX-based TagLibraryValidator for the JSTL XML library. - * Currently implements the following checks:

- * - *
    - *
  • Expression syntax validation. - *
  • Choose / when / otherwise constraints
  • - *
  • Tag bodies that must either be empty or non-empty given - * particular attributes.
  • - *
  • Other minor constraints.
  • - *
- * - * @author Shawn Bayern - */ -public class JstlXmlTLV extends JstlBaseTLV { - - //********************************************************************* - // Implementation Overview - - /* - * We essentially just run the page through a SAX parser, handling - * the callbacks that interest us. We collapse elements - * into the text they contain, since this simplifies processing - * somewhat. Even a quick glance at the implementation shows its - * necessary, tree-oriented nature: multiple Stacks, an understanding - * of 'depth', and so on all are important as we recover necessary - * state upon each callback. This TLV demonstrates various techniques, - * from the general "how do I use a SAX parser for a TLV?" to - * "how do I read my init parameters and then validate?" But also, - * the specific SAX methodology was kept as general as possible to - * allow for experimentation and flexibility. - * - * Much of the code and structure is duplicated from JstlCoreTLV. - * An effort has been made to re-use code where unambiguously useful. - * However, splitting logic among parent/child classes isn't - * necessarily the cleanest approach when writing a parser like the - * one we need. I'd like to reorganize this somewhat, but it's not - * a priority. - */ - - - //********************************************************************* - // Constants - - // tag names - private final String CHOOSE = "choose"; - private final String WHEN = "when"; - private final String OTHERWISE = "otherwise"; - private final String PARSE = "parse"; - private final String PARAM = "param"; - private final String TRANSFORM = "transform"; - private final String JSP_TEXT = "jsp:text"; - - // attribute names - private final String VALUE = "value"; - private final String SOURCE = "xml"; - - - //********************************************************************* - // set its type and delegate validation to super-class - public ValidationMessage[] validate( - String prefix, String uri, PageData page) { - return super.validate( TYPE_XML, prefix, uri, page ); - } - - - //********************************************************************* - // Contract fulfillment - - protected DefaultHandler getHandler() { - return new Handler(); - } - - - //********************************************************************* - // SAX event handler - - /** The handler that provides the base of our implementation. */ - private class Handler extends DefaultHandler { - - // parser state - private int depth = 0; - private Stack chooseDepths = new Stack<>(); - private Stack chooseHasOtherwise = new Stack<>(); - private Stack chooseHasWhen = new Stack<>(); - private String lastElementName = null; - private boolean bodyNecessary = false; - private boolean bodyIllegal = false; - private Stack transformWithSource = new Stack<>(); - - // process under the existing context (state), then modify it - public void startElement( - String ns, String ln, String qn, Attributes a) { - - // substitute our own parsed 'ln' if it's not provided - if (ln == null) - ln = getLocalPart(qn); - - // for simplicity, we can ignore for our purposes - // (don't bother distinguishing between it and its characters) - if (qn.equals(JSP_TEXT)) - return; - - // check body-related constraint - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName)); - - // validate expression syntax if we need to - Set expAtts; - if (qn.startsWith(prefix + ":") && (expAtts = config.get(ln)) != null) { - for (int i = 0; i < a.getLength(); i++) { - String attName = a.getLocalName(i); - if (expAtts.contains(attName)) { - String vMsg = - validateExpression( - ln, - attName, - a.getValue(i)); - if (vMsg != null) - fail(vMsg); - } - } - } - - // validate attributes - if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) - fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE", - SCOPE, qn, a.getValue(SCOPE))); - if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) - fail(Resources.getMessage("TLV_EMPTY_VAR", qn)); - if (qn.startsWith(prefix + ":") && hasDanglingScope(a)) - fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn)); - - // check invariants for - if (chooseChild()) { - // mark for the first the first - if (isXmlTag(ns, ln, WHEN)) { - chooseHasWhen.pop(); - chooseHasWhen.push(Boolean.TRUE); - } - - // ensure has the right children - if(!isXmlTag(ns, ln, WHEN) && !isXmlTag(ns, ln, OTHERWISE)) { - fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG", - prefix, CHOOSE, qn)); - } - - // make sure is the last tag - if (chooseHasOtherwise.peek()) { - fail(Resources.getMessage("TLV_ILLEGAL_ORDER", - qn, prefix, OTHERWISE, CHOOSE)); - } - if (isXmlTag(ns, ln, OTHERWISE)) { - chooseHasOtherwise.pop(); - chooseHasOtherwise.push(Boolean.TRUE); - } - - } - - // Specific check, directly inside - if (!transformWithSource.empty() && - topDepth(transformWithSource) == (depth - 1)) { - // only allow - if (!isXmlTag(ns, ln, PARAM)) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", - prefix + ":" + TRANSFORM)); - - // thus, if we get the opportunity to hit depth++, - // we know we've got a subtag - } - - // now, modify state - - // we're a choose, so record new choose-specific state - if (isXmlTag(ns, ln, CHOOSE)) { - chooseDepths.push(Integer.valueOf(depth)); - chooseHasWhen.push(Boolean.FALSE); - chooseHasOtherwise.push(Boolean.FALSE); - } - - // set up a check against illegal attribute/body combinations - bodyIllegal = false; - bodyNecessary = false; - if (isXmlTag(ns, ln, PARSE)) { - if (hasAttribute(a, SOURCE)) - bodyIllegal = true; - } else if (isXmlTag(ns, ln, PARAM)) { - if (hasAttribute(a, VALUE)) - bodyIllegal = true; - else - bodyNecessary = true; - } else if (isXmlTag(ns, ln, TRANSFORM)) { - if (hasAttribute(a, SOURCE)) - transformWithSource.push(Integer.valueOf(depth)); - } - - // record the most recent tag (for error reporting) - lastElementName = qn; - lastElementId = a.getValue("http://java.sun.com/JSP/Page", "id"); - - // we're a new element, so increase depth - depth++; - } - - public void characters(char[] ch, int start, int length) { - - bodyNecessary = false; // body is no longer necessary! - - // ignore strings that are just whitespace - String s = new String(ch, start, length).trim(); - if (s.equals("")) - return; - - // check and update body-related constraints - if (bodyIllegal) - fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName)); - - // make sure has no non-whitespace text - if (chooseChild()) { - String msg = - Resources.getMessage("TLV_ILLEGAL_TEXT_BODY", - prefix, CHOOSE, - (s.length() < 7 ? s : s.substring(0,7))); - fail(msg); - } - - // Specific check, directly inside - if (!transformWithSource.empty() - && topDepth(transformWithSource) == (depth - 1)) { - fail(Resources.getMessage("TLV_ILLEGAL_BODY", - prefix + ":" + TRANSFORM)); - } - } - - public void endElement(String ns, String ln, String qn) { - - // consistently, we ignore JSP_TEXT - if (qn.equals(JSP_TEXT)) - return; - - // handle body-related invariant - if (bodyNecessary) - fail(Resources.getMessage("TLV_MISSING_BODY", - lastElementName)); - bodyIllegal = false; // reset: we've left the tag - - // update -related state - if (isXmlTag(ns, ln, CHOOSE)) { - Boolean b = chooseHasWhen.pop(); - if (!b) - fail(Resources.getMessage("TLV_PARENT_WITHOUT_SUBTAG", - CHOOSE, WHEN)); - chooseDepths.pop(); - chooseHasOtherwise.pop(); - } - - // update -related state - if (!transformWithSource.empty() - && topDepth(transformWithSource) == (depth - 1)) - transformWithSource.pop(); - - // update our depth - depth--; - } - - // are we directly under a ? - private boolean chooseChild() { - return (!chooseDepths.empty() && (depth - 1) == chooseDepths.peek()); - } - - // returns the top int depth (peeked at) from a Stack of Integer - private int topDepth(Stack s) { - return (s.peek()); - } - } -} diff --git a/impl/src/main/resources/META-INF/c-1_0-rt.tld b/impl/src/main/resources/META-INF/c-1_0-rt.tld deleted file mode 100644 index dfd1394..0000000 --- a/impl/src/main/resources/META-INF/c-1_0-rt.tld +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - 1.0 - 1.2 - c_rt - http://java.sun.com/jstl/core_rt - JSTL core RT - JSTL 1.0 core library - - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - Provides core validation features for JSTL tags. - - - - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - Catches any Throwable that occurs in its body and optionally - exposes it. - - - var - false - false - - - - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - - - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - - test - true - true - boolean - - - var - false - false - - - scope - false - false - - - - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - - url - true - true - - - var - false - false - - - scope - false - false - - - varReader - false - false - - - context - false - true - - - charEncoding - false - true - - - - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - - items - false - true - java.lang.Object - - - begin - false - true - int - - - end - false - true - int - - - step - false - true - int - - - var - false - false - - - varStatus - false - false - - - - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - Iterates over tokens, separated by the supplied delimeters - - - items - true - true - java.lang.String - - - delims - true - true - java.lang.String - - - begin - false - true - int - - - end - false - true - int - - - step - false - true - int - - - var - false - false - - - varStatus - false - false - - - - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - Like <%= ... >, but for expressions. - - - value - true - true - - - default - false - true - - - escapeXml - false - true - - - - - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - - - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - Adds a parameter to a containing 'import' tag's URL. - - - name - true - true - - - value - false - true - - - - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - Redirects to a new URL. - - - var - false - false - - - scope - false - false - - - url - false - true - - - context - false - true - - - - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - Removes a scoped variable (from a particular scope, if specified). - - - var - true - false - - - scope - false - false - - - - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - Sets the result of an expression evaluation in a 'scope' - - - var - false - false - - - value - false - true - - - target - false - true - - - property - false - true - - - scope - false - false - - - - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - Creates a URL with optional query parameters. - - - var - false - false - - - scope - false - false - - - value - false - true - - - context - false - true - - - - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - - test - true - true - boolean - - - - diff --git a/impl/src/main/resources/META-INF/c-1_0.tld b/impl/src/main/resources/META-INF/c-1_0.tld deleted file mode 100644 index 29fb9a7..0000000 --- a/impl/src/main/resources/META-INF/c-1_0.tld +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - 1.0 - 1.2 - c - http://java.sun.com/jstl/core - JSTL core - JSTL 1.0 core library - - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - expressionAttributes - - out:value - out:default - out:escapeXml - if:test - import:url - import:context - import:charEncoding - forEach:items - forEach:begin - forEach:end - forEach:step - forTokens:items - forTokens:begin - forTokens:end - forTokens:step - param:encode - param:name - param:value - redirect:context - redirect:url - set:property - set:target - set:value - url:context - url:value - when:test - - - Whitespace-separated list of colon-separated token pairs - describing tag:attribute combinations that accept expressions. - The validator uses this information to determine which - attributes need their syntax validated. - - - - - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - Catches any Throwable that occurs in its body and optionally - exposes it. - - - var - false - false - - - - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - - - - out - org.apache.taglibs.standard.tag.el.core.OutTag - JSP - - Like <%= ... >, but for expressions. - - - value - true - false - - - default - false - false - - - escapeXml - false - false - - - - - if - org.apache.taglibs.standard.tag.el.core.IfTag - JSP - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - - test - true - false - - - var - false - false - - - scope - false - false - - - - - import - org.apache.taglibs.standard.tag.el.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - - url - true - false - - - var - false - false - - - scope - false - false - - - varReader - false - false - - - context - false - false - - - charEncoding - false - false - - - - - forEach - org.apache.taglibs.standard.tag.el.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - - items - false - false - - - begin - false - false - - - end - false - false - - - step - false - false - - - var - false - false - - - varStatus - false - false - - - - - forTokens - org.apache.taglibs.standard.tag.el.core.ForTokensTag - JSP - - Iterates over tokens, separated by the supplied delimeters - - - items - true - false - - - delims - true - false - - - begin - false - false - - - end - false - false - - - step - false - false - - - var - false - false - - - varStatus - false - false - - - - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - - - - param - org.apache.taglibs.standard.tag.el.core.ParamTag - JSP - - Adds a parameter to a containing 'import' tag's URL. - - - name - true - false - - - value - false - false - - - - - redirect - org.apache.taglibs.standard.tag.el.core.RedirectTag - JSP - - Redirects to a new URL. - - - var - false - false - - - scope - false - false - - - url - true - false - - - context - false - false - - - - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - Removes a scoped variable (from a particular scope, if specified). - - - var - true - false - - - scope - false - false - - - - - set - org.apache.taglibs.standard.tag.el.core.SetTag - JSP - - Sets the result of an expression evaluation in a 'scope' - - - var - false - false - - - value - false - false - - - target - false - false - - - property - false - false - - - scope - false - false - - - - - url - org.apache.taglibs.standard.tag.el.core.UrlTag - JSP - - Prints or exposes a URL with optional query parameters - (via the c:param tag). - - - var - false - false - - - scope - false - false - - - value - true - false - - - context - false - false - - - - - when - org.apache.taglibs.standard.tag.el.core.WhenTag - JSP - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - - test - true - false - - - - diff --git a/impl/src/main/resources/META-INF/c-1_2.tld b/impl/src/main/resources/META-INF/c-1_2.tld deleted file mode 100644 index 03e436b..0000000 --- a/impl/src/main/resources/META-INF/c-1_2.tld +++ /dev/null @@ -1,589 +0,0 @@ - - - - - - JSTL 1.2 core library - JSTL core - 1.2 - c - http://java.sun.com/jsp/jstl/core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - java.lang.Object - - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -jakarta.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - java.lang.String - - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -jakarta.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - java.lang.Object - - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/impl/src/main/resources/META-INF/c.tld b/impl/src/main/resources/META-INF/c.tld deleted file mode 100644 index 896df19..0000000 --- a/impl/src/main/resources/META-INF/c.tld +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - Tags 3.0 core library - Tags core - 3.0 - c - jakarta.tags.core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - java.lang.Object - - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -jakarta.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - java.lang.String - - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -jakarta.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - java.lang.Object - - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/impl/src/main/resources/META-INF/fmt-1_0-rt.tld b/impl/src/main/resources/META-INF/fmt-1_0-rt.tld deleted file mode 100644 index 7d3918e..0000000 --- a/impl/src/main/resources/META-INF/fmt-1_0-rt.tld +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - 1.0 - 1.2 - fmt_rt - http://java.sun.com/jstl/fmt_rt - JSTL fmt RT - JSTL 1.0 i18n-capable formatting library - - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - Provides core validation features for JSTL tags. - - - - - requestEncoding - org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag - empty - - Sets the request character encoding - - - value - false - true - - - - - setLocale - org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag - empty - - Stores the given locale in the locale configuration variable - - - value - true - true - - - variant - false - true - - - scope - false - false - - - - - timeZone - org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag - JSP - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - - value - true - true - - - - - setTimeZone - org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag - empty - - Stores the given time zone in the time zone configuration variable - - - value - true - true - - - var - false - false - - - scope - false - false - - - - - bundle - org.apache.taglibs.standard.tag.rt.fmt.BundleTag - JSP - - Loads a resource bundle to be used by its tag body - - - basename - true - true - - - prefix - false - true - - - - - setBundle - org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag - empty - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - - basename - true - true - - - var - false - false - - - scope - false - false - - - - - message - org.apache.taglibs.standard.tag.rt.fmt.MessageTag - JSP - - Maps key to localized message and performs parametric replacement - - - key - false - true - - - bundle - false - true - - - var - false - false - - - scope - false - false - - - - - param - org.apache.taglibs.standard.tag.rt.fmt.ParamTag - JSP - - Supplies an argument for parametric replacement to a containing - <message> tag - - - value - false - true - - - - - formatNumber - org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag - JSP - - Formats a numeric value as a number, currency, or percentage - - - value - false - true - - - type - false - true - - - pattern - false - true - - - currencyCode - false - true - - - currencySymbol - false - true - - - groupingUsed - false - true - - - maxIntegerDigits - false - true - - - minIntegerDigits - false - true - - - maxFractionDigits - false - true - - - minFractionDigits - false - true - - - var - false - false - - - scope - false - false - - - - - parseNumber - org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag - JSP - - Parses the string representation of a number, currency, or percentage - - - value - false - true - - - type - false - true - - - pattern - false - true - - - parseLocale - false - true - - - integerOnly - false - true - - - var - false - false - - - scope - false - false - - - - - formatDate - org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag - empty - - Formats a date and/or time using the supplied styles and pattern - - - value - true - true - - - type - false - true - - - dateStyle - false - true - - - timeStyle - false - true - - - pattern - false - true - - - timeZone - false - true - - - var - false - false - - - scope - false - false - - - - - parseDate - org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag - JSP - - Parses the string representation of a date and/or time - - - value - false - true - - - type - false - true - - - dateStyle - false - true - - - timeStyle - false - true - - - pattern - false - true - - - timeZone - false - true - - - parseLocale - false - true - - - var - false - false - - - scope - false - false - - - - diff --git a/impl/src/main/resources/META-INF/fmt-1_0.tld b/impl/src/main/resources/META-INF/fmt-1_0.tld deleted file mode 100644 index 1daf4e1..0000000 --- a/impl/src/main/resources/META-INF/fmt-1_0.tld +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - 1.0 - 1.2 - fmt - http://java.sun.com/jstl/fmt - JSTL fmt - JSTL 1.0 i18n-capable formatting library - - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - expressionAttributes - - requestEncoding:value - setLocale:value - setLocale:variant - timeZone:value - setTimeZone:value - bundle:basename - bundle:prefix - setBundle:basename - message:key - message:bundle - param:value - formatNumber:value - formatNumber:pattern - formatNumber:currencyCode - formatNumber:currencySymbol - formatNumber:groupingUsed - formatNumber:maxIntegerDigits - formatNumber:minIntegerDigits - formatNumber:maxFractionDigits - formatNumber:minFractionDigits - parseNumber:value - parseNumber:pattern - parseNumber:parseLocale - parseNumber:integerOnly - formatDate:value - formatDate:pattern - formatDate:timeZone - parseDate:value - parseDate:pattern - parseDate:timeZone - parseDate:parseLocale - - - Whitespace-separated list of colon-separated token pairs - describing tag:attribute combinations that accept expressions. - The validator uses this information to determine which - attributes need their syntax validated. - - - - - - requestEncoding - org.apache.taglibs.standard.tag.el.fmt.RequestEncodingTag - empty - - Sets the request character encoding - - - value - false - false - - - - - setLocale - org.apache.taglibs.standard.tag.el.fmt.SetLocaleTag - empty - - Stores the given locale in the locale configuration variable - - - value - true - false - - - variant - false - false - - - scope - false - false - - - - - timeZone - org.apache.taglibs.standard.tag.el.fmt.TimeZoneTag - JSP - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - - value - true - false - - - - - setTimeZone - org.apache.taglibs.standard.tag.el.fmt.SetTimeZoneTag - empty - - Stores the given time zone in the time zone configuration variable - - - value - true - false - - - var - false - false - - - scope - false - false - - - - - bundle - org.apache.taglibs.standard.tag.el.fmt.BundleTag - JSP - - Loads a resource bundle to be used by its tag body - - - basename - true - false - - - prefix - false - false - - - - - setBundle - org.apache.taglibs.standard.tag.el.fmt.SetBundleTag - empty - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - - basename - true - false - - - var - false - false - - - scope - false - false - - - - - message - org.apache.taglibs.standard.tag.el.fmt.MessageTag - JSP - - Maps key to localized message and performs parametric replacement - - - key - false - false - - - bundle - false - false - - - var - false - false - - - scope - false - false - - - - - param - org.apache.taglibs.standard.tag.el.fmt.ParamTag - JSP - - Supplies an argument for parametric replacement to a containing - <message> tag - - - value - false - false - - - - - formatNumber - org.apache.taglibs.standard.tag.el.fmt.FormatNumberTag - JSP - - Formats a numeric value as a number, currency, or percentage - - - value - false - false - - - type - false - false - - - pattern - false - false - - - currencyCode - false - false - - - currencySymbol - false - false - - - groupingUsed - false - false - - - maxIntegerDigits - false - false - - - minIntegerDigits - false - false - - - maxFractionDigits - false - false - - - minFractionDigits - false - false - - - var - false - false - - - scope - false - false - - - - - parseNumber - org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag - JSP - - Parses the string representation of a number, currency, or percentage - - - value - false - false - - - type - false - false - - - pattern - false - false - - - parseLocale - false - false - - - integerOnly - false - false - - - var - false - false - - - scope - false - false - - - - - formatDate - org.apache.taglibs.standard.tag.el.fmt.FormatDateTag - empty - - Formats a date and/or time using the supplied styles and pattern - - - value - true - false - - - type - false - false - - - dateStyle - false - false - - - timeStyle - false - false - - - pattern - false - false - - - timeZone - false - false - - - var - false - false - - - scope - false - false - - - - - parseDate - org.apache.taglibs.standard.tag.el.fmt.ParseDateTag - JSP - - Parses the string representation of a date and/or time - - - value - false - false - - - type - false - false - - - dateStyle - false - false - - - timeStyle - false - false - - - pattern - false - false - - - timeZone - false - false - - - parseLocale - false - false - - - var - false - false - - - scope - false - false - - - - diff --git a/impl/src/main/resources/META-INF/fmt-1_1.tld b/impl/src/main/resources/META-INF/fmt-1_1.tld deleted file mode 100644 index 1c7f635..0000000 --- a/impl/src/main/resources/META-INF/fmt-1_1.tld +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - JSTL 1.1 i18n-capable formatting library - JSTL fmt - 1.1 - fmt - http://java.sun.com/jsp/jstl/fmt - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - - - - Sets the request character encoding - - requestEncoding - org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag - empty - - -Name of character encoding to be applied when -decoding request parameters. - - value - false - true - - - - - - Stores the given locale in the locale configuration variable - - setLocale - org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag - empty - - -A String value is interpreted as the -printable representation of a locale, which -must contain a two-letter (lower-case) -language code (as defined by ISO-639), -and may contain a two-letter (upper-case) -country code (as defined by ISO-3166). -Language and country codes must be -separated by hyphen (-) or underscore -(_). - - value - true - true - - - -Vendor- or browser-specific variant. -See the java.util.Locale javadocs for -more information on variants. - - variant - false - true - - - -Scope of the locale configuration variable. - - scope - false - false - - - - - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - timeZone - org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag - JSP - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See -java.util.TimeZone for more information on -supported time zone formats. - - value - true - true - - - - - - Stores the given time zone in the time zone configuration variable - - setTimeZone - org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag - empty - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See java.util.TimeZone for -more information on supported time zone -formats. - - value - true - true - - - -Name of the exported scoped variable which -stores the time zone of type -java.util.TimeZone. - - var - false - false - - - -Scope of var or the time zone configuration -variable. - - scope - false - false - - - - - - Loads a resource bundle to be used by its tag body - - bundle - org.apache.taglibs.standard.tag.rt.fmt.BundleTag - JSP - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Prefix to be prepended to the value of the message -key of any nested <fmt:message> action. - - prefix - false - true - - - - - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - setBundle - org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag - empty - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Name of the exported scoped variable which stores -the i18n localization context of type -jakarta.servlet.jsp.jstl.fmt.LocalizationC -ontext. - - var - false - false - - - -Scope of var or the localization context -configuration variable. - - scope - false - false - - - - - - Maps key to localized message and performs parametric replacement - - message - org.apache.taglibs.standard.tag.rt.fmt.MessageTag - JSP - - -Message key to be looked up. - - key - false - true - - - -Localization context in whose resource -bundle the message key is looked up. - - bundle - false - true - - - -Name of the exported scoped variable -which stores the localized message. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Supplies an argument for parametric replacement to a containing - <message> tag - - param - org.apache.taglibs.standard.tag.rt.fmt.ParamTag - JSP - - -Argument used for parametric replacement. - - value - false - true - - - - - - Formats a numeric value as a number, currency, or percentage - - formatNumber - org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag - JSP - - -Numeric value to be formatted. - - value - false - true - - - -Specifies whether the value is to be -formatted as number, currency, or -percentage. - - type - false - true - - - -Custom formatting pattern. - - pattern - false - true - - - -ISO 4217 currency code. Applied only -when formatting currencies (i.e. if type is -equal to "currency"); ignored otherwise. - - currencyCode - false - true - - - -Currency symbol. Applied only when -formatting currencies (i.e. if type is equal -to "currency"); ignored otherwise. - - currencySymbol - false - true - - - -Specifies whether the formatted output -will contain any grouping separators. - - groupingUsed - false - true - - - -Maximum number of digits in the integer -portion of the formatted output. - - maxIntegerDigits - false - true - - - -Minimum number of digits in the integer -portion of the formatted output. - - minIntegerDigits - false - true - - - -Maximum number of digits in the -fractional portion of the formatted output. - - maxFractionDigits - false - true - - - -Minimum number of digits in the -fractional portion of the formatted output. - - minFractionDigits - false - true - - - -Name of the exported scoped variable -which stores the formatted result as a -String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a number, currency, or percentage - - parseNumber - org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag - JSP - - -String to be parsed. - - value - false - true - - - -Specifies whether the string in the value -attribute should be parsed as a number, -currency, or percentage. - - type - false - true - - - -Custom formatting pattern that determines -how the string in the value attribute is to be -parsed. - - pattern - false - true - - - -Locale whose default formatting pattern (for -numbers, currencies, or percentages, -respectively) is to be used during the parse -operation, or to which the pattern specified -via the pattern attribute (if present) is -applied. - - parseLocale - false - true - - - -Specifies whether just the integer portion of -the given value should be parsed. - - integerOnly - false - true - - - -Name of the exported scoped variable which -stores the parsed result (of type -java.lang.Number). - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Formats a date and/or time using the supplied styles and pattern - - formatDate - org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag - empty - - -Date and/or time to be formatted. - - value - true - true - - - -Specifies whether the time, the date, or both -the time and date components of the given -date are to be formatted. - - type - false - true - - - -Predefined formatting style for dates. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a date or both a date and -time (i.e. if type is missing or is equal to -"date" or "both"); ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting style for times. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a time or both a date and -time (i.e. if type is equal to "time" or "both"); -ignored otherwise. - - timeStyle - false - true - - - -Custom formatting style for dates and times. - - pattern - false - true - - - -Time zone in which to represent the formatted -time. - - timeZone - false - true - - - -Name of the exported scoped variable which -stores the formatted result as a String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a date and/or time - - parseDate - org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag - JSP - - -Date string to be parsed. - - value - false - true - - - -Specifies whether the date string in the -value attribute is supposed to contain a -time, a date, or both. - - type - false - true - - - -Predefined formatting style for days -which determines how the date -component of the date string is to be -parsed. Applied only when formatting a -date or both a date and time (i.e. if type -is missing or is equal to "date" or "both"); -ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting styles for times -which determines how the time -component in the date string is to be -parsed. Applied only when formatting a -time or both a date and time (i.e. if type -is equal to "time" or "both"); ignored -otherwise. - - timeStyle - false - true - - - -Custom formatting pattern which -determines how the date string is to be -parsed. - - pattern - false - true - - - -Time zone in which to interpret any time -information in the date string. - - timeZone - false - true - - - -Locale whose predefined formatting styles -for dates and times are to be used during -the parse operation, or to which the -pattern specified via the pattern -attribute (if present) is applied. - - parseLocale - false - true - - - -Name of the exported scoped variable in -which the parsing result (of type -java.util.Date) is stored. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - diff --git a/impl/src/main/resources/META-INF/fmt.tld b/impl/src/main/resources/META-INF/fmt.tld deleted file mode 100644 index d3f1a9c..0000000 --- a/impl/src/main/resources/META-INF/fmt.tld +++ /dev/null @@ -1,689 +0,0 @@ - - - - - - Tags 3.0 i18n-capable formatting library - Tags fmt - 3.0 - fmt - jakarta.tags.fmt - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - - - - Sets the request character encoding - - requestEncoding - org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag - empty - - -Name of character encoding to be applied when -decoding request parameters. - - value - false - true - - - - - - Stores the given locale in the locale configuration variable - - setLocale - org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag - empty - - -A String value is interpreted as the -printable representation of a locale, which -must contain a two-letter (lower-case) -language code (as defined by ISO-639), -and may contain a two-letter (upper-case) -country code (as defined by ISO-3166). -Language and country codes must be -separated by hyphen (-) or underscore -(_). - - value - true - true - - - -Vendor- or browser-specific variant. -See the java.util.Locale javadocs for -more information on variants. - - variant - false - true - - - -Scope of the locale configuration variable. - - scope - false - false - - - - - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - timeZone - org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag - JSP - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See -java.util.TimeZone for more information on -supported time zone formats. - - value - true - true - - - - - - Stores the given time zone in the time zone configuration variable - - setTimeZone - org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag - empty - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See java.util.TimeZone for -more information on supported time zone -formats. - - value - true - true - - - -Name of the exported scoped variable which -stores the time zone of type -java.util.TimeZone. - - var - false - false - - - -Scope of var or the time zone configuration -variable. - - scope - false - false - - - - - - Loads a resource bundle to be used by its tag body - - bundle - org.apache.taglibs.standard.tag.rt.fmt.BundleTag - JSP - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Prefix to be prepended to the value of the message -key of any nested <fmt:message> action. - - prefix - false - true - - - - - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - setBundle - org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag - empty - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Name of the exported scoped variable which stores -the i18n localization context of type -jakarta.servlet.jsp.jstl.fmt.LocalizationC -ontext. - - var - false - false - - - -Scope of var or the localization context -configuration variable. - - scope - false - false - - - - - - Maps key to localized message and performs parametric replacement - - message - org.apache.taglibs.standard.tag.rt.fmt.MessageTag - JSP - - -Message key to be looked up. - - key - false - true - - - -Localization context in whose resource -bundle the message key is looked up. - - bundle - false - true - - - -Name of the exported scoped variable -which stores the localized message. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Supplies an argument for parametric replacement to a containing - <message> tag - - param - org.apache.taglibs.standard.tag.rt.fmt.ParamTag - JSP - - -Argument used for parametric replacement. - - value - false - true - - - - - - Formats a numeric value as a number, currency, or percentage - - formatNumber - org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag - JSP - - -Numeric value to be formatted. - - value - false - true - - - -Specifies whether the value is to be -formatted as number, currency, or -percentage. - - type - false - true - - - -Custom formatting pattern. - - pattern - false - true - - - -ISO 4217 currency code. Applied only -when formatting currencies (i.e. if type is -equal to "currency"); ignored otherwise. - - currencyCode - false - true - - - -Currency symbol. Applied only when -formatting currencies (i.e. if type is equal -to "currency"); ignored otherwise. - - currencySymbol - false - true - - - -Specifies whether the formatted output -will contain any grouping separators. - - groupingUsed - false - true - - - -Maximum number of digits in the integer -portion of the formatted output. - - maxIntegerDigits - false - true - - - -Minimum number of digits in the integer -portion of the formatted output. - - minIntegerDigits - false - true - - - -Maximum number of digits in the -fractional portion of the formatted output. - - maxFractionDigits - false - true - - - -Minimum number of digits in the -fractional portion of the formatted output. - - minFractionDigits - false - true - - - -Name of the exported scoped variable -which stores the formatted result as a -String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a number, currency, or percentage - - parseNumber - org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag - JSP - - -String to be parsed. - - value - false - true - - - -Specifies whether the string in the value -attribute should be parsed as a number, -currency, or percentage. - - type - false - true - - - -Custom formatting pattern that determines -how the string in the value attribute is to be -parsed. - - pattern - false - true - - - -Locale whose default formatting pattern (for -numbers, currencies, or percentages, -respectively) is to be used during the parse -operation, or to which the pattern specified -via the pattern attribute (if present) is -applied. - - parseLocale - false - true - - - -Specifies whether just the integer portion of -the given value should be parsed. - - integerOnly - false - true - - - -Name of the exported scoped variable which -stores the parsed result (of type -java.lang.Number). - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Formats a date and/or time using the supplied styles and pattern - - formatDate - org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag - empty - - -Date and/or time to be formatted. - - value - true - true - - - -Specifies whether the time, the date, or both -the time and date components of the given -date are to be formatted. - - type - false - true - - - -Predefined formatting style for dates. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a date or both a date and -time (i.e. if type is missing or is equal to -"date" or "both"); ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting style for times. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a time or both a date and -time (i.e. if type is equal to "time" or "both"); -ignored otherwise. - - timeStyle - false - true - - - -Custom formatting style for dates and times. - - pattern - false - true - - - -Time zone in which to represent the formatted -time. - - timeZone - false - true - - - -Name of the exported scoped variable which -stores the formatted result as a String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a date and/or time - - parseDate - org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag - JSP - - -Date string to be parsed. - - value - false - true - - - -Specifies whether the date string in the -value attribute is supposed to contain a -time, a date, or both. - - type - false - true - - - -Predefined formatting style for days -which determines how the date -component of the date string is to be -parsed. Applied only when formatting a -date or both a date and time (i.e. if type -is missing or is equal to "date" or "both"); -ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting styles for times -which determines how the time -component in the date string is to be -parsed. Applied only when formatting a -time or both a date and time (i.e. if type -is equal to "time" or "both"); ignored -otherwise. - - timeStyle - false - true - - - -Custom formatting pattern which -determines how the date string is to be -parsed. - - pattern - false - true - - - -Time zone in which to interpret any time -information in the date string. - - timeZone - false - true - - - -Locale whose predefined formatting styles -for dates and times are to be used during -the parse operation, or to which the -pattern specified via the pattern -attribute (if present) is applied. - - parseLocale - false - true - - - -Name of the exported scoped variable in -which the parsing result (of type -java.util.Date) is stored. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - diff --git a/impl/src/main/resources/META-INF/fn-1_1.tld b/impl/src/main/resources/META-INF/fn-1_1.tld deleted file mode 100644 index 6e6b15f..0000000 --- a/impl/src/main/resources/META-INF/fn-1_1.tld +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - JSTL 1.1 functions library - JSTL functions - 1.1 - fn - http://java.sun.com/jsp/jstl/functions - - - - Tests if an input string contains the specified substring. - - contains - org.apache.taglibs.standard.functions.Functions - boolean contains(java.lang.String, java.lang.String) - - <c:if test="${fn:contains(name, searchString)}"> - - - - - - Tests if an input string contains the specified substring in a case insensitive way. - - containsIgnoreCase - org.apache.taglibs.standard.functions.Functions - boolean containsIgnoreCase(java.lang.String, java.lang.String) - - <c:if test="${fn:containsIgnoreCase(name, searchString)}"> - - - - - - Tests if an input string ends with the specified suffix. - - endsWith - org.apache.taglibs.standard.functions.Functions - boolean endsWith(java.lang.String, java.lang.String) - - <c:if test="${fn:endsWith(filename, ".txt")}"> - - - - - - Escapes characters that could be interpreted as XML markup. - - escapeXml - org.apache.taglibs.standard.functions.Functions - java.lang.String escapeXml(java.lang.String) - - ${fn:escapeXml(param:info)} - - - - - - Returns the index withing a string of the first occurrence of a specified substring. - - indexOf - org.apache.taglibs.standard.functions.Functions - int indexOf(java.lang.String, java.lang.String) - - ${fn:indexOf(name, "-")} - - - - - - Joins all elements of an array into a string. - - join - org.apache.taglibs.standard.functions.Functions - java.lang.String join(java.lang.String[], java.lang.String) - - ${fn:join(array, ";")} - - - - - - Returns the number of items in a collection, or the number of characters in a string. - - length - org.apache.taglibs.standard.functions.Functions - int length(java.lang.Object) - - You have ${fn:length(shoppingCart.products)} in your shopping cart. - - - - - - Returns a string resulting from replacing in an input string all occurrences - of a "before" string into an "after" substring. - - replace - org.apache.taglibs.standard.functions.Functions - java.lang.String replace(java.lang.String, java.lang.String, java.lang.String) - - ${fn:replace(text, "-", "•")} - - - - - - Splits a string into an array of substrings. - - split - org.apache.taglibs.standard.functions.Functions - java.lang.String[] split(java.lang.String, java.lang.String) - - ${fn:split(customerNames, ";")} - - - - - - Tests if an input string starts with the specified prefix. - - startsWith - org.apache.taglibs.standard.functions.Functions - boolean startsWith(java.lang.String, java.lang.String) - - <c:if test="${fn:startsWith(product.id, "100-")}"> - - - - - - Returns a subset of a string. - - substring - org.apache.taglibs.standard.functions.Functions - java.lang.String substring(java.lang.String, int, int) - - P.O. Box: ${fn:substring(zip, 6, -1)} - - - - - - Returns a subset of a string following a specific substring. - - substringAfter - org.apache.taglibs.standard.functions.Functions - java.lang.String substringAfter(java.lang.String, java.lang.String) - - P.O. Box: ${fn:substringAfter(zip, "-")} - - - - - - Returns a subset of a string before a specific substring. - - substringBefore - org.apache.taglibs.standard.functions.Functions - java.lang.String substringBefore(java.lang.String, java.lang.String) - - Zip (without P.O. Box): ${fn:substringBefore(zip, "-")} - - - - - - Converts all of the characters of a string to lower case. - - toLowerCase - org.apache.taglibs.standard.functions.Functions - java.lang.String toLowerCase(java.lang.String) - - Product name: ${fn.toLowerCase(product.name)} - - - - - - Converts all of the characters of a string to upper case. - - toUpperCase - org.apache.taglibs.standard.functions.Functions - java.lang.String toUpperCase(java.lang.String) - - Product name: ${fn.UpperCase(product.name)} - - - - - - Removes white spaces from both ends of a string. - - trim - org.apache.taglibs.standard.functions.Functions - java.lang.String trim(java.lang.String) - - Name: ${fn.trim(name)} - - - - diff --git a/impl/src/main/resources/META-INF/fn.tld b/impl/src/main/resources/META-INF/fn.tld deleted file mode 100644 index 5227d86..0000000 --- a/impl/src/main/resources/META-INF/fn.tld +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - Tags 3.0 functions library - Tags functions - 3.0 - fn - jakarta.tags.functions - - - - Tests if an input string contains the specified substring. - - contains - org.apache.taglibs.standard.functions.Functions - boolean contains(java.lang.String, java.lang.String) - - <c:if test="${fn:contains(name, searchString)}"> - - - - - - Tests if an input string contains the specified substring in a case insensitive way. - - containsIgnoreCase - org.apache.taglibs.standard.functions.Functions - boolean containsIgnoreCase(java.lang.String, java.lang.String) - - <c:if test="${fn:containsIgnoreCase(name, searchString)}"> - - - - - - Tests if an input string ends with the specified suffix. - - endsWith - org.apache.taglibs.standard.functions.Functions - boolean endsWith(java.lang.String, java.lang.String) - - <c:if test="${fn:endsWith(filename, ".txt")}"> - - - - - - Escapes characters that could be interpreted as XML markup. - - escapeXml - org.apache.taglibs.standard.functions.Functions - java.lang.String escapeXml(java.lang.String) - - ${fn:escapeXml(param:info)} - - - - - - Returns the index withing a string of the first occurrence of a specified substring. - - indexOf - org.apache.taglibs.standard.functions.Functions - int indexOf(java.lang.String, java.lang.String) - - ${fn:indexOf(name, "-")} - - - - - - Joins all elements of an array into a string. - - join - org.apache.taglibs.standard.functions.Functions - java.lang.String join(java.lang.String[], java.lang.String) - - ${fn:join(array, ";")} - - - - - - Returns the number of items in a collection, or the number of characters in a string. - - length - org.apache.taglibs.standard.functions.Functions - int length(java.lang.Object) - - You have ${fn:length(shoppingCart.products)} in your shopping cart. - - - - - - Returns a string resulting from replacing in an input string all occurrences - of a "before" string into an "after" substring. - - replace - org.apache.taglibs.standard.functions.Functions - java.lang.String replace(java.lang.String, java.lang.String, java.lang.String) - - ${fn:replace(text, "-", "•")} - - - - - - Splits a string into an array of substrings. - - split - org.apache.taglibs.standard.functions.Functions - java.lang.String[] split(java.lang.String, java.lang.String) - - ${fn:split(customerNames, ";")} - - - - - - Tests if an input string starts with the specified prefix. - - startsWith - org.apache.taglibs.standard.functions.Functions - boolean startsWith(java.lang.String, java.lang.String) - - <c:if test="${fn:startsWith(product.id, "100-")}"> - - - - - - Returns a subset of a string. - - substring - org.apache.taglibs.standard.functions.Functions - java.lang.String substring(java.lang.String, int, int) - - P.O. Box: ${fn:substring(zip, 6, -1)} - - - - - - Returns a subset of a string following a specific substring. - - substringAfter - org.apache.taglibs.standard.functions.Functions - java.lang.String substringAfter(java.lang.String, java.lang.String) - - P.O. Box: ${fn:substringAfter(zip, "-")} - - - - - - Returns a subset of a string before a specific substring. - - substringBefore - org.apache.taglibs.standard.functions.Functions - java.lang.String substringBefore(java.lang.String, java.lang.String) - - Zip (without P.O. Box): ${fn:substringBefore(zip, "-")} - - - - - - Converts all of the characters of a string to lower case. - - toLowerCase - org.apache.taglibs.standard.functions.Functions - java.lang.String toLowerCase(java.lang.String) - - Product name: ${fn.toLowerCase(product.name)} - - - - - - Converts all of the characters of a string to upper case. - - toUpperCase - org.apache.taglibs.standard.functions.Functions - java.lang.String toUpperCase(java.lang.String) - - Product name: ${fn.UpperCase(product.name)} - - - - - - Removes white spaces from both ends of a string. - - trim - org.apache.taglibs.standard.functions.Functions - java.lang.String trim(java.lang.String) - - Name: ${fn.trim(name)} - - - - diff --git a/impl/src/main/resources/META-INF/permittedTaglibs-1_1.tld b/impl/src/main/resources/META-INF/permittedTaglibs-1_1.tld deleted file mode 100644 index 55c125a..0000000 --- a/impl/src/main/resources/META-INF/permittedTaglibs-1_1.tld +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - Restricts JSP pages to the JSTL tag libraries - - permittedTaglibs - 1.1 - permittedTaglibs - http://jakarta.apache.org/taglibs/standard/permittedTaglibs - - - - jakarta.servlet.jsp.jstl.tlv.PermittedTaglibsTLV - - - - Whitespace-separated list of taglib URIs to permit. This example - TLD for the Standard Taglib allows only JSTL 'el' taglibs to be - imported. - - permittedTaglibs - - http://java.sun.com/jsp/jstl/core - http://java.sun.com/jsp/jstl/fmt - http://java.sun.com/jsp/jstl/sql - http://java.sun.com/jsp/jstl/xml - - - - diff --git a/impl/src/main/resources/META-INF/permittedTaglibs.tld b/impl/src/main/resources/META-INF/permittedTaglibs.tld deleted file mode 100644 index 7d525f0..0000000 --- a/impl/src/main/resources/META-INF/permittedTaglibs.tld +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - Restricts JSP pages to the Tags libraries - - permittedTaglibs - 3.0 - permittedTaglibs - jakarta.tags.permittedTaglibs - - - - jakarta.servlet.jsp.jstl.tlv.PermittedTaglibsTLV - - - - Whitespace-separated list of taglib URIs to permit. - This example TLD for the Standard Taglib allows only - Jakarta Standard Tag Library el taglibs to be imported. - This list only permits the EE10+ jakarta.tags URIs. - - permittedTaglibs - - jakarta.tags.core - jakarta.tags.fmt - jakarta.tags.sql - jakarta.tags.xml - - - - diff --git a/impl/src/main/resources/META-INF/scriptfree-1_1.tld b/impl/src/main/resources/META-INF/scriptfree-1_1.tld deleted file mode 100644 index 1679a7d..0000000 --- a/impl/src/main/resources/META-INF/scriptfree-1_1.tld +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - Validates JSP pages to prohibit use of scripting elements. - - 1.1 - scriptfree - http://jakarta.apache.org/taglibs/standard/scriptfree - - - - Validates prohibitions against scripting elements. - - - jakarta.servlet.jsp.jstl.tlv.ScriptFreeTLV - - - - Controls whether or not declarations are considered valid. - - allowDeclarations - false - - - - Controls whether or not scriptlets are considered valid. - - allowScriptlets - false - - - - Controls whether or not top-level expressions are considered valid. - - allowExpressions - false - - - - Controls whether or not expressions used to supply request-time - attribute values are considered valid. - - allowRTExpressions - false - - - diff --git a/impl/src/main/resources/META-INF/scriptfree.tld b/impl/src/main/resources/META-INF/scriptfree.tld deleted file mode 100644 index 630f681..0000000 --- a/impl/src/main/resources/META-INF/scriptfree.tld +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - Validates JSP pages to prohibit use of scripting elements. - - 3.0 - scriptfree - jakarta.tags.scriptfree - - - - Validates prohibitions against scripting elements. - - - jakarta.servlet.jsp.jstl.tlv.ScriptFreeTLV - - - - Controls whether or not declarations are considered valid. - - allowDeclarations - false - - - - Controls whether or not scriptlets are considered valid. - - allowScriptlets - false - - - - Controls whether or not top-level expressions are considered valid. - - allowExpressions - false - - - - Controls whether or not expressions used to supply request-time - attribute values are considered valid. - - allowRTExpressions - false - - - diff --git a/impl/src/main/resources/META-INF/sql-1_0-rt.tld b/impl/src/main/resources/META-INF/sql-1_0-rt.tld deleted file mode 100644 index 374e69b..0000000 --- a/impl/src/main/resources/META-INF/sql-1_0-rt.tld +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - 1.0 - 1.2 - sql_rt - http://java.sun.com/jstl/sql_rt - JSTL sql RT - JSTL 1.0 sql library - - - - org.apache.taglibs.standard.tlv.JstlSqlTLV - - - Provides core validation features for JSTL tags. - - - - - transaction - org.apache.taglibs.standard.tag.rt.sql.TransactionTag - JSP - - Provides nested database action elements with a shared Connection, - set up to execute all statements as one transaction. - - - dataSource - false - true - - - isolation - false - true - - - - - query - org.apache.taglibs.standard.tag.rt.sql.QueryTag - JSP - - Executes the SQL query defined in its body or through the - sql attribute. - - - var - true - false - - - scope - false - false - - - sql - false - true - - - dataSource - false - true - - - startRow - false - true - - - maxRows - false - true - - - - - update - org.apache.taglibs.standard.tag.rt.sql.UpdateTag - JSP - - Executes the SQL update defined in its body or through the - sql attribute. - - - var - false - false - - - scope - false - false - - - sql - false - true - - - dataSource - false - true - - - - - param - org.apache.taglibs.standard.tag.rt.sql.ParamTag - JSP - - Sets a parameter in an SQL statement to the specified value. - - - value - false - true - - - - - dateParam - org.apache.taglibs.standard.tag.rt.sql.DateParamTag - empty - - Sets a parameter in an SQL statement to the specified java.util.Date value. - - - value - true - true - - - type - false - true - - - - - setDataSource - org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag - empty - - Creates a simple DataSource suitable only for prototyping. - - - var - false - false - - - scope - false - false - - - dataSource - false - true - - - driver - false - true - - - url - false - true - - - user - false - true - - - password - false - true - - - diff --git a/impl/src/main/resources/META-INF/sql-1_0.tld b/impl/src/main/resources/META-INF/sql-1_0.tld deleted file mode 100644 index 6c0e990..0000000 --- a/impl/src/main/resources/META-INF/sql-1_0.tld +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - 1.0 - 1.2 - sql - http://java.sun.com/jstl/sql - JSTL sql - JSTL 1.0 sql library - - - - org.apache.taglibs.standard.tlv.JstlSqlTLV - - - expressionAttributes - - transaction:dataSource - transaction:isolation - query:sql - query:dataSource - query:startRow - query:maxRows - update:sql - update:dataSource - param:value - dateParam:value - dateParam:type - setDataSource:dataSource - setDataSource:driver - setDataSource:url - setDataSource:user - setDataSource:password - - - Whitespace-separated list of colon-separated token pairs - describing tag:attribute combinations that accept expressions. - The validator uses this information to determine which - attributes need their syntax validated. - - - - - - transaction - org.apache.taglibs.standard.tag.el.sql.TransactionTag - JSP - - Provides nested database action elements with a shared Connection, - set up to execute all statements as one transaction. - - - dataSource - false - false - - - isolation - false - false - - - - - query - org.apache.taglibs.standard.tag.el.sql.QueryTag - JSP - - Executes the SQL query defined in its body or through the - sql attribute. - - - var - true - false - - - scope - false - false - - - sql - false - false - - - dataSource - false - false - - - startRow - false - false - - - maxRows - false - false - - - - - update - org.apache.taglibs.standard.tag.el.sql.UpdateTag - JSP - - Executes the SQL update defined in its body or through the - sql attribute. - - - var - false - false - - - scope - false - false - - - sql - false - false - - - dataSource - false - false - - - - - param - org.apache.taglibs.standard.tag.el.sql.ParamTag - JSP - - Sets a parameter in an SQL statement to the specified value. - - - value - false - false - - - - - dateParam - org.apache.taglibs.standard.tag.el.sql.DateParamTag - empty - - Sets a parameter in an SQL statement to the specified java.util.Date val -ue. - - - value - true - true - - - type - false - true - - - - - setDataSource - org.apache.taglibs.standard.tag.el.sql.SetDataSourceTag - empty - - Creates a simple DataSource suitable only for prototyping. - - - var - false - false - - - scope - false - false - - - dataSource - false - false - - - driver - false - false - - - url - false - false - - - user - false - false - - - password - false - false - - - diff --git a/impl/src/main/resources/META-INF/sql-1_1.tld b/impl/src/main/resources/META-INF/sql-1_1.tld deleted file mode 100644 index fbbe4a1..0000000 --- a/impl/src/main/resources/META-INF/sql-1_1.tld +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - JSTL 1.1 sql library - JSTL sql - 1.1 - sql - http://java.sun.com/jsp/jstl/sql - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlSqlTLV - - - - - - Provides nested database action elements with a shared Connection, - set up to execute all statements as one transaction. - - transaction - org.apache.taglibs.standard.tag.rt.sql.TransactionTag - JSP - - -DataSource associated with the database to access. A -String value represents a relative path to a JNDI -resource or the parameters for the JDBC -DriverManager facility. - - dataSource - false - true - - - -Transaction isolation level. If not specified, it is the -isolation level the DataSource has been configured -with. - - isolation - false - true - - - - - - Executes the SQL query defined in its body or through the - sql attribute. - - query - org.apache.taglibs.standard.tag.rt.sql.QueryTag - JSP - - -Name of the exported scoped variable for the -query result. The type of the scoped variable is -jakarta.servlet.jsp.jstl.sql. -Result (see Chapter 16 "Java APIs"). - - var - true - false - - - -Scope of var. - - scope - false - false - - - -SQL query statement. - - sql - false - true - - - -Data source associated with the database to -query. A String value represents a relative path -to a JNDI resource or the parameters for the -DriverManager class. - - dataSource - false - true - - - -The returned Result object includes the rows -starting at the specified index. The first row of -the original query result set is at index 0. If not -specified, rows are included starting from the -first row at index 0. - - startRow - false - true - - - -The maximum number of rows to be included in -the query result. If not specified, or set to -1, no -limit on the maximum number of rows is -enforced. - - maxRows - false - true - - - - - - Executes the SQL update defined in its body or through the - sql attribute. - - update - org.apache.taglibs.standard.tag.rt.sql.UpdateTag - JSP - - -Name of the exported scoped variable for the result -of the database update. The type of the scoped -variable is java.lang.Integer. - - var - false - false - - - -Scope of var. - - scope - false - false - - - -SQL update statement. - - sql - false - true - - - -Data source associated with the database to update. -A String value represents a relative path to a JNDI -resource or the parameters for the JDBC -DriverManager class. - - dataSource - false - true - - - - - - Sets a parameter in an SQL statement to the specified value. - - param - org.apache.taglibs.standard.tag.rt.sql.ParamTag - JSP - - -Parameter value. - - value - false - true - - - - - - Sets a parameter in an SQL statement to the specified java.util.Date value. - - dateParam - org.apache.taglibs.standard.tag.rt.sql.DateParamTag - empty - - -Parameter value for DATE, TIME, or -TIMESTAMP column in a database table. - - value - true - true - - - -One of "date", "time" or "timestamp". - - type - false - true - - - - - - Creates a simple DataSource suitable only for prototyping. - - setDataSource - org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag - empty - - -Name of the exported scoped variable -for the data source specified. Type can -be String or DataSource. - - var - false - false - - - -If var is specified, scope of the -exported variable. Otherwise, scope of -the data source configuration variable. - - scope - false - false - - - -Data source. If specified as a string, it -can either be a relative path to a JNDI -resource, or a JDBC parameters string -as defined in Section 10.1.1. - - dataSource - false - true - - - -JDBC parameter: driver class name. - - driver - false - true - - - -JDBC parameter: URL associated with -the database. - - url - false - true - - - -JDBC parameter: database user on -whose behalf the connection to the -database is being made. - - user - false - true - - - -JDBC parameter: user password - - password - false - true - - - diff --git a/impl/src/main/resources/META-INF/sql.tld b/impl/src/main/resources/META-INF/sql.tld deleted file mode 100644 index 766c0f8..0000000 --- a/impl/src/main/resources/META-INF/sql.tld +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - Tags 3.0 sql library - Tags sql - 3.0 - sql - jakarta.tags.sql - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlSqlTLV - - - - - - Provides nested database action elements with a shared Connection, - set up to execute all statements as one transaction. - - transaction - org.apache.taglibs.standard.tag.rt.sql.TransactionTag - JSP - - -DataSource associated with the database to access. A -String value represents a relative path to a JNDI -resource or the parameters for the JDBC -DriverManager facility. - - dataSource - false - true - - - -Transaction isolation level. If not specified, it is the -isolation level the DataSource has been configured -with. - - isolation - false - true - - - - - - Executes the SQL query defined in its body or through the - sql attribute. - - query - org.apache.taglibs.standard.tag.rt.sql.QueryTag - JSP - - -Name of the exported scoped variable for the -query result. The type of the scoped variable is -jakarta.servlet.jsp.jstl.sql. -Result (see Chapter 16 "Java APIs"). - - var - true - false - - - -Scope of var. - - scope - false - false - - - -SQL query statement. - - sql - false - true - - - -Data source associated with the database to -query. A String value represents a relative path -to a JNDI resource or the parameters for the -DriverManager class. - - dataSource - false - true - - - -The returned Result object includes the rows -starting at the specified index. The first row of -the original query result set is at index 0. If not -specified, rows are included starting from the -first row at index 0. - - startRow - false - true - - - -The maximum number of rows to be included in -the query result. If not specified, or set to -1, no -limit on the maximum number of rows is -enforced. - - maxRows - false - true - - - - - - Executes the SQL update defined in its body or through the - sql attribute. - - update - org.apache.taglibs.standard.tag.rt.sql.UpdateTag - JSP - - -Name of the exported scoped variable for the result -of the database update. The type of the scoped -variable is java.lang.Integer. - - var - false - false - - - -Scope of var. - - scope - false - false - - - -SQL update statement. - - sql - false - true - - - -Data source associated with the database to update. -A String value represents a relative path to a JNDI -resource or the parameters for the JDBC -DriverManager class. - - dataSource - false - true - - - - - - Sets a parameter in an SQL statement to the specified value. - - param - org.apache.taglibs.standard.tag.rt.sql.ParamTag - JSP - - -Parameter value. - - value - false - true - - - - - - Sets a parameter in an SQL statement to the specified java.util.Date value. - - dateParam - org.apache.taglibs.standard.tag.rt.sql.DateParamTag - empty - - -Parameter value for DATE, TIME, or -TIMESTAMP column in a database table. - - value - true - true - - - -One of "date", "time" or "timestamp". - - type - false - true - - - - - - Creates a simple DataSource suitable only for prototyping. - - setDataSource - org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag - empty - - -Name of the exported scoped variable -for the data source specified. Type can -be String or DataSource. - - var - false - false - - - -If var is specified, scope of the -exported variable. Otherwise, scope of -the data source configuration variable. - - scope - false - false - - - -Data source. If specified as a string, it -can either be a relative path to a JNDI -resource, or a JDBC parameters string -as defined in Section 10.1.1. - - dataSource - false - true - - - -JDBC parameter: driver class name. - - driver - false - true - - - -JDBC parameter: URL associated with -the database. - - url - false - true - - - -JDBC parameter: database user on -whose behalf the connection to the -database is being made. - - user - false - true - - - -JDBC parameter: user password - - password - false - true - - - diff --git a/impl/src/main/resources/META-INF/x-1_0-rt.tld b/impl/src/main/resources/META-INF/x-1_0-rt.tld deleted file mode 100644 index e18aded..0000000 --- a/impl/src/main/resources/META-INF/x-1_0-rt.tld +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - 1.0 - 1.2 - x_rt - http://java.sun.com/jstl/xml_rt - JSTL XML RT - JSTL 1.0 XML library - - - - org.apache.taglibs.standard.tlv.JstlXmlTLV - - - Provides validation features for JSTL XML tags. - - - - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - - - - out - org.apache.taglibs.standard.tag.rt.xml.ExprTag - empty - - Like <%= ... >, but for XPath expressions. - - - select - true - false - - - escapeXml - false - true - - - - - if - org.apache.taglibs.standard.tag.common.xml.IfTag - JSP - - XML conditional tag, which evalutes its body if the - supplied XPath expression evalutes to 'true' as a boolean - - - select - true - false - - - var - false - false - - - scope - false - false - - - - - forEach - org.apache.taglibs.standard.tag.common.xml.ForEachTag - JSP - - XML iteration tag. - - - var - false - false - - - select - true - false - - - - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - - - - param - org.apache.taglibs.standard.tag.rt.xml.ParamTag - JSP - - Adds a parameter to a containing 'transform' tag's Transformer - - - name - true - true - - - value - false - true - - - - - parse - org.apache.taglibs.standard.tag.rt.xml.ParseTag - org.apache.taglibs.standard.tei.XmlParseTEI - JSP - - Parses XML content from 'source' attribute or 'body' - - - var - false - false - - - varDom - false - false - - - scope - false - false - - - scopeDom - false - false - - - xml - false - true - - - systemId - false - true - - - filter - false - true - - - - - set - org.apache.taglibs.standard.tag.common.xml.SetTag - empty - - Saves the result of an XPath expression evaluation in a 'scope' - - - var - true - false - - - select - false - false - - - scope - false - false - - - - - transform - org.apache.taglibs.standard.tag.rt.xml.TransformTag - org.apache.taglibs.standard.tei.XmlTransformTEI - JSP - - Conducts a transformation given a source XML document - and an XSLT stylesheet - - - var - false - false - - - scope - false - false - - - result - false - true - - - xml - false - true - - - xmlSystemId - false - true - - - xslt - false - true - - - xsltSystemId - false - true - - - - - when - org.apache.taglibs.standard.tag.common.xml.WhenTag - JSP - - Subtag of <choose> that includes its body if its - expression evalutes to 'true' - - - select - true - false - - - - diff --git a/impl/src/main/resources/META-INF/x-1_0.tld b/impl/src/main/resources/META-INF/x-1_0.tld deleted file mode 100644 index 2f5f0e3..0000000 --- a/impl/src/main/resources/META-INF/x-1_0.tld +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - 1.0 - 1.2 - x - http://java.sun.com/jstl/xml - JSTL XML - JSTL 1.0 XML library - - - - org.apache.taglibs.standard.tlv.JstlXmlTLV - - - expressionAttributes - - out:escapeXml - parse:xml - parse:systemId - parse:filter - transform:xml - transform:xmlSystemId - transform:xslt - transform:xsltSystemId - transform:result - - - Whitespace-separated list of colon-separated token pairs - describing tag:attribute combinations that accept expressions. - The validator uses this information to determine which - attributes need their syntax validated. - - - - - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - - - - out - org.apache.taglibs.standard.tag.el.xml.ExprTag - empty - - Like <%= ... >, but for XPath expressions. - - - select - true - false - - - escapeXml - false - false - - - - - if - org.apache.taglibs.standard.tag.common.xml.IfTag - JSP - - XML conditional tag, which evalutes its body if the - supplied XPath expression evalutes to 'true' as a boolean - - - select - true - false - - - var - false - false - - - scope - false - false - - - - - forEach - org.apache.taglibs.standard.tag.common.xml.ForEachTag - JSP - - XML iteration tag. - - - var - false - false - - - select - true - false - - - - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - - - - param - org.apache.taglibs.standard.tag.el.xml.ParamTag - JSP - - Adds a parameter to a containing 'transform' tag's Transformer - - - name - true - false - - - value - false - false - - - - - parse - org.apache.taglibs.standard.tag.el.xml.ParseTag - org.apache.taglibs.standard.tei.XmlParseTEI - JSP - - Parses XML content from 'source' attribute or 'body' - - - var - false - false - - - varDom - false - false - - - scope - false - false - - - scopeDom - false - false - - - xml - false - false - - - systemId - false - false - - - filter - false - false - - - - - set - org.apache.taglibs.standard.tag.common.xml.SetTag - empty - - Saves the result of an XPath expression evaluation in a 'scope' - - - var - true - false - - - select - false - false - - - scope - false - false - - - - - transform - org.apache.taglibs.standard.tag.el.xml.TransformTag - org.apache.taglibs.standard.tei.XmlTransformTEI - JSP - - Conducts a transformation given a source XML document - and an XSLT stylesheet - - - var - false - false - - - scope - false - false - - - result - false - false - - - xml - false - false - - - xmlSystemId - false - false - - - xslt - false - false - - - xsltSystemId - false - false - - - - - when - org.apache.taglibs.standard.tag.common.xml.WhenTag - JSP - - Subtag of <choose> that includes its body if its - expression evalutes to 'true' - - - select - true - false - - - - diff --git a/impl/src/main/resources/META-INF/x-1_1.tld b/impl/src/main/resources/META-INF/x-1_1.tld deleted file mode 100644 index eca4516..0000000 --- a/impl/src/main/resources/META-INF/x-1_1.tld +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - JSTL 1.1 XML library - JSTL XML - 1.1 - x - http://java.sun.com/jsp/jstl/xml - - - - Provides validation features for JSTL XML tags. - - - org.apache.taglibs.standard.tlv.JstlXmlTLV - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Like <%= ... >, but for XPath expressions. - - out - org.apache.taglibs.standard.tag.rt.xml.ExprTag - empty - - -XPath expression to be evaluated. - - select - true - false - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default -value is true. - - escapeXml - false - true - - - - - - XML conditional tag, which evalutes its body if the - supplied XPath expression evalutes to 'true' as a boolean - - if - org.apache.taglibs.standard.tag.common.xml.IfTag - JSP - - -The test condition that tells whether or not the -body content should be processed. - - select - true - false - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - XML iteration tag. - - forEach - org.apache.taglibs.standard.tag.common.xml.ForEachTag - JSP - - -Name of the exported scoped variable for the -current item of the iteration. This scoped variable -has nested visibility. Its type depends on the -result of the XPath expression in the select -attribute. - - var - false - false - - - -XPath expression to be evaluated. - - select - true - false - - - -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. - - begin - false - true - int - - - -Iteration ends at the item located at the specified -index (inclusive). - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -jakarta.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility. - - varStatus - false - false - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'transform' tag's Transformer - - param - org.apache.taglibs.standard.tag.rt.xml.ParamTag - JSP - - -Name of the transformation parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Parses XML content from 'source' attribute or 'body' - - parse - org.apache.taglibs.standard.tag.rt.xml.ParseTag - org.apache.taglibs.standard.tei.XmlParseTEI - JSP - - -Name of the exported scoped variable for -the parsed XML document. The type of the -scoped variable is implementation -dependent. - - var - false - false - - - -Name of the exported scoped variable for -the parsed XML document. The type of the -scoped variable is -org.w3c.dom.Document. - - varDom - false - false - - - -Scope for var. - - scope - false - false - - - -Scope for varDom. - - scopeDom - false - false - - - -Deprecated. Use attribute 'doc' instead. - - xml - false - true - - - -Source XML document to be parsed. - - doc - false - true - - - -The system identifier (URI) for parsing the -XML document. - - systemId - false - true - - - -Filter to be applied to the source -document. - - filter - false - true - - - - - - Saves the result of an XPath expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.common.xml.SetTag - empty - - -Name of the exported scoped variable to hold -the value specified in the action. The type of the -scoped variable is whatever type the select -expression evaluates to. - - var - true - false - - - -XPath expression to be evaluated. - - select - false - false - - - -Scope for var. - - scope - false - false - - - - - - Conducts a transformation given a source XML document - and an XSLT stylesheet - - transform - org.apache.taglibs.standard.tag.rt.xml.TransformTag - org.apache.taglibs.standard.tei.XmlTransformTEI - JSP - - -Name of the exported -scoped variable for the -transformed XML -document. The type of the -scoped variable is -org.w3c.dom.Document. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Result -Object that captures or -processes the transformation -result. - - result - false - true - - - -Deprecated. Use attribute -'doc' instead. - - xml - false - true - - - -Source XML document to be -transformed. (If exported by -<x:set>, it must correspond -to a well-formed XML -document, not a partial -document.) - - doc - false - true - - - -Deprecated. Use attribute -'docSystemId' instead. - - xmlSystemId - false - true - - - -The system identifier (URI) -for parsing the XML -document. - - docSystemId - false - true - - - -javax.xml.transform.Source -Transformation stylesheet as -a String, Reader, or -Source object. - - xslt - false - true - - - -The system identifier (URI) -for parsing the XSLT -stylesheet. - - xsltSystemId - false - true - - - - - - Subtag of <choose> that includes its body if its - expression evalutes to 'true' - - when - org.apache.taglibs.standard.tag.common.xml.WhenTag - JSP - - -The test condition that tells whether or -not the body content should be -processed - - select - true - false - - - - diff --git a/impl/src/main/resources/META-INF/x.tld b/impl/src/main/resources/META-INF/x.tld deleted file mode 100644 index 51062e0..0000000 --- a/impl/src/main/resources/META-INF/x.tld +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - Tags 3.0 XML library - Tags XML - 3.0 - x - jakarta.tags.xml - - - - Provides validation features for JSTL XML tags. - - - org.apache.taglibs.standard.tlv.JstlXmlTLV - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Like <%= ... >, but for XPath expressions. - - out - org.apache.taglibs.standard.tag.rt.xml.ExprTag - empty - - -XPath expression to be evaluated. - - select - true - false - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default -value is true. - - escapeXml - false - true - - - - - - XML conditional tag, which evalutes its body if the - supplied XPath expression evalutes to 'true' as a boolean - - if - org.apache.taglibs.standard.tag.common.xml.IfTag - JSP - - -The test condition that tells whether or not the -body content should be processed. - - select - true - false - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - XML iteration tag. - - forEach - org.apache.taglibs.standard.tag.common.xml.ForEachTag - JSP - - -Name of the exported scoped variable for the -current item of the iteration. This scoped variable -has nested visibility. Its type depends on the -result of the XPath expression in the select -attribute. - - var - false - false - - - -XPath expression to be evaluated. - - select - true - false - - - -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. - - begin - false - true - int - - - -Iteration ends at the item located at the specified -index (inclusive). - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -jakarta.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility. - - varStatus - false - false - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'transform' tag's Transformer - - param - org.apache.taglibs.standard.tag.rt.xml.ParamTag - JSP - - -Name of the transformation parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Parses XML content from 'source' attribute or 'body' - - parse - org.apache.taglibs.standard.tag.rt.xml.ParseTag - org.apache.taglibs.standard.tei.XmlParseTEI - JSP - - -Name of the exported scoped variable for -the parsed XML document. The type of the -scoped variable is implementation -dependent. - - var - false - false - - - -Name of the exported scoped variable for -the parsed XML document. The type of the -scoped variable is -org.w3c.dom.Document. - - varDom - false - false - - - -Scope for var. - - scope - false - false - - - -Scope for varDom. - - scopeDom - false - false - - - -Deprecated. Use attribute 'doc' instead. - - xml - false - true - - - -Source XML document to be parsed. - - doc - false - true - - - -The system identifier (URI) for parsing the -XML document. - - systemId - false - true - - - -Filter to be applied to the source -document. - - filter - false - true - - - - - - Saves the result of an XPath expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.common.xml.SetTag - empty - - -Name of the exported scoped variable to hold -the value specified in the action. The type of the -scoped variable is whatever type the select -expression evaluates to. - - var - true - false - - - -XPath expression to be evaluated. - - select - false - false - - - -Scope for var. - - scope - false - false - - - - - - Conducts a transformation given a source XML document - and an XSLT stylesheet - - transform - org.apache.taglibs.standard.tag.rt.xml.TransformTag - org.apache.taglibs.standard.tei.XmlTransformTEI - JSP - - -Name of the exported -scoped variable for the -transformed XML -document. The type of the -scoped variable is -org.w3c.dom.Document. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Result -Object that captures or -processes the transformation -result. - - result - false - true - - - -Deprecated. Use attribute -'doc' instead. - - xml - false - true - - - -Source XML document to be -transformed. (If exported by -<x:set>, it must correspond -to a well-formed XML -document, not a partial -document.) - - doc - false - true - - - -Deprecated. Use attribute -'docSystemId' instead. - - xmlSystemId - false - true - - - -The system identifier (URI) -for parsing the XML -document. - - docSystemId - false - true - - - -javax.xml.transform.Source -Transformation stylesheet as -a String, Reader, or -Source object. - - xslt - false - true - - - -The system identifier (URI) -for parsing the XSLT -stylesheet. - - xsltSystemId - false - true - - - - - - Subtag of <choose> that includes its body if its - expression evalutes to 'true' - - when - org.apache.taglibs.standard.tag.common.xml.WhenTag - JSP - - -The test condition that tells whether or -not the body content should be -processed - - select - true - false - - - - diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean1.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean1.java deleted file mode 100644 index 1e8f30b..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean1.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -import java.util.List; -import java.util.Map; - -/** - * - *

This is a test bean with a set of properties - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: jluehe $ - **/ - -public class Bean1 -{ - //------------------------------------- - // Properties - //------------------------------------- - // property boolean1 - - boolean mBoolean1; - public boolean getBoolean1 () - { return mBoolean1; } - public void setBoolean1 (boolean pBoolean1) - { mBoolean1 = pBoolean1; } - - //------------------------------------- - // property byte1 - - byte mByte1; - public byte getByte1 () - { return mByte1; } - public void setByte1 (byte pByte1) - { mByte1 = pByte1; } - - //------------------------------------- - // property char1 - - char mChar1; - public char getChar1 () - { return mChar1; } - public void setChar1 (char pChar1) - { mChar1 = pChar1; } - - //------------------------------------- - // property short1 - - short mShort1; - public short getShort1 () - { return mShort1; } - public void setShort1 (short pShort1) - { mShort1 = pShort1; } - - //------------------------------------- - // property int1 - - int mInt1; - public int getInt1 () - { return mInt1; } - public void setInt1 (int pInt1) - { mInt1 = pInt1; } - - //------------------------------------- - // property long1 - - long mLong1; - public long getLong1 () - { return mLong1; } - public void setLong1 (long pLong1) - { mLong1 = pLong1; } - - //------------------------------------- - // property float1 - - float mFloat1; - public float getFloat1 () - { return mFloat1; } - public void setFloat1 (float pFloat1) - { mFloat1 = pFloat1; } - - //------------------------------------- - // property double1 - - double mDouble1; - public double getDouble1 () - { return mDouble1; } - public void setDouble1 (double pDouble1) - { mDouble1 = pDouble1; } - - //------------------------------------- - // property boolean2 - - Boolean mBoolean2; - public Boolean getBoolean2 () - { return mBoolean2; } - public void setBoolean2 (Boolean pBoolean2) - { mBoolean2 = pBoolean2; } - - //------------------------------------- - // property byte2 - - Byte mByte2; - public Byte getByte2 () - { return mByte2; } - public void setByte2 (Byte pByte2) - { mByte2 = pByte2; } - - //------------------------------------- - // property char2 - - Character mChar2; - public Character getChar2 () - { return mChar2; } - public void setChar2 (Character pChar2) - { mChar2 = pChar2; } - - //------------------------------------- - // property short2 - - Short mShort2; - public Short getShort2 () - { return mShort2; } - public void setShort2 (Short pShort2) - { mShort2 = pShort2; } - - //------------------------------------- - // property int2 - - Integer mInt2; - public Integer getInt2 () - { return mInt2; } - public void setInt2 (Integer pInt2) - { mInt2 = pInt2; } - - //------------------------------------- - // property long2 - - Long mLong2; - public Long getLong2 () - { return mLong2; } - public void setLong2 (Long pLong2) - { mLong2 = pLong2; } - - //------------------------------------- - // property float2 - - Float mFloat2; - public Float getFloat2 () - { return mFloat2; } - public void setFloat2 (Float pFloat2) - { mFloat2 = pFloat2; } - - //------------------------------------- - // property double2 - - Double mDouble2; - public Double getDouble2 () - { return mDouble2; } - public void setDouble2 (Double pDouble2) - { mDouble2 = pDouble2; } - - //------------------------------------- - // property string1 - - String mString1; - public String getString1 () - { return mString1; } - public void setString1 (String pString1) - { mString1 = pString1; } - - //------------------------------------- - // property string2 - - String mString2; - public String getString2 () - { return mString2; } - public void setString2 (String pString2) - { mString2 = pString2; } - - //------------------------------------- - // property bean1 - - Bean1 mBean1; - public Bean1 getBean1 () - { return mBean1; } - public void setBean1 (Bean1 pBean1) - { mBean1 = pBean1; } - - //------------------------------------- - // property bean2 - - Bean1 mBean2; - public Bean1 getBean2 () - { return mBean2; } - public void setBean2 (Bean1 pBean2) - { mBean2 = pBean2; } - - //------------------------------------- - // property noGetter - - String mNoGetter; - public void setNoGetter (String pNoGetter) - { mNoGetter = pNoGetter; } - - //------------------------------------- - // property errorInGetter - - public String getErrorInGetter () - { throw new NullPointerException ("Error!"); } - - //------------------------------------- - // property stringArray1 - - String [] mStringArray1; - public String [] getStringArray1 () - { return mStringArray1; } - public void setStringArray1 (String [] pStringArray1) - { mStringArray1 = pStringArray1; } - - //------------------------------------- - // property list1 - - List mList1; - public List getList1 () - { return mList1; } - public void setList1 (List pList1) - { mList1 = pList1; } - - //------------------------------------- - // property map1 - - Map mMap1; - public Map getMap1 () - { return mMap1; } - public void setMap1 (Map pMap1) - { mMap1 = pMap1; } - - //------------------------------------- - // property indexed1 - - public String getIndexed1 (int pIndex) - { return mStringArray1 [pIndex]; } - - //------------------------------------- - // Member variables - //------------------------------------- - - //------------------------------------- - /** - * - * Constructor - **/ - public Bean1 () - { - } - - //------------------------------------- - -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2.java deleted file mode 100644 index eaae4bb..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -/** - * - *

This is a test bean that holds a single String - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class Bean2 -{ - //------------------------------------- - // Properties - //------------------------------------- - // property value - - String mValue; - public String getValue () - { return mValue; } - public void setValue (String pValue) - { mValue = pValue; } - - //------------------------------------- - // Member variables - //------------------------------------- - - //------------------------------------- - /** - * - * Constructor - **/ - public Bean2 (String pValue) - { - mValue = pValue; - } - - //------------------------------------- - public String toString () - { - return ("Bean2[" + mValue + "]"); - } - - //------------------------------------- - -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2Editor.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2Editor.java deleted file mode 100644 index 7eb47a1..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/Bean2Editor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -import java.beans.PropertyEditorSupport; - -/** - * - * PropertyEditor for parsing Bean2 - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class Bean2Editor - extends PropertyEditorSupport -{ - //------------------------------------- - public void setAsText (String pText) - throws IllegalArgumentException - { - if ("badvalue".equals (pText)) { - throw new IllegalArgumentException ("Bad value " + pText); - } - else { - setValue (new Bean2 (pText)); - } - } - - //------------------------------------- -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java deleted file mode 100644 index da2444a..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020 Payara Services Ltd. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -import jakarta.servlet.jsp.JspException; -import jakarta.servlet.jsp.PageContext; - -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.taglibs.standard.lang.jstl.Evaluator; -import org.apache.taglibs.standard.lang.jstl.test.beans.Factory; -import org.apache.taglibs.standard.lang.jstl.test.mock.PageContextImpl; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.apache.taglibs.standard.lang.jstl.test.TestUtilities.assertEqualContent; -import static org.apache.taglibs.standard.lang.jstl.test.TestUtilities.openFileForReading; - -/** - *

- * This runs a series of tests specifically for the evaluator. It - * parses and evaluates various expressions in the context of a test - * PageContext containing preset data, and prints out the results of - * the evaluations. - *

- * The expressions are stored in an input text file, where one line - * contains the expression and the next line contains the expected - * type. Blank lines and lines that start with # are ignored. The - * results are written to an output file (blank lines and # lines are - * included in the output file). The output file may be compared - * against an existing output file to do regression testing. - * - * @author Nathan Abramson - Art Technology Group 2001 - * @author David Matejcek 2022 - **/ - -public class EvaluationTest { - - private static BufferedReader pIn; - private static PrintStream pOut; - private static File outputFile; - - @BeforeAll - public static void init() throws Exception { - InputStream fin = EvaluationTest.class.getResourceAsStream("/evaluationTests.txt"); - pIn = openFileForReading(fin); - - outputFile = File.createTempFile(EvaluationTest.class.getName(), ".out"); - FileOutputStream fout = new FileOutputStream(outputFile); - BufferedOutputStream bout = new BufferedOutputStream(fout); - pOut = new PrintStream(bout); - } - - - @AfterAll - public static void close() throws Exception { - if (pIn != null) { - pIn.close(); - } - if (pOut != null) { - pOut.close(); - } - } - - - /** - * Runs the tests, reading expressions from pIn and writing the - * results to pOut. - */ - @Test - public void generateAndCompare() throws Exception { - PageContext context = createTestContext(); - while (true) { - String str = pIn.readLine(); - if (str == null) { - break; - } - if (str.startsWith("#") || "".equals(str.trim())) { - pOut.println(str); - } else { - String typeStr = pIn.readLine(); - pOut.println("Expression: " + str); - - try { - Class cl = parseClassName(typeStr); - pOut.println("ExpectedType: " + cl); - Evaluator e = new Evaluator(); - Object val = e.evaluate("test", str, cl, null, context); - pOut.println("Evaluates to: " + val); - if (val != null) { - pOut.println("With type: " + val.getClass().getName()); - } - pOut.println(); - } catch (JspException exc) { - pOut.println("Causes an error: " + exc); - pOut.println(); - } catch (ClassNotFoundException exc) { - pOut.println("Causes an error: " + exc); - pOut.println(); - } - } - } - pOut.flush(); - - BufferedReader expected = openFileForReading(EvaluationTest.class.getResourceAsStream("/evaluationTestsOutput.txt")); - BufferedReader generated = openFileForReading(outputFile); - assertEqualContent(expected, generated); - } - - - /** - * Finds the class for a class name, including primitive names - **/ - private static Class parseClassName(String pClassName) throws ClassNotFoundException { - String c = pClassName.trim(); - if ("boolean".equals(c)) { - return Boolean.TYPE; - } else if ("byte".equals(c)) { - return Byte.TYPE; - } else if ("char".equals(c)) { - return Character.TYPE; - } else if ("short".equals(c)) { - return Short.TYPE; - } else if ("int".equals(c)) { - return Integer.TYPE; - } else if ("long".equals(c)) { - return Long.TYPE; - } else if ("float".equals(c)) { - return Float.TYPE; - } else if ("double".equals(c)) { - return Double.TYPE; - } else { - return Class.forName(pClassName); - } - } - - - /** - * Creates and returns the test PageContext that will be used for the tests. - **/ - private static PageContext createTestContext() { - PageContext ret = new PageContextImpl(); - - // Create some basic values for lookups - ret.setAttribute("val1a", "page-scoped1", PageContext.PAGE_SCOPE); - ret.setAttribute("val1b", "request-scoped1", PageContext.REQUEST_SCOPE); - ret.setAttribute("val1c", "session-scoped1", PageContext.SESSION_SCOPE); - ret.setAttribute("val1d", "app-scoped1", PageContext.APPLICATION_SCOPE); - - // Create a bean - { - Bean1 b1 = new Bean1(); - b1.setBoolean1(true); - b1.setByte1((byte) 12); - b1.setShort1((short) -124); - b1.setChar1('b'); - b1.setInt1(4); - b1.setLong1(222423); - b1.setFloat1((float) 12.4); - b1.setDouble1(89.224); - b1.setString1("hello"); - b1.setStringArray1(new String[] {"string1", "string2", "string3", "string4"}); - { - List l = new ArrayList<>(); - l.add(Integer.valueOf(14)); - l.add("another value"); - l.add(b1.getStringArray1()); - b1.setList1(l); - } - { - Map m = new HashMap<>(); - m.put("key1", "value1"); - m.put(Integer.valueOf(14), "value2"); - m.put(Long.valueOf(14), "value3"); - m.put("recurse", b1); - b1.setMap1(m); - } - ret.setAttribute("bean1a", b1); - - Bean1 b2 = new Bean1(); - b2.setInt2(Integer.valueOf(-224)); - b2.setString2("bean2's string"); - b1.setBean1(b2); - - Bean1 b3 = new Bean1(); - b3.setDouble1(1422.332); - b3.setString2("bean3's string"); - b2.setBean2(b3); - } - - // Create the public/private beans - { - ret.setAttribute("pbean1", Factory.createBean1()); - ret.setAttribute("pbean2", Factory.createBean2()); - ret.setAttribute("pbean3", Factory.createBean3()); - ret.setAttribute("pbean4", Factory.createBean4()); - ret.setAttribute("pbean5", Factory.createBean5()); - ret.setAttribute("pbean6", Factory.createBean6()); - ret.setAttribute("pbean7", Factory.createBean7()); - } - - // Create the empty tests - { - Map m = new HashMap<>(); - m.put("emptyArray", new Object[0]); - m.put("nonemptyArray", new Object[] {"abc"}); - m.put("emptyList", new ArrayList<>()); - { - List l = new ArrayList<>(); - l.add("hello"); - m.put("nonemptyList", l); - } - m.put("emptyMap", new HashMap<>()); - { - Map m2 = new HashMap<>(); - m2.put("a", "a"); - m.put("nonemptyMap", m2); - } - m.put("emptySet", new HashSet<>()); - { - Set s = new HashSet<>(); - s.add("hello"); - m.put("nonemptySet", s); - } - ret.setAttribute("emptyTests", m); - } - - return ret; - } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/FunctionTest.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/FunctionTest.java deleted file mode 100644 index e04b0e0..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/FunctionTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 2020 Payara Services Ltd. - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -import jakarta.servlet.jsp.JspException; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; -import org.apache.taglibs.standard.lang.jstl.Evaluator; -import org.apache.taglibs.standard.lang.jstl.parser.ELParserConstants; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * This class contains some test functions. - * - * @author Shawn Bayern - * @author David Matejcek - */ -public class FunctionTest { - - private static Map functions; - private static Evaluator evaluator; - - - @BeforeAll - public static void initSystemProperty() throws Exception { - System.setProperty(ELParserConstants.SYSTEM_PROPERTY_ALLOW_FUNCTIONS, "true"); - functions = getSampleMethodMap(); - evaluator = new Evaluator(); - } - - - @AfterAll - public static void resetSystemProperty() { - System.clearProperty(ELParserConstants.SYSTEM_PROPERTY_ALLOW_FUNCTIONS); - } - - - @Test - public void functionsAsStaticMethods() throws Exception{ - assertAll( - () -> assertEquals(4, evaluate("4")), - () -> assertEquals(4, evaluate("${4}")), - () -> assertEquals(4, evaluate("${2+2}")), - () -> assertEquals(5, evaluate("${foo:add(2, 3)}")), - () -> assertEquals(5, evaluate("${add(2, 3)}")), - () -> assertEquals(6, evaluate("${multiply(2, 3)}")), - () -> assertEquals(10, evaluate("${add(2, 3) + 5}")), - () -> assertEquals(5, evaluate("${getInt(getInteger(getInt(5)))}")), - () -> assertEquals(5, evaluate("${getInteger(getInt(getInteger(5)))}")), - () -> assertEquals(5, evaluate("${getInt(getInt(getInt(5)))}")), - () -> assertEquals(5, evaluate("${getInteger(getInteger(getInteger(5)))}")) - ); - } - - private static Map getSampleMethodMap() throws Exception { - Map m = new HashMap<>(); - Class c = TestedClass.class; - m.put("foo:add", c.getMethod("add", new Class[] { Integer.TYPE, Integer.TYPE })); - m.put("foo:multiply", c.getMethod("multiply", new Class[] { Integer.TYPE, Integer.TYPE })); - m.put("foo:getInt", c.getMethod("getInt", new Class[] { Integer.class })); - m.put("foo:getInteger", c.getMethod("getInteger", new Class[] { Integer.TYPE })); - return m; - } - - - private static Object evaluate(String value) throws JspException { - return evaluator.evaluate("", value, Integer.class, null, null, functions, "foo"); - } - - - public static class TestedClass { - public static int add(int a, int b) { - return a + b; - } - - public static int multiply(int a, int b) { - return a * b; - } - - public static int getInt(Integer i) { - return i.intValue(); - } - - public static Integer getInteger(int i) { - return Integer.valueOf(i); - } - } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java deleted file mode 100644 index bd81a7f..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/ParserTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -import jakarta.servlet.jsp.JspException; - -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintStream; - -import org.apache.taglibs.standard.lang.jstl.Evaluator; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.apache.taglibs.standard.lang.jstl.test.TestUtilities.assertEqualContent; -import static org.apache.taglibs.standard.lang.jstl.test.TestUtilities.openFileForReading; - -/** - *

This runs a series of tests specifically for the parser. It - * parses various expressions and prints out the canonical - * representation of those parsed expressions. - * - *

The expressions are stored in an input text file, with one line - * per expression. Blank lines and lines that start with # are - * ignored. The results are written to an output file (blank lines - * and # lines are included in the output file). The output file may - * be compared against an existing output file to do regression - * testing. - * - * @author Nathan Abramson - Art Technology Group 2001 - * @author David Matejcek 2022 - */ -public class ParserTest { - private static BufferedReader pIn; - private static PrintStream pOut; - private static File outputFile; - - @BeforeAll - public static void init() throws Exception { - InputStream fin = ParserTest.class.getResourceAsStream("/parserTests.txt"); - pIn = openFileForReading(fin); - - outputFile = File.createTempFile(ParserTest.class.getName(), ".out"); - FileOutputStream fout = new FileOutputStream(outputFile); - BufferedOutputStream bout = new BufferedOutputStream(fout); - pOut = new PrintStream(bout); - } - - - @AfterAll - public static void close() throws Exception { - if (pIn != null) { - pIn.close(); - } - if (pOut != null) { - pOut.close(); - } - } - - - /** - * Runs the tests, reading expressions from pIn and writing the - * results to pOut. - **/ - @Test - public void runTests() throws IOException { - while (true) { - String str = pIn.readLine(); - if (str == null) { - break; - } - if (str.startsWith("#") || "".equals(str.trim())) { - pOut.println(str); - } else { - // For testing non-ASCII values, the string @@non-ascii gets - // converted internally to '\u1111' - if ("@@non-ascii".equals(str)) { - str = "\u1111"; - } - - pOut.println("Attribute value: " + str); - try { - String result = Evaluator.parseAndRender(str); - pOut.println("Parses to: " + result); - } catch (JspException exc) { - pOut.println("Causes an error: " + exc.getMessage()); - } - } - } - pOut.flush(); - - BufferedReader expected = openFileForReading(EvaluationTest.class.getResourceAsStream("/parserTestsOutput.txt")); - BufferedReader generated = openFileForReading(outputFile); - assertEqualContent(expected, generated); - } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/TestUtilities.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/TestUtilities.java deleted file mode 100644 index 356c018..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/TestUtilities.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.apache.taglibs.standard.lang.jstl.test; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author David Matejcek - */ -class TestUtilities { - - static BufferedReader openFileForReading(File file) throws FileNotFoundException { - return openFileForReading(new FileInputStream(file)); - } - - - static BufferedReader openFileForReading(InputStream file) { - return new BufferedReader(new InputStreamReader(file)); - } - - - /** - * Performs a line-by-line comparison of the two files, returning - * true if the files are different, false if not. - **/ - static boolean assertEqualContent(BufferedReader expected, BufferedReader generated) throws IOException { - int line = 1; - while (true) { - String expectedLine = expected.readLine(); - String generatedLine = generated.readLine(); - if (expectedLine == null && generatedLine == null) { - return false; - } - assertEquals(expectedLine, generatedLine, "Line: " + line); - line++; - } - } - -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/Factory.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/Factory.java deleted file mode 100644 index a8b7850..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/Factory.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A factory for generating the various beans - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public class Factory -{ - public static PublicBean1 createBean1 () - { - return new PublicBean1 (); - } - - public static PublicBean1 createBean2 () - { - return new PrivateBean1a (); - } - - public static PublicBean1 createBean3 () - { - return new PublicBean1b (); - } - - public static PublicInterface2 createBean4 () - { - return new PublicBean2a (); - } - - public static PublicInterface2 createBean5 () - { - return new PrivateBean2b (); - } - - public static PublicInterface2 createBean6 () - { - return new PrivateBean2c (); - } - - public static PublicInterface2 createBean7 () - { - return new PrivateBean2d (); - } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean1a.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean1a.java deleted file mode 100644 index 7a0305d..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean1a.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A private bean subclassing a public bean - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -class PrivateBean1a - extends PublicBean1 -{ -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2b.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2b.java deleted file mode 100644 index ebd9fdf..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2b.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A private implementation of a public interface - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -class PrivateBean2b - implements PublicInterface2 -{ - public Object getValue () { return "got the value"; } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2c.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2c.java deleted file mode 100644 index 2e1dbfd..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2c.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A private subclass of a public class impelementing a public - * interface - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -class PrivateBean2c - extends PublicBean2a -{ -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2d.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2d.java deleted file mode 100644 index 6863183..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PrivateBean2d.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A private subclass of a private class impelementing a public - * interface - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -class PrivateBean2d - extends PrivateBean2b -{ -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1.java deleted file mode 100644 index 88ca215..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A publicly-accessible bean - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public class PublicBean1 -{ - public Object getValue () { return "got the value"; } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1b.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1b.java deleted file mode 100644 index eca8b8b..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean1b.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A public bean subclassing a private bean subclassing a public - * bean - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public class PublicBean1b - extends PrivateBean1a -{ -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean2a.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean2a.java deleted file mode 100644 index 3bd669c..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicBean2a.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A publicly-accessible implementation of a public interface - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public class PublicBean2a - implements PublicInterface2 -{ - public Object getValue () { return "got the value"; } -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicInterface2.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicInterface2.java deleted file mode 100644 index 6ec7e52..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/beans/PublicInterface2.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.beans; - -/** - * - *

A publicly-accessible interface - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181181 $$DateTime: 2001/06/26 09:55:09 $$Author: kchung $ - **/ - -public interface PublicInterface2 -{ - public Object getValue (); -} diff --git a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/mock/PageContextImpl.java b/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/mock/PageContextImpl.java deleted file mode 100644 index b442295..0000000 --- a/impl/src/test/java/org/apache/taglibs/standard/lang/jstl/test/mock/PageContextImpl.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * Copyright (c) 1997-2020 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020 Payara Services Ltd. - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.taglibs.standard.lang.jstl.test.mock; - -import jakarta.servlet.Servlet; -import jakarta.servlet.ServletConfig; -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletRequest; -import jakarta.servlet.ServletResponse; -import jakarta.servlet.http.HttpSession; -import jakarta.servlet.jsp.JspWriter; -import jakarta.servlet.jsp.PageContext; -import jakarta.servlet.jsp.el.ExpressionEvaluator; -import jakarta.servlet.jsp.el.VariableResolver; - -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -/** - *

This is a "dummy" implementation of PageContext whose only - * purpose is to serve the attribute getter/setter API's. - * - * @author Nathan Abramson - Art Technology Group - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - */ -public class PageContextImpl extends PageContext { - //------------------------------------- - // Properties - //------------------------------------- - - //------------------------------------- - // Member variables - //------------------------------------- - - Map mPage = Collections.synchronizedMap(new HashMap<>()); - Map mRequest = Collections.synchronizedMap (new HashMap<>()); - Map mSession = Collections.synchronizedMap (new HashMap<>()); - Map mApp = Collections.synchronizedMap (new HashMap<>()); - - //------------------------------------- - /** - * - * Constructor - **/ - public PageContextImpl () - { - } - - //------------------------------------- - // PageContext methods - //------------------------------------- - @Override -public void initialize (Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needSession, - int bufferSize, - boolean autoFlush) - { - } - - //------------------------------------- - @Override -public void release () - { - } - - //------------------------------------- - @Override - public void setAttribute (String name, Object attribute) { - mPage.put (name, attribute); - } - - //------------------------------------- - @Override -public void setAttribute (String name, - Object attribute, - int scope) - { - switch (scope) { - case PAGE_SCOPE: - mPage.put (name, attribute); - break; - case REQUEST_SCOPE: - mRequest.put (name, attribute); - break; - case SESSION_SCOPE: - mSession.put (name, attribute); - break; - case APPLICATION_SCOPE: - mApp.put (name, attribute); - break; - default: - throw new IllegalArgumentException ("Bad scope " + scope); - } - } - - //------------------------------------- - @Override -public Object getAttribute (String name) - { - return mPage.get (name); - } - - //------------------------------------- - @Override -public Object getAttribute (String name, - int scope) - { - switch (scope) { - case PAGE_SCOPE: - return mPage.get (name); - case REQUEST_SCOPE: - return mRequest.get (name); - case SESSION_SCOPE: - return mSession.get (name); - case APPLICATION_SCOPE: - return mApp.get (name); - default: - throw new IllegalArgumentException ("Bad scope " + scope); - } - } - - //------------------------------------- - @Override -public Object findAttribute (String name) - { - if (mPage.containsKey (name)) { - return mPage.get (name); - } - else if (mRequest.containsKey (name)) { - return mRequest.get (name); - } - else if (mSession.containsKey (name)) { - return mSession.get (name); - } - else if (mApp.containsKey (name)) { - return mApp.get (name); - } - else { - return null; - } - } - - //------------------------------------- - @Override -public void removeAttribute (String name) - { - if (mPage.containsKey (name)) { - mPage.remove (name); - } - else if (mRequest.containsKey (name)) { - mRequest.remove (name); - } - else if (mSession.containsKey (name)) { - mSession.remove (name); - } - else if (mApp.containsKey (name)) { - mApp.remove (name); - } - } - - //------------------------------------- - @Override -public void removeAttribute (String name, - int scope) - { - switch (scope) { - case PAGE_SCOPE: - mPage.remove (name); - break; - case REQUEST_SCOPE: - mRequest.remove (name); - break; - case SESSION_SCOPE: - mSession.remove (name); - break; - case APPLICATION_SCOPE: - mApp.remove (name); - break; - default: - throw new IllegalArgumentException ("Bad scope " + scope); - } - } - - //------------------------------------- - @Override -public int getAttributesScope (String name) - { - if (mPage.containsKey (name)) { - return PAGE_SCOPE; - } - else if (mRequest.containsKey (name)) { - return REQUEST_SCOPE; - } - else if (mSession.containsKey (name)) { - return SESSION_SCOPE; - } - else if (mApp.containsKey (name)) { - return APPLICATION_SCOPE; - } - else { - return 0; - } - } - - //------------------------------------- - @Override - public Enumeration getAttributeNamesInScope(int scope) { - return null; - } - - //------------------------------------- - @Override -public JspWriter getOut () - { - return null; - } - - //------------------------------------- - @Override -public HttpSession getSession () - { - return null; - } - - //------------------------------------- - @Override -public Object getPage () - { - return null; - } - - //------------------------------------- - @Override -public ServletRequest getRequest () - { - return null; - } - - //------------------------------------- - @Override -public ServletResponse getResponse () - { - return null; - } - - //------------------------------------- - @Override -public Exception getException () - { - return null; - } - - //------------------------------------- - @Override -public ServletConfig getServletConfig () - { - return null; - } - - //------------------------------------- - @Override -public ServletContext getServletContext () - { - return null; - } - - //------------------------------------- - @Override -public void forward (String path) - { - } - - //------------------------------------- - @Override -public void include (String path) - { - } - - //------------------------------------- - @Override -public void handlePageException (Exception exc) - { - } - - //------------------------------------- - @Override -public void handlePageException (Throwable exc) - { - } - - //------------------------------------- - - // Since JSP 2.0 - @Override -public void include(java.lang.String relativeUrlPath, boolean flush) {} - @Override -public ExpressionEvaluator getExpressionEvaluator() { return null; } - @Override -public VariableResolver getVariableResolver() { return null; } - - // Since JSP 2.1 - @Override -public jakarta.el.ELContext getELContext() { return null; } - -} diff --git a/impl/src/test/resources/evaluationTests.txt b/impl/src/test/resources/evaluationTests.txt deleted file mode 100644 index 98ba045..0000000 --- a/impl/src/test/resources/evaluationTests.txt +++ /dev/null @@ -1,1058 +0,0 @@ -# The set of evaluator tests - -####################################################### -# basic literals -${1} -int -${-12} -int -${true} -boolean -${false} -boolean -${null} -java.lang.String -${4.2} -double -${-21.3} -float -${4.} -float -${.21} -float -${3e-1} -double -${.2222222222} -double - - -####################################################### -# basic relationals between literals - -${1 < 2} -boolean -${1 > 2} -boolean -${1 >= 2} -boolean -${1 <= 2} -boolean -${1 == 2} -boolean -${1 != 2} -boolean -${3 >= 3} -boolean -${3 <= 3} -boolean -${3 == 3} -boolean -${3 < 3} -boolean -${3 > 3} -boolean -${3 != 3} -boolean - - -####################################################### -# relationals between booleans - -${false < true} -java.lang.Object -${false > true} -java.lang.Object -${true >= true} -java.lang.Object -${true <= true} -java.lang.Object -${true == true} -java.lang.Object -${true != true} -java.lang.Object - -####################################################### -# looking up objects in scopes - -# val1a - defined in page scope -${pageScope.val1a} -java.lang.String -${requestScope.val1a} -java.lang.String -${sessionScope.val1a} -java.lang.String -${applicationScope.val1a} -java.lang.String -${val1a} -java.lang.String - -# val1b - defined in request scope -${pageScope.val1b} -java.lang.String -${requestScope.val1b} -java.lang.String -${sessionScope.val1b} -java.lang.String -${applicationScope.val1b} -java.lang.String -${val1b} -java.lang.String - -# val1c - defined in session scope -${pageScope.val1c} -java.lang.String -${requestScope.val1c} -java.lang.String -${sessionScope.val1c} -java.lang.String -${applicationScope.val1c} -java.lang.String -${val1c} -java.lang.String - -# val1d - defined in application scope -${pageScope.val1d} -java.lang.String -${requestScope.val1d} -java.lang.String -${sessionScope.val1d} -java.lang.String -${applicationScope.val1d} -java.lang.String -${val1d} -java.lang.String - -####################################################### -# accessing properties - -${bean1a.int1} -int -${bean1a.boolean1} -boolean -${bean1a.string1} -java.lang.String -${bean1a.bean1.int2} -int -${bean1a.bean1.bean2.string2} -java.lang.String - -####################################################### -# test the entire conversion matrix - -${bean1a.byte1} -byte -${bean1a.byte1} -char -${bean1a.byte1} -short -${bean1a.byte1} -int -${bean1a.byte1} -long -${bean1a.byte1} -float -${bean1a.byte1} -double - -${bean1a.char1} -byte -${bean1a.char1} -char -${bean1a.char1} -short -${bean1a.char1} -int -${bean1a.char1} -long -${bean1a.char1} -float -${bean1a.char1} -double - -${bean1a.short1} -byte -${bean1a.short1} -char -${bean1a.short1} -short -${bean1a.short1} -int -${bean1a.short1} -long -${bean1a.short1} -float -${bean1a.short1} -double - -${bean1a.int1} -byte -${bean1a.int1} -char -${bean1a.int1} -short -${bean1a.int1} -int -${bean1a.int1} -long -${bean1a.int1} -float -${bean1a.int1} -double - -${bean1a.long1} -byte -${bean1a.long1} -char -${bean1a.long1} -short -${bean1a.long1} -int -${bean1a.long1} -long -${bean1a.long1} -float -${bean1a.long1} -double - -${bean1a.float1} -byte -${bean1a.float1} -char -${bean1a.float1} -short -${bean1a.float1} -int -${bean1a.float1} -long -${bean1a.float1} -float -${bean1a.float1} -double - -${bean1a.double1} -byte -${bean1a.double1} -char -${bean1a.double1} -short -${bean1a.double1} -int -${bean1a.double1} -long -${bean1a.double1} -float -${bean1a.double1} -double - -####################################################### -# test the entire relational comparison type promotion matrix - -${bean1a.byte1 < bean1a.byte1} -boolean -${bean1a.byte1 < bean1a.char1} -boolean -${bean1a.byte1 < bean1a.short1} -boolean -${bean1a.byte1 < bean1a.int1} -boolean -${bean1a.byte1 < bean1a.long1} -boolean -${bean1a.byte1 < bean1a.float1} -boolean -${bean1a.byte1 < bean1a.double1} -boolean - -${bean1a.char1 < bean1a.byte1} -boolean -${bean1a.char1 < bean1a.char1} -boolean -${bean1a.char1 < bean1a.short1} -boolean -${bean1a.char1 < bean1a.int1} -boolean -${bean1a.char1 < bean1a.long1} -boolean -${bean1a.char1 < bean1a.float1} -boolean -${bean1a.char1 < bean1a.double1} -boolean - -${bean1a.short1 < bean1a.byte1} -boolean -${bean1a.short1 < bean1a.char1} -boolean -${bean1a.short1 < bean1a.short1} -boolean -${bean1a.short1 < bean1a.int1} -boolean -${bean1a.short1 < bean1a.long1} -boolean -${bean1a.short1 < bean1a.float1} -boolean -${bean1a.short1 < bean1a.double1} -boolean - -${bean1a.int1 < bean1a.byte1} -boolean -${bean1a.int1 < bean1a.char1} -boolean -${bean1a.int1 < bean1a.short1} -boolean -${bean1a.int1 < bean1a.int1} -boolean -${bean1a.int1 < bean1a.long1} -boolean -${bean1a.int1 < bean1a.float1} -boolean -${bean1a.int1 < bean1a.double1} -boolean - -${bean1a.long1 < bean1a.byte1} -boolean -${bean1a.long1 < bean1a.char1} -boolean -${bean1a.long1 < bean1a.short1} -boolean -${bean1a.long1 < bean1a.int1} -boolean -${bean1a.long1 < bean1a.long1} -boolean -${bean1a.long1 < bean1a.float1} -boolean -${bean1a.long1 < bean1a.double1} -boolean - -${bean1a.float1 < bean1a.byte1} -boolean -${bean1a.float1 < bean1a.char1} -boolean -${bean1a.float1 < bean1a.short1} -boolean -${bean1a.float1 < bean1a.int1} -boolean -${bean1a.float1 < bean1a.long1} -boolean -${bean1a.float1 < bean1a.float1} -boolean -${bean1a.float1 < bean1a.double1} -boolean - -${bean1a.double1 < bean1a.byte1} -boolean -${bean1a.double1 < bean1a.char1} -boolean -${bean1a.double1 < bean1a.short1} -boolean -${bean1a.double1 < bean1a.int1} -boolean -${bean1a.double1 < bean1a.long1} -boolean -${bean1a.double1 < bean1a.float1} -boolean -${bean1a.double1 < bean1a.double1} -boolean - -####################################################### -# test other relational comparison rules - -${null == null} -boolean -${noSuchAttribute == noSuchAttribute} -boolean -${noSuchAttribute == null} -boolean -${null == noSuchAttribute} -boolean -${bean1a == null} -boolean -${null == bean1a} -boolean -${bean1a == bean1a} -boolean -${bean1a > "hello"} -boolean -${bean1a.bean1 < 14} -boolean -${bean1a.bean1 == "hello"} -boolean - -####################################################### -# test String comparisons - -${bean1a.string1 == "hello"} -boolean -${bean1a.string1 != "hello"} -boolean -${bean1a.string1 == "goodbye"} -boolean -${bean1a.string1 != "goodbye"} -boolean -${bean1a.string1 > "goodbye"} -boolean -${"hello" == bean1a.string1} -boolean -${"goodbye" > bean1a.string1} -boolean - -####################################################### -# test errors in property traversal - -${noSuchAttribute.abc} -java.lang.Object -${bean1a.bean2.byte1} -java.lang.Object -${bean1a.noProperty} -java.lang.Object -${bean1a.noGetter} -java.lang.Object -${bean1a.errorInGetter} -java.lang.Object -${bean1a.bean2.string2} -java.lang.Object - -####################################################### -# test accessing public properties from private classes - -${pbean1.value} -java.lang.Object -${pbean2.value} -java.lang.Object -${pbean3.value} -java.lang.Object -${pbean4.value} -java.lang.Object -${pbean5.value} -java.lang.Object -${pbean6.value} -java.lang.Object -${pbean7.value} -java.lang.Object - -####################################################### -# test literal conversions - -true -boolean -false -boolean -12 -byte -12 -char -12 -short -12 -int -12 -long -12 -float -12 -double - -hello -org.apache.taglibs.standard.lang.jstl.test.Bean2 -badvalue -org.apache.taglibs.standard.lang.jstl.test.Bean2 -hello -org.apache.taglibs.standard.lang.jstl.test.Bean1 - -####################################################### -# test null values bumped up to constants - -${null} -boolean -${null} -byte -${null} -short -#${null} -#char - -${null} -int -${null} -long -${null} -float -${null} -double -${null} -java.lang.Boolean -${null} -java.lang.Byte -${null} -java.lang.Short -#${null} -#java.lang.Character - -${null} -java.lang.Integer -${null} -java.lang.Long -${null} -java.lang.Float -${null} -java.lang.Double - - -####################################################### -# test reserved words as identifiers - -${and} -java.lang.Object -${or} -java.lang.Object -${not} -java.lang.Object -${eq} -java.lang.Object -${ne} -java.lang.Object -${lt} -java.lang.Object -${gt} -java.lang.Object -${le} -java.lang.Object -${ge} -java.lang.Object -${instanceof} -java.lang.Object -${true} -java.lang.Object -${false} -java.lang.Object -${null} -java.lang.Object - - -####################################################### -# test reserved words as property names - -${bean1a.and} -java.lang.Object -${bean1a.or} -java.lang.Object -${bean1a.not} -java.lang.Object -${bean1a.eq} -java.lang.Object -${bean1a.ne} -java.lang.Object -${bean1a.lt} -java.lang.Object -${bean1a.gt} -java.lang.Object -${bean1a.le} -java.lang.Object -${bean1a.ge} -java.lang.Object -${bean1a.instanceof} -java.lang.Object -${bean1a.page} -java.lang.Object -${bean1a.request} -java.lang.Object -${bean1a.session} -java.lang.Object -${bean1a.application} -java.lang.Object -${bean1a.true} -java.lang.Object -${bean1a.false} -java.lang.Object -${bean1a.null} -java.lang.Object - -####################################################### -# test arithmetic - -${3+5} -java.lang.Object -${3-5} -java.lang.Object -${3/5} -java.lang.Object -${3*5} -java.lang.Object -${3*5.0} -java.lang.Object -${3.0*5} -java.lang.Object -${3.0*5.0} -java.lang.Object -${225 % 17} -java.lang.Object - -${ 1 + 2 + 3 * 5 + 6} -java.lang.Object -${ 1 + (2 + 3) * 5 + 6} -java.lang.Object - -####################################################### -# test logical operators - -${ true} -java.lang.Object -${ not true} -java.lang.Object -${ not false} -java.lang.Object -${ not not true} -java.lang.Object -${ not not false} -java.lang.Object -${ true and false} -java.lang.Object -${ true and true} -java.lang.Object -${ false and true} -java.lang.Object -${ false and false} -java.lang.Object -${ true or false} -java.lang.Object -${ true or true} -java.lang.Object -${ false or true} -java.lang.Object -${ false or false} -java.lang.Object - -${ false or false or false or true and false} -java.lang.Object -${ false or false or false or true and false or true} -java.lang.Object - -####################################################### -# test indexed access operator - -# Test as equivalent to property accessor -${ bean1a["double1"] } -java.lang.Object -${ bean1a["double1"].class } -java.lang.Object - -# Test as array accessor -${ bean1a.stringArray1[-1]} -java.lang.Object -${ bean1a.stringArray1[0]} -java.lang.Object -${ bean1a.stringArray1[1]} -java.lang.Object -${ bean1a.stringArray1[2]} -java.lang.Object -${ bean1a.stringArray1[3]} -java.lang.Object -${ bean1a.stringArray1[4]} -java.lang.Object - -# Test as list accessor -${ bean1a.list1 [0] } -java.lang.Object -${ bean1a.list1 [1] } -java.lang.Object -${ bean1a.list1 [2][2] } -java.lang.Object - -# Test as indexed property accessor -${ bean1a.indexed1[-1]} -java.lang.Object -${ bean1a.indexed1[0]} -java.lang.Object -${ bean1a.indexed1[1]} -java.lang.Object -${ bean1a.indexed1[2]} -java.lang.Object -${ bean1a.indexed1[3]} -java.lang.Object -${ bean1a.indexed1[4]} -java.lang.Object - -# Test as map accessor -${ bean1a.map1.key1 } -java.lang.Object -${ bean1a.map1 ["key1"] } -java.lang.Object -${ bean1a.map1 [14] } -java.lang.Object -${ bean1a.map1 [2 * 7] } -java.lang.Object -${ bean1a.map1.recurse.list1[0] } -java.lang.Object - -####################################################### -# test String concatenation - -${ "a" + "bcd" } -java.lang.Object -${ "a" + (4*3) } -java.lang.Object -${ bean1a.map1 ["key" + (5-4)] } -java.lang.Object - -####################################################### -# test String comparisons - -${ "30" < "4" } -java.lang.Object -${ 30 < "4" } -java.lang.Object -${ 30 > "4" } -java.lang.Object -${ "0004" == "4" } -java.lang.Object - -####################################################### -# test relational comparison with alternate symbols - -${ 4 eq 3} -java.lang.Object -${ 4 ne 3} -java.lang.Object -${ 4 eq 4} -java.lang.Object -${ 4 ne 4} -java.lang.Object -${ 4 lt 3} -java.lang.Object -${ 4 gt 3} -java.lang.Object -${ 4 le 3} -java.lang.Object -${ 4 ge 3} -java.lang.Object -${ 4 le 4} -java.lang.Object -${ 4 ge 4} -java.lang.Object - -####################################################### -# test expressions on the left side of a value suffix - -${(3).class} -java.lang.Object -${(bean1a.map1)["key1"]} -java.lang.Object - - -####################################################### -# test String/boolean logical operators - -${'true' and false} -java.lang.Object -${'true' or true} -java.lang.Object -${false and 'true'} -java.lang.Object -${false or 'true'} -java.lang.Object - -####################################################### -# test empty operator - -${ empty "A"} -java.lang.Object -${ empty "" } -java.lang.Object -${ empty null } -java.lang.Object -${ empty false} -java.lang.Object -${ empty 0} -java.lang.Object -${ not empty 0} -java.lang.Object -${ not empty empty 0} -java.lang.Object -${ empty emptyTests.emptyArray } -java.lang.Object -${ empty emptyTests.nonemptyArray } -java.lang.Object -${ empty emptyTests.emptyList } -java.lang.Object -${ empty emptyTests.nonemptyList } -java.lang.Object -${ empty emptyTests.emptyMap } -java.lang.Object -${ empty emptyTests.nonemptyMap } -java.lang.Object -${ empty emptyTests.emptySet } -java.lang.Object -${ empty emptyTests.nonemptySet } -java.lang.Object - -####################################################### -# test String arithmetic - -${ "6" / "3" } -java.lang.Object -${ 3 + "4" } -java.lang.Object -${ "4" + 3 } -java.lang.Object -${ 3 + "4.5" } -java.lang.Object -${ "4.5" + 3 } -java.lang.Object -${ 3.0 + 6.0} -java.lang.Object -${ 31121.0 * 61553.0 } -java.lang.Object -${ 31121 * 61553 } -java.lang.Object -${ 65536 * 65536 * 65536 * 32759 } -java.lang.Object -${ 9220838762064379904.0 - 9220838762064379900.0 } -java.lang.Object -${ 9220838762064379904 - 9220838762064379900 } -java.lang.Object - -####################################################### -# test relational operators involving null - -${ null == null } -java.lang.Object -${ null != null } -java.lang.Object -${ null > null } -java.lang.Object -${ null < null } -java.lang.Object -${ null >= null } -java.lang.Object -${ null <= null } -java.lang.Object - -${ null == 3 } -java.lang.Object -${ null != 3 } -java.lang.Object -${ null > 3 } -java.lang.Object -${ null < 3 } -java.lang.Object -${ null >= 3 } -java.lang.Object -${ null <= 3 } -java.lang.Object - -${ 3 == null } -java.lang.Object -${ 3 != null } -java.lang.Object -${ 3 > null } -java.lang.Object -${ 3 < null } -java.lang.Object -${ 3 >= null } -java.lang.Object -${ 3 <= null } -java.lang.Object - -${ null == "" } -java.lang.Object -${ null != "" } -java.lang.Object -${ "" == null } -java.lang.Object -${ "" != null } -java.lang.Object - -####################################################### -# arithmetic operators involving Strings - -${ 4 + 3 } -java.lang.Object -${ 4.0 + 3 } -java.lang.Object -${ 4 + 3.0 } -java.lang.Object -${ 4.0 + 3.0 } -java.lang.Object -${ "4" + 3 } -java.lang.Object -${ "4.0" + 3 } -java.lang.Object -${ "4" + 3.0 } -java.lang.Object -${ "4.0" + 3.0 } -java.lang.Object -${ 4 + "3" } -java.lang.Object -${ 4.0 + "3" } -java.lang.Object -${ 4 + "3.0" } -java.lang.Object -${ 4.0 + "3.0" } -java.lang.Object -${ "4" + "3" } -java.lang.Object -${ "4.0" + "3" } -java.lang.Object -${ "4" + "3.0" } -java.lang.Object -${ "4.0" + "3.0" } -java.lang.Object - - -${ 4 - 3 } -java.lang.Object -${ 4.0 - 3 } -java.lang.Object -${ 4 - 3.0 } -java.lang.Object -${ 4.0 - 3.0 } -java.lang.Object -${ "4" - 3 } -java.lang.Object -${ "4.0" - 3 } -java.lang.Object -${ "4" - 3.0 } -java.lang.Object -${ "4.0" - 3.0 } -java.lang.Object -${ 4 - "3" } -java.lang.Object -${ 4.0 - "3" } -java.lang.Object -${ 4 - "3.0" } -java.lang.Object -${ 4.0 - "3.0" } -java.lang.Object -${ "4" - "3" } -java.lang.Object -${ "4.0" - "3" } -java.lang.Object -${ "4" - "3.0" } -java.lang.Object -${ "4.0" - "3.0" } -java.lang.Object - - -${ 4 * 3 } -java.lang.Object -${ 4.0 * 3 } -java.lang.Object -${ 4 * 3.0 } -java.lang.Object -${ 4.0 * 3.0 } -java.lang.Object -${ "4" * 3 } -java.lang.Object -${ "4.0" * 3 } -java.lang.Object -${ "4" * 3.0 } -java.lang.Object -${ "4.0" * 3.0 } -java.lang.Object -${ 4 * "3" } -java.lang.Object -${ 4.0 * "3" } -java.lang.Object -${ 4 * "3.0" } -java.lang.Object -${ 4.0 * "3.0" } -java.lang.Object -${ "4" * "3" } -java.lang.Object -${ "4.0" * "3" } -java.lang.Object -${ "4" * "3.0" } -java.lang.Object -${ "4.0" * "3.0" } -java.lang.Object - - -${ 4 / 3 } -java.lang.Object -${ 4.0 / 3 } -java.lang.Object -${ 4 / 3.0 } -java.lang.Object -${ 4.0 / 3.0 } -java.lang.Object -${ "4" / 3 } -java.lang.Object -${ "4.0" / 3 } -java.lang.Object -${ "4" / 3.0 } -java.lang.Object -${ "4.0" / 3.0 } -java.lang.Object -${ 4 / "3" } -java.lang.Object -${ 4.0 / "3" } -java.lang.Object -${ 4 / "3.0" } -java.lang.Object -${ 4.0 / "3.0" } -java.lang.Object -${ "4" / "3" } -java.lang.Object -${ "4.0" / "3" } -java.lang.Object -${ "4" / "3.0" } -java.lang.Object -${ "4.0" / "3.0" } -java.lang.Object - - -${ 4 % 3 } -java.lang.Object -${ 4.0 % 3 } -java.lang.Object -${ 4 % 3.0 } -java.lang.Object -${ 4.0 % 3.0 } -java.lang.Object -${ "4" % 3 } -java.lang.Object -${ "4.0" % 3 } -java.lang.Object -${ "4" % 3.0 } -java.lang.Object -${ "4.0" % 3.0 } -java.lang.Object -${ 4 % "3" } -java.lang.Object -${ 4.0 % "3" } -java.lang.Object -${ 4 % "3.0" } -java.lang.Object -${ 4.0 % "3.0" } -java.lang.Object -${ "4" % "3" } -java.lang.Object -${ "4.0" % "3" } -java.lang.Object -${ "4" % "3.0" } -java.lang.Object -${ "4.0" % "3.0" } -java.lang.Object - - -${ "8" / "2" } -java.lang.Object -${ "4e2" + "3" } -java.lang.Object -${ "4" + "3e2" } -java.lang.Object -${ "4e2" + "3e2" } -java.lang.Object - - -####################################################### -# unary minus operator involving Strings - -${ -3 } -java.lang.Object -${ -3.0 } -java.lang.Object -${ -"3" } -java.lang.Object -${ -"3.0" } -java.lang.Object -${ -"3e2" } -java.lang.Object diff --git a/impl/src/test/resources/evaluationTestsOutput.txt b/impl/src/test/resources/evaluationTestsOutput.txt deleted file mode 100644 index 10aad85..0000000 --- a/impl/src/test/resources/evaluationTestsOutput.txt +++ /dev/null @@ -1,2345 +0,0 @@ -# The set of evaluator tests - -####################################################### -# basic literals -Expression: ${1} -ExpectedType: int -Evaluates to: 1 -With type: java.lang.Integer - -Expression: ${-12} -ExpectedType: int -Evaluates to: -12 -With type: java.lang.Integer - -Expression: ${true} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${false} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${null} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${4.2} -ExpectedType: double -Evaluates to: 4.2 -With type: java.lang.Double - -Expression: ${-21.3} -ExpectedType: float -Evaluates to: -21.3 -With type: java.lang.Float - -Expression: ${4.} -ExpectedType: float -Evaluates to: 4.0 -With type: java.lang.Float - -Expression: ${.21} -ExpectedType: float -Evaluates to: 0.21 -With type: java.lang.Float - -Expression: ${3e-1} -ExpectedType: double -Evaluates to: 0.3 -With type: java.lang.Double - -Expression: ${.2222222222} -ExpectedType: double -Evaluates to: 0.2222222222 -With type: java.lang.Double - - - -####################################################### -# basic relationals between literals - -Expression: ${1 < 2} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${1 > 2} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${1 >= 2} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${1 <= 2} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${1 == 2} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${1 != 2} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${3 >= 3} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${3 <= 3} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${3 == 3} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${3 < 3} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${3 > 3} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${3 != 3} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - - - -####################################################### -# relationals between booleans - -Expression: ${false < true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${false > true} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${true >= true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${true <= true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${true == true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${true != true} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - - -####################################################### -# looking up objects in scopes - -# val1a - defined in page scope -Expression: ${pageScope.val1a} -ExpectedType: class java.lang.String -Evaluates to: page-scoped1 -With type: java.lang.String - -Expression: ${requestScope.val1a} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${sessionScope.val1a} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${applicationScope.val1a} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${val1a} -ExpectedType: class java.lang.String -Evaluates to: page-scoped1 -With type: java.lang.String - - -# val1b - defined in request scope -Expression: ${pageScope.val1b} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${requestScope.val1b} -ExpectedType: class java.lang.String -Evaluates to: request-scoped1 -With type: java.lang.String - -Expression: ${sessionScope.val1b} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${applicationScope.val1b} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${val1b} -ExpectedType: class java.lang.String -Evaluates to: request-scoped1 -With type: java.lang.String - - -# val1c - defined in session scope -Expression: ${pageScope.val1c} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${requestScope.val1c} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${sessionScope.val1c} -ExpectedType: class java.lang.String -Evaluates to: session-scoped1 -With type: java.lang.String - -Expression: ${applicationScope.val1c} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${val1c} -ExpectedType: class java.lang.String -Evaluates to: session-scoped1 -With type: java.lang.String - - -# val1d - defined in application scope -Expression: ${pageScope.val1d} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${requestScope.val1d} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${sessionScope.val1d} -ExpectedType: class java.lang.String -Evaluates to: -With type: java.lang.String - -Expression: ${applicationScope.val1d} -ExpectedType: class java.lang.String -Evaluates to: app-scoped1 -With type: java.lang.String - -Expression: ${val1d} -ExpectedType: class java.lang.String -Evaluates to: app-scoped1 -With type: java.lang.String - - -####################################################### -# accessing properties - -Expression: ${bean1a.int1} -ExpectedType: int -Evaluates to: 4 -With type: java.lang.Integer - -Expression: ${bean1a.boolean1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.string1} -ExpectedType: class java.lang.String -Evaluates to: hello -With type: java.lang.String - -Expression: ${bean1a.bean1.int2} -ExpectedType: int -Evaluates to: -224 -With type: java.lang.Integer - -Expression: ${bean1a.bean1.bean2.string2} -ExpectedType: class java.lang.String -Evaluates to: bean3's string -With type: java.lang.String - - -####################################################### -# test the entire conversion matrix - -Expression: ${bean1a.byte1} -ExpectedType: byte -Evaluates to: 12 -With type: java.lang.Byte - -Expression: ${bean1a.byte1} -ExpectedType: char -Evaluates to: -With type: java.lang.Character - -Expression: ${bean1a.byte1} -ExpectedType: short -Evaluates to: 12 -With type: java.lang.Short - -Expression: ${bean1a.byte1} -ExpectedType: int -Evaluates to: 12 -With type: java.lang.Integer - -Expression: ${bean1a.byte1} -ExpectedType: long -Evaluates to: 12 -With type: java.lang.Long - -Expression: ${bean1a.byte1} -ExpectedType: float -Evaluates to: 12.0 -With type: java.lang.Float - -Expression: ${bean1a.byte1} -ExpectedType: double -Evaluates to: 12.0 -With type: java.lang.Double - - -Expression: ${bean1a.char1} -ExpectedType: byte -Evaluates to: 98 -With type: java.lang.Byte - -Expression: ${bean1a.char1} -ExpectedType: char -Evaluates to: b -With type: java.lang.Character - -Expression: ${bean1a.char1} -ExpectedType: short -Evaluates to: 98 -With type: java.lang.Short - -Expression: ${bean1a.char1} -ExpectedType: int -Evaluates to: 98 -With type: java.lang.Integer - -Expression: ${bean1a.char1} -ExpectedType: long -Evaluates to: 98 -With type: java.lang.Long - -Expression: ${bean1a.char1} -ExpectedType: float -Evaluates to: 98.0 -With type: java.lang.Float - -Expression: ${bean1a.char1} -ExpectedType: double -Evaluates to: 98.0 -With type: java.lang.Double - - -Expression: ${bean1a.short1} -ExpectedType: byte -Evaluates to: -124 -With type: java.lang.Byte - -Expression: ${bean1a.short1} -ExpectedType: char -Evaluates to: ト -With type: java.lang.Character - -Expression: ${bean1a.short1} -ExpectedType: short -Evaluates to: -124 -With type: java.lang.Short - -Expression: ${bean1a.short1} -ExpectedType: int -Evaluates to: -124 -With type: java.lang.Integer - -Expression: ${bean1a.short1} -ExpectedType: long -Evaluates to: -124 -With type: java.lang.Long - -Expression: ${bean1a.short1} -ExpectedType: float -Evaluates to: -124.0 -With type: java.lang.Float - -Expression: ${bean1a.short1} -ExpectedType: double -Evaluates to: -124.0 -With type: java.lang.Double - - -Expression: ${bean1a.int1} -ExpectedType: byte -Evaluates to: 4 -With type: java.lang.Byte - -Expression: ${bean1a.int1} -ExpectedType: char -Evaluates to:  -With type: java.lang.Character - -Expression: ${bean1a.int1} -ExpectedType: short -Evaluates to: 4 -With type: java.lang.Short - -Expression: ${bean1a.int1} -ExpectedType: int -Evaluates to: 4 -With type: java.lang.Integer - -Expression: ${bean1a.int1} -ExpectedType: long -Evaluates to: 4 -With type: java.lang.Long - -Expression: ${bean1a.int1} -ExpectedType: float -Evaluates to: 4.0 -With type: java.lang.Float - -Expression: ${bean1a.int1} -ExpectedType: double -Evaluates to: 4.0 -With type: java.lang.Double - - -Expression: ${bean1a.long1} -ExpectedType: byte -Evaluates to: -41 -With type: java.lang.Byte - -Expression: ${bean1a.long1} -ExpectedType: char -Evaluates to: 擗 -With type: java.lang.Character - -Expression: ${bean1a.long1} -ExpectedType: short -Evaluates to: 25815 -With type: java.lang.Short - -Expression: ${bean1a.long1} -ExpectedType: int -Evaluates to: 222423 -With type: java.lang.Integer - -Expression: ${bean1a.long1} -ExpectedType: long -Evaluates to: 222423 -With type: java.lang.Long - -Expression: ${bean1a.long1} -ExpectedType: float -Evaluates to: 222423.0 -With type: java.lang.Float - -Expression: ${bean1a.long1} -ExpectedType: double -Evaluates to: 222423.0 -With type: java.lang.Double - - -Expression: ${bean1a.float1} -ExpectedType: byte -Evaluates to: 12 -With type: java.lang.Byte - -Expression: ${bean1a.float1} -ExpectedType: char -Evaluates to: -With type: java.lang.Character - -Expression: ${bean1a.float1} -ExpectedType: short -Evaluates to: 12 -With type: java.lang.Short - -Expression: ${bean1a.float1} -ExpectedType: int -Evaluates to: 12 -With type: java.lang.Integer - -Expression: ${bean1a.float1} -ExpectedType: long -Evaluates to: 12 -With type: java.lang.Long - -Expression: ${bean1a.float1} -ExpectedType: float -Evaluates to: 12.4 -With type: java.lang.Float - -Expression: ${bean1a.float1} -ExpectedType: double -Evaluates to: 12.399999618530273 -With type: java.lang.Double - - -Expression: ${bean1a.double1} -ExpectedType: byte -Evaluates to: 89 -With type: java.lang.Byte - -Expression: ${bean1a.double1} -ExpectedType: char -Evaluates to: Y -With type: java.lang.Character - -Expression: ${bean1a.double1} -ExpectedType: short -Evaluates to: 89 -With type: java.lang.Short - -Expression: ${bean1a.double1} -ExpectedType: int -Evaluates to: 89 -With type: java.lang.Integer - -Expression: ${bean1a.double1} -ExpectedType: long -Evaluates to: 89 -With type: java.lang.Long - -Expression: ${bean1a.double1} -ExpectedType: float -Evaluates to: 89.224 -With type: java.lang.Float - -Expression: ${bean1a.double1} -ExpectedType: double -Evaluates to: 89.224 -With type: java.lang.Double - - -####################################################### -# test the entire relational comparison type promotion matrix - -Expression: ${bean1a.byte1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.byte1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.byte1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.byte1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.byte1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.byte1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.byte1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - - -Expression: ${bean1a.char1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.char1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.char1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.char1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.char1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.char1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.char1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - - -Expression: ${bean1a.short1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.short1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.short1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.short1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.short1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.short1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.short1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - - -Expression: ${bean1a.int1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.int1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.int1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.int1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.int1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.int1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.int1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - - -Expression: ${bean1a.long1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.long1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.long1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.long1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.long1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.long1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.long1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - - -Expression: ${bean1a.float1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.float1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.float1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.float1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.float1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.float1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.float1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - - -Expression: ${bean1a.double1 < bean1a.byte1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.double1 < bean1a.char1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.double1 < bean1a.short1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.double1 < bean1a.int1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.double1 < bean1a.long1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.double1 < bean1a.float1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.double1 < bean1a.double1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - - -####################################################### -# test other relational comparison rules - -Expression: ${null == null} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${noSuchAttribute == noSuchAttribute} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${noSuchAttribute == null} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${null == noSuchAttribute} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a == null} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${null == bean1a} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a == bean1a} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a > "hello"} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.bean1 < 14} -ExpectedType: boolean -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.bean1 < 14}": Attempt to coerce a value of type "org.apache.taglibs.standard.lang.jstl.test.Bean1" to type "java.lang.Long" (null) - -Expression: ${bean1a.bean1 == "hello"} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - - -####################################################### -# test String comparisons - -Expression: ${bean1a.string1 == "hello"} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.string1 != "hello"} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.string1 == "goodbye"} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${bean1a.string1 != "goodbye"} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${bean1a.string1 > "goodbye"} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${"hello" == bean1a.string1} -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${"goodbye" > bean1a.string1} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - - -####################################################### -# test errors in property traversal - -Expression: ${noSuchAttribute.abc} -ExpectedType: class java.lang.Object -Evaluates to: null - -Expression: ${bean1a.bean2.byte1} -ExpectedType: class java.lang.Object -Evaluates to: null - -Expression: ${bean1a.noProperty} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.noProperty}": Unable to find a value for "noProperty" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.noGetter} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.noGetter}": Unable to find a value for "noGetter" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.errorInGetter} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.errorInGetter}": An error occurred while getting property "errorInGetter" from an instance of class org.apache.taglibs.standard.lang.jstl.test.Bean1 (java.lang.NullPointerException: Error!) - -Expression: ${bean1a.bean2.string2} -ExpectedType: class java.lang.Object -Evaluates to: null - - -####################################################### -# test accessing public properties from private classes - -Expression: ${pbean1.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - -Expression: ${pbean2.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - -Expression: ${pbean3.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - -Expression: ${pbean4.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - -Expression: ${pbean5.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - -Expression: ${pbean6.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - -Expression: ${pbean7.value} -ExpectedType: class java.lang.Object -Evaluates to: got the value -With type: java.lang.String - - -####################################################### -# test literal conversions - -Expression: true -ExpectedType: boolean -Evaluates to: true -With type: java.lang.Boolean - -Expression: false -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: 12 -ExpectedType: byte -Evaluates to: 12 -With type: java.lang.Byte - -Expression: 12 -ExpectedType: char -Evaluates to: 1 -With type: java.lang.Character - -Expression: 12 -ExpectedType: short -Evaluates to: 12 -With type: java.lang.Short - -Expression: 12 -ExpectedType: int -Evaluates to: 12 -With type: java.lang.Integer - -Expression: 12 -ExpectedType: long -Evaluates to: 12 -With type: java.lang.Long - -Expression: 12 -ExpectedType: float -Evaluates to: 12.0 -With type: java.lang.Float - -Expression: 12 -ExpectedType: double -Evaluates to: 12.0 -With type: java.lang.Double - - -Expression: hello -ExpectedType: class org.apache.taglibs.standard.lang.jstl.test.Bean2 -Evaluates to: Bean2[hello] -With type: org.apache.taglibs.standard.lang.jstl.test.Bean2 - -Expression: badvalue -ExpectedType: class org.apache.taglibs.standard.lang.jstl.test.Bean2 -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "badvalue": Unable to parse value "badvalue" into expected type "org.apache.taglibs.standard.lang.jstl.test.Bean2" (java.lang.IllegalArgumentException: Bad value badvalue) - -Expression: hello -ExpectedType: class org.apache.taglibs.standard.lang.jstl.test.Bean1 -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "hello": Attempt to convert String "hello" to type "org.apache.taglibs.standard.lang.jstl.test.Bean1", but there is no PropertyEditor for that type (null) - - -####################################################### -# test null values bumped up to constants - -Expression: ${null} -ExpectedType: boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${null} -ExpectedType: byte -Evaluates to: 0 -With type: java.lang.Byte - -Expression: ${null} -ExpectedType: short -Evaluates to: 0 -With type: java.lang.Short - -#${null} -#char - -Expression: ${null} -ExpectedType: int -Evaluates to: 0 -With type: java.lang.Integer - -Expression: ${null} -ExpectedType: long -Evaluates to: 0 -With type: java.lang.Long - -Expression: ${null} -ExpectedType: float -Evaluates to: 0.0 -With type: java.lang.Float - -Expression: ${null} -ExpectedType: double -Evaluates to: 0.0 -With type: java.lang.Double - -Expression: ${null} -ExpectedType: class java.lang.Boolean -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${null} -ExpectedType: class java.lang.Byte -Evaluates to: 0 -With type: java.lang.Byte - -Expression: ${null} -ExpectedType: class java.lang.Short -Evaluates to: 0 -With type: java.lang.Short - -#${null} -#java.lang.Character - -Expression: ${null} -ExpectedType: class java.lang.Integer -Evaluates to: 0 -With type: java.lang.Integer - -Expression: ${null} -ExpectedType: class java.lang.Long -Evaluates to: 0 -With type: java.lang.Long - -Expression: ${null} -ExpectedType: class java.lang.Float -Evaluates to: 0.0 -With type: java.lang.Float - -Expression: ${null} -ExpectedType: class java.lang.Double -Evaluates to: 0.0 -With type: java.lang.Double - - - -####################################################### -# test reserved words as identifiers - -Expression: ${and} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${and}": Encountered "and", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${or} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${or}": Encountered "or", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${not} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${not}": Encountered "}", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${eq} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${eq}": Encountered "eq", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${ne} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ne}": Encountered "ne", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${lt} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${lt}": Encountered "lt", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${gt} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${gt}": Encountered "gt", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${le} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${le}": Encountered "le", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${ge} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ge}": Encountered "ge", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] (null) - -Expression: ${instanceof} -ExpectedType: class java.lang.Object -Evaluates to: null - -Expression: ${true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${null} -ExpectedType: class java.lang.Object -Evaluates to: null - - - -####################################################### -# test reserved words as property names - -Expression: ${bean1a.and} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.and}": Encountered "and", expected one of [] (null) - -Expression: ${bean1a.or} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.or}": Encountered "or", expected one of [] (null) - -Expression: ${bean1a.not} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.not}": Encountered "not", expected one of [] (null) - -Expression: ${bean1a.eq} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.eq}": Encountered "eq", expected one of [] (null) - -Expression: ${bean1a.ne} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.ne}": Encountered "ne", expected one of [] (null) - -Expression: ${bean1a.lt} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.lt}": Encountered "lt", expected one of [] (null) - -Expression: ${bean1a.gt} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.gt}": Encountered "gt", expected one of [] (null) - -Expression: ${bean1a.le} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.le}": Encountered "le", expected one of [] (null) - -Expression: ${bean1a.ge} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.ge}": Encountered "ge", expected one of [] (null) - -Expression: ${bean1a.instanceof} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.instanceof}": Unable to find a value for "instanceof" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.page} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.page}": Unable to find a value for "page" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.request} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.request}": Unable to find a value for "request" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.session} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.session}": Unable to find a value for "session" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.application} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.application}": Unable to find a value for "application" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${bean1a.true} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.true}": Encountered "true", expected one of [] (null) - -Expression: ${bean1a.false} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.false}": Encountered "false", expected one of [] (null) - -Expression: ${bean1a.null} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${bean1a.null}": Encountered "null", expected one of [] (null) - - -####################################################### -# test arithmetic - -Expression: ${3+5} -ExpectedType: class java.lang.Object -Evaluates to: 8 -With type: java.lang.Long - -Expression: ${3-5} -ExpectedType: class java.lang.Object -Evaluates to: -2 -With type: java.lang.Long - -Expression: ${3/5} -ExpectedType: class java.lang.Object -Evaluates to: 0.6 -With type: java.lang.Double - -Expression: ${3*5} -ExpectedType: class java.lang.Object -Evaluates to: 15 -With type: java.lang.Long - -Expression: ${3*5.0} -ExpectedType: class java.lang.Object -Evaluates to: 15.0 -With type: java.lang.Double - -Expression: ${3.0*5} -ExpectedType: class java.lang.Object -Evaluates to: 15.0 -With type: java.lang.Double - -Expression: ${3.0*5.0} -ExpectedType: class java.lang.Object -Evaluates to: 15.0 -With type: java.lang.Double - -Expression: ${225 % 17} -ExpectedType: class java.lang.Object -Evaluates to: 4 -With type: java.lang.Long - - -Expression: ${ 1 + 2 + 3 * 5 + 6} -ExpectedType: class java.lang.Object -Evaluates to: 24 -With type: java.lang.Long - -Expression: ${ 1 + (2 + 3) * 5 + 6} -ExpectedType: class java.lang.Object -Evaluates to: 32 -With type: java.lang.Long - - -####################################################### -# test logical operators - -Expression: ${ true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ not true} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ not false} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ not not true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ not not false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ true and false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ true and true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ false and true} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ false and false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ true or false} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ true or true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ false or true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ false or false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - - -Expression: ${ false or false or false or true and false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ false or false or false or true and false or true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - - -####################################################### -# test indexed access operator - -# Test as equivalent to property accessor -Expression: ${ bean1a["double1"] } -ExpectedType: class java.lang.Object -Evaluates to: 89.224 -With type: java.lang.Double - -Expression: ${ bean1a["double1"].class } -ExpectedType: class java.lang.Object -Evaluates to: class java.lang.Double -With type: java.lang.Class - - -# Test as array accessor -Expression: ${ bean1a.stringArray1[-1]} -ExpectedType: class java.lang.Object -Evaluates to: null - -Expression: ${ bean1a.stringArray1[0]} -ExpectedType: class java.lang.Object -Evaluates to: string1 -With type: java.lang.String - -Expression: ${ bean1a.stringArray1[1]} -ExpectedType: class java.lang.Object -Evaluates to: string2 -With type: java.lang.String - -Expression: ${ bean1a.stringArray1[2]} -ExpectedType: class java.lang.Object -Evaluates to: string3 -With type: java.lang.String - -Expression: ${ bean1a.stringArray1[3]} -ExpectedType: class java.lang.Object -Evaluates to: string4 -With type: java.lang.String - -Expression: ${ bean1a.stringArray1[4]} -ExpectedType: class java.lang.Object -Evaluates to: null - - -# Test as list accessor -Expression: ${ bean1a.list1 [0] } -ExpectedType: class java.lang.Object -Evaluates to: 14 -With type: java.lang.Integer - -Expression: ${ bean1a.list1 [1] } -ExpectedType: class java.lang.Object -Evaluates to: another value -With type: java.lang.String - -Expression: ${ bean1a.list1 [2][2] } -ExpectedType: class java.lang.Object -Evaluates to: string3 -With type: java.lang.String - - -# Test as indexed property accessor -Expression: ${ bean1a.indexed1[-1]} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.indexed1[-1]}": Unable to find a value for "indexed1" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${ bean1a.indexed1[0]} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.indexed1[0]}": Unable to find a value for "indexed1" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${ bean1a.indexed1[1]} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.indexed1[1]}": Unable to find a value for "indexed1" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${ bean1a.indexed1[2]} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.indexed1[2]}": Unable to find a value for "indexed1" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${ bean1a.indexed1[3]} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.indexed1[3]}": Unable to find a value for "indexed1" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - -Expression: ${ bean1a.indexed1[4]} -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.indexed1[4]}": Unable to find a value for "indexed1" in object of class "org.apache.taglibs.standard.lang.jstl.test.Bean1" using operator "." (null) - - -# Test as map accessor -Expression: ${ bean1a.map1.key1 } -ExpectedType: class java.lang.Object -Evaluates to: value1 -With type: java.lang.String - -Expression: ${ bean1a.map1 ["key1"] } -ExpectedType: class java.lang.Object -Evaluates to: value1 -With type: java.lang.String - -Expression: ${ bean1a.map1 [14] } -ExpectedType: class java.lang.Object -Evaluates to: value3 -With type: java.lang.String - -Expression: ${ bean1a.map1 [2 * 7] } -ExpectedType: class java.lang.Object -Evaluates to: value3 -With type: java.lang.String - -Expression: ${ bean1a.map1.recurse.list1[0] } -ExpectedType: class java.lang.Object -Evaluates to: 14 -With type: java.lang.Integer - - -####################################################### -# test String concatenation - -Expression: ${ "a" + "bcd" } -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ "a" + "bcd" }": An exception occured trying to convert String "a" to type "java.lang.Long" (null) - -Expression: ${ "a" + (4*3) } -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ "a" + (4*3) }": An exception occured trying to convert String "a" to type "java.lang.Long" (null) - -Expression: ${ bean1a.map1 ["key" + (5-4)] } -ExpectedType: class java.lang.Object -Causes an error: jakarta.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ bean1a.map1 ["key" + (5-4)] }": An exception occured trying to convert String "key" to type "java.lang.Double" (null) - - -####################################################### -# test String comparisons - -Expression: ${ "30" < "4" } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 30 < "4" } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 30 > "4" } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ "0004" == "4" } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - - -####################################################### -# test relational comparison with alternate symbols - -Expression: ${ 4 eq 3} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 4 ne 3} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 4 eq 4} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 4 ne 4} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 4 lt 3} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 4 gt 3} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 4 le 3} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 4 ge 3} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 4 le 4} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 4 ge 4} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - - -####################################################### -# test expressions on the left side of a value suffix - -Expression: ${(3).class} -ExpectedType: class java.lang.Object -Evaluates to: class java.lang.Long -With type: java.lang.Class - -Expression: ${(bean1a.map1)["key1"]} -ExpectedType: class java.lang.Object -Evaluates to: value1 -With type: java.lang.String - - - -####################################################### -# test String/boolean logical operators - -Expression: ${'true' and false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${'true' or true} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${false and 'true'} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${false or 'true'} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - - -####################################################### -# test empty operator - -Expression: ${ empty "A"} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ empty "" } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ empty null } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ empty false} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ empty 0} -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ not empty 0} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ not empty empty 0} -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.emptyArray } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.nonemptyArray } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.emptyList } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.nonemptyList } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.emptyMap } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.nonemptyMap } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.emptySet } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ empty emptyTests.nonemptySet } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - - -####################################################### -# test String arithmetic - -Expression: ${ "6" / "3" } -ExpectedType: class java.lang.Object -Evaluates to: 2.0 -With type: java.lang.Double - -Expression: ${ 3 + "4" } -ExpectedType: class java.lang.Object -Evaluates to: 7 -With type: java.lang.Long - -Expression: ${ "4" + 3 } -ExpectedType: class java.lang.Object -Evaluates to: 7 -With type: java.lang.Long - -Expression: ${ 3 + "4.5" } -ExpectedType: class java.lang.Object -Evaluates to: 7.5 -With type: java.lang.Double - -Expression: ${ "4.5" + 3 } -ExpectedType: class java.lang.Object -Evaluates to: 7.5 -With type: java.lang.Double - -Expression: ${ 3.0 + 6.0} -ExpectedType: class java.lang.Object -Evaluates to: 9.0 -With type: java.lang.Double - -Expression: ${ 31121.0 * 61553.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.915590913E9 -With type: java.lang.Double - -Expression: ${ 31121 * 61553 } -ExpectedType: class java.lang.Object -Evaluates to: 1915590913 -With type: java.lang.Long - -Expression: ${ 65536 * 65536 * 65536 * 32759 } -ExpectedType: class java.lang.Object -Evaluates to: 9220838762064379904 -With type: java.lang.Long - -Expression: ${ 9220838762064379904.0 - 9220838762064379900.0 } -ExpectedType: class java.lang.Object -Evaluates to: 0.0 -With type: java.lang.Double - -Expression: ${ 9220838762064379904 - 9220838762064379900 } -ExpectedType: class java.lang.Object -Evaluates to: 4 -With type: java.lang.Long - - -####################################################### -# test relational operators involving null - -Expression: ${ null == null } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ null != null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null > null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null < null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null >= null } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ null <= null } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - - -Expression: ${ null == 3 } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null != 3 } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ null > 3 } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null < 3 } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null >= 3 } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null <= 3 } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - - -Expression: ${ 3 == null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 3 != null } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ 3 > null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 3 < null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 3 >= null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ 3 <= null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - - -Expression: ${ null == "" } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ null != "" } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - -Expression: ${ "" == null } -ExpectedType: class java.lang.Object -Evaluates to: false -With type: java.lang.Boolean - -Expression: ${ "" != null } -ExpectedType: class java.lang.Object -Evaluates to: true -With type: java.lang.Boolean - - -####################################################### -# arithmetic operators involving Strings - -Expression: ${ 4 + 3 } -ExpectedType: class java.lang.Object -Evaluates to: 7 -With type: java.lang.Long - -Expression: ${ 4.0 + 3 } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ 4 + 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ 4.0 + 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ "4" + 3 } -ExpectedType: class java.lang.Object -Evaluates to: 7 -With type: java.lang.Long - -Expression: ${ "4.0" + 3 } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ "4" + 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ "4.0" + 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ 4 + "3" } -ExpectedType: class java.lang.Object -Evaluates to: 7 -With type: java.lang.Long - -Expression: ${ 4.0 + "3" } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ 4 + "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ 4.0 + "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ "4" + "3" } -ExpectedType: class java.lang.Object -Evaluates to: 7 -With type: java.lang.Long - -Expression: ${ "4.0" + "3" } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ "4" + "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - -Expression: ${ "4.0" + "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 7.0 -With type: java.lang.Double - - - -Expression: ${ 4 - 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ 4.0 - 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4 - 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4.0 - 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" - 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ "4.0" - 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" - 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4.0" - 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4 - "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ 4.0 - "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4 - "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4.0 - "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" - "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ "4.0" - "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" - "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4.0" - "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - - - -Expression: ${ 4 * 3 } -ExpectedType: class java.lang.Object -Evaluates to: 12 -With type: java.lang.Long - -Expression: ${ 4.0 * 3 } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ 4 * 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ 4.0 * 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ "4" * 3 } -ExpectedType: class java.lang.Object -Evaluates to: 12 -With type: java.lang.Long - -Expression: ${ "4.0" * 3 } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ "4" * 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ "4.0" * 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ 4 * "3" } -ExpectedType: class java.lang.Object -Evaluates to: 12 -With type: java.lang.Long - -Expression: ${ 4.0 * "3" } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ 4 * "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ 4.0 * "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ "4" * "3" } -ExpectedType: class java.lang.Object -Evaluates to: 12 -With type: java.lang.Long - -Expression: ${ "4.0" * "3" } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ "4" * "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - -Expression: ${ "4.0" * "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 12.0 -With type: java.lang.Double - - - -Expression: ${ 4 / 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4.0 / 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4 / 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4.0 / 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4" / 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4.0" / 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4" / 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4.0" / 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4 / "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4.0 / "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4 / "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ 4.0 / "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4" / "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4.0" / "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4" / "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - -Expression: ${ "4.0" / "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.3333333333333333 -With type: java.lang.Double - - - -Expression: ${ 4 % 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ 4.0 % 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4 % 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4.0 % 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" % 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ "4.0" % 3 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" % 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4.0" % 3.0 } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4 % "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ 4.0 % "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4 % "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ 4.0 % "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" % "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1 -With type: java.lang.Long - -Expression: ${ "4.0" % "3" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4" % "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - -Expression: ${ "4.0" % "3.0" } -ExpectedType: class java.lang.Object -Evaluates to: 1.0 -With type: java.lang.Double - - - -Expression: ${ "8" / "2" } -ExpectedType: class java.lang.Object -Evaluates to: 4.0 -With type: java.lang.Double - -Expression: ${ "4e2" + "3" } -ExpectedType: class java.lang.Object -Evaluates to: 403.0 -With type: java.lang.Double - -Expression: ${ "4" + "3e2" } -ExpectedType: class java.lang.Object -Evaluates to: 304.0 -With type: java.lang.Double - -Expression: ${ "4e2" + "3e2" } -ExpectedType: class java.lang.Object -Evaluates to: 700.0 -With type: java.lang.Double - - - -####################################################### -# unary minus operator involving Strings - -Expression: ${ -3 } -ExpectedType: class java.lang.Object -Evaluates to: -3 -With type: java.lang.Long - -Expression: ${ -3.0 } -ExpectedType: class java.lang.Object -Evaluates to: -3.0 -With type: java.lang.Double - -Expression: ${ -"3" } -ExpectedType: class java.lang.Object -Evaluates to: -3 -With type: java.lang.Long - -Expression: ${ -"3.0" } -ExpectedType: class java.lang.Object -Evaluates to: -3.0 -With type: java.lang.Double - -Expression: ${ -"3e2" } -ExpectedType: class java.lang.Object -Evaluates to: -300.0 -With type: java.lang.Double - diff --git a/impl/src/test/resources/parserTests.txt b/impl/src/test/resources/parserTests.txt deleted file mode 100644 index 1341b2c..0000000 --- a/impl/src/test/resources/parserTests.txt +++ /dev/null @@ -1,165 +0,0 @@ -# -# Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# testing mixture of strings and expressions -abc -${ 3} -a${ -a${ 5 } -${ 3 }b -${ 1 }${ 2 } -abc ${ 1} ${ 2} def - -# testing values that end with or contain "$" -$ -\$ - $ -test$ -$test -test$test -test$$$ -test$$${ 34 } -test$$${ 34 }$$ -test$${ 34 } -$${ 34 } -$$ -test$$ -test$$test -${ 34 }$${ 34 } - -# literals -${1} -${-12} -${true} -${false} -${null} -${4.2} -${-21.3} -${4.} -${.21} -${3e-1} -${.2222222222} - -# string literals with " -${"abc"} -${""} -${"a"} -${" "} -${" some string ''' "} -${" with escaping \\"} -${" with escaping \""} -${" with escaping \"\\\""} -${" bad \ escaping"} -${" bad \' escaping"} - -# string literals with ' -${'abc'} -${''} -${'a'} -${' '} -${' some string """ '} -${' with escaping \\'} -${' with escaping \''} -${' with escaping \'\\\''} -${' bad \ escaping'} -${' bad \" escaping'} - -# identifiers -${abc} -${abc123} -${abc_123} -${bad*identifier} - -# property accessors -${a .b .c} -${ abc . 'def.ghi' . ghi . "jkl \"" } - -# array accessors -${ a[14] } -${ abc [def]} -${ def ["yesthisisallowed"]} - -# mixed property/array accessors -${ a.b.c[d. e. f]} -${ a[14].b[32].c[24][ 261] [24]} -${ a[b[c[d[e[f]]]].g] } - -# mixed operators -${ 1 + 3 - 2 * 1 == 4} -${ 1 + 3 - 2 * 1 == 4 / 1.2} -${ 1 + 3 - 2 * 1 == 4 / 1.2 and abc} -${ 1 + 3 - 2 * 1 == 4 / 1.2 and abc or def or ghi and true} - -# unary operators -${ --not abc.def } - -# array accessors of non-integer types -${ a ["hello"]."12" [17.5] } - -# making sure unicode escapes are not recognized -\u0040 -"\u0040" - -# relational operators -${ a > b } -${ a gt b } -${ a < b } -${ a lt b } -${ a >= b } -${ a ge b } -${ a <= b } -${ a le b } -${ a == b } -${ a eq b } -${ a != b } -${ a ne b } - -# logical operators -${ a and b} -${ a && b} -${ a or b} -${ a || b} -${ !a } -${ not a } - -# empty operator -${ empty "A"} -${ empty "" } -${ empty null } -${ empty false} -${ empty 0} -${ not empty 0} -${ not empty empty 0} -${ empty } - -# functions -#${a()} -#${ a() } -#${a(b)} -#${ a(b) } -#${a(b,c)} -#${a(b,c,d)} -#${a:b(c)} -#${a:b(c,d)} -#${a:b(c,d,e)} -#${a(b).c} -#${a(b)[c]} -#${a[b()]} - -# non-ascii input - the parser automatically translates the @@non-ascii -# into a UNICODE string with value \u1111 -@@non-ascii diff --git a/impl/src/test/resources/parserTestsOutput.txt b/impl/src/test/resources/parserTestsOutput.txt deleted file mode 100644 index b351e87..0000000 --- a/impl/src/test/resources/parserTestsOutput.txt +++ /dev/null @@ -1,265 +0,0 @@ -# -# Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# testing mixture of strings and expressions -Attribute value: abc -Parses to: abc -Attribute value: ${ 3} -Parses to: ${3} -Attribute value: a${ -Causes an error: An error occurred while parsing custom action attribute "test" with value "a${": Encountered "", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] -Attribute value: a${ 5 } -Parses to: a${5} -Attribute value: ${ 3 }b -Parses to: ${3}b -Attribute value: ${ 1 }${ 2 } -Parses to: ${1}${2} -Attribute value: abc ${ 1} ${ 2} def -Parses to: abc ${1} ${2} def - -# testing values that end with or contain "$" -Attribute value: $ -Parses to: $ -Attribute value: \$ -Parses to: \$ -Attribute value: $ -Parses to: $ -Attribute value: test$ -Parses to: test$ -Attribute value: $test -Parses to: $test -Attribute value: test$test -Parses to: test$test -Attribute value: test$$$ -Parses to: test$$$ -Attribute value: test$$${ 34 } -Parses to: test$$${34} -Attribute value: test$$${ 34 }$$ -Parses to: test$$${34}$$ -Attribute value: test$${ 34 } -Parses to: test$${34} -Attribute value: $${ 34 } -Parses to: $${34} -Attribute value: $$ -Parses to: $$ -Attribute value: test$$ -Parses to: test$$ -Attribute value: test$$test -Parses to: test$$test -Attribute value: ${ 34 }$${ 34 } -Parses to: ${34}$${34} - -# literals -Attribute value: ${1} -Parses to: ${1} -Attribute value: ${-12} -Parses to: ${(- 12)} -Attribute value: ${true} -Parses to: ${true} -Attribute value: ${false} -Parses to: ${false} -Attribute value: ${null} -Parses to: ${null} -Attribute value: ${4.2} -Parses to: ${4.2} -Attribute value: ${-21.3} -Parses to: ${(- 21.3)} -Attribute value: ${4.} -Parses to: ${4.0} -Attribute value: ${.21} -Parses to: ${0.21} -Attribute value: ${3e-1} -Parses to: ${0.3} -Attribute value: ${.2222222222} -Parses to: ${0.2222222222} - -# string literals with " -Attribute value: ${"abc"} -Parses to: ${"abc"} -Attribute value: ${""} -Parses to: ${""} -Attribute value: ${"a"} -Parses to: ${"a"} -Attribute value: ${" "} -Parses to: ${" "} -Attribute value: ${" some string ''' "} -Parses to: ${" some string ''' "} -Attribute value: ${" with escaping \\"} -Parses to: ${" with escaping \\"} -Attribute value: ${" with escaping \""} -Parses to: ${" with escaping \""} -Attribute value: ${" with escaping \"\\\""} -Parses to: ${" with escaping \"\\\""} -Attribute value: ${" bad \ escaping"} -Causes an error: An error occurred while parsing custom action attribute "test" with value "${" bad \ escaping"}": Encountered "" bad \ ", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] -Attribute value: ${" bad \' escaping"} -Causes an error: An error occurred while parsing custom action attribute "test" with value "${" bad \' escaping"}": Encountered "" bad \'", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] - -# string literals with ' -Attribute value: ${'abc'} -Parses to: ${"abc"} -Attribute value: ${''} -Parses to: ${""} -Attribute value: ${'a'} -Parses to: ${"a"} -Attribute value: ${' '} -Parses to: ${" "} -Attribute value: ${' some string """ '} -Parses to: ${" some string \"\"\" "} -Attribute value: ${' with escaping \\'} -Parses to: ${" with escaping \\"} -Attribute value: ${' with escaping \''} -Parses to: ${" with escaping '"} -Attribute value: ${' with escaping \'\\\''} -Parses to: ${" with escaping '\\'"} -Attribute value: ${' bad \ escaping'} -Causes an error: An error occurred while parsing custom action attribute "test" with value "${' bad \ escaping'}": Encountered "' bad \ ", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] -Attribute value: ${' bad \" escaping'} -Causes an error: An error occurred while parsing custom action attribute "test" with value "${' bad \" escaping'}": Encountered "' bad \"", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] - -# identifiers -Attribute value: ${abc} -Parses to: ${abc} -Attribute value: ${abc123} -Parses to: ${abc123} -Attribute value: ${abc_123} -Parses to: ${abc_123} -Attribute value: ${bad*identifier} -Parses to: ${(bad * identifier)} - -# property accessors -Attribute value: ${a .b .c} -Parses to: ${a.b.c} -Attribute value: ${ abc . 'def.ghi' . ghi . "jkl \"" } -Causes an error: An error occurred while parsing custom action attribute "test" with value "${ abc . 'def.ghi' . ghi . "jkl \"" }": Encountered "'def.ghi'", expected one of [] - -# array accessors -Attribute value: ${ a[14] } -Parses to: ${a[14]} -Attribute value: ${ abc [def]} -Parses to: ${abc[def]} -Attribute value: ${ def ["yesthisisallowed"]} -Parses to: ${def["yesthisisallowed"]} - -# mixed property/array accessors -Attribute value: ${ a.b.c[d. e. f]} -Parses to: ${a.b.c[d.e.f]} -Attribute value: ${ a[14].b[32].c[24][ 261] [24]} -Parses to: ${a[14].b[32].c[24][261][24]} -Attribute value: ${ a[b[c[d[e[f]]]].g] } -Parses to: ${a[b[c[d[e[f]]]].g]} - -# mixed operators -Attribute value: ${ 1 + 3 - 2 * 1 == 4} -Parses to: ${((1 + 3 - (2 * 1)) == 4)} -Attribute value: ${ 1 + 3 - 2 * 1 == 4 / 1.2} -Parses to: ${((1 + 3 - (2 * 1)) == (4 / 1.2))} -Attribute value: ${ 1 + 3 - 2 * 1 == 4 / 1.2 and abc} -Parses to: ${(((1 + 3 - (2 * 1)) == (4 / 1.2)) and abc)} -Attribute value: ${ 1 + 3 - 2 * 1 == 4 / 1.2 and abc or def or ghi and true} -Parses to: ${((((1 + 3 - (2 * 1)) == (4 / 1.2)) and abc) or def or (ghi and true))} - -# unary operators -Attribute value: ${ --not abc.def } -Parses to: ${(- - not abc.def)} - -# array accessors of non-integer types -Attribute value: ${ a ["hello"]."12" [17.5] } -Causes an error: An error occurred while parsing custom action attribute "test" with value "${ a ["hello"]."12" [17.5] }": Encountered ""12"", expected one of [] - -# making sure unicode escapes are not recognized -Attribute value: \u0040 -Parses to: \u0040 -Attribute value: "\u0040" -Parses to: "\u0040" - -# relational operators -Attribute value: ${ a > b } -Parses to: ${(a > b)} -Attribute value: ${ a gt b } -Parses to: ${(a > b)} -Attribute value: ${ a < b } -Parses to: ${(a < b)} -Attribute value: ${ a lt b } -Parses to: ${(a < b)} -Attribute value: ${ a >= b } -Parses to: ${(a >= b)} -Attribute value: ${ a ge b } -Parses to: ${(a >= b)} -Attribute value: ${ a <= b } -Parses to: ${(a <= b)} -Attribute value: ${ a le b } -Parses to: ${(a <= b)} -Attribute value: ${ a == b } -Parses to: ${(a == b)} -Attribute value: ${ a eq b } -Parses to: ${(a == b)} -Attribute value: ${ a != b } -Parses to: ${(a != b)} -Attribute value: ${ a ne b } -Parses to: ${(a != b)} - -# logical operators -Attribute value: ${ a and b} -Parses to: ${(a and b)} -Attribute value: ${ a && b} -Parses to: ${(a and b)} -Attribute value: ${ a or b} -Parses to: ${(a or b)} -Attribute value: ${ a || b} -Parses to: ${(a or b)} -Attribute value: ${ !a } -Parses to: ${(not a)} -Attribute value: ${ not a } -Parses to: ${(not a)} - -# empty operator -Attribute value: ${ empty "A"} -Parses to: ${(empty "A")} -Attribute value: ${ empty "" } -Parses to: ${(empty "")} -Attribute value: ${ empty null } -Parses to: ${(empty null)} -Attribute value: ${ empty false} -Parses to: ${(empty false)} -Attribute value: ${ empty 0} -Parses to: ${(empty 0)} -Attribute value: ${ not empty 0} -Parses to: ${(not empty 0)} -Attribute value: ${ not empty empty 0} -Parses to: ${(not empty empty 0)} -Attribute value: ${ empty } -Causes an error: An error occurred while parsing custom action attribute "test" with value "${ empty }": Encountered "}", expected one of [, , , "true", "false", "null", "(", "-", "not", "!", "empty", ] - -# functions -#${a()} -#${ a() } -#${a(b)} -#${ a(b) } -#${a(b,c)} -#${a(b,c,d)} -#${a:b(c)} -#${a:b(c,d)} -#${a:b(c,d,e)} -#${a(b).c} -#${a(b)[c]} -#${a[b()]} - -# non-ascii input - the parser automatically translates the @@non-ascii -# into a UNICODE string with value \u1111 -Attribute value: ᄑ -Parses to: ᄑ diff --git a/pom.xml b/pom.xml index 1cd47ed..bd051f6 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,6 @@ tagsdoc api - impl spec