[CXF-7183] Resolve by namespace and systemID (as required by aries)
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c4f7b19c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c4f7b19c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c4f7b19c Branch: refs/heads/3.1.x-fixes Commit: c4f7b19c18c118834dfa059a4432610aa97098da Parents: f484a68 Author: Grzegorz Grzybek <[email protected]> Authored: Thu Dec 15 13:36:41 2016 +0100 Committer: Guillaume Nodet <[email protected]> Committed: Thu Dec 15 14:28:04 2016 +0100 ---------------------------------------------------------------------- .../cxf/internal/CXFAPINamespaceHandler.java | 19 ++++++++++++++----- .../jaxrs/blueprint/JAXRSBPNamespaceHandler.java | 5 ++++- .../blueprint/JAXRSBPNamespaceHandler.java | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/c4f7b19c/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java b/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java index 507e1ca..6e416e4 100644 --- a/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java +++ b/core/src/main/java/org/apache/cxf/internal/CXFAPINamespaceHandler.java @@ -49,15 +49,24 @@ public class CXFAPINamespaceHandler implements NamespaceHandler { public URL getSchemaLocation(String namespace) { String location = null; - if ("http://cxf.apache.org/configuration/beans".equals(namespace)) { + // when schema is being resolved for custom namespace elements, "namespace" is real namespace + // (from xmlns:prefix="<namespace>" + // but when namespace is <xsd:import>ed, aries/xerces uses systemID (schemaLocation) + + if ("http://cxf.apache.org/configuration/beans".equals(namespace) + || "http://cxf.apache.org/schemas/configuration/cxf-beans.xsd".equals(namespace)) { location = "schemas/configuration/cxf-beans.xsd"; - } else if ("http://cxf.apache.org/configuration/parameterized-types".equals(namespace)) { + } else if ("http://cxf.apache.org/configuration/parameterized-types".equals(namespace) + || "http://cxf.apache.org/schemas/configuration/parameterized-types.xsd".equals(namespace)) { location = "schemas/configuration/parameterized-types.xsd"; - } else if ("http://cxf.apache.org/configuration/security".equals(namespace)) { + } else if ("http://cxf.apache.org/configuration/security".equals(namespace) + || "http://cxf.apache.org/schemas/configuration/security.xsd".equals(namespace)) { location = "schemas/configuration/security.xsd"; - } else if ("http://schemas.xmlsoap.org/wsdl/".equals(namespace)) { + } else if ("http://schemas.xmlsoap.org/wsdl/".equals(namespace) + || "http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd".equals(namespace)) { location = "schemas/wsdl/wsdl.xsd"; - } else if ("http://www.w3.org/2005/08/addressing".equals(namespace)) { + } else if ("http://www.w3.org/2005/08/addressing".equals(namespace) + || "http://www.w3.org/2006/03/addressing/ws-addr.xsd".equals(namespace)) { location = "schemas/wsdl/ws-addr.xsd"; } else if ("http://schemas.xmlsoap.org/ws/2004/08/addressing".equals(namespace)) { location = "schemas/wsdl/addressing.xsd"; http://git-wip-us.apache.org/repos/asf/cxf/blob/c4f7b19c/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java index 2c7aa13..ea2f919 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java @@ -47,8 +47,11 @@ public class JAXRSBPNamespaceHandler extends BaseNamespaceHandler { } public URL getSchemaLocation(String namespace) { - if ("http://cxf.apache.org/blueprint/jaxrs".equals(namespace)) { + if ("http://cxf.apache.org/blueprint/jaxrs".equals(namespace) + || "http://cxf.apache.org/schemas/jaxrs.xsd".equals(namespace)) { return getClass().getClassLoader().getResource("schemas/blueprint/jaxrs.xsd"); + } else if ("http://cxf.apache.org/schemas/jaxrs-common.xsd".equals(namespace)) { + return getClass().getClassLoader().getResource("schemas/blueprint/jaxrs-common.xsd"); } return super.findCoreSchemaLocation(namespace); } http://git-wip-us.apache.org/repos/asf/cxf/blob/c4f7b19c/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/blueprint/JAXRSBPNamespaceHandler.java ---------------------------------------------------------------------- diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/blueprint/JAXRSBPNamespaceHandler.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/blueprint/JAXRSBPNamespaceHandler.java index 6a49418..fc0d1bc 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/blueprint/JAXRSBPNamespaceHandler.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/blueprint/JAXRSBPNamespaceHandler.java @@ -35,9 +35,10 @@ import org.osgi.service.blueprint.reflect.Metadata; @Namespaces("http://cxf.apache.org/blueprint/jaxrs-client") public class JAXRSBPNamespaceHandler implements NamespaceHandler { private BlueprintContainer blueprintContainer; - private JAXRSBPNamespaceHandler jaxRSBPNamespaceHandler = new JAXRSBPNamespaceHandler(); + private org.apache.cxf.jaxrs.blueprint.JAXRSBPNamespaceHandler jaxRSBPNamespaceHandler; public JAXRSBPNamespaceHandler() { + jaxRSBPNamespaceHandler = new org.apache.cxf.jaxrs.blueprint.JAXRSBPNamespaceHandler(); } public URL getSchemaLocation(String namespace) {
