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 883a1b8712c66c480cc8f2b6e6fbbd4baef77a51 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Feb 3 06:20:25 2021 +0100 Revert "CAMEL-16129: camel-netty - Avoid reflection when configuring endpoints." This reverts commit 0b72e8c567ad29313d7a45cc4f10a6329f6ff256. --- .../java/org/apache/camel/component/netty/NettyComponent.java | 8 +++----- .../java/org/apache/camel/component/netty/NettyConfiguration.java | 7 ++++--- 2 files changed, 7 insertions(+), 8 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 5519338..4e62bdb 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,13 +96,11 @@ public class NettyComponent extends DefaultComponent implements SSLContextParame config.setSslContextParameters(retrieveGlobalSslContextParameters()); } - NettyEndpoint nettyEndpoint = new NettyEndpoint(uri, this, config); - setProperties(nettyEndpoint, parameters); - - // set defaults on config and validate - config.setDefaultEncodersAndDecoders(); + // validate config config.validateConfiguration(); + NettyEndpoint nettyEndpoint = new NettyEndpoint(uri, this, config); + setProperties(nettyEndpoint, parameters); 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 d6f5baa..95db9db 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,6 +36,7 @@ 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; @@ -163,7 +164,6 @@ 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,14 +207,15 @@ 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()) {