struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [struts] 05/11: WW-5049 Extends xwork DTD as well
Date Tue, 03 Dec 2019 08:32:55 GMT
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5049-velocity-plugin
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 258153b66fd13f1ce7621f27ff2cad9f0b95dbe1
Author: Lukasz Lenart <lukaszlenart@apache.org>
AuthorDate: Tue Nov 26 20:27:28 2019 +0100

    WW-5049 Extends xwork DTD as well
---
 .../config/providers/XmlConfigurationProvider.java |   3 +-
 .../config/StrutsXmlConfigurationProvider.java     |   1 +
 core/src/main/resources/xwork-2.6.dtd              | 157 +++++++++++++++++++++
 3 files changed, 160 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
index cec1c65..40e5cac 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
@@ -116,6 +116,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider
{
         this.errorIfMissing = errorIfMissing;
 
         Map<String, String> mappings = new HashMap<>();
+        mappings.put("-//Apache Struts//XWork 2.6//EN", "xwork-2.6.dtd");
         mappings.put("-//Apache Struts//XWork 2.5//EN", "xwork-2.5.dtd");
         mappings.put("-//Apache Struts//XWork 2.3//EN", "xwork-2.3.dtd");
         mappings.put("-//Apache Struts//XWork 2.1.3//EN", "xwork-2.1.3.dtd");
@@ -224,7 +225,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider
{
                         String impl = child.getAttribute("class");
                         try {
                             Class classImpl = ClassLoaderUtil.loadClass(impl, getClass());
-                            if (classImpl.isAssignableFrom(ConfigurationProvider.class))
{
+                            if (ConfigurationProvider.class.isAssignableFrom(classImpl))
{
                                 ConfigurationProvider provider = (ConfigurationProvider)
classImpl.newInstance();
                                 provider.register(containerBuilder, props);
                             } else {
diff --git a/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
b/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
index ef27b6c..5f4bf9e 100644
--- a/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
@@ -73,6 +73,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider
{
         dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN",
"struts-2.1.7.dtd");
         dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.3//EN",
"struts-2.3.dtd");
         dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.5//EN",
"struts-2.5.dtd");
+        dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.6//EN",
"struts-2.6.dtd");
         setDtdMappings(dtdMappings);
         File file = new File(filename);
         if (file.getParent() != null) {
diff --git a/core/src/main/resources/xwork-2.6.dtd b/core/src/main/resources/xwork-2.6.dtd
new file mode 100644
index 0000000..6f0e319
--- /dev/null
+++ b/core/src/main/resources/xwork-2.6.dtd
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+-->
+<!-- START SNIPPET: xworkDtd -->
+
+<!--
+   XWork configuration DTD.
+   Use the following DOCTYPE
+
+   <!DOCTYPE xwork PUBLIC
+	"-//Apache Struts//XWork 2.6//EN"
+	"http://struts.apache.org/dtds/xwork-2.6.dtd">
+-->
+
+<!ELEMENT xwork ((package|include|bean-provider|bean|constant)*, unknown-handler-stack?)>
+<!ATTLIST xwork
+    order CDATA #IMPLIED
+>
+
+<!ELEMENT package (result-types?, interceptors?, default-interceptor-ref?, default-action-ref?,
default-class-ref?, global-results?, global-allowed-methods?, global-exception-mappings?,
action*)>
+<!ATTLIST package
+    name CDATA #REQUIRED
+    extends CDATA #IMPLIED
+    namespace CDATA #IMPLIED
+    abstract CDATA #IMPLIED
+    strict-method-invocation (true|false) "true"
+>
+
+<!ELEMENT result-types (result-type+)>
+
+<!ELEMENT result-type (param*)>
+<!ATTLIST result-type
+    name CDATA #REQUIRED
+    class CDATA #REQUIRED
+    default (true|false) "false"
+>
+
+<!ELEMENT interceptors (interceptor|interceptor-stack)+>
+
+<!ELEMENT interceptor (param*)>
+<!ATTLIST interceptor
+    name CDATA #REQUIRED
+    class CDATA #REQUIRED
+>
+
+<!ELEMENT interceptor-stack (interceptor-ref*)>
+<!ATTLIST interceptor-stack
+    name CDATA #REQUIRED
+>
+
+<!ELEMENT interceptor-ref (param*)>
+<!ATTLIST interceptor-ref
+    name CDATA #REQUIRED
+>
+
+<!ELEMENT default-interceptor-ref (#PCDATA)>
+<!ATTLIST default-interceptor-ref
+    name CDATA #REQUIRED
+>
+
+<!ELEMENT default-action-ref (#PCDATA)>
+<!ATTLIST default-action-ref
+    name CDATA #REQUIRED
+>
+
+<!ELEMENT default-class-ref (#PCDATA)>
+<!ATTLIST default-class-ref
+   class CDATA #REQUIRED
+>
+
+<!ELEMENT global-results (result+)>
+
+<!ELEMENT global-allowed-methods (#PCDATA)>
+
+<!ELEMENT global-exception-mappings (exception-mapping+)>
+
+<!ELEMENT action ((param|result|interceptor-ref|exception-mapping)*,allowed-methods?)>
+<!ATTLIST action
+    name CDATA #REQUIRED
+    class CDATA #IMPLIED
+    method CDATA #IMPLIED
+    converter CDATA #IMPLIED
+>
+
+<!ELEMENT param (#PCDATA)>
+<!ATTLIST param
+    name CDATA #REQUIRED
+>
+
+<!ELEMENT result (#PCDATA|param)*>
+<!ATTLIST result
+    name CDATA #IMPLIED
+    type CDATA #IMPLIED
+>
+
+<!ELEMENT exception-mapping (#PCDATA|param)*>
+<!ATTLIST exception-mapping
+    name CDATA #IMPLIED
+    exception CDATA #REQUIRED
+    result CDATA #REQUIRED
+>
+
+<!ELEMENT allowed-methods (#PCDATA)>
+
+<!ELEMENT include (#PCDATA)>
+<!ATTLIST include
+    file CDATA #REQUIRED
+>
+
+<!ELEMENT bean-provider (#PCDATA)>
+<!ATTLIST bean-provider
+    name CDATA #IMPLIED
+    class CDATA #IMPLIED
+>
+
+<!ELEMENT bean (#PCDATA)>
+<!ATTLIST bean
+    type CDATA #IMPLIED
+    name CDATA #IMPLIED
+    class CDATA #REQUIRED
+    scope CDATA #IMPLIED
+    static CDATA #IMPLIED
+    optional CDATA #IMPLIED
+>
+
+<!ELEMENT constant (#PCDATA)>
+<!ATTLIST constant
+    name CDATA #REQUIRED
+    value CDATA #REQUIRED
+>
+
+<!ELEMENT unknown-handler-stack (unknown-handler-ref*)>
+<!ELEMENT unknown-handler-ref (#PCDATA)>
+<!ATTLIST unknown-handler-ref
+    name CDATA #REQUIRED
+>
+
+<!-- END SNIPPET: xworkDtd -->
+


Mime
View raw message