You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2018/06/01 11:13:30 UTC

[camel] branch master updated: CAMEL-12553 Using cxf new LoggingFeature

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 18a110c  CAMEL-12553 Using cxf new LoggingFeature
18a110c is described below

commit 18a110cc4e78968b623564fe02484d54af7f906f
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Fri Jun 1 19:11:33 2018 +0800

    CAMEL-12553 Using cxf new LoggingFeature
---
 components/camel-cxf/pom.xml                          |  4 ++++
 .../org/apache/camel/component/cxf/CxfEndpoint.java   | 19 ++++++++++---------
 .../cxf/blueprint/RsClientBlueprintBean.java          | 13 ++++---------
 .../camel/component/cxf/jaxrs/CxfRsEndpoint.java      |  8 ++++----
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/components/camel-cxf/pom.xml b/components/camel-cxf/pom.xml
index e160c75..20bfee5 100644
--- a/components/camel-cxf/pom.xml
+++ b/components/camel-cxf/pom.xml
@@ -122,6 +122,10 @@
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-rs-client</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-features-logging</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.springframework</groupId>
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
index 372f672..81316be 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
@@ -88,8 +88,8 @@ import org.apache.cxf.databinding.source.SourceDataBinding;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.feature.Feature;
-import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.headers.Header;
@@ -341,11 +341,11 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade
         }
 
         if (isLoggingFeatureEnabled()) {
-            if (getLoggingSizeLimit() != 0) {
-                sfb.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
-            } else {
-                sfb.getFeatures().add(new LoggingFeature());
+            LoggingFeature loggingFeature = new LoggingFeature();
+            if (getLoggingSizeLimit() > 0) {
+                loggingFeature.setLimit(getLoggingSizeLimit());
             }
+            sfb.getFeatures().add(loggingFeature);
         }
 
         if (getDataFormat() == DataFormat.PAYLOAD) {
@@ -530,11 +530,12 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade
         }
 
         if (isLoggingFeatureEnabled()) {
-            if (getLoggingSizeLimit() != 0) {
-                factoryBean.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
-            } else {
-                factoryBean.getFeatures().add(new LoggingFeature());
+            LoggingFeature loggingFeature = new LoggingFeature();
+            if (getLoggingSizeLimit() > 0) {
+                loggingFeature.setLimit(getLoggingSizeLimit());
+
             }
+            factoryBean.getFeatures().add(loggingFeature);
         }
 
         // set the document-literal wrapped style
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java
index cdd45b5..bca343a 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.cxf.blueprint;
 import java.util.HashMap;
 
 import org.apache.camel.component.cxf.NullFaultListener;
-import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.logging.FaultListener;
 import org.osgi.framework.BundleContext;
@@ -57,10 +57,9 @@ public class RsClientBlueprintBean extends JAXRSClientFactoryBean implements Blu
             loggingFeature = null;
         }
         if (loggingFeatureEnabled) {
+            loggingFeature = new LoggingFeature();
             if (getLoggingSizeLimit() > 0) {
-                loggingFeature = new LoggingFeature(getLoggingSizeLimit());
-            } else {
-                loggingFeature = new LoggingFeature();
+                loggingFeature.setLimit(getLoggingSizeLimit());
             }
             getFeatures().add(loggingFeature);
         }
@@ -74,13 +73,9 @@ public class RsClientBlueprintBean extends JAXRSClientFactoryBean implements Blu
     public void setLoggingSizeLimit(int loggingSizeLimit) {
         this.loggingSizeLimit = loggingSizeLimit;
         if (loggingFeature != null) {
-            getFeatures().remove(loggingFeature);
             if (loggingSizeLimit > 0) {
-                loggingFeature = new LoggingFeature(loggingSizeLimit);
-            } else {
-                loggingFeature = new LoggingFeature();
+                loggingFeature.setLimit(loggingSizeLimit);
             }
-            getFeatures().add(loggingFeature);
         }
     }
     
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
index 803b8f3..e8333ae 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
@@ -47,8 +47,8 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.feature.Feature;
-import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean;
@@ -359,11 +359,11 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
         }
 
         if (isLoggingFeatureEnabled()) {
+            LoggingFeature loggingFeature = new LoggingFeature();
             if (getLoggingSizeLimit() > 0) {
-                factory.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
-            } else {
-                factory.getFeatures().add(new LoggingFeature());
+                loggingFeature.setLimit(getLoggingSizeLimit());
             }
+            factory.getFeatures().add(loggingFeature);
         }
         if (this.isSkipFaultLogging()) {
             if (factory.getProperties() == null) {

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.