diff --git a/common/src/main/java/org/jboss/metadata/parser/util/XMLResourceResolver.java b/common/src/main/java/org/jboss/metadata/parser/util/XMLResourceResolver.java
index 56582527b..808c82e80 100644
--- a/common/src/main/java/org/jboss/metadata/parser/util/XMLResourceResolver.java
+++ b/common/src/main/java/org/jboss/metadata/parser/util/XMLResourceResolver.java
@@ -219,6 +219,7 @@ public Object run() {
registerEntity("http://xmlns.jcp.org/xml/ns/javaee/web-jsptaglibrary_2_1.xsd", "web-jsptaglibrary_2_1.xsd");
registerEntity("https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_3_0.xsd", "web-jsptaglibrary_3_0.xsd");
registerEntity("https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_3_1.xsd", "web-jsptaglibrary_3_1.xsd");
+ registerEntity("https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_4_0.xsd", "web-jsptaglibrary_4_0.xsd");
registerEntity("http://xmlns.jcp.org/xml/ns/javaee/web-partialresponse_2_2.xsd", "web-partialresponse_2_2.xsd");
registerEntity("http://xmlns.jcp.org/xml/ns/javaee/web-partialresponse_2_3.xsd", "web-partialresponse_2_3.xsd");
registerEntity("https://jakarta.ee/xml/ns/jakartaee/web-partialresponse_3_0.xsd", "web-partialresponse_3_0.xsd");
diff --git a/web/src/main/java/org/jboss/metadata/parser/jsp/Location.java b/web/src/main/java/org/jboss/metadata/parser/jsp/Location.java
index 66c8792c2..9e7b16df0 100644
--- a/web/src/main/java/org/jboss/metadata/parser/jsp/Location.java
+++ b/web/src/main/java/org/jboss/metadata/parser/jsp/Location.java
@@ -18,6 +18,7 @@ public class Location {
bindings.put("http://xmlns.jcp.org/xml/ns/javaee/web-jsptaglibrary_2_1.xsd", Version.TLD_2_1);
bindings.put("https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_3_0.xsd", Version.TLD_3_0);
bindings.put("https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_3_1.xsd", Version.TLD_3_1);
+ bindings.put("https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_4_0.xsd", Version.TLD_4_0);
}
public static Version getVersion(String location) {
diff --git a/web/src/main/java/org/jboss/metadata/parser/jsp/TldMetaDataParser.java b/web/src/main/java/org/jboss/metadata/parser/jsp/TldMetaDataParser.java
index 3c845350a..98992360b 100644
--- a/web/src/main/java/org/jboss/metadata/parser/jsp/TldMetaDataParser.java
+++ b/web/src/main/java/org/jboss/metadata/parser/jsp/TldMetaDataParser.java
@@ -70,11 +70,13 @@ public static TldMetaData parse(XMLStreamReader reader) throws XMLStreamExceptio
version = Version.TLD_3_0;
} else if ("3.1".equals(versionString)) {
version = Version.TLD_3_1;
+ } else if ("4.0".equals(versionString)) {
+ version = Version.TLD_4_0;
}
}
if (version == null) {
// It is likely an error to not have a version at this point though
- version = Version.TLD_3_1;
+ version = Version.TLD_4_0;
}
TldMetaData tld = new TldMetaData();
// Handle attributes
diff --git a/web/src/main/java/org/jboss/metadata/parser/jsp/Version.java b/web/src/main/java/org/jboss/metadata/parser/jsp/Version.java
index 9ea7c6dc5..1fde53fb0 100644
--- a/web/src/main/java/org/jboss/metadata/parser/jsp/Version.java
+++ b/web/src/main/java/org/jboss/metadata/parser/jsp/Version.java
@@ -6,5 +6,5 @@
package org.jboss.metadata.parser.jsp;
public enum Version {
- TLD_1_1, TLD_1_2, TLD_2_0, TLD_2_1, TLD_3_0, TLD_3_1
+ TLD_1_1, TLD_1_2, TLD_2_0, TLD_2_1, TLD_3_0, TLD_3_1, TLD_4_0
}
diff --git a/web/src/main/resources/schema/web-jsptaglibrary_4_0.xsd b/web/src/main/resources/schema/web-jsptaglibrary_4_0.xsd
new file mode 100644
index 000000000..4c210ddd4
--- /dev/null
+++ b/web/src/main/resources/schema/web-jsptaglibrary_4_0.xsd
@@ -0,0 +1,1109 @@
+
+
+
+
+
+ Copyright (c) 2009, 2021 Oracle 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
+
+
+
+
+
+
+
+ ...
+
+
+ The instance documents may indicate the published
+ version of the schema using xsi:schemaLocation attribute
+ for Jakarta EE namespace with the following location:
+
+ https://jakarta.ee/xml/ns/jakartaee/web-jsptaglibrary_4_0.xsd
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ The taglib tag is the document root.
+ The definition of taglib is provided
+ by the tldTaglibType.
+
+
+
+
+
+
+
+ The taglib element contains, among other things, tag and
+ tag-file elements.
+ The name subelements of these elements must each be unique.
+
+
+
+
+
+
+
+
+
+
+ The taglib element contains function elements.
+ The name subelements of these elements must each be unique.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Specifies the type of body that is valid for a tag.
+ This value is used by the JSP container to validate
+ that a tag invocation has the correct body syntax and
+ by page composition tools to assist the page author
+ in providing a valid tag body.
+
+ There are currently four values specified:
+
+ tagdependent The body of the tag is interpreted by the tag
+ implementation itself, and is most likely
+ in a different "language", e.g embedded SQL
+ statements.
+
+ JSP The body of the tag contains nested JSP
+ syntax.
+
+ empty The body must be empty
+
+ scriptless The body accepts only template text, EL
+ Expressions, and JSP action elements. No
+ scripting elements are allowed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Defines the canonical name of a tag or attribute being
+ defined.
+
+ The name must conform to the lexical rules for an NMTOKEN.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A validator that can be used to validate
+ the conformance of a JSP page to using this tag library is
+ defined by a validatorType.
+
+
+
+
+
+
+
+
+
+ Defines the TagLibraryValidator class that can be used
+ to validate the conformance of a JSP page to using this
+ tag library.
+
+
+
+
+
+
+
+
+ The init-param element contains a name/value pair as an
+ initialization param.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The tag defines a unique tag in this tag library. It has one
+ attribute, id.
+
+ The tag element may have several subelements defining:
+
+ description Optional tag-specific information
+
+ display-name A short name that is intended to be
+ displayed by tools
+
+ icon Optional icon element that can be used
+ by tools
+
+ name The unique action name
+
+ tag-class The tag handler class implementing
+ jakarta.servlet.jsp.tagext.JspTag
+
+ tei-class An optional subclass of
+ jakarta.servlet.jsp.tagext.TagExtraInfo
+
+ body-content The body content type
+
+ variable Optional scripting variable information
+
+ attribute All attributes of this action that are
+ evaluated prior to invocation.
+
+ dynamic-attributes Whether this tag supports additional
+ attributes with dynamic names. If
+ true, the tag-class must implement the
+ jakarta.servlet.jsp.tagext.DynamicAttributes
+ interface. Defaults to false.
+
+ example Optional informal description of an
+ example of a use of this tag
+
+ tag-extension Zero or more extensions that provide extra
+ information about this tag, for tool
+ consumption
+
+
+
+
+
+
+
+
+
+
+ Defines the subclass of jakarta.servlet.jsp.tagext.JspTag
+ that implements the request time semantics for
+ this tag. (required)
+
+
+
+
+
+
+
+
+ Defines the subclass of jakarta.servlet.jsp.tagext.TagExtraInfo
+ for this tag. (optional)
+
+ If this is not given, the class is not consulted at
+ translation time.
+
+
+
+
+
+
+
+
+ Specifies the format for the body of this tag.
+ The default in JSP 1.2 was "JSP" but because this
+ is an invalid setting for simple tag handlers, there
+ is no longer a default in JSP 2.0. A reasonable
+ default for simple tag handlers is "scriptless" if
+ the tag can have a body.
+
+
+
+
+
+
+
+
+
+
+
+ The example element contains an informal description
+ of an example of the use of a tag.
+
+
+
+
+
+
+
+
+ Tag extensions are for tool use only and must not affect
+ the behavior of a container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Defines an action in this tag library that is implemented
+ as a .tag file.
+
+ The tag-file element has two required subelements:
+
+ description Optional tag-specific information
+
+ display-name A short name that is intended to be
+ displayed by tools
+
+ icon Optional icon element that can be used
+ by tools
+
+ name The unique action name
+
+ path Where to find the .tag file implementing this
+ action, relative to the root of the web
+ application or the root of the JAR file for a
+ tag library packaged in a JAR. This must
+ begin with /WEB-INF/tags if the .tag file
+ resides in the WAR, or /META-INF/tags if the
+ .tag file resides in a JAR.
+
+ example Optional informal description of an
+ example of a use of this tag
+
+ tag-extension Zero or more extensions that provide extra
+ information about this tag, for tool
+ consumption
+
+
+
+
+
+
+
+
+
+
+
+ The example element contains an informal description
+ of an example of the use of a tag.
+
+
+
+
+
+
+
+
+ Tag extensions are for tool use only and must not affect
+ the behavior of a container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The function element is used to provide information on each
+ function in the tag library that is to be exposed to the EL.
+
+ The function element may have several subelements defining:
+
+ description Optional tag-specific information
+
+ display-name A short name that is intended to be
+ displayed by tools
+
+ icon Optional icon element that can be used
+ by tools
+
+ name A unique name for this function
+
+ function-class Provides the name of the Java class that
+ implements the function
+
+ function-signature Provides the signature, as in the Java
+ Language Specification, of the Java
+ method that is to be used to implement
+ the function.
+
+ example Optional informal description of an
+ example of a use of this function
+
+ function-extension Zero or more extensions that provide extra
+ information about this function, for tool
+ consumption
+
+
+
+
+
+
+
+
+
+ A unique name for this function.
+
+
+
+
+
+
+
+
+ Provides the fully-qualified class name of the Java
+ class containing the static method that implements
+ the function.
+
+
+
+
+
+
+
+
+ Provides the signature, of the static Java method that is
+ to be used to implement the function. The syntax of the
+ function-signature element is as follows:
+
+ FunctionSignature ::= ReturnType S MethodName S?
+ '(' S? Parameters? S? ')'
+
+ ReturnType ::= Type
+
+ MethodName ::= Identifier
+
+ Parameters ::= Parameter
+ | ( Parameter S? ',' S? Parameters )
+
+ Parameter ::= Type
+
+ Where:
+
+ * Type is a basic type or a fully qualified
+ Java class name (including package name),
+ as per the 'Type' production in the Java
+ Language Specification, Second Edition,
+ Chapter 18.
+
+ * Identifier is a Java identifier, as per
+ the 'Identifier' production in the Java
+ Language Specification, Second
+ Edition, Chapter 18.
+
+ Example:
+
+ java.lang.String nickName( java.lang.String, int )
+
+
+
+
+
+
+
+
+ The example element contains an informal description
+ of an example of the use of this function.
+
+
+
+
+
+
+
+
+ Function extensions are for tool use only and must not
+ affect the behavior of a container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The taglib tag is the document root, it defines:
+
+ description a simple string describing the "use" of this
+ taglib, should be user discernable
+
+ display-name the display-name element contains a
+ short name that is intended to be displayed
+ by tools
+
+ icon optional icon that can be used by tools
+
+ tlib-version the version of the tag library implementation
+
+ short-name a simple default short name that could be
+ used by a JSP authoring tool to create
+ names with a mnemonic value; for example,
+ the it may be used as the prefered prefix
+ value in taglib directives
+
+ uri a uri uniquely identifying this taglib
+
+ validator optional TagLibraryValidator information
+
+ listener optional event listener specification
+
+ tag tags in this tag library
+
+ tag-file tag files in this tag library
+
+ function zero or more EL functions defined in this
+ tag library
+
+ taglib-extension zero or more extensions that provide extra
+ information about this taglib, for tool
+ consumption
+
+
+
+
+
+
+
+
+
+ Describes this version (number) of the taglibrary.
+ It is described as a dewey decimal.
+
+
+
+
+
+
+
+
+ Defines a simple default name that could be used by
+ a JSP authoring tool to create names with a
+ mnemonicvalue; for example, it may be used as the
+ preferred prefix value in taglib directives. Do
+ not use white space, and do not start with digits
+ or underscore.
+
+
+
+
+
+
+
+
+ Defines a public URI that uniquely identifies this
+ version of the taglibrary. Leave it empty if it
+ does not apply.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Taglib extensions are for tool use only and must not
+ affect the behavior of a container.
+
+
+
+
+
+
+
+
+
+ Describes the JSP version (number) this taglibrary
+ requires in order to function (dewey decimal)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The variableType provides information on the scripting
+ variables defined by using this tag. It is a (translation
+ time) error for a tag that has one or more variable
+ subelements to have a TagExtraInfo class that returns a
+ non-null value from a call to getVariableInfo().
+
+ The subelements of variableType are of the form:
+
+ description Optional description of this
+ variable
+
+ name-given The variable name as a constant
+
+ name-from-attribute The name of an attribute whose
+ (translation time) value will
+ give the name of the
+ variable. One of name-given or
+ name-from-attribute is required.
+
+ variable-class Name of the class of the variable.
+ java.lang.String is default.
+
+ declare Whether the variable is declared
+ or not. True is the default.
+
+ scope The scope of the scripting varaible
+ defined. NESTED is default.
+
+
+
+
+
+
+
+
+
+
+ The name for the scripting variable.
+
+
+
+
+
+
+
+
+ The name of an attribute whose
+ (translation-time) value will give the name of
+ the variable.
+
+
+
+
+
+
+
+
+
+ The optional name of the class for the scripting
+ variable. The default is java.lang.String.
+
+
+
+
+
+
+
+
+ Whether the scripting variable is to be defined
+ or not. See TagExtraInfo for details. This
+ element is optional and "true" is the default.
+
+
+
+
+
+
+
+
+ The element is optional and "NESTED" is the default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This type defines scope of the scripting variable. See
+ TagExtraInfo for details. The allowed values are,
+ "NESTED", "AT_BEGIN" and "AT_END".
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The attribute element defines an attribute for the nesting
+ tag. The attribute element may have several subelements
+ defining:
+
+ description a description of the attribute
+
+ name the name of the attribute
+
+ required whether the attribute is required or
+ optional
+
+ rtexprvalue whether the attribute is a runtime attribute
+
+ type the type of the attributes
+
+ fragment whether this attribute is a fragment
+
+ deferred-value present if this attribute is to be parsed as a
+ jakarta.el.ValueExpression
+
+ deferred-method present if this attribute is to be parsed as a
+ jakarta.el.MethodExpression
+
+
+
+
+
+
+
+
+
+
+ Defines if the nesting attribute is required or
+ optional.
+
+ If not present then the default is "false", i.e
+ the attribute is optional.
+
+
+
+
+
+
+
+
+
+
+
+ Defines if the nesting attribute can have scriptlet
+ expressions as a value, i.e the value of the
+ attribute may be dynamically calculated at request
+ time, as opposed to a static value determined at
+ translation time.
+ If not present then the default is "false", i.e the
+ attribute has a static value
+
+
+
+
+
+
+
+
+ Defines the Java type of the attributes value.
+ If this element is omitted, the expected type is
+ assumed to be "java.lang.Object".
+
+
+
+
+
+
+
+
+
+
+ Present if the value for this attribute is to be
+ passed to the tag handler as a
+ jakarta.el.ValueExpression. This allows for deferred
+ evaluation of EL expressions. An optional subelement
+ will contain the expected type that the value will
+ be coerced to after evaluation of the expression.
+ The type defaults to Object if one is not provided.
+
+
+
+
+
+
+
+
+ Present if the value for this attribute is to be
+ passed to the tag handler as a
+ jakarta.el.MethodExpression. This allows for deferred
+ evaluation of an EL expression that identifies a
+ method to be invoked on an Object. An optional
+ subelement will contain the expected method
+ signature. The signature defaults to "void method()"
+ if one is not provided.
+
+
+
+
+
+
+
+
+
+
+ "true" if this attribute is of type
+ jakarta.servlet.jsp.tagext.JspFragment, representing dynamic
+ content that can be re-evaluated as many times
+ as needed by the tag handler. If omitted or "false",
+ the default is still type="java.lang.String"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Defines information about how to provide the value for a
+ tag handler attribute that accepts a jakarta.el.ValueExpression.
+
+ The deferred-value element has one optional subelement:
+
+ type the expected type of the attribute
+
+
+
+
+
+
+
+
+ The fully-qualified name of the Java type that is the
+ expected type for this deferred expression. If this
+ element is omitted, the expected type is assumed to be
+ "java.lang.Object".
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Defines information about how to provide the value for a
+ tag handler attribute that accepts a jakarta.el.MethodExpression.
+
+ The deferred-method element has one optional subelement:
+
+ method-signature Provides the signature, as in the Java
+ Language Specifies, that is expected for
+ the method being identified by the
+ expression.
+
+
+
+
+
+
+
+
+ Provides the expected signature of the method identified
+ by the jakarta.el.MethodExpression.
+
+ This disambiguates overloaded methods and ensures that
+ the return value is of the expected type.
+
+ The syntax of the method-signature element is identical
+ to that of the function-signature element. See the
+ documentation for function-signature for more details.
+
+ The name of the method is for documentation purposes only
+ and is ignored by the JSP container.
+
+ Example:
+
+ boolean validate(java.lang.String)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The tld-extensionType is used to indicate
+ extensions to a specific TLD element.
+
+ It is used by elements to designate an extension block
+ that is targeted to a specific extension designated by
+ a set of extension elements that are declared by a
+ namespace. The namespace identifies the extension to
+ the tool that processes the extension.
+
+ The type of the extension-element is abstract. Therefore,
+ a concrete type must be specified by the TLD using
+ xsi:type attribute for each extension-element.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The extensibleType is an abstract base type that is used to
+ define the type of extension-elements. Instance documents
+ must substitute a known type to define the extension by
+ using xsi:type attribute to define the actual type of
+ extension-elements.
+
+
+
+
+
+
+
diff --git a/web/src/test/java/org/jboss/test/metadata/web/Tld40UnitTestCase.java b/web/src/test/java/org/jboss/test/metadata/web/Tld40UnitTestCase.java
new file mode 100644
index 000000000..056dd788c
--- /dev/null
+++ b/web/src/test/java/org/jboss/test/metadata/web/Tld40UnitTestCase.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright The JBoss Metadata Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+package org.jboss.test.metadata.web;
+
+import org.jboss.metadata.parser.jsp.TldMetaDataParser;
+import org.jboss.test.metadata.javaee.AbstractJavaEEEverythingTest;
+
+/**
+ * Tests of 4. taglib elements
+ *
+ * @author Brian Stansberry
+ */
+public class Tld40UnitTestCase extends AbstractJavaEEEverythingTest {
+ public void testEverything() throws Exception {
+ TldMetaDataParser.parse(getReader());
+ }
+}
diff --git a/web/src/test/resources/org/jboss/test/metadata/web/Tld40_testEverything.xml b/web/src/test/resources/org/jboss/test/metadata/web/Tld40_testEverything.xml
new file mode 100644
index 000000000..fb24e50e4
--- /dev/null
+++ b/web/src/test/resources/org/jboss/test/metadata/web/Tld40_testEverything.xml
@@ -0,0 +1,139 @@
+
+
+
+
+
+ A tag library exercising SimpleTag handlers.
+ 1.0
+ SimpleTagLibrary
+ /SimpleTagLibrary
+
+
+
+ Provides core validation features for JSTL tags.
+
+
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+
+
+
+
+ org.example.listener
+
+
+
+
+ Outputs Hello, World
+ helloWorld
+ jsp2.examples.simpletag.HelloWorldSimpleTag
+ empty
+
+
+ Repeats the body of the tag 'num' times
+ repeat
+ jsp2.examples.simpletag.RepeatSimpleTag
+ scriptless
+
+ Current invocation count (1 to num)
+ count
+
+
+ num
+ true
+ true
+
+
+
+ Populates the page context with a BookBean
+ findBook
+ jsp2.examples.simpletag.FindBookSimpleTag
+ empty
+
+ var
+ true
+ true
+
+
+
+
+ Takes 3 fragments and invokes them in a random order
+
+ shuffle
+ jsp2.examples.simpletag.ShuffleSimpleTag
+ empty
+
+ fragment1
+ true
+ true
+
+
+ fragment2
+ true
+ true
+
+
+ fragment3
+ true
+ true
+
+
+
+ Outputs a colored tile
+ tile
+ jsp2.examples.simpletag.TileSimpleTag
+ empty
+
+ color
+ true
+
+
+ label
+ true
+ true
+ java.lang.Object
+
+ java.lang.Object
+
+
+
+
+
+ Tag that echoes all its attributes and body content
+
+ echoAttributes
+ jsp2.examples.simpletag.EchoAttributesTag
+ empty
+ true
+
+
+
+ name
+ path
+
+
+
+ Reverses the characters in the given String
+ reverse
+ jsp2.examples.el.Functions
+ java.lang.String reverse( java.lang.String )
+
+
+ Counts the number of vowels (a,e,i,o,u) in the given String
+ countVowels
+ jsp2.examples.el.Functions
+ java.lang.String numVowels( java.lang.String )
+
+
+ Converts the string to all caps
+ caps
+ jsp2.examples.el.Functions
+ java.lang.String caps( java.lang.String )
+
+
+