You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/05/05 16:38:29 UTC
svn commit: r941315 - in /cxf/trunk:
api/src/main/java/org/apache/cxf/transport/
rt/core/src/main/java/org/apache/cxf/transport/http/
rt/core/src/test/java/org/apache/cxf/wsdl11/
rt/core/src/test/resources/folder with spaces/ rt/core/src/test/resources...
Author: dkulp
Date: Wed May 5 14:38:29 2010
New Revision: 941315
URL: http://svn.apache.org/viewvc?rev=941315&view=rev
Log:
[CXF-2767] More fixes for spaces in dirs
Patch from William Tam applied
Added:
cxf/trunk/rt/core/src/test/resources/folder with spaces/
cxf/trunk/rt/core/src/test/resources/folder with spaces/import_test.wsdl
cxf/trunk/rt/core/src/test/resources/schema/
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_In.xsd
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_Out.xsd
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_In.xsd
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_Out.xsd
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_In.xsd
cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_Out.xsd
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java?rev=941315&r1=941314&r2=941315&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java Wed May 5 14:38:29 2010
@@ -61,6 +61,10 @@ public class TransportURIResolver extend
}
public InputSource resolve(String curUri, String baseUri) {
+
+ // Spaces must be encoded or URI.resolve() will choke
+ curUri = curUri.replace(" ", "%20");
+
InputSource is = null;
URI base;
try {
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=941315&r1=941314&r2=941315&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Wed May 5 14:38:29 2010
@@ -121,7 +121,14 @@ public class WSDLQueryHandler implements
}
String wsdl = params.get("wsdl");
+ if (wsdl != null) {
+ wsdl = wsdl.replace("%20", " ");
+ }
+
String xsd = params.get("xsd");
+ if (xsd != null) {
+ xsd = xsd.replace("%20", " ");
+ }
Map<String, Definition> mp = CastUtils.cast((Map)endpointInfo.getService()
.getProperty(WSDLQueryHandler.class.getName()));
@@ -243,7 +250,7 @@ public class WSDLQueryHandler implements
for (Element el : elementList) {
String sl = el.getAttribute("schemaLocation");
if (smp.containsKey(sl)) {
- el.setAttribute("schemaLocation", base + "?xsd=" + sl);
+ el.setAttribute("schemaLocation", base + "?xsd=" + sl.replace(" ", "%20"));
}
}
@@ -253,7 +260,7 @@ public class WSDLQueryHandler implements
for (Element el : elementList) {
String sl = el.getAttribute("schemaLocation");
if (smp.containsKey(sl)) {
- el.setAttribute("schemaLocation", base + "?xsd=" + sl);
+ el.setAttribute("schemaLocation", base + "?xsd=" + sl.replace(" ", "%20"));
}
}
elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
@@ -262,7 +269,7 @@ public class WSDLQueryHandler implements
for (Element el : elementList) {
String sl = el.getAttribute("schemaLocation");
if (smp.containsKey(sl)) {
- el.setAttribute("schemaLocation", base + "?xsd=" + sl);
+ el.setAttribute("schemaLocation", base + "?xsd=" + sl.replace(" ", "%20"));
}
}
elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
@@ -271,7 +278,7 @@ public class WSDLQueryHandler implements
for (Element el : elementList) {
String sl = el.getAttribute("location");
if (mp.containsKey(sl)) {
- el.setAttribute("location", base + "?wsdl=" + sl);
+ el.setAttribute("location", base + "?wsdl=" + sl.replace(" ", "%20"));
}
}
Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java?rev=941315&r1=941314&r2=941315&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java (original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java Wed May 5 14:38:29 2010
@@ -103,4 +103,28 @@ public class WSDLDefinitionBuilderTest e
assertNotNull(part);
assertEquals(new QName("http://apache.org/hello_world/types", "sayHi"), part.getElementName());
}
+
+ @Test
+ public void testBuildImportedWSDLSpacesInPath() throws Exception {
+ WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(BusFactory.getDefaultBus());
+ String wsdlUrl = getClass().getResource("/folder with spaces/import_test.wsdl").toString();
+
+ Definition def = builder.build(wsdlUrl);
+ assertNotNull(def);
+
+ Map services = def.getServices();
+ assertNotNull(services);
+ assertEquals(1, services.size());
+
+ String serviceQName = "urn:S1importS2S3/resources/wsdl/S1importsS2S3Test1";
+ Service service = (Service)services.get(new QName(serviceQName, "S1importsS2S3TestService"));
+ assertNotNull(service);
+
+ Map ports = service.getPorts();
+ assertNotNull(ports);
+ assertEquals(1, ports.size());
+ Port port = service.getPort("S1importsS2S3TestPort");
+ assertNotNull(port);
+ }
+
}
Added: cxf/trunk/rt/core/src/test/resources/folder with spaces/import_test.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/folder%20with%20spaces/import_test.wsdl?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/folder with spaces/import_test.wsdl (added)
+++ cxf/trunk/rt/core/src/test/resources/folder with spaces/import_test.wsdl Wed May 5 14:38:29 2010
@@ -0,0 +1,97 @@
+<?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.
+-->
+
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:S1importS2S3/resources/wsdl/S1importsS2S3Test1"
+ xmlns:S1importsS2S3Test="urn:S1importS2S3/resources/wsdl/S1importsS2S3Test1/S1importsS2S3Test/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xmime="http://www.w3.org/2005/05/xmlmime" targetNamespace="urn:S1importS2S3/resources/wsdl/S1importsS2S3Test1"
+ name="S1importsS2S3Test1">
+ <wsdl:types>
+ <schema
+ targetNamespace="urn:S1importS2S3/resources/wsdl/S1importsS2S3Test1/S1importsS2S3Test/types"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:prefix0="urn:Schema1_Out"
+ xmlns:prefix="urn:Schema1_In" elementFormDefault="qualified">
+
+ <xsd:import namespace="urn:Schema1_Out"
+ schemaLocation="../schema/folder with spaces/Schema1_Out.xsd" />
+ <xsd:import namespace="urn:Schema1_In"
+ schemaLocation="../schema/folder with spaces/Schema1_In.xsd" />d
+
+ <element name="S1importsS2S3Test">
+ <complexType>
+ <sequence>
+ <element name="DefaultInputElem" type="prefix:UseImportedElements_In" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="S1importsS2S3TestResponse">
+ <complexType>
+ <sequence>
+ <element name="DefaultOutputElem" type="prefix0:UseImportedElements_Out" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="S1importsS2S3TestRequest">
+ <wsdl:part name="in" element="S1importsS2S3Test:S1importsS2S3Test" />
+ </wsdl:message>
+
+ <wsdl:message name="S1importsS2S3TestResponse">
+ <wsdl:part name="out"
+ element="S1importsS2S3Test:S1importsS2S3TestResponse" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="S1importsS2S3TestPortType">
+ <wsdl:operation name="S1importsS2S3Test">
+ <wsdl:input message="tns:S1importsS2S3TestRequest" />
+ <wsdl:output message="tns:S1importsS2S3TestResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="S1importsS2S3TestSOAP_11Binding" type="tns:S1importsS2S3TestPortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="S1importsS2S3Test">
+ <soap:operation soapAction="" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+
+ </wsdl:operation>
+ </wsdl:binding>
+
+
+ <wsdl:service name="S1importsS2S3TestService">
+ <wsdl:port name="S1importsS2S3TestPort" binding="tns:S1importsS2S3TestSOAP_11Binding">
+ <soap:address location="http://localhost:3580/connect/S1importsS2S3Test" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
Added: cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_In.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/schema/folder%20with%20spaces/Schema1_In.xsd?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_In.xsd (added)
+++ cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_In.xsd Wed May 5 14:38:29 2010
@@ -0,0 +1,30 @@
+<!--
+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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:S1_In="urn:Schema1_In" xmlns:UseInt="urn:Schema2_In" xmlns:UseString="urn:Schema3_In" targetNamespace="urn:Schema1_In">
+ <xsd:import schemaLocation="Schema2_In.xsd" namespace="urn:Schema2_In">
+ </xsd:import>
+ <xsd:import schemaLocation="Schema3_In.xsd" namespace="urn:Schema3_In" />
+ <xsd:complexType name="UseImportedElements_In">
+ <xsd:sequence>
+ <xsd:element ref="UseInt:ElementS2_In_Int" />
+ <xsd:element ref="UseString:ElementS3_In_string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
\ No newline at end of file
Added: cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_Out.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/schema/folder%20with%20spaces/Schema1_Out.xsd?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_Out.xsd (added)
+++ cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema1_Out.xsd Wed May 5 14:38:29 2010
@@ -0,0 +1,30 @@
+<!--
+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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:S1_In="urn:Schema1_Out" xmlns:UseIntOut="urn:Schema2_Out" xmlns:UseStringOut="urn:Schema3_Out" targetNamespace="urn:Schema1_Out">
+ <xsd:import schemaLocation="Schema2_Out.xsd" namespace="urn:Schema2_Out">
+ </xsd:import>
+ <xsd:import schemaLocation="Schema3_Out.xsd" namespace="urn:Schema3_Out" />
+ <xsd:complexType name="UseImportedElements_Out">
+ <xsd:sequence>
+ <xsd:element ref="UseIntOut:ElementS2_Out_Int" />
+ <xsd:element ref="UseStringOut:ElementS3_Out_string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
\ No newline at end of file
Added: cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_In.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/schema/folder%20with%20spaces/Schema2_In.xsd?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_In.xsd (added)
+++ cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_In.xsd Wed May 5 14:38:29 2010
@@ -0,0 +1,28 @@
+<!--
+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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:S1_In="urn:Schema2_In" targetNamespace="urn:Schema2_In">
+ <xsd:element name="ElementS2_In_Int">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="S2_In_Int" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
\ No newline at end of file
Added: cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_Out.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/schema/folder%20with%20spaces/Schema2_Out.xsd?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_Out.xsd (added)
+++ cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema2_Out.xsd Wed May 5 14:38:29 2010
@@ -0,0 +1,28 @@
+<!--
+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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:S1_In="urn:Schema2_Out" targetNamespace="urn:Schema2_Out">
+ <xsd:element name="ElementS2_Out_Int">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="S2_Out_Int" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
\ No newline at end of file
Added: cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_In.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/schema/folder%20with%20spaces/Schema3_In.xsd?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_In.xsd (added)
+++ cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_In.xsd Wed May 5 14:38:29 2010
@@ -0,0 +1,28 @@
+<!--
+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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:S1_In="urn:Schema3_In" targetNamespace="urn:Schema3_In">
+ <xsd:element name="ElementS3_In_string">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="S3_In_string" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
\ No newline at end of file
Added: cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_Out.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/resources/schema/folder%20with%20spaces/Schema3_Out.xsd?rev=941315&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_Out.xsd (added)
+++ cxf/trunk/rt/core/src/test/resources/schema/folder with spaces/Schema3_Out.xsd Wed May 5 14:38:29 2010
@@ -0,0 +1,28 @@
+<!--
+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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:S1_In="urn:Schema3_Out" targetNamespace="urn:Schema3_Out">
+ <xsd:element name="ElementS3_Out_string">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="S3_Out_string" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
\ No newline at end of file