Author: dkulp
Date: Wed Aug 5 19:36:37 2009
New Revision: 801381
URL: http://svn.apache.org/viewvc?rev=801381&view=rev
Log:
[CXF-2380] Have imports check the ResourceResolvers as well
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java?rev=801381&r1=801380&r2=801381&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
Wed Aug 5 19:36:37 2009
@@ -28,6 +28,7 @@
String wsdlUrl;
InputSource last;
String baseUri;
+ String lastImport;
boolean fromParent;
public AbstractWrapperWSDLLocator(String wsdlUrl,
@@ -50,6 +51,7 @@
}
public abstract InputSource getInputSource();
+ public abstract InputSource getInputSource(String parentLocation, String
importLocation);
public InputSource getBaseInputSource() {
InputSource is = parent.getBaseInputSource();
@@ -80,10 +82,21 @@
}
public InputSource getImportInputSource(String parentLocation, String
importLocation) {
- return parent.getImportInputSource(parentLocation, importLocation);
+ InputSource src = parent.getImportInputSource(parentLocation,
importLocation);
+ lastImport = null;
+ if (src == null || (src.getByteStream() == null &&
src.getCharacterStream() == null)) {
+ src = getInputSource(parentLocation, importLocation);
+ if (src != null) {
+ lastImport = src.getSystemId();
+ }
+ }
+ return src;
}
public String getLatestImportURI() {
+ if (lastImport != null) {
+ return lastImport;
+ }
return parent.getLatestImportURI();
}
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java?rev=801381&r1=801380&r2=801381&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java
Wed Aug 5 19:36:37 2009
@@ -45,19 +45,23 @@
this.bus = bus;
}
-
public InputSource getInputSource() {
- InputStream ins =
bus.getExtension(ResourceManager.class).getResourceAsStream(wsdlUrl);
+ InputSource src = getInputSource(null, wsdlUrl);
+ baseUri = src.getPublicId();
+ return src;
+ }
+
+ public InputSource getInputSource(String parentLocation, String
importLocation) {
+ InputStream ins =
bus.getExtension(ResourceManager.class).getResourceAsStream(importLocation);
InputSource is = new InputSource(ins);
- is.setSystemId(wsdlUrl);
- is.setPublicId(wsdlUrl);
+ is.setSystemId(importLocation);
+ is.setPublicId(importLocation);
- URL url =
bus.getExtension(ResourceManager.class).resolveResource(wsdlUrl, URL.class);
+ URL url =
bus.getExtension(ResourceManager.class).resolveResource(importLocation,
URL.class);
if (url != null) {
is.setSystemId(url.toString());
is.setPublicId(url.toString());
}
- baseUri = is.getPublicId();
return is;
}