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 2019/10/11 10:49:29 UTC

[camel] 02/02: CAMEL-14025: Add muteException as global option on undertow component so you can easily turn this on

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 1c114d872b5268a9d358877e0c4cfcdfbd7a0be4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Oct 11 12:49:10 2019 +0200

    CAMEL-14025: Add muteException as global option on undertow component so you can easily turn this on
---
 .../camel-undertow/src/main/docs/undertow-component.adoc   |  3 ++-
 .../apache/camel/component/undertow/UndertowComponent.java | 14 ++++++++++++++
 .../apache/camel/component/undertow/UndertowEndpoint.java  |  1 -
 .../endpoint/dsl/UndertowEndpointBuilderFactory.java       |  7 +++----
 .../springboot/UndertowComponentConfiguration.java         | 13 +++++++++++++
 5 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/components/camel-undertow/src/main/docs/undertow-component.adoc b/components/camel-undertow/src/main/docs/undertow-component.adoc
index 060f44f..e39185d 100644
--- a/components/camel-undertow/src/main/docs/undertow-component.adoc
+++ b/components/camel-undertow/src/main/docs/undertow-component.adoc
@@ -43,7 +43,7 @@ You can append query options to the URI in the following format,
 == Options
 
 // component options: START
-The Undertow component supports 5 options, which are listed below.
+The Undertow component supports 6 options, which are listed below.
 
 
 
@@ -54,6 +54,7 @@ The Undertow component supports 5 options, which are listed below.
 | *sslContextParameters* (security) | To configure security using SSLContextParameters |  | SSLContextParameters
 | *useGlobalSslContext Parameters* (security) | Enable usage of global SSL context parameters. | false | boolean
 | *hostOptions* (advanced) | To configure common options, such as thread pools |  | UndertowHostOptions
+| *muteException* (consumer) | If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace. | false | boolean
 | *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 |===
 // component options: END
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
index faa2b4c..7468b7e 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
@@ -69,6 +69,8 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF
     private boolean useGlobalSslContextParameters;
     @Metadata(label = "advanced")
     private UndertowHostOptions hostOptions;
+    @Metadata(label = "consumer", defaultValue = "false")
+    private boolean muteException;
 
     public UndertowComponent() {
         this(null);
@@ -98,6 +100,7 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF
         UndertowEndpoint endpoint = createEndpointInstance(endpointUri, this);
         // set options from component
         endpoint.setSslContextParameters(sslParams);
+        endpoint.setMuteException(muteException);
         // Prefer endpoint configured over component configured
         if (undertowHttpBinding == null) {
             // fallback to component configured
@@ -395,6 +398,17 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF
         this.hostOptions = hostOptions;
     }
 
+    public boolean isMuteException() {
+        return muteException;
+    }
+
+    /**
+     * If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace.
+     */
+    public void setMuteException(boolean muteException) {
+        this.muteException = muteException;
+    }
+
     public ComponentVerifierExtension getVerifier() {
         return (scope, parameters) -> getExtension(ComponentVerifierExtension.class).orElseThrow(UnsupportedOperationException::new).verify(scope, parameters);
     }
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
index f2932e7..b4643ff 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
@@ -262,7 +262,6 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint,
 
     /**
      * If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace.
-     *
      */
     public void setMuteException(Boolean muteException) {
         this.muteException = muteException;
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java
index fb84b0c..510846c 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java
@@ -184,12 +184,12 @@ public interface UndertowEndpointBuilderFactory {
          * If enabled and an Exchange failed processing on the consumer side the
          * response's body won't contain the exception's stack trace.
          * 
-         * The option is a: <code>java.lang.Boolean</code> type.
+         * The option is a: <code>boolean</code> type.
          * 
          * Group: consumer
          */
         default UndertowEndpointConsumerBuilder muteException(
-                Boolean muteException) {
+                boolean muteException) {
             doSetProperty("muteException", muteException);
             return this;
         }
@@ -197,8 +197,7 @@ public interface UndertowEndpointBuilderFactory {
          * If enabled and an Exchange failed processing on the consumer side the
          * response's body won't contain the exception's stack trace.
          * 
-         * The option will be converted to a <code>java.lang.Boolean</code>
-         * type.
+         * The option will be converted to a <code>boolean</code> type.
          * 
          * Group: consumer
          */
diff --git a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java
index a029ce6..56e6d3f 100644
--- a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java
@@ -57,6 +57,11 @@ public class UndertowComponentConfiguration
      */
     private UndertowHostOptionsNestedConfiguration hostOptions;
     /**
+     * If enabled and an Exchange failed processing on the consumer side the
+     * response's body won't contain the exception's stack trace.
+     */
+    private Boolean muteException = false;
+    /**
      * Whether the component should use basic property binding (Camel 2.x) or
      * the newer property binding with additional capabilities
      */
@@ -96,6 +101,14 @@ public class UndertowComponentConfiguration
         this.hostOptions = hostOptions;
     }
 
+    public Boolean getMuteException() {
+        return muteException;
+    }
+
+    public void setMuteException(Boolean muteException) {
+        this.muteException = muteException;
+    }
+
     public Boolean getBasicPropertyBinding() {
         return basicPropertyBinding;
     }