You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ay...@apache.org on 2013/08/15 15:10:54 UTC

git commit: CAMEL-6471: CXF in PAYLOAD mode should not output body/headers in the toString as that may force loading into memory. Also log if payload mode is allowing streaming or not, as thats not easy to see how is configured.

Updated Branches:
  refs/heads/camel-2.11.x e7a040b2c -> b158d8d95


CAMEL-6471: CXF in PAYLOAD mode should not output body/headers in the toString as that may force loading into memory. Also log if payload mode is allowing streaming or not, as thats not easy to see how is configured.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b158d8d9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b158d8d9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b158d8d9

Branch: refs/heads/camel-2.11.x
Commit: b158d8d95c934dbaf511978480655c78f3e383e0
Parents: e7a040b
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jun 20 13:48:16 2013 +0200
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Thu Aug 15 15:06:51 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/component/cxf/CxfPayload.java  | 29 ++------------------
 .../cxf/feature/PayLoadDataFormatFeature.java   |  4 +++
 2 files changed, 6 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b158d8d9/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
index f40efcd..2fad481 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
@@ -130,34 +130,9 @@ public class CxfPayload<T> {
         return headers;
     }
     
-    /**
-     * Returns the contents as a String
-     * Important notes:
-     *   1) This requires the message to be fully loaded breaking the streaming
-     *   2) For large messages, the result can be a VERY large String and require
-     *   large amounts of memory.
-     */
     public String toString() {
-        StringBuilder buf = new StringBuilder();
-        buf.append(getClass().getName());
-        buf.append(" headers: " + headers);
-        // go through the list of element and turn it into String
-        if (body == null) {
-            buf.append("body: " + body);
-        } else {
-            buf.append("body: [ ");
-            for (Element src : getBody()) {
-                String elementString;
-                try {
-                    elementString = StaxUtils.toString(src);
-                } catch (XMLStreamException e) {
-                    elementString = src.toString();
-                }
-                buf.append("[" + elementString + "]");
-            }
-            buf.append("]");
-        }
-        return buf.toString();
+        // do not load or print the payload body etc as we do not want to load that into memory etc
+        return super.toString();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b158d8d9/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
index 4642358..dae5b86 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
@@ -85,6 +85,8 @@ public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
                           SoapHeaderInterceptor.class);
         client.getEndpoint().getBinding().getInInterceptors().add(new ConfigureDocLitWrapperInterceptor(true));
         resetPartTypes(client.getEndpoint().getBinding());
+
+        LOG.info("Initialized CXF Client: {} in Payload mode with allow streaming: {}", client, allowStreaming);
     }
 
 
@@ -103,6 +105,8 @@ public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
         removeInterceptor(server.getEndpoint().getBinding().getInInterceptors(), 
                           SoapHeaderInterceptor.class);
         resetPartTypes(server.getEndpoint().getBinding());
+
+        LOG.info("Initialized CXF Server: {} in Payload mode with allow streaming: {}", server, allowStreaming);
     }
 
     @Override