cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r821046 - /cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Date Fri, 02 Oct 2009 15:08:28 GMT
Author: dkulp
Date: Fri Oct  2 15:08:28 2009
New Revision: 821046

URL: http://svn.apache.org/viewvc?rev=821046&view=rev
Log:
[CXF-2453] If datasource isn't "xml", don't do the xml things.

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=821046&r1=821045&r2=821046&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Fri Oct  2 15:08:28 2009
@@ -43,7 +43,9 @@
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.SAAJOutEndingInterceptor;
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.message.MessageImpl;
@@ -117,6 +119,25 @@
                     }
                     
                 });
+            } else if (!ct.toLowerCase().contains("xml")) {
+                //not XML based, need to stream out directly.  This is a bit tricky as
+                //we don't want the stax stuff triggering and such
+                OutputStream out = message.getContent(OutputStream.class);
+                message.put(Message.CONTENT_TYPE, ct);
+                try {
+                    InputStream in = ds.getInputStream();
+                    IOUtils.copy(in, out);
+                    in.close();
+                    out.flush();
+                    out.close();
+                } catch (IOException e) {
+                    throw new Fault(e);
+                }
+                list.remove(0);
+                out = new CachedOutputStream();
+                message.setContent(OutputStream.class, out);
+                XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
+                message.setContent(XMLStreamWriter.class, writer);
             }
         }
         



Mime
View raw message