cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1145049 - /cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/demo/jaxrs/client/Client.java
Date Mon, 11 Jul 2011 07:28:53 GMT
Author: ffang
Date: Mon Jul 11 07:28:53 2011
New Revision: 1145049

URL: http://svn.apache.org/viewvc?rev=1145049&view=rev
Log:
[CXF-3650]jax-rs basic example doesn't work when there's a space in file path url

Modified:
    cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/demo/jaxrs/client/Client.java

Modified: cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/demo/jaxrs/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/demo/jaxrs/client/Client.java?rev=1145049&r1=1145048&r2=1145049&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/demo/jaxrs/client/Client.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/demo/jaxrs/client/Client.java
Mon Jul 11 07:28:53 2011
@@ -31,6 +31,7 @@ import org.apache.commons.httpclient.met
 
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.resource.URIResolver;
 
 public final class Client {
 
@@ -64,7 +65,8 @@ public final class Client {
         System.out.println("Sent HTTP PUT request to update customer info");
         Client client = new Client();
         String inputFile = client.getClass().getResource("update_customer.xml").getFile();
-        File input = new File(inputFile);
+        URIResolver resolver = new URIResolver(inputFile);
+        File input = new File(resolver.getURI());
         PutMethod put = new PutMethod("http://localhost:9000/customerservice/customers");
         RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");
         put.setRequestEntity(entity);
@@ -85,7 +87,8 @@ public final class Client {
         System.out.println("\n");
         System.out.println("Sent HTTP POST request to add customer");
         inputFile = client.getClass().getResource("add_customer.xml").getFile();
-        input = new File(inputFile);
+        resolver = new URIResolver(inputFile);
+        input = new File(resolver.getURI());
         PostMethod post = new PostMethod("http://localhost:9000/customerservice/customers");
         post.addRequestHeader("Accept" , "text/xml");
         entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");



Mime
View raw message