[ https://issues.apache.org/jira/browse/CAMEL-12609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533572#comment-16533572 ]
ASF GitHub Bot commented on CAMEL-12609: ---------------------------------------- davsclaus closed pull request #2408: CAMEL-12609: Filter Headers/Properties in DefaultExchangeFormatter URL: https://github.com/apache/camel/pull/2408 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 3f05e306813..b98395d7a2b 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 String format(Exchange exchange) { 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 String format(Exchange exchange) { 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,15 @@ public String format(Exchange exchange) { } } + /** + * 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; } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > DefaultExchangeFormatter: Make it easy to override the header and property > formatting > -------------------------------------------------------------------------------------- > > Key: CAMEL-12609 > URL: https://issues.apache.org/jira/browse/CAMEL-12609 > Project: Camel > Issue Type: Improvement > Reporter: Darius Cooper > Priority: Minor > > To omit certain headers (or mask their values) in ExchangeFormatter, one can > write a custom implementation. > In > [DefaultExchangeFormatter|[https://github.com/apache/camel/blob/apache-master/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java],] > ... it would be nice if the header-formatting (maybe the Property > formatting) was done as separate methods that we could over-ride, while > keeping the rest of the functionality. > Not sure if it would be acceptable to do this without also changing the > ExchangeFormatter interface to add such methods. -- This message was sent by Atlassian JIRA (v7.6.3#76005)