camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1201878 - in /camel/branches/camel-2.8.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/ components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/
Date Mon, 14 Nov 2011 20:28:15 GMT
Author: dkulp
Date: Mon Nov 14 20:28:14 2011
New Revision: 1201878

URL: http://svn.apache.org/viewvc?rev=1201878&view=rev
Log:
Merged revisions 1199260 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1199260 | ningjiang | 2011-11-08 09:30:46 -0500 (Tue, 08 Nov 2011) | 1 line
  
  CAMEL-4644 MessageDataFormatFeature should keep the LoggingOutInterceptor
........

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java
    camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java?rev=1201878&r1=1201877&r2=1201878&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java
Mon Nov 14 20:28:14 2011
@@ -24,6 +24,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.slf4j.Logger;
@@ -54,15 +55,21 @@ public class MessageDataFormatFeature ex
 
     @Override
     public void initialize(Client client, Bus bus) {
-
+        //check if there is logging interceptor
+        
         removeInterceptorWhichIsOutThePhases(client.getInInterceptors(), REMAINING_IN_PHASES);
         removeInterceptorWhichIsOutThePhases(client.getEndpoint().getInInterceptors(), REMAINING_IN_PHASES);
         client.getEndpoint().getBinding().getInInterceptors().clear();
 
+        //we need to keep the LoggingOutputInterceptor
+        Interceptor<? extends Message> loggingOutputInterceptor =  getLoggingOutInterceptor(client);
         removeInterceptorWhichIsOutThePhases(client.getOutInterceptors(), REMAINING_OUT_PHASES);
         removeInterceptorWhichIsOutThePhases(client.getEndpoint().getOutInterceptors(), REMAINING_OUT_PHASES);
         client.getEndpoint().getBinding().getOutInterceptors().clear();
         client.getEndpoint().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
+        if (loggingOutputInterceptor != null) {
+            client.getEndpoint().getOutInterceptors().add(loggingOutputInterceptor);
+        }
     }
 
     @Override
@@ -81,6 +88,9 @@ public class MessageDataFormatFeature ex
             server.getEndpoint().getInInterceptors().add(wsdlGetInterceptor);
         }
         
+        //we need to keep the LoggingOutputInterceptor
+        Interceptor<? extends Message> loggingOutputInterceptor =  getLoggingOutInterceptor(server);
+        
         // Do not using the binding interceptor any more
         server.getEndpoint().getBinding().getInInterceptors().clear();
 
@@ -90,6 +100,10 @@ public class MessageDataFormatFeature ex
         // Do not use the binding interceptor any more
         server.getEndpoint().getBinding().getOutInterceptors().clear();
         server.getEndpoint().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
+        
+        if (loggingOutputInterceptor != null) {
+            server.getEndpoint().getOutInterceptors().add(loggingOutputInterceptor);
+        }
     }
 
     @Override
@@ -105,5 +119,21 @@ public class MessageDataFormatFeature ex
         } 
         return null;
     }
+    
+    protected Interceptor<? extends Message> getLoggingOutInterceptor(Client client)
{
+        Interceptor<? extends Message> result = getInterceptorByName(client.getOutInterceptors(),
LoggingOutInterceptor.class.getName());
+        if (result == null) {
+            result = getInterceptorByName(client.getEndpoint().getOutInterceptors(), LoggingOutInterceptor.class.getName());
+        }
+        return result;
+    }
+    
+    protected Interceptor<? extends Message> getLoggingOutInterceptor(Server server)
{
+        Interceptor<? extends Message> result = getInterceptorByName(server.getEndpoint().getOutInterceptors(),
LoggingOutInterceptor.class.getName());
+        if (result == null) {
+            result = getInterceptorByName(server.getEndpoint().getService().getOutInterceptors(),
LoggingOutInterceptor.class.getName());
+        }
+        return result;
+    }
 
 }

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml?rev=1201878&r1=1201877&r2=1201878&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
(original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
Mon Nov 14 20:28:14 2011
@@ -32,13 +32,21 @@
 
 
    <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:${CxfGreeterMessageRouterTest.port2}/CamelContext/RouterPort"
-    		serviceClass="org.apache.hello_world_soap_http.GreeterImpl"/>
+    		serviceClass="org.apache.hello_world_soap_http.GreeterImpl">
+        <cxf:features>
+			<bean class="org.apache.cxf.feature.LoggingFeature"/>
+		</cxf:features>
+   </cxf:cxfEndpoint>
 
    <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:${CxfGreeterMessageRouterTest.port1}/SoapContext/SoapPort"
     		wsdlURL="testutils/hello_world.wsdl"
     		serviceClass="org.apache.hello_world_soap_http.Greeter"
     		endpointName="s:SoapPort"
     		serviceName="s:SOAPService"
-    	xmlns:s="http://apache.org/hello_world_soap_http" />
+    	xmlns:s="http://apache.org/hello_world_soap_http" >
+    	<cxf:features>
+			<bean class="org.apache.cxf.feature.LoggingFeature"/>
+		</cxf:features>
+   </cxf:cxfEndpoint>
 
 </beans>
\ No newline at end of file



Mime
View raw message