Created
December 15, 2016 08:44
-
-
Save johnpoth/485768993f8fc39910bef468a7226dc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public URL getSchemaLocation(String namespace) { | |
final ClassLoader classLoader = getClass().getClassLoader(); | |
if ("http://cxf.apache.org/blueprint/jaxws".equals(namespace)) { | |
return classLoader.getResource("schemas/blueprint/jaxws.xsd"); | |
} else { | |
try { | |
Class<?> extNsHandlerClazz; | |
Bundle extBundle = FrameworkUtil.getBundle(Endpoint.class); | |
if (extBundle == null) { | |
// we may not be in OSGi environment | |
extNsHandlerClazz = classLoader.loadClass("org.apache.cxf.internal.CXFAPINamespaceHandler"); | |
} else { | |
extNsHandlerClazz = extBundle.loadClass("org.apache.cxf.internal.CXFAPINamespaceHandler"); | |
} | |
final NamespaceHandler handler = (NamespaceHandler) extNsHandlerClazz.newInstance(); | |
// if the given namespace is the location, pass the corresponding namespace instead | |
if ("http://cxf.apache.org/schemas/configuration/cxf-beans.xsd".equals(namespace)) { | |
return handler.getSchemaLocation("http://cxf.apache.org/configuration/beans"); | |
} | |
if ("http://cxf.apache.org/schemas/configuration/parameterized-types.xsd".equals(namespace)) { | |
return handler.getSchemaLocation("http://cxf.apache.org/configuration/parameterized-types"); | |
} | |
return handler.getSchemaLocation(namespace); | |
} catch (Throwable t) { | |
LOG.warning("Could not locate ext namespace schema: " + t.getMessage()); | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment