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/28 04:22:33 UTC
[2/5] git commit: CAMEL-7971 merged the patch into camel-netty
component
CAMEL-7971 merged the patch into camel-netty component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/40774a15
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/40774a15
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/40774a15
Branch: refs/heads/master
Commit: 40774a15f661472bbf218dda5b0087a233d720e5
Parents: 9352734
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Oct 28 10:32:35 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Oct 28 10:32:35 2014 +0800
----------------------------------------------------------------------
.../camel/component/netty/http/NettyHttpComponent.java | 12 +++++++-----
.../component/netty/http/rest/RestNettyHttpGetTest.java | 11 ++++++++++-
2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/40774a15/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
index 31240c0..3751ad2 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
@@ -269,15 +269,17 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt
String query = URISupport.createQueryString(map);
String url = "netty-http:%s://%s:%s/%s?httpMethodRestrict=%s";
- if (!query.isEmpty()) {
- url = url + "?" + query;
- }
-
+
// must use upper case for restrict
String restrict = verb.toUpperCase(Locale.US);
-
// get the endpoint
url = String.format(url, scheme, host, port, path, restrict);
+
+ if (!query.isEmpty()) {
+ url = url + "&" + query;
+ }
+
+
NettyHttpEndpoint endpoint = camelContext.getEndpoint(url, NettyHttpEndpoint.class);
setProperties(endpoint, parameters);
http://git-wip-us.apache.org/repos/asf/camel/blob/40774a15/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpGetTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpGetTest.java
index d36db7f..897af52 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpGetTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyHttpGetTest.java
@@ -20,9 +20,18 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.netty.http.BaseNettyTest;
+import org.apache.camel.component.netty.http.RestNettyHttpBinding;
+import org.apache.camel.impl.JndiRegistry;
import org.junit.Test;
public class RestNettyHttpGetTest extends BaseNettyTest {
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+ jndi.bind("mybinding", new RestNettyHttpBinding());
+ return jndi;
+ }
@Test
public void testProducerGet() throws Exception {
@@ -36,7 +45,7 @@ public class RestNettyHttpGetTest extends BaseNettyTest {
@Override
public void configure() throws Exception {
// configure to use netty-http on localhost with the given port
- restConfiguration().component("netty-http").host("localhost").port(getPort());
+ restConfiguration().component("netty-http").host("localhost").port(getPort()).endpointProperty("nettyHttpBinding", "#mybinding");
// use the rest DSL to define the rest services
rest("/users/")