cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r542121 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/main/java/org...
Date Mon, 28 May 2007 05:55:04 GMT
Author: dandiep
Date: Sun May 27 22:55:03 2007
New Revision: 542121

URL: http://svn.apache.org/viewvc?view=rev&rev=542121
Log:
Don't remove headers or attachments from the out objects, instead just ensure that the BareOutInterceptor
only uses the objects that it needs.

Fix AbstractMessageContainer.getMessagePartIndex to actually return the index of the message
part inside of the message, and not the method index.

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java?view=diff&rev=542121&r1=542120&r2=542121
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
Sun May 27 22:55:03 2007
@@ -92,10 +92,12 @@
     }
 
     public int getMessagePartIndex(MessagePartInfo part) {
+        int i = 0;
         for (MessagePartInfo p : messageParts.values()) {
             if (part == p) {
-                return p.getIndex();
+                return i;
             }
+            i++;
         }
         return -1;
     }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java?view=diff&rev=542121&r1=542120&r2=542121
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
Sun May 27 22:55:03 2007
@@ -24,7 +24,7 @@
 import org.apache.ws.commons.schema.XmlSchemaAnnotated;
 
 public final class MessagePartInfo extends AbstractPropertiesHolder {
-    
+
     private QName pname;
     private AbstractMessageContainer mInfo;
     

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=542121&r1=542120&r2=542121
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
Sun May 27 22:55:03 2007
@@ -20,7 +20,6 @@
 package org.apache.cxf.binding.soap.interceptor;
 
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.ResourceBundle;
 
@@ -40,6 +39,7 @@
 import org.apache.cxf.headers.Header;
 import org.apache.cxf.headers.HeaderManager;
 import org.apache.cxf.headers.HeaderProcessor;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -141,7 +141,7 @@
         
         List<MessagePartInfo> parts = wrappedBmi.getMessageInfo().getMessageParts();
         if (parts.size() > 0) {
-            List<?> objs = message.getContent(List.class);
+            List<Object> objs = CastUtils.cast((List<?>)message.getContent(List.class));
             if (objs == null) {
                 return endedHeader;
             }
@@ -149,17 +149,13 @@
             List<SoapHeaderInfo> headers = bmi.getExtensors(SoapHeaderInfo.class);
             if (headers == null) {
                 return endedHeader;
-            }
-            
-                        
+            }            
             
-            List<Object> objsToRemove = new ArrayList<Object>(headers.size());
             for (SoapHeaderInfo header : headers) {
                 MessagePartInfo part = header.getPart();
 
                 int idx = parts.indexOf(part);
-                //int idx = part.getIndex();
-                                
+                
                 Object arg = objs.get(idx);
                 if (!(startedHeader || preexistingHeaders)) {
                     try {
@@ -174,13 +170,7 @@
                 }
                 DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message);
                 dataWriter.write(arg, header.getPart(), xtw);
-                
-                objsToRemove.add(arg);
-            }
-            for (Object obj : objsToRemove) {
-                objs.remove(obj);
             }
-            
             
             if (startedHeader || preexistingHeaders) {
                 try {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java?view=diff&rev=542121&r1=542120&r2=542121
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
Sun May 27 22:55:03 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 
@@ -48,31 +49,33 @@
         DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message, XMLStreamWriter.class);
         XMLStreamWriter xmlWriter = message.getContent(XMLStreamWriter.class);
         
-        int countParts = 0;
         List<MessagePartInfo> parts = null;
+        BindingMessageInfo bmsg = null;
+        boolean client = isRequestor(message);
 
-        if (!isRequestor(message)) {
+        if (!client) {
             if (operation.getOutput() != null) {
-                parts = operation.getOutput().getMessageParts();
+                bmsg = operation.getOutput();
+                parts = bmsg.getMessageParts();
             } else {
                 // partial response to oneway
                 return;
             }
         } else {
-            parts = operation.getInput().getMessageParts();
+            bmsg = operation.getInput();
+            parts = bmsg.getMessageParts();
         }
-        countParts = parts.size();
-
-        if (countParts > 0) {
-            List<?> objs = message.getContent(List.class);
-            if (objs != null) {
-                Object[] args = objs.toArray();
-                Object[] els = parts.toArray();
-
-                for (int idx = 0; idx < countParts; idx++) {
-                    dataWriter.write(args[idx], (MessagePartInfo)els[idx], xmlWriter);
-                }
-            }
+        
+        List<?> objs = message.getContent(List.class);
+        if (objs == null) {
+            return;
+        }
+        
+        for (MessagePartInfo part : parts) {
+            int idx = part.getMessageInfo().getMessagePartIndex(part);
+            
+            Object o = objs.get(idx);
+            dataWriter.write(o, part, xmlWriter);
         }
     }
     

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java?view=diff&rev=542121&r1=542120&r2=542121
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
Sun May 27 22:55:03 2007
@@ -112,7 +112,6 @@
 
         List<Object> outObjects = CastUtils.cast(message.getContent(List.class));
         
-        int removed = 0;
         for (MessagePartInfo mpi : sbi.getAttachments()) {
             String partName = mpi.getConcreteName().getLocalPart();
             String ct = (String) mpi.getProperty(Message.CONTENT_TYPE);
@@ -123,12 +122,13 @@
                 .append("@apache.org").toString();
             
             // this assumes things are in order...
-            Object o = outObjects.remove(mpi.getIndex() - removed);
+            int idx = mpi.getMessageInfo().getMessagePartIndex(mpi);
+            Object o = outObjects.get(idx);
+            
             if (o == null) {
                 continue;
             }
             
-            removed++;
             DataHandler dh = null;
             
             // This code could probably be refactored out somewhere...



Mime
View raw message