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 2021/02/03 07:57:39 UTC
[camel] 01/06: CAMEL-16129: camel-netty - Avoid reflection when
configuring endpoints.
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 6e8a24901f69de1e949936b1ea9631d2c88aa910
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Feb 2 21:17:36 2021 +0100
CAMEL-16129: camel-netty - Avoid reflection when configuring endpoints.
---
.../java/org/apache/camel/component/netty/NettyComponent.java | 8 +++++---
.../java/org/apache/camel/component/netty/NettyConfiguration.java | 7 +++----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
index 4e62bdb..5519338 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
@@ -96,11 +96,13 @@ public class NettyComponent extends DefaultComponent implements SSLContextParame
config.setSslContextParameters(retrieveGlobalSslContextParameters());
}
- // validate config
- config.validateConfiguration();
-
NettyEndpoint nettyEndpoint = new NettyEndpoint(uri, this, config);
setProperties(nettyEndpoint, parameters);
+
+ // set defaults on config and validate
+ config.setDefaultEncodersAndDecoders();
+ config.validateConfiguration();
+
return nettyEndpoint;
}
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
index 95db9db..d6f5baa 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
@@ -36,7 +36,6 @@ import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriParams;
import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.EndpointHelper;
-import org.apache.camel.support.PropertyBindingSupport;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.PropertiesHelper;
import org.apache.camel.util.StringHelper;
@@ -164,6 +163,7 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem
}
}
+ @Deprecated
public void parseURI(URI uri, Map<String, Object> parameters, NettyComponent component, String... supportedProtocols)
throws Exception {
protocol = uri.getScheme();
@@ -207,15 +207,14 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem
= component.resolveAndRemoveReferenceListParameter(parameters, "decoders", ChannelHandler.class, null);
addToHandlersList(decoders, referencedDecoders, ChannelHandler.class);
- // then set parameters with the help of the camel context type converters
- PropertyBindingSupport.bindProperties(component.getCamelContext(), this, parameters);
-
// additional netty options, we don't want to store an empty map, so set it as null if empty
options = PropertiesHelper.extractProperties(parameters, "option.");
if (options.isEmpty()) {
options = null;
}
+ }
+ public void setDefaultEncodersAndDecoders() {
// add default encoders and decoders
if (encoders.isEmpty() && decoders.isEmpty()) {
if (isAllowDefaultCodec()) {