Author: dkulp
Date: Fri Jul 24 13:58:18 2009
New Revision: 797460
URL: http://svn.apache.org/viewvc?rev=797460&view=rev
Log:
Merged revisions 797232 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r797232 | dkulp | 2009-07-23 17:33:48 -0400 (Thu, 23 Jul 2009) | 2 lines
Fix issues in mtom demo of the streams getting corrupt
Fix checkstyle issues in aegis demo
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/server/HelloWorldImpl.java
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 24 13:58:18 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797232
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java?rev=797460&r1=797459&r2=797460&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java
(original)
+++
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java
Fri Jul 24 13:58:18 2009
@@ -19,9 +19,11 @@
package demo.hw.client;
+
import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
+
import demo.hw.server.HelloWorld;
public final class Client {
Modified:
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/server/HelloWorldImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/server/HelloWorldImpl.java?rev=797460&r1=797459&r2=797460&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/server/HelloWorldImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/aegis/src/demo/hw/server/HelloWorldImpl.java
Fri Jul 24 13:58:18 2009
@@ -24,5 +24,6 @@
System.out.println("sayHi called");
return "Hello " + text;
}
+
}
Modified:
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java?rev=797460&r1=797459&r2=797460&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
(original)
+++
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
Fri Jul 24 13:58:18 2009
@@ -22,7 +22,6 @@
import java.awt.Image;
import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
@@ -50,9 +49,6 @@
}
public static void main(String args[]) throws Exception {
-
- Client client = new Client();
-
if (args.length == 0) {
System.out.println("Please specify the WSDL file.");
System.exit(1);
@@ -83,7 +79,10 @@
Holder<byte[]> param = new Holder<byte[]>();
param.value = new byte[(int) fileSize];
InputStream in = fileURL.openStream();
- in.read(param.value);
+ int len = in.read(param.value);
+ while (len < fileSize) {
+ len += in.read(param.value, len, (int)(fileSize - len));
+ }
System.out.println("--Sending the me.bmp image to server");
System.out.println("--Sending a name value of " + name.value);
@@ -123,8 +122,4 @@
System.exit(0);
}
- private static InputStream getResourceStream(File file) throws Exception {
- InputStream in = new FileInputStream(file);
- return in;
- }
}
Modified:
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java?rev=797460&r1=797459&r2=797460&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java
Fri Jul 24 13:58:18 2009
@@ -18,10 +18,14 @@
*/
package demo.mtom.server;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import javax.activation.DataHandler;
import javax.jws.WebService;
+import javax.mail.util.ByteArrayDataSource;
import javax.xml.ws.Holder;
import org.apache.cxf.mime.TestMtomPortType;
@@ -44,12 +48,29 @@
try {
System.out.println("Received image with mtom enabled from client");
InputStream mtomIn = attachinfo.value.getInputStream();
- long fileSize = 0;
- System.out.println("The image data size is " + mtomIn.available());
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ copy(mtomIn, out);
+ System.out.println("The image data size is " + out.size());
name.value = "Hello " + name.value;
mtomIn.close();
+ attachinfo.value = new DataHandler(new
ByteArrayDataSource(out.toByteArray(),
+
attachinfo.value.getContentType()));
} catch (Exception e) {
e.printStackTrace();
}
}
+ public static int copy(final InputStream input, final OutputStream output)
throws IOException {
+ final byte[] buffer = new byte[4096];
+ int n = 0;
+ n = input.read(buffer);
+ int total = 0;
+ while (-1 != n) {
+ output.write(buffer, 0, n);
+ total += n;
+ n = input.read(buffer);
+ }
+ return total;
+ }
+
+
}