You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/07/05 12:08:08 UTC

[camel] 01/02: CAMEL-12609: Filter Headers/Properties in DefaultExchangeFormatter

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

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

commit 049910798dd0c012ac72555311d753bc3b42e45c
Author: dariusx <da...@gmail.com>
AuthorDate: Thu Jul 5 06:22:54 2018 -0400

    CAMEL-12609: Filter Headers/Properties in DefaultExchangeFormatter
---
 .../apache/camel/processor/DefaultExchangeFormatter.java | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java b/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
index 3f05e30..184430823 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
@@ -111,13 +111,13 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
             if (multiline) {
                 sb.append(SEPARATOR);
             }
-            sb.append(style("Properties")).append(sortMap(exchange.getProperties()));
+            sb.append(style("Properties")).append(sortMap(filterHeaderAndProperties(exchange.getProperties())));
         }
         if (showAll || showHeaders) {
             if (multiline) {
                 sb.append(SEPARATOR);
             }
-            sb.append(style("Headers")).append(sortMap(in.getHeaders()));
+            sb.append(style("Headers")).append(sortMap(filterHeaderAndProperties(in.getHeaders())));
         }
         if (showAll || showBodyType) {
             if (multiline) {
@@ -173,7 +173,7 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
                     if (multiline) {
                         sb.append(SEPARATOR);
                     }
-                    sb.append(style("OutHeaders")).append(sortMap(out.getHeaders()));
+                    sb.append(style("OutHeaders")).append(sortMap(filterHeaderAndProperties(out.getHeaders())));
                 }
                 if (showAll || showBodyType) {
                     if (multiline) {
@@ -235,6 +235,16 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
         }
     }
 
+    /**
+     * Filters the headers or properties before formatting them. No default behavior, but can be overridden.
+     *
+     * @param map
+     * @return
+     */
+    protected Map<String, Object> filterHeaderAndProperties(Map<String, Object> map) {
+        return map;
+    }
+
     public boolean isShowExchangeId() {
         return showExchangeId;
     }