Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 49001 invoked from network); 29 Jul 2009 02:29:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Jul 2009 02:29:48 -0000 Received: (qmail 48656 invoked by uid 500); 29 Jul 2009 02:29:49 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 48572 invoked by uid 500); 29 Jul 2009 02:29:48 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 48561 invoked by uid 99); 29 Jul 2009 02:29:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2009 02:29:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2009 02:29:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8A3AC23888DD; Wed, 29 Jul 2009 02:29:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r798755 - in /cxf/branches/2.1.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/core/src/main/java/org/apache/cxf/attachment/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/ Date: Wed, 29 Jul 2009 02:29:26 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090729022926.8A3AC23888DD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Wed Jul 29 02:29:25 2009 New Revision: 798755 URL: http://svn.apache.org/viewvc?rev=798755&view=rev Log: Merged revisions 798752 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes ................ r798752 | dkulp | 2009-07-28 22:20:55 -0400 (Tue, 28 Jul 2009) | 10 lines Merged revisions 798749 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r798749 | dkulp | 2009-07-28 22:14:11 -0400 (Tue, 28 Jul 2009) | 2 lines SAAJ requires the attachments to be cached as well as it breaks the streaming. ........ ................ Modified: cxf/branches/2.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jul 29 02:29:25 2009 @@ -1,2 +1,2 @@ -/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873 67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798350,798568,798574-798575,798577-798578,798586,798608,798655 -/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798346,798479,798533,798551,798557,798561-798562,798570,798573,798584,798654 +/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873 67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798350,798568,798574-798575,798577-798578,798586,798608,798655,798752 +/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798346,798479,798533,798551,798557,798561-798562,798570,798573,798584,798654,798749 Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=798755&r1=798754&r2=798755&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java (original) +++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java Wed Jul 29 02:29:25 2009 @@ -20,6 +20,7 @@ package org.apache.cxf.binding.soap.saaj; +import java.io.IOException; import java.util.Collection; import java.util.Iterator; import java.util.ResourceBundle; @@ -43,6 +44,7 @@ import org.w3c.dom.Node; import org.apache.cxf.Bus; +import org.apache.cxf.attachment.AttachmentDataSource; import org.apache.cxf.binding.soap.Soap11; import org.apache.cxf.binding.soap.SoapFault; import org.apache.cxf.binding.soap.SoapHeader; @@ -106,6 +108,13 @@ Collection atts = message.getAttachments(); if (atts != null) { for (Attachment a : atts) { + if (a.getDataHandler().getDataSource() instanceof AttachmentDataSource) { + try { + ((AttachmentDataSource)a.getDataHandler().getDataSource()).cache(); + } catch (IOException e) { + throw new Fault(e); + } + } AttachmentPart ap = soapMessage.createAttachmentPart(a.getDataHandler()); ap.setContentId(a.getId()); Iterator i = a.getHeaderNames(); Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java?rev=798755&r1=798754&r2=798755&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java Wed Jul 29 02:29:25 2009 @@ -33,34 +33,44 @@ private final String ct; private CachedOutputStream cache; private InputStream ins; - private DelegatingInputStream lastIns; + private DelegatingInputStream delegating; public AttachmentDataSource(String ctParam, InputStream inParam) throws IOException { this.ct = ctParam; ins = inParam; + if (ins instanceof DelegatingInputStream) { + delegating = (DelegatingInputStream)ins; + } + } + public AttachmentDataSource(String ctParam, + InputStream inParam, + InputStream delegate) throws IOException { + this.ct = ctParam; + ins = inParam; + if (delegate instanceof DelegatingInputStream) { + delegating = (DelegatingInputStream)delegate; + } } public boolean isCached() { return cache != null; } - - public void hold() { - try { - if (cache == null) { - cache = new CachedOutputStream(); - IOUtils.copy(ins, cache); - cache.lockOutputStream(); - cache.holdTempFile(); - ins.close(); - ins = null; - if (lastIns != null) { - lastIns.setInputStream(cache.getInputStream()); - } + public void cache() throws IOException { + if (cache == null) { + cache = new CachedOutputStream(); + IOUtils.copy(ins, cache); + cache.lockOutputStream(); + ins.close(); + ins = null; + if (delegating != null) { + delegating.setInputStream(cache.getInputStream()); } - } catch (IOException e) { - //shouldn't happen } } + public void hold() throws IOException { + cache(); + cache.holdTempFile(); + } public void release() { cache.releaseTempFileHold(); } @@ -68,15 +78,14 @@ public String getContentType() { return ct; } - + public DelegatingInputStream getDelegatingInputStream() { + return delegating; + } public InputStream getInputStream() { try { if (cache != null) { return cache.getInputStream(); } - if (ins instanceof DelegatingInputStream) { - lastIns = (DelegatingInputStream)ins; - } return ins; } catch (IOException e) { return null; Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?rev=798755&r1=798754&r2=798755&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java Wed Jul 29 02:29:25 2009 @@ -208,8 +208,8 @@ for (Attachment a : attachments.getLoadedAttachments()) { DataSource s = a.getDataHandler().getDataSource(); if (s instanceof AttachmentDataSource) { - if (!((AttachmentDataSource)s).isCached()) { - cache((DelegatingInputStream) s.getInputStream(), false); + if (((AttachmentDataSource)s).getDelegatingInputStream() != null) { + cache(((AttachmentDataSource)s).getDelegatingInputStream(), false); } } else { cache((DelegatingInputStream) s.getInputStream(), false); Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?rev=798755&r1=798754&r2=798755&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java Wed Jul 29 02:29:25 2009 @@ -162,7 +162,9 @@ } if (quotedPrintable) { - DataSource source = new AttachmentDataSource(ct, new QuotedPrintableDecoderStream(stream)); + DataSource source = new AttachmentDataSource(ct, + new QuotedPrintableDecoderStream(stream), + stream); att.setDataHandler(new DataHandler(source)); } else { DataSource source = new AttachmentDataSource(ct, stream); Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java?rev=798755&r1=798754&r2=798755&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java Wed Jul 29 02:29:25 2009 @@ -19,6 +19,7 @@ package org.apache.cxf.jaxb.attachment; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -51,7 +52,11 @@ for (Attachment at : message.getAttachments()) { if (at.getDataHandler().getDataSource() instanceof AttachmentDataSource) { AttachmentDataSource ds = (AttachmentDataSource)at.getDataHandler().getDataSource(); - ds.hold(); + try { + ds.hold(); + } catch (IOException e) { + throw new Fault(e); + } dss.add(ds); } }