You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2021/05/03 01:34:26 UTC

[tomee] branch master updated: Switch back to SXC and update the schema manually

This is an automated email from the ASF dual-hosted git repository.

jlmonteiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/master by this push:
     new 009fbc2  Switch back to SXC and update the schema manually
009fbc2 is described below

commit 009fbc23f48fb4b9084b01935d66a29e55385615
Author: Jean-Louis Monteiro <jl...@tomitribe.com>
AuthorDate: Mon May 3 03:34:11 2021 +0200

    Switch back to SXC and update the schema manually
---
 .../java/org/apache/openejb/config/ReadDescriptors.java     |  5 +++--
 .../src/main/java/org/apache/openejb/jee/WebApp$JAXB.java   | 13 +++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
index 58936f3..73e972a 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
@@ -58,6 +58,7 @@ import org.apache.openejb.sxc.EjbJarXml;
 import org.apache.openejb.sxc.FacesConfigXml;
 import org.apache.openejb.sxc.HandlerChainsXml;
 import org.apache.openejb.sxc.TldTaglibXml;
+import org.apache.openejb.sxc.WebXml;
 import org.apache.openejb.sxc.WebservicesXml;
 import org.apache.openejb.util.LengthInputStream;
 import org.apache.openejb.util.LogCategory;
@@ -832,9 +833,9 @@ public class ReadDescriptors implements DynamicDeployer {
     public static WebApp readWebApp(final URL url) throws OpenEJBException {
         final WebApp webApp;
         try {
-            webApp = (WebApp) JaxbJavaee.unmarshalJavaee(WebApp.class, IO.read(url));
+            // webApp = (WebApp) JaxbJavaee.unmarshalJavaee(WebApp.class, IO.read(url));
             // don't use the SXC version with the accessors as it's not up to date
-            // webApp = WebXml.unmarshal(url);
+            webApp = WebXml.unmarshal(url);
         } catch (final SAXException e) {
             throw new OpenEJBException("Cannot parse the web.xml file: " + url.toExternalForm(), e);
         } catch (final JAXBException e) {
diff --git a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
index f8781e3..4a43820 100644
--- a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
+++ b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
@@ -609,6 +609,19 @@ public class WebApp$JAXB
                 }
 
                 webApp.moduleName = moduleName;
+            } else if (("default-context-path" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
+                // ELEMENT: defaultContextPath
+                final String defaultContextPathRaw = elementReader.getElementAsString();
+
+                final String defaultContextPath;
+                try {
+                    defaultContextPath = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultContextPathRaw);
+                } catch (final Exception e) {
+                    context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
+                    continue;
+                }
+
+                webApp.defaultContextPath = defaultContextPath;
             } /*
             else not yet used so ignored, here will come servlet 3.1 elements we don't parse cause don't need yet
             */