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/10/24 09:03:04 UTC
[1/3] git commit: Fix javadoc warning,
ChannelPipelineFactory not found
Repository: camel
Updated Branches:
refs/heads/camel-2.14.x 52691e427 -> 5886d8f27
Fix javadoc warning, ChannelPipelineFactory not found
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/80ddc5ac
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/80ddc5ac
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/80ddc5ac
Branch: refs/heads/camel-2.14.x
Commit: 80ddc5acb574fe5a7e183f3ca9d6427c14636119
Parents: 52691e4
Author: wuwen <wu...@gmail.com>
Authored: Thu Oct 23 02:18:20 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Oct 24 15:02:15 2014 +0800
----------------------------------------------------------------------
.../apache/camel/component/netty4/ServerInitializerFactory.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/80ddc5ac/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerInitializerFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerInitializerFactory.java
index 3fea1b2..4249b6c 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerInitializerFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerInitializerFactory.java
@@ -28,7 +28,7 @@ import io.netty.channel.ChannelPipeline;
* to the given {@link NettyConsumer} using the {@link #createPipelineFactory(NettyConsumer)}
* method.
*
- * @see ChannelPipelineFactory
+ * @see ChannelInitializer
*/
public abstract class ServerInitializerFactory extends ChannelInitializer<Channel> {
[3/3] git commit: CAMEL-7848 Need to added the encode and decode
after the http codec in camel-netty4-http
Posted by ni...@apache.org.
CAMEL-7848 Need to added the encode and decode after the http codec in 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/5886d8f2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5886d8f2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5886d8f2
Branch: refs/heads/camel-2.14.x
Commit: 5886d8f276e01072524ffa02ce9ca950db9fa253
Parents: 21f37e1
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Oct 24 14:33:05 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Oct 24 15:02:36 2014 +0800
----------------------------------------------------------------------
components/camel-netty4-http/pom.xml | 14 ++++++++++----
.../netty4/http/HttpClientInitializerFactory.java | 4 ++--
.../netty4/http/HttpServerInitializerFactory.java | 10 ++++------
parent/pom.xml | 1 +
4 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5886d8f2/components/camel-netty4-http/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/pom.xml b/components/camel-netty4-http/pom.xml
index bd44ef0..1026fba 100644
--- a/components/camel-netty4-http/pom.xml
+++ b/components/camel-netty4-http/pom.xml
@@ -41,13 +41,19 @@
<artifactId>camel-netty4</artifactId>
</dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-codec-http</artifactId>
- <version>${netty-version}</version>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-codec-http</artifactId>
+ <version>${netty-version}</version>
</dependency>
-
+
<!-- testing -->
<dependency>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jzlib</artifactId>
+ <version>${jzlib-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/camel/blob/5886d8f2/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 b19fcf1..bda2f9e 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
@@ -85,6 +85,8 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
pipeline.addLast("ssl", sslHandler);
}
+ pipeline.addLast("http", new HttpClientCodec());
+
List<ChannelHandler> encoders = producer.getConfiguration().getEncoders();
for (int x = 0; x < encoders.size(); x++) {
ChannelHandler encoder = encoders.get(x);
@@ -104,8 +106,6 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
}
pipeline.addLast("decoder-" + x, decoder);
}
-
- pipeline.addLast("http", new HttpClientCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(configuration.getChunkedMaxContentLength()));
if (producer.getConfiguration().getRequestTimeout() > 0) {
http://git-wip-us.apache.org/repos/asf/camel/blob/5886d8f2/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 6d61945..c7f40ea 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
@@ -87,6 +87,7 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
pipeline.addLast("ssl", sslHandler);
}
+ pipeline.addLast("decoder", new HttpRequestDecoder());
List<ChannelHandler> decoders = consumer.getConfiguration().getDecoders();
for (int x = 0; x < decoders.size(); x++) {
ChannelHandler decoder = decoders.get(x);
@@ -96,7 +97,9 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
}
pipeline.addLast("decoder-" + x, decoder);
}
-
+ pipeline.addLast("aggregator", new HttpObjectAggregator(configuration.getChunkedMaxContentLength()));
+
+ pipeline.addLast("encoder", new HttpResponseEncoder());
List<ChannelHandler> encoders = consumer.getConfiguration().getEncoders();
for (int x = 0; x < encoders.size(); x++) {
ChannelHandler encoder = encoders.get(x);
@@ -106,11 +109,6 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
}
pipeline.addLast("encoder-" + x, encoder);
}
-
- pipeline.addLast("decoder", new HttpRequestDecoder());
- pipeline.addLast("aggregator", new HttpObjectAggregator(configuration.getChunkedMaxContentLength()));
-
- pipeline.addLast("encoder", new HttpResponseEncoder());
if (supportCompressed()) {
pipeline.addLast("deflater", new HttpContentCompressor());
}
http://git-wip-us.apache.org/repos/asf/camel/blob/5886d8f2/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 5b513d5..a51f3cb 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -272,6 +272,7 @@
<junit-bundle-version>4.11_1</junit-bundle-version>
<junit-version>4.11</junit-version>
<jython-version>2.5.3</jython-version>
+ <jzlib-version>1.1.3</jzlib-version>
<kafka-version>0.8.1</kafka-version>
<kafka-bundle-version>0.8.1_1</kafka-bundle-version>
<karaf-version>2.3.7</karaf-version>
[2/3] git commit: CAMEL-7848 Need to added the encode and decode
after the http codec
Posted by ni...@apache.org.
CAMEL-7848 Need to added the encode and decode after the http codec
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/21f37e19
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/21f37e19
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/21f37e19
Branch: refs/heads/camel-2.14.x
Commit: 21f37e19d02260ceb21ff88975b6d32910a9d001
Parents: 80ddc5a
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Oct 24 14:08:31 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Oct 24 15:02:27 2014 +0800
----------------------------------------------------------------------
.../netty/http/HttpClientPipelineFactory.java | 4 +-
.../netty/http/HttpServerPipelineFactory.java | 10 ++-
.../netty/http/NettyHttpCompressTest.java | 70 ++++++++++++++++++++
3 files changed, 76 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/21f37e19/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 846d690..019a6cd 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
@@ -82,6 +82,8 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
pipeline.addLast("ssl", sslHandler);
}
+ pipeline.addLast("http", new HttpClientCodec());
+
List<ChannelHandler> decoders = producer.getConfiguration().getDecoders();
for (int x = 0; x < decoders.size(); x++) {
ChannelHandler decoder = decoders.get(x);
@@ -102,8 +104,6 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
pipeline.addLast("encoder-" + x, encoder);
}
- pipeline.addLast("http", new HttpClientCodec());
-
if (producer.getConfiguration().getRequestTimeout() > 0) {
if (LOG.isTraceEnabled()) {
LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout());
http://git-wip-us.apache.org/repos/asf/camel/blob/21f37e19/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 37fc58b..22ea852 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
@@ -86,6 +86,7 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
pipeline.addLast("ssl", sslHandler);
}
+ pipeline.addLast("decoder", new HttpRequestDecoder());
List<ChannelHandler> decoders = consumer.getConfiguration().getDecoders();
for (int x = 0; x < decoders.size(); x++) {
ChannelHandler decoder = decoders.get(x);
@@ -95,7 +96,9 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
}
pipeline.addLast("decoder-" + x, decoder);
}
+ pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));
+ pipeline.addLast("encoder", new HttpResponseEncoder());
List<ChannelHandler> encoders = consumer.getConfiguration().getEncoders();
for (int x = 0; x < encoders.size(); x++) {
ChannelHandler encoder = encoders.get(x);
@@ -105,15 +108,10 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
}
pipeline.addLast("encoder-" + x, encoder);
}
-
- pipeline.addLast("decoder", new HttpRequestDecoder());
- pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));
-
- pipeline.addLast("encoder", new HttpResponseEncoder());
if (supportCompressed()) {
pipeline.addLast("deflater", new HttpContentCompressor());
}
-
+
if (consumer.getConfiguration().isOrderedThreadPoolExecutor()) {
// this must be added just before the HttpServerMultiplexChannelHandler
// use ordered thread pool, to ensure we process the events in order, and can send back
http://git-wip-us.apache.org/repos/asf/camel/blob/21f37e19/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCompressTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCompressTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCompressTest.java
new file mode 100644
index 0000000..f642b13
--- /dev/null
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpCompressTest.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty.http;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.handler.codec.http.HttpContentDecompressor;
+import org.junit.Test;
+
+public class NettyHttpCompressTest extends BaseNettyTest {
+
+ // setup the decompress decoder here
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry registry = super.createRegistry();
+ List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
+ decoders.add(new HttpContentDecompressor());
+ registry.bind("myDecoders", decoders);
+ return registry;
+ }
+
+
+ @Test
+ public void testContentType() throws Exception {
+
+ byte[] data = "Hello World".getBytes(Charset.forName("UTF-8"));
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("content-type", "text/plain; charset=\"UTF-8\"");
+ headers.put("Accept-Encoding", "compress, gzip");
+ String out = template.requestBodyAndHeaders("netty-http:http://0.0.0.0:9001/foo?decoders=#myDecoders", data,
+ headers, String.class);
+ // The decoded out has some space to clean up.
+ assertEquals("Bye World", out.trim());
+
+
+
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("netty-http:http://0.0.0.0:9001/foo?compression=true")
+ .transform().constant("Bye World").setHeader("content-type").constant("text/plain; charset=\"UTF-8\"");
+ }
+ };
+ }
+}