cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r798752 - in /cxf/branches/2.2.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:20:55 GMT
Author: dkulp
Date: Wed Jul 29 02:20:55 2009
New Revision: 798752

URL: http://svn.apache.org/viewvc?rev=798752&view=rev
Log:
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.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
    cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 29 02:20:55 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-797233,797442,797505,797517,797534,797581-797583,797587,797640,797651,797699,797882-797883,798344-798346,798363,798461,798479,798533,798551,798557,798561-798562,798570,798573,79858
 4,798654,798748
+/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-797233,797442,797505,797517,797534,797581-797583,797587,797640,797651,797699,797882-797883,798344-798346,798363,798461,798479,798533,798551,798557,798561-798562,798570,798573,79858
 4,798654,798748-798749

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.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.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=798752&r1=798751&r2=798752&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Wed Jul 29 02:20:55 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;
@@ -112,6 +114,13 @@
             Collection<Attachment> 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<String> i = a.getHeaderNames();

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java?rev=798752&r1=798751&r2=798752&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
Wed Jul 29 02:20:55 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.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?rev=798752&r1=798751&r2=798752&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
Wed Jul 29 02:20:55 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.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?rev=798752&r1=798751&r2=798752&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
Wed Jul 29 02:20:55 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.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java?rev=798752&r1=798751&r2=798752&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
Wed Jul 29 02:20:55 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);
                 }
             }



Mime
View raw message