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 2013/06/26 12:43:56 UTC
[1/5] git commit: CAMEL-6488: camel-netty-http allow to share port in
OSGi environment. Work in progress.
Updated Branches:
refs/heads/master 17eabf535 -> b60b6cc4f
CAMEL-6488: camel-netty-http allow to share port in OSGi environment. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/97a91a04
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/97a91a04
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/97a91a04
Branch: refs/heads/master
Commit: 97a91a04275304f27ec8da460d9aa7a5731bb4d2
Parents: 17eabf5
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 26 10:29:27 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 26 10:29:27 2013 +0200
----------------------------------------------------------------------
.../http/DefaultNettySharedHttpServer.java | 6 +--
.../http/HttpServerSharedPipelineFactory.java | 18 ++-------
.../netty/http/NettySharedHttpServer.java | 4 +-
...ySharedHttpServerBootstrapConfiguration.java | 41 ++++++++++++++++++++
.../netty/http/NettySharedHttpServerTest.java | 3 +-
5 files changed, 52 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/97a91a04/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
index eae6669..0ef3c2a 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
@@ -34,12 +34,12 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
private static final Logger LOG = LoggerFactory.getLogger(DefaultNettySharedHttpServer.class);
- private NettyServerBootstrapConfiguration configuration;
+ private NettySharedHttpServerBootstrapConfiguration configuration;
private HttpServerConsumerChannelFactory channelFactory;
private HttpServerBootstrapFactory bootstrapFactory;
private ClassResolver classResolver;
- public void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration) {
+ public void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration configuration) {
this.configuration = configuration;
}
@@ -64,7 +64,7 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
// port must be set
if (configuration.getPort() <= 0) {
- throw new IllegalArgumentException("Port must be configured on NettyServerBootstrapConfiguration " + configuration);
+ throw new IllegalArgumentException("Port must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
}
LOG.info("Starting NettySharedHttpServer using configuration: {} on port: {}", configuration, configuration.getPort());
http://git-wip-us.apache.org/repos/asf/camel/blob/97a91a04/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
index d82143d..7200f8e 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
@@ -43,12 +43,12 @@ import org.slf4j.LoggerFactory;
public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
private static final Logger LOG = LoggerFactory.getLogger(HttpServerSharedPipelineFactory.class);
- private final NettyServerBootstrapConfiguration configuration;
+ private final NettySharedHttpServerBootstrapConfiguration configuration;
private final HttpServerConsumerChannelFactory channelFactory;
private final ClassResolver classResolver;
private SSLContext sslContext;
- public HttpServerSharedPipelineFactory(NettyServerBootstrapConfiguration configuration, HttpServerConsumerChannelFactory channelFactory,
+ public HttpServerSharedPipelineFactory(NettySharedHttpServerBootstrapConfiguration configuration, HttpServerConsumerChannelFactory channelFactory,
ClassResolver classResolver) {
this.configuration = configuration;
this.channelFactory = channelFactory;
@@ -82,11 +82,11 @@ public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
pipeline.addLast("decoder", new HttpRequestDecoder());
// Uncomment the following line if you don't want to handle HttpChunks.
- if (supportChunked()) {
+ if (configuration.isChunked()) {
pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
}
pipeline.addLast("encoder", new HttpResponseEncoder());
- if (supportCompressed()) {
+ if (configuration.isCompression()) {
pipeline.addLast("deflater", new HttpContentCompressor());
}
@@ -153,14 +153,4 @@ public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
}
}
- private boolean supportChunked() {
- // TODO: options on bootstrap
- return true;
- }
-
- private boolean supportCompressed() {
- // TODO: options on bootstrap
- return false;
- }
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/97a91a04/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
index 8e41d40..c29e553 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
@@ -26,7 +26,7 @@ import org.apache.camel.spi.ClassResolver;
* to be re-used among other Camel applications.
* <p/>
* To use this, just define a {@link NettyServerBootstrapConfiguration} configuration, and
- * set this using {@link #setNettyServerBootstrapConfiguration(org.apache.camel.component.netty.NettyServerBootstrapConfiguration)}.
+ * set this using {@link #setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration)}.
* Then call the {@link #start()} to initialize this shared server.
*/
public interface NettySharedHttpServer extends Service {
@@ -34,7 +34,7 @@ public interface NettySharedHttpServer extends Service {
/**
* Sets the bootstrap configuration to use by this shared Netty HTTP server.
*/
- void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration);
+ void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration configuration);
/**
* To use a custom {@link ClassResolver} for loading resource on the classpath.
http://git-wip-us.apache.org/repos/asf/camel/blob/97a91a04/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServerBootstrapConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServerBootstrapConfiguration.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServerBootstrapConfiguration.java
new file mode 100644
index 0000000..0e99996
--- /dev/null
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServerBootstrapConfiguration.java
@@ -0,0 +1,41 @@
+/**
+ * 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 org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
+
+public class NettySharedHttpServerBootstrapConfiguration extends NettyServerBootstrapConfiguration {
+
+ private boolean chunked = true;
+ private boolean compression;
+
+ public boolean isChunked() {
+ return chunked;
+ }
+
+ public void setChunked(boolean chunked) {
+ this.chunked = chunked;
+ }
+
+ public boolean isCompression() {
+ return compression;
+ }
+
+ public void setCompression(boolean compression) {
+ this.compression = compression;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/97a91a04/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
index ca887ca..aa8073f 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
@@ -29,11 +29,12 @@ public class NettySharedHttpServerTest extends BaseNettyTest {
protected JndiRegistry createRegistry() throws Exception {
nettySharedHttpServer = new DefaultNettySharedHttpServer();
- NettyServerBootstrapConfiguration configuration = new NettyServerBootstrapConfiguration();
+ NettySharedHttpServerBootstrapConfiguration configuration = new NettySharedHttpServerBootstrapConfiguration();
configuration.setPort(getPort());
configuration.setHost("localhost");
configuration.setBacklog(20);
configuration.setKeepAlive(true);
+ configuration.setCompression(true);
nettySharedHttpServer.setNettyServerBootstrapConfiguration(configuration);
nettySharedHttpServer.start();
[5/5] git commit: CAMEL-6488: camel-netty-http. Added example for
blueprint.
Posted by da...@apache.org.
CAMEL-6488: camel-netty-http. Added example for blueprint.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b60b6cc4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b60b6cc4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b60b6cc4
Branch: refs/heads/master
Commit: b60b6cc4fd077eca18573929732cff608c91452f
Parents: d7498cd
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 26 12:43:47 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 26 12:43:47 2013 +0200
----------------------------------------------------------------------
examples/camel-example-netty-http/README.txt | 55 ++++++++++++++++++++
examples/camel-example-netty-http/pom.xml | 2 +-
.../OSGI-INF/blueprint/http-server.xml | 1 -
parent/pom.xml | 5 ++
4 files changed, 61 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b60b6cc4/examples/camel-example-netty-http/README.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/README.txt b/examples/camel-example-netty-http/README.txt
new file mode 100644
index 0000000..616c26b
--- /dev/null
+++ b/examples/camel-example-netty-http/README.txt
@@ -0,0 +1,55 @@
+Camel Netty HTTP Server Example
+===============================
+
+This example shows how to use a shared Netty HTTP Server in an OSGi environment.
+
+There is 3 modules in this example
+
+* shared-netty-http-server - The Shared Netty HTTP server that the other Camel applications uses.
+* myapp-one - A Camel application that reuses the shared Netty HTTP server
+* myapp-two - A Camel application that reuses the shared Netty HTTP server
+
+You will need to compile and prepared this example first:
+ mvn install
+
+This example requires running in Apache Karaf / ServiceMix
+
+To install Apache Camel in Karaf you type in the shell (we use version 2.12.0):
+
+ features:chooseurl camel 2.12.0
+ features:install camel
+
+First you need to install the following features in Karaf/ServiceMix with:
+
+ features:install camel-netty-http
+
+Then you can install the shared Netty HTTP server which by default runs on port 8888.
+The port number can be changed by editing the following source file:
+
+ shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
+
+In the Apache Karaf / ServiceMix shell type:
+
+ osgi:install -s mvn:mvn:org.apache.camel/camel-example-netty-http-shared/2.12.0
+
+Then you can install the Camel applications:
+
+ osgi:install -s mvn:org.apache.camel/camel-example-netty-myapp-one/2.12.0
+ osgi:install -s mvn:org.apache.camel/camel-example-netty-myapp-two/2.12.0
+
+From a web browser you can then try the example by accessing the followign URLs:
+
+ http://localhost:8888/one
+ http://localhost:8888/two
+
+This example is documented at
+ http://camel.apache.org/netty-http-server-example.html
+
+If you hit any problems please talk to us on the Camel Forums
+ http://camel.apache.org/discussion-forums.html
+
+Please help us make Apache Camel better - we appreciate any feedback you
+may have. Enjoy!
+
+------------------------
+The Camel riders!
http://git-wip-us.apache.org/repos/asf/camel/blob/b60b6cc4/examples/camel-example-netty-http/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/pom.xml b/examples/camel-example-netty-http/pom.xml
index a1b9aa5..b9efe3b 100644
--- a/examples/camel-example-netty-http/pom.xml
+++ b/examples/camel-example-netty-http/pom.xml
@@ -26,7 +26,7 @@
<artifactId>camel-example-netty-http</artifactId>
<packaging>pom</packaging>
- <name>Camel :: Example :: Netty Shared HTTP Server</name>
+ <name>Camel :: Example :: Netty HTTP</name>
<description>An example showing how to use a shared Netty HTTP server with multiple Camel applications in OSGi container</description>
<properties>
http://git-wip-us.apache.org/repos/asf/camel/blob/b60b6cc4/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
index ba8f0631..7e4e6d2 100755
--- a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
+++ b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
@@ -27,7 +27,6 @@
<property name="host" value="0.0.0.0"/>
<!-- additional options -->
<property name="backlog" value="50"/>
- <property name="compression" value="true"/>
</bean>
<!-- the netty http server -->
http://git-wip-us.apache.org/repos/asf/camel/blob/b60b6cc4/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 9fc13aa..3b5e6d9 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1274,6 +1274,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-example-netty-http</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-example-jms-file</artifactId>
<version>${project.version}</version>
</dependency>
[3/5] git commit: CAMEL-6488: camel-netty-http. Weird osgi issue.
Posted by da...@apache.org.
CAMEL-6488: camel-netty-http. Weird osgi issue.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6e8ca922
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6e8ca922
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6e8ca922
Branch: refs/heads/master
Commit: 6e8ca92263c5fbb6de73c2bbcb3e9ad6be1f0ae2
Parents: d553a92
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 26 11:26:22 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 26 11:26:22 2013 +0200
----------------------------------------------------------------------
.../netty/http/DefaultNettySharedHttpServer.java | 4 ++--
.../netty/http/HttpServerSharedPipelineFactory.java | 14 +++++++-------
.../component/netty/http/NettySharedHttpServer.java | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6e8ca922/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
index 0ef3c2a..034bb68 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
@@ -34,12 +34,12 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
private static final Logger LOG = LoggerFactory.getLogger(DefaultNettySharedHttpServer.class);
- private NettySharedHttpServerBootstrapConfiguration configuration;
+ private NettyServerBootstrapConfiguration configuration;
private HttpServerConsumerChannelFactory channelFactory;
private HttpServerBootstrapFactory bootstrapFactory;
private ClassResolver classResolver;
- public void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration configuration) {
+ public void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration) {
this.configuration = configuration;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/6e8ca922/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
index 7200f8e..e4e88f9 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
@@ -43,12 +43,12 @@ import org.slf4j.LoggerFactory;
public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
private static final Logger LOG = LoggerFactory.getLogger(HttpServerSharedPipelineFactory.class);
- private final NettySharedHttpServerBootstrapConfiguration configuration;
+ private final NettyServerBootstrapConfiguration configuration;
private final HttpServerConsumerChannelFactory channelFactory;
private final ClassResolver classResolver;
private SSLContext sslContext;
- public HttpServerSharedPipelineFactory(NettySharedHttpServerBootstrapConfiguration configuration, HttpServerConsumerChannelFactory channelFactory,
+ public HttpServerSharedPipelineFactory(NettyServerBootstrapConfiguration configuration, HttpServerConsumerChannelFactory channelFactory,
ClassResolver classResolver) {
this.configuration = configuration;
this.channelFactory = channelFactory;
@@ -82,13 +82,13 @@ public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
pipeline.addLast("decoder", new HttpRequestDecoder());
// Uncomment the following line if you don't want to handle HttpChunks.
- if (configuration.isChunked()) {
+// if (configuration.isChunked()) {
pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
- }
+// }
pipeline.addLast("encoder", new HttpResponseEncoder());
- if (configuration.isCompression()) {
- pipeline.addLast("deflater", new HttpContentCompressor());
- }
+// if (configuration.isCompression()) {
+// pipeline.addLast("deflater", new HttpContentCompressor());
+// }
pipeline.addLast("handler", channelFactory.getChannelHandler());
http://git-wip-us.apache.org/repos/asf/camel/blob/6e8ca922/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
index c29e553..b98f118 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
@@ -34,7 +34,7 @@ public interface NettySharedHttpServer extends Service {
/**
* Sets the bootstrap configuration to use by this shared Netty HTTP server.
*/
- void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration configuration);
+ void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration);
/**
* To use a custom {@link ClassResolver} for loading resource on the classpath.
[2/5] git commit: CAMEL-6488: camel-netty-http. Added example for
blueprint.
Posted by da...@apache.org.
CAMEL-6488: camel-netty-http. Added example for blueprint.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d553a925
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d553a925
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d553a925
Branch: refs/heads/master
Commit: d553a925cb677e679c728165ddc56a48c9893694
Parents: 97a91a0
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 26 11:25:36 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 26 11:25:36 2013 +0200
----------------------------------------------------------------------
.../camel-example-netty-http/myapp-one/pom.xml | 30 ++++++++
.../resources/OSGI-INF/blueprint/camel-one.xml | 37 ++++++++++
.../camel-example-netty-http/myapp-two/pom.xml | 30 ++++++++
.../resources/OSGI-INF/blueprint/camel-two.xml | 37 ++++++++++
examples/camel-example-netty-http/pom.xml | 72 ++++++++++++++++++++
.../shared-netty-http-server/pom.xml | 56 +++++++++++++++
.../OSGI-INF/blueprint/http-server.xml | 40 +++++++++++
examples/pom.xml | 1 +
8 files changed, 303 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/myapp-one/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-one/pom.xml b/examples/camel-example-netty-http/myapp-one/pom.xml
new file mode 100644
index 0000000..9a05c18
--- /dev/null
+++ b/examples/camel-example-netty-http/myapp-one/pom.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>camel-example-netty-http</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>2.12-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-example-netty-myapp-one</artifactId>
+ <name>Camel :: Example :: Netty HTTP :: My Application One</name>
+ <packaging>bundle</packaging>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml b/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
new file mode 100644
index 0000000..6371b35
--- /dev/null
+++ b/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- reference the shared http server -->
+ <reference id="sharedNettyHttpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+ <route id="http-route-one">
+ <from uri="netty-http:http://0.0.0.0/one?matchOnUriPrefix=true&nettySharedHttpServer=#sharedNettyHttpServer"/>
+ <transform>
+ <simple>Response from camel one: ${body}</simple>
+ </transform>
+ </route>
+
+ </camelContext>
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/myapp-two/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-two/pom.xml b/examples/camel-example-netty-http/myapp-two/pom.xml
new file mode 100644
index 0000000..6e0ae27
--- /dev/null
+++ b/examples/camel-example-netty-http/myapp-two/pom.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>camel-example-netty-http</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>2.12-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-example-netty-myapp-two</artifactId>
+ <name>Camel :: Example :: Netty HTTP :: My Application Two</name>
+ <packaging>bundle</packaging>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml b/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
new file mode 100644
index 0000000..b34a983
--- /dev/null
+++ b/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- reference the shared http server -->
+ <reference id="sharedNettyHttpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+ <route id="http-route-two">
+ <from uri="netty-http:http://0.0.0.0/two?matchOnUriPrefix=true&nettySharedHttpServer=#sharedNettyHttpServer"/>
+ <transform>
+ <simple>Response from camel two: ${body}</simple>
+ </transform>
+ </route>
+
+ </camelContext>
+
+</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/pom.xml b/examples/camel-example-netty-http/pom.xml
new file mode 100644
index 0000000..a1b9aa5
--- /dev/null
+++ b/examples/camel-example-netty-http/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>examples</artifactId>
+ <version>2.12-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-example-netty-http</artifactId>
+ <packaging>pom</packaging>
+ <name>Camel :: Example :: Netty Shared HTTP Server</name>
+ <description>An example showing how to use a shared Netty HTTP server with multiple Camel applications in OSGi container</description>
+
+ <properties>
+ <camel.osgi.export.pkg>org.apache.camel.example.netty.*</camel.osgi.export.pkg>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-blueprint</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-netty-http</artifactId>
+ </dependency>
+
+ <!-- logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ <!-- for testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <modules>
+ <module>shared-netty-http-server</module>
+ <module>myapp-one</module>
+ <module>myapp-two</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/pom.xml b/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
new file mode 100644
index 0000000..af85beb
--- /dev/null
+++ b/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>camel-example-netty-http</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>2.12-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-example-netty-http-shared</artifactId>
+ <name>Camel :: Example :: Netty HTTP :: Shared Netty HTTP Server</name>
+ <packaging>bundle</packaging>
+
+ <build>
+ <plugins>
+
+ <!-- to generate the MANIFEST-FILE of the bundle -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>target/META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ org.apache.camel.component.netty,
+ org.apache.camel.component.netty.http,
+ org.osgi.service.blueprint
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
new file mode 100755
index 0000000..54a7cf4
--- /dev/null
+++ b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- netty http bootstrap configuration -->
+ <!--<bean id="configuration" class="org.apache.camel.component.netty.http.NettySharedHttpServerBootstrapConfiguration">-->
+ <bean id="configuration" class="org.apache.camel.component.netty.NettyServerBootstrapConfiguration">
+ <!-- the port number is mandatory and must be set -->
+ <property name="port" value="8888"/>
+ <property name="backlog" value="20"/>
+ </bean>
+
+ <!-- the netty http server -->
+ <bean id="httpServer" class="org.apache.camel.component.netty.http.DefaultNettySharedHttpServer"
+ init-method="start" destroy-method="stop">
+ <property name="nettyServerBootstrapConfiguration" ref="configuration"/>
+ </bean>
+
+ <!-- and exported in the OSGi server registry so we can use it from the Camel application bundles -->
+ <service id="sharedNettyHttpServer" ref="httpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+
+</blueprint>
http://git-wip-us.apache.org/repos/asf/camel/blob/d553a925/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 9fbf957..1acb3cb 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -53,6 +53,7 @@
<module>camel-example-loadbalancing</module>
<module>camel-example-loan-broker</module>
<module>camel-example-management</module>
+ <module>camel-example-netty-http</module>
<module>camel-example-osgi</module>
<module>camel-example-osgi-rmi</module>
<module>camel-example-pojo-messaging</module>
[4/5] git commit: CAMEL-6488: camel-netty-http. Added example for
blueprint.
Posted by da...@apache.org.
CAMEL-6488: camel-netty-http. Added example for blueprint.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d7498cd1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d7498cd1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d7498cd1
Branch: refs/heads/master
Commit: d7498cd158e598c5c67d311e92156a8d5929d76c
Parents: 6e8ca92
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jun 26 12:09:31 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 26 12:09:31 2013 +0200
----------------------------------------------------------------------
.../http/DefaultNettySharedHttpServer.java | 36 +++++++++++++---
.../http/HttpServerSharedPipelineFactory.java | 15 +++----
.../component/netty/http/NettyHttpEndpoint.java | 2 +-
.../netty/http/NettySharedHttpServer.java | 12 +++++-
.../netty/http/NettySharedHttpServerTest.java | 3 +-
.../SingleTCPNettyServerBootstrapFactory.java | 5 ++-
.../SingleUDPNettyServerBootstrapFactory.java | 35 ++++++++-------
.../camel-example-netty-http/myapp-one/pom.xml | 45 +++++++++++++++-----
.../resources/OSGI-INF/blueprint/camel-one.xml | 5 ++-
.../camel-example-netty-http/myapp-two/pom.xml | 45 +++++++++++++++-----
.../resources/OSGI-INF/blueprint/camel-two.xml | 5 ++-
.../shared-netty-http-server/pom.xml | 1 -
.../OSGI-INF/blueprint/http-server.xml | 14 +++---
13 files changed, 159 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
index 034bb68..c264128 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.netty.http;
-import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
import org.apache.camel.component.netty.NettyServerBootstrapFactory;
import org.apache.camel.component.netty.http.handlers.HttpServerMultiplexChannelHandler;
import org.apache.camel.spi.ClassResolver;
@@ -32,14 +31,18 @@ import org.slf4j.LoggerFactory;
*/
public class DefaultNettySharedHttpServer extends ServiceSupport implements NettySharedHttpServer {
+ // TODO: option to enlist in JMX
+ // TODO: option to configure thread name pattern for the shared jetty threads
+
private static final Logger LOG = LoggerFactory.getLogger(DefaultNettySharedHttpServer.class);
- private NettyServerBootstrapConfiguration configuration;
+ private NettySharedHttpServerBootstrapConfiguration configuration;
private HttpServerConsumerChannelFactory channelFactory;
private HttpServerBootstrapFactory bootstrapFactory;
private ClassResolver classResolver;
+ private boolean startServer = true;
- public void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration) {
+ public void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration configuration) {
this.configuration = configuration;
}
@@ -59,6 +62,18 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
return bootstrapFactory;
}
+ public int getConsumersSize() {
+ if (channelFactory != null) {
+ return channelFactory.consumers();
+ } else {
+ return -1;
+ }
+ }
+
+ public void setStartServer(boolean startServer) {
+ this.startServer = startServer;
+ }
+
protected void doStart() throws Exception {
ObjectHelper.notNull(configuration, "setNettyServerBootstrapConfiguration() must be called with a NettyServerBootstrapConfiguration instance", this);
@@ -66,8 +81,12 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
if (configuration.getPort() <= 0) {
throw new IllegalArgumentException("Port must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
}
+ // hostname must be set
+ if (ObjectHelper.isEmpty(configuration.getHost())) {
+ throw new IllegalArgumentException("Host must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
+ }
- LOG.info("Starting NettySharedHttpServer using configuration: {} on port: {}", configuration, configuration.getPort());
+ LOG.debug("NettySharedHttpServer using configuration: {}", configuration);
// force using tcp as the underlying transport
configuration.setProtocol("tcp");
@@ -80,11 +99,18 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
// create bootstrap factory and disable compatible check as its shared among the consumers
bootstrapFactory = new HttpServerBootstrapFactory(channelFactory, false);
bootstrapFactory.init(null, configuration, pipelineFactory);
+
+ ServiceHelper.startServices(channelFactory);
+
+ if (startServer) {
+ LOG.info("Starting NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
+ ServiceHelper.startServices(bootstrapFactory);
+ }
}
@Override
protected void doStop() throws Exception {
- LOG.info("Stopping NettySharedHttpServer using configuration: {} on port: {}", configuration, configuration.getPort());
+ LOG.info("Stopping NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
ServiceHelper.stopServices(bootstrapFactory, channelFactory);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
index e4e88f9..daa896a 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
@@ -43,12 +43,12 @@ import org.slf4j.LoggerFactory;
public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
private static final Logger LOG = LoggerFactory.getLogger(HttpServerSharedPipelineFactory.class);
- private final NettyServerBootstrapConfiguration configuration;
+ private final NettySharedHttpServerBootstrapConfiguration configuration;
private final HttpServerConsumerChannelFactory channelFactory;
private final ClassResolver classResolver;
private SSLContext sslContext;
- public HttpServerSharedPipelineFactory(NettyServerBootstrapConfiguration configuration, HttpServerConsumerChannelFactory channelFactory,
+ public HttpServerSharedPipelineFactory(NettySharedHttpServerBootstrapConfiguration configuration, HttpServerConsumerChannelFactory channelFactory,
ClassResolver classResolver) {
this.configuration = configuration;
this.channelFactory = channelFactory;
@@ -81,14 +81,13 @@ public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
}
pipeline.addLast("decoder", new HttpRequestDecoder());
- // Uncomment the following line if you don't want to handle HttpChunks.
-// if (configuration.isChunked()) {
+ if (configuration.isChunked()) {
pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
-// }
+ }
pipeline.addLast("encoder", new HttpResponseEncoder());
-// if (configuration.isCompression()) {
-// pipeline.addLast("deflater", new HttpContentCompressor());
-// }
+ if (configuration.isCompression()) {
+ pipeline.addLast("deflater", new HttpContentCompressor());
+ }
pipeline.addLast("handler", channelFactory.getChannelHandler());
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
index 18565b4..252ea46 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
@@ -63,7 +63,7 @@ public class NettyHttpEndpoint extends NettyEndpoint implements HeaderFilterStra
if (nettySharedHttpServer != null) {
answer.setNettyServerBootstrapFactory(nettySharedHttpServer.getServerBootstrapFactory());
- LOG.debug("Created NettyHttpConsumer: {} using NettySharedHttpServer: {}", answer, nettySharedHttpServer);
+ LOG.info("NettyHttpConsumer: {} is using NettySharedHttpServer on port: {}", answer, nettySharedHttpServer.getPort());
} else {
// reuse pipeline factory for the same address
HttpServerBootstrapFactory factory = getComponent().getOrCreateHttpNettyServerBootstrapFactory(answer);
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
index b98f118..22110bb 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
@@ -34,7 +34,7 @@ public interface NettySharedHttpServer extends Service {
/**
* Sets the bootstrap configuration to use by this shared Netty HTTP server.
*/
- void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration);
+ void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration configuration);
/**
* To use a custom {@link ClassResolver} for loading resource on the classpath.
@@ -42,6 +42,11 @@ public interface NettySharedHttpServer extends Service {
void setClassResolver(ClassResolver classResolver);
/**
+ * Whether to start the Netty HTTP server eager and bind to the port, or wait on first demand
+ */
+ void setStartServer(boolean startServer);
+
+ /**
* Gets the port number this Netty HTTP server uses.
*/
int getPort();
@@ -56,4 +61,9 @@ public interface NettySharedHttpServer extends Service {
*/
NettyServerBootstrapFactory getServerBootstrapFactory();
+ /**
+ * Number of consumers using this shared Netty HTTP server.
+ */
+ int getConsumersSize();
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
index aa8073f..a268ba9 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.component.netty.http;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
import org.apache.camel.impl.JndiRegistry;
import org.junit.Test;
@@ -61,6 +60,8 @@ public class NettySharedHttpServerTest extends BaseNettyTest {
out = template.requestBody("netty-http:http://localhost:{{port}}/bar", "Hello Camel", String.class);
assertEquals("Bye Camel", out);
+ assertEquals(2, nettySharedHttpServer.getConsumersSize());
+
assertMockEndpointsSatisfied();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
index 45442ce..17b019b 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
@@ -124,11 +124,12 @@ public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport impleme
}
}
- LOG.info("Created ServerBootstrap {} with options: {}", serverBootstrap, serverBootstrap.getOptions());
+ LOG.debug("Created ServerBootstrap {} with options: {}", serverBootstrap, serverBootstrap.getOptions());
// set the pipeline factory, which creates the pipeline for each newly created channels
serverBootstrap.setPipelineFactory(pipelineFactory);
+ LOG.info("ServerBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
channel = serverBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
// to keep track of all channels in use
allChannels.add(channel);
@@ -136,6 +137,8 @@ public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport impleme
protected void stopServerBootstrap() {
// close all channels
+ LOG.info("ServerBootstrap unbinding from {}:{}", configuration.getHost(), configuration.getPort());
+
LOG.trace("Closing {} channels", allChannels.size());
ChannelGroupFuture future = allChannels.close();
future.awaitUninterruptibly();
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
index 138c98f..b43fe97 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
@@ -46,7 +46,7 @@ public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport impleme
private NettyServerBootstrapConfiguration configuration;
private ChannelPipelineFactory pipelineFactory;
private DatagramChannelFactory datagramChannelFactory;
- private ConnectionlessBootstrap connectionlessServerBootstrap;
+ private ConnectionlessBootstrap connectionlessBootstrap;
private Channel channel;
private ExecutorService workerExecutor;
@@ -100,43 +100,46 @@ public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport impleme
datagramChannelFactory = new NioDatagramChannelFactory(workerExecutor, configuration.getWorkerCount());
}
- connectionlessServerBootstrap = new ConnectionlessBootstrap(datagramChannelFactory);
- connectionlessServerBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
- connectionlessServerBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
- connectionlessServerBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
- connectionlessServerBootstrap.setOption("child.reuseAddress", configuration.isReuseAddress());
- connectionlessServerBootstrap.setOption("child.connectTimeoutMillis", configuration.getConnectTimeout());
- connectionlessServerBootstrap.setOption("child.broadcast", configuration.isBroadcast());
- connectionlessServerBootstrap.setOption("sendBufferSize", configuration.getSendBufferSize());
- connectionlessServerBootstrap.setOption("receiveBufferSize", configuration.getReceiveBufferSize());
+ connectionlessBootstrap = new ConnectionlessBootstrap(datagramChannelFactory);
+ connectionlessBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
+ connectionlessBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
+ connectionlessBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
+ connectionlessBootstrap.setOption("child.reuseAddress", configuration.isReuseAddress());
+ connectionlessBootstrap.setOption("child.connectTimeoutMillis", configuration.getConnectTimeout());
+ connectionlessBootstrap.setOption("child.broadcast", configuration.isBroadcast());
+ connectionlessBootstrap.setOption("sendBufferSize", configuration.getSendBufferSize());
+ connectionlessBootstrap.setOption("receiveBufferSize", configuration.getReceiveBufferSize());
// only set this if user has specified
if (configuration.getReceiveBufferSizePredictor() > 0) {
- connectionlessServerBootstrap.setOption("receiveBufferSizePredictorFactory",
+ connectionlessBootstrap.setOption("receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(configuration.getReceiveBufferSizePredictor()));
}
if (configuration.getBacklog() > 0) {
- connectionlessServerBootstrap.setOption("backlog", configuration.getBacklog());
+ connectionlessBootstrap.setOption("backlog", configuration.getBacklog());
}
// set any additional netty options
if (configuration.getOptions() != null) {
for (Map.Entry<String, Object> entry : configuration.getOptions().entrySet()) {
- connectionlessServerBootstrap.setOption(entry.getKey(), entry.getValue());
+ connectionlessBootstrap.setOption(entry.getKey(), entry.getValue());
}
}
- LOG.info("Created ConnectionlessBootstrap {} with options: {}", connectionlessServerBootstrap, connectionlessServerBootstrap.getOptions());
+ LOG.debug("Created ConnectionlessBootstrap {} with options: {}", connectionlessBootstrap, connectionlessBootstrap.getOptions());
// set the pipeline factory, which creates the pipeline for each newly created channels
- connectionlessServerBootstrap.setPipelineFactory(pipelineFactory);
+ connectionlessBootstrap.setPipelineFactory(pipelineFactory);
- channel = connectionlessServerBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
+ LOG.info("ConnectionlessBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
+ channel = connectionlessBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
// to keep track of all channels in use
allChannels.add(channel);
}
protected void stopServerBootstrap() {
// close all channels
+ LOG.info("ConnectionlessBootstrap unbinding from {}:{}", configuration.getHost(), configuration.getPort());
+
LOG.trace("Closing {} channels", allChannels.size());
ChannelGroupFuture future = allChannels.close();
future.awaitUninterruptibly();
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-one/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-one/pom.xml b/examples/camel-example-netty-http/myapp-one/pom.xml
index 9a05c18..c7263f9 100644
--- a/examples/camel-example-netty-http/myapp-one/pom.xml
+++ b/examples/camel-example-netty-http/myapp-one/pom.xml
@@ -15,16 +15,41 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>camel-example-netty-http</artifactId>
- <groupId>org.apache.camel</groupId>
- <version>2.12-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>camel-example-netty-http</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>2.12-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>camel-example-netty-myapp-one</artifactId>
- <name>Camel :: Example :: Netty HTTP :: My Application One</name>
- <packaging>bundle</packaging>
+ <artifactId>camel-example-netty-myapp-one</artifactId>
+ <name>Camel :: Example :: Netty HTTP :: My Application One</name>
+ <packaging>bundle</packaging>
+
+ <build>
+ <plugins>
+
+ <!-- to generate the MANIFEST-FILE of the bundle -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>target/META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ org.apache.camel.component.netty,
+ org.apache.camel.component.netty.http,
+ org.osgi.service.blueprint
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml b/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
index 6371b35..a1ce86f 100644
--- a/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
+++ b/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
@@ -23,12 +23,13 @@
<!-- reference the shared http server -->
<reference id="sharedNettyHttpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+ <!-- Camel application which uses the netty-http component and the shared Netty HTTP server -->
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="http-route-one">
- <from uri="netty-http:http://0.0.0.0/one?matchOnUriPrefix=true&nettySharedHttpServer=#sharedNettyHttpServer"/>
+ <from uri="netty-http:http://localhost/one?matchOnUriPrefix=true&nettySharedHttpServer=#sharedNettyHttpServer"/>
<transform>
- <simple>Response from camel one: ${body}</simple>
+ <simple>Response from Camel one using thread: ${threadName}</simple>
</transform>
</route>
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-two/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-two/pom.xml b/examples/camel-example-netty-http/myapp-two/pom.xml
index 6e0ae27..9628fae 100644
--- a/examples/camel-example-netty-http/myapp-two/pom.xml
+++ b/examples/camel-example-netty-http/myapp-two/pom.xml
@@ -15,16 +15,41 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>camel-example-netty-http</artifactId>
- <groupId>org.apache.camel</groupId>
- <version>2.12-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>camel-example-netty-http</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>2.12-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>camel-example-netty-myapp-two</artifactId>
- <name>Camel :: Example :: Netty HTTP :: My Application Two</name>
- <packaging>bundle</packaging>
+ <artifactId>camel-example-netty-myapp-two</artifactId>
+ <name>Camel :: Example :: Netty HTTP :: My Application Two</name>
+ <packaging>bundle</packaging>
+
+ <build>
+ <plugins>
+
+ <!-- to generate the MANIFEST-FILE of the bundle -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>target/META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ org.apache.camel.component.netty,
+ org.apache.camel.component.netty.http,
+ org.osgi.service.blueprint
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml b/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
index b34a983..c83b6eb 100644
--- a/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
+++ b/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
@@ -23,12 +23,13 @@
<!-- reference the shared http server -->
<reference id="sharedNettyHttpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+ <!-- Camel application which uses the netty-http component and the shared Netty HTTP server -->
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="http-route-two">
- <from uri="netty-http:http://0.0.0.0/two?matchOnUriPrefix=true&nettySharedHttpServer=#sharedNettyHttpServer"/>
+ <from uri="netty-http:http://localhost/two?matchOnUriPrefix=true&nettySharedHttpServer=#sharedNettyHttpServer"/>
<transform>
- <simple>Response from camel two: ${body}</simple>
+ <simple>Response from Camel one using thread: ${threadName}</simple>
</transform>
</route>
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/pom.xml b/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
index af85beb..97d3d7e 100644
--- a/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
+++ b/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
@@ -49,7 +49,6 @@
</configuration>
</plugin>
-
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
index 54a7cf4..ba8f0631 100755
--- a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
+++ b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
@@ -21,11 +21,13 @@
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<!-- netty http bootstrap configuration -->
- <!--<bean id="configuration" class="org.apache.camel.component.netty.http.NettySharedHttpServerBootstrapConfiguration">-->
- <bean id="configuration" class="org.apache.camel.component.netty.NettyServerBootstrapConfiguration">
- <!-- the port number is mandatory and must be set -->
+ <bean id="configuration" class="org.apache.camel.component.netty.http.NettySharedHttpServerBootstrapConfiguration">
+ <!-- the port and host is mandatory and must be set -->
<property name="port" value="8888"/>
- <property name="backlog" value="20"/>
+ <property name="host" value="0.0.0.0"/>
+ <!-- additional options -->
+ <property name="backlog" value="50"/>
+ <property name="compression" value="true"/>
</bean>
<!-- the netty http server -->
@@ -34,7 +36,7 @@
<property name="nettyServerBootstrapConfiguration" ref="configuration"/>
</bean>
- <!-- and exported in the OSGi server registry so we can use it from the Camel application bundles -->
- <service id="sharedNettyHttpServer" ref="httpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+ <!-- export in the OSGi server registry so we can use it from the Camel application bundles -->
+ <service ref="httpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
</blueprint>