Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 29875 invoked from network); 29 Oct 2007 16:09:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Oct 2007 16:09:07 -0000 Received: (qmail 4879 invoked by uid 500); 29 Oct 2007 16:08:55 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 4741 invoked by uid 500); 29 Oct 2007 16:08:54 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 4732 invoked by uid 99); 29 Oct 2007 16:08:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Oct 2007 09:08:54 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Oct 2007 16:08:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1E0841A9838; Mon, 29 Oct 2007 09:08:35 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r589707 - in /incubator/cxf/branches/2.0.x-fixes: ./ distribution/src/main/release/samples/mtom/build.xml distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java Date: Mon, 29 Oct 2007 16:08:34 -0000 To: cxf-commits@incubator.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071029160835.1E0841A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Mon Oct 29 09:08:33 2007 New Revision: 589707 URL: http://svn.apache.org/viewvc?rev=589707&view=rev Log: Merged revisions 589363 via svnmerge from https://svn.apache.org/repos/asf/incubator/cxf/trunk ........ r589363 | gmazza | 2007-10-28 10:33:41 -0400 (Sun, 28 Oct 2007) | 1 line Simplified method of handling me.bmp file. ........ Modified: incubator/cxf/branches/2.0.x-fixes/ (props changed) incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/build.xml incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java Propchange: incubator/cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/build.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/build.xml?rev=589707&r1=589706&r2=589707&view=diff ============================================================================== --- incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/build.xml (original) +++ incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/build.xml Mon Oct 29 09:08:33 2007 @@ -22,7 +22,7 @@ - + - + Modified: incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java?rev=589707&r1=589706&r2=589707&view=diff ============================================================================== --- incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java (original) +++ incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java Mon Oct 29 09:08:33 2007 @@ -24,11 +24,11 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import java.net.URI; import java.net.URL; import javax.activation.DataHandler; import javax.imageio.ImageIO; -import javax.mail.util.ByteArrayDataSource; import javax.xml.namespace.QName; import javax.xml.ws.Binding; import javax.xml.ws.BindingProvider; @@ -40,9 +40,11 @@ public final class Client { - private static final QName SERVICE_NAME = new QName("http://cxf.apache.org/mime", "TestMtomService"); + private static final QName SERVICE_NAME = new QName("http://cxf.apache.org/mime", + "TestMtomService"); - private static final QName PORT_NAME = new QName("http://cxf.apache.org/mime", "TestMtomPort"); + private static final QName PORT_NAME = new QName("http://cxf.apache.org/mime", + "TestMtomPort"); private Client() { } @@ -71,19 +73,16 @@ Binding binding = ((BindingProvider)port).getBinding(); ((SOAPBinding)binding).setMTOMEnabled(true); - InputStream pre = client.getClass().getResourceAsStream("me.bmp"); - long fileSize = 0; - for (int i = pre.read(); i != -1; i = pre.read()) { - fileSize++; - } + URL fileURL = client.getClass().getClassLoader().getResource("me.bmp"); + File aFile = new File(new URI(fileURL.toString())); + long fileSize = aFile.length(); System.out.println("Filesize of me.bmp image is: " + fileSize); - Holder param = new Holder(); - param.value = new byte[(int) fileSize]; System.out.println("\nStarting MTOM Test using basic byte array:"); - Holder name = new Holder("Sam"); - InputStream in = client.getClass().getResourceAsStream("me.bmp"); + Holder param = new Holder(); + param.value = new byte[(int) fileSize]; + InputStream in = fileURL.openStream(); in.read(param.value); System.out.println("--Sending the me.bmp image to server"); System.out.println("--Sending a name value of " + name.value); @@ -102,10 +101,9 @@ System.out.println("\nStarting MTOM test with DataHandler:"); name.value = "Bob"; Holder handler = new Holder(); - byte[] data = new byte[(int) fileSize]; - client.getClass().getResourceAsStream("me.bmp").read(data); - handler.value = new DataHandler(new ByteArrayDataSource(data, - "application/octet-stream")); + + handler.value = new DataHandler(fileURL); + System.out.println("--Sending the me.bmp image to server"); System.out.println("--Sending a name value of " + name.value);