You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/09/28 08:41:29 UTC
[1/3] git commit: CAMEL-7848 merged the patch to camel-netty4-http
Repository: camel
Updated Branches:
refs/heads/camel-2.13.x ca14720c7 -> 229890c49
refs/heads/camel-2.14.x fbc22e54c -> 56ce89dc1
CAMEL-7848 merged the patch to camel-netty4-http
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9c9f0a00
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9c9f0a00
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9c9f0a00
Branch: refs/heads/camel-2.14.x
Commit: 9c9f0a00cd71adf6d281d7f2c6ed44f053f7c776
Parents: fbc22e5
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Sep 28 14:11:33 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Sep 28 14:32:43 2014 +0800
----------------------------------------------------------------------
.../http/HttpClientInitializerFactory.java | 24 +++++++++++++++++-
.../http/HttpServerInitializerFactory.java | 26 ++++++++++++++++++--
2 files changed, 47 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9c9f0a00/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
index 0cb4742..b19fcf1 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.netty4.http;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
@@ -28,6 +29,7 @@ import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.timeout.ReadTimeoutHandler;
+import org.apache.camel.component.netty4.ChannelHandlerFactory;
import org.apache.camel.component.netty4.ClientInitializerFactory;
import org.apache.camel.component.netty4.NettyConfiguration;
import org.apache.camel.component.netty4.NettyProducer;
@@ -82,7 +84,27 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
LOG.debug("Client SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> encoders = producer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
+ List<ChannelHandler> decoders = producer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
pipeline.addLast("http", new HttpClientCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(configuration.getChunkedMaxContentLength()));
@@ -93,7 +115,7 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
ChannelHandler timeout = new ReadTimeoutHandler(producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
pipeline.addLast("timeout", timeout);
}
-
+
// handler to route Camel messages
pipeline.addLast("handler", new HttpClientChannelHandler(producer));
http://git-wip-us.apache.org/repos/asf/camel/blob/9c9f0a00/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
index a98aef0..6d61945 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
@@ -17,6 +17,8 @@
package org.apache.camel.component.netty4.http;
+import java.util.List;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
@@ -30,6 +32,7 @@ import io.netty.handler.codec.http.HttpResponseEncoder;
import io.netty.handler.ssl.SslHandler;
import io.netty.util.concurrent.EventExecutorGroup;
import org.apache.camel.CamelContext;
+import org.apache.camel.component.netty4.ChannelHandlerFactory;
import org.apache.camel.component.netty4.NettyConsumer;
import org.apache.camel.component.netty4.NettyServerBootstrapConfiguration;
import org.apache.camel.component.netty4.ServerInitializerFactory;
@@ -83,6 +86,26 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
LOG.debug("Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = consumer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = consumer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpObjectAggregator(configuration.getChunkedMaxContentLength()));
@@ -91,7 +114,7 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
if (supportCompressed()) {
pipeline.addLast("deflater", new HttpContentCompressor());
}
-
+
int port = consumer.getConfiguration().getPort();
ChannelHandler handler = consumer.getEndpoint().getComponent().getMultiplexChannelHandler(port).getChannelHandler();
@@ -101,7 +124,6 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
} else {
pipeline.addLast("handler", handler);
}
-
}
private SSLContext createSSLContext(CamelContext camelContext, NettyServerBootstrapConfiguration configuration) throws Exception {
[2/3] git commit: CAMEL-7848 Added support for registry's encoders
and decoders
Posted by ni...@apache.org.
CAMEL-7848 Added support for registry's encoders and decoders
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/56ce89dc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/56ce89dc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/56ce89dc
Branch: refs/heads/camel-2.14.x
Commit: 56ce89dc1f40e82b1a8cc7cf35ab8ae1db5a8ba9
Parents: 9c9f0a0
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Sep 28 13:59:49 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Sep 28 14:32:55 2014 +0800
----------------------------------------------------------------------
.../netty/http/HttpClientPipelineFactory.java | 24 +++++++++++++++++++-
.../netty/http/HttpServerPipelineFactory.java | 23 +++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/56ce89dc/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
index b5d2d4d..846d690 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
@@ -16,11 +16,13 @@
*/
package org.apache.camel.component.netty.http;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.apache.camel.component.netty.ChannelHandlerFactory;
import org.apache.camel.component.netty.ClientPipelineFactory;
import org.apache.camel.component.netty.NettyComponent;
import org.apache.camel.component.netty.NettyConfiguration;
@@ -79,6 +81,26 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
LOG.debug("Client SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = producer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = producer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("http", new HttpClientCodec());
@@ -89,7 +111,7 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
pipeline.addLast("timeout", timeout);
}
-
+
// handler to route Camel messages
pipeline.addLast("handler", new HttpClientChannelHandler(producer));
http://git-wip-us.apache.org/repos/asf/camel/blob/56ce89dc/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
index 5d705ad..37fc58b 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
@@ -16,10 +16,13 @@
*/
package org.apache.camel.component.netty.http;
+import java.util.List;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import org.apache.camel.CamelContext;
+import org.apache.camel.component.netty.ChannelHandlerFactory;
import org.apache.camel.component.netty.NettyConsumer;
import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
import org.apache.camel.component.netty.ServerPipelineFactory;
@@ -82,6 +85,26 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
LOG.debug("Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = consumer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = consumer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));
[3/3] git commit: CAMEL-7848 Added support for registry's encoders
and decoders
Posted by ni...@apache.org.
CAMEL-7848 Added support for registry's encoders and decoders
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/229890c4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/229890c4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/229890c4
Branch: refs/heads/camel-2.13.x
Commit: 229890c49ce0aefdefa2d8dc17b12ae0abdc16ab
Parents: ca14720
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Sep 28 13:59:49 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Sep 28 14:41:05 2014 +0800
----------------------------------------------------------------------
.../netty/http/HttpClientPipelineFactory.java | 24 +++++++++++++++++++-
.../netty/http/HttpServerPipelineFactory.java | 23 +++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/229890c4/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
index b5d2d4d..846d690 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
@@ -16,11 +16,13 @@
*/
package org.apache.camel.component.netty.http;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.apache.camel.component.netty.ChannelHandlerFactory;
import org.apache.camel.component.netty.ClientPipelineFactory;
import org.apache.camel.component.netty.NettyComponent;
import org.apache.camel.component.netty.NettyConfiguration;
@@ -79,6 +81,26 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
LOG.debug("Client SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = producer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = producer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("http", new HttpClientCodec());
@@ -89,7 +111,7 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
pipeline.addLast("timeout", timeout);
}
-
+
// handler to route Camel messages
pipeline.addLast("handler", new HttpClientChannelHandler(producer));
http://git-wip-us.apache.org/repos/asf/camel/blob/229890c4/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
index 5d705ad..37fc58b 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
@@ -16,10 +16,13 @@
*/
package org.apache.camel.component.netty.http;
+import java.util.List;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import org.apache.camel.CamelContext;
+import org.apache.camel.component.netty.ChannelHandlerFactory;
import org.apache.camel.component.netty.NettyConsumer;
import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
import org.apache.camel.component.netty.ServerPipelineFactory;
@@ -82,6 +85,26 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
LOG.debug("Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = consumer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = consumer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));