camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/9] CAMEL-7782 Added camel-netty4-http component
Date Fri, 05 Sep 2014 13:13:20 GMT
http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java
new file mode 100644
index 0000000..792150b
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeAutoWithXmlTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpBindingModeAutoWithXmlTest extends BaseNettyTest {
+
+    @Test
+    public void testBindingMode() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+        String body = "<user name=\"Donald Duck\" id=\"123\"></user>";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+        assertNotNull(user);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").consumes("application/xml").type(UserJaxbPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java
new file mode 100644
index 0000000..af38612
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeJsonTest.java
@@ -0,0 +1,76 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpBindingModeJsonTest extends BaseNettyTest {
+
+    @Test
+    public void testBindingMode() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+        String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+        assertNotNull(user);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Test
+    public void testBindingModeWrong() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(0);
+
+        // we bind to json, but send in xml, which is not possible
+        String body = "<user name=\"Donald Duck\" id=\"123\"></user>";
+        try {
+            template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+            fail("Should have thrown exception");
+        } catch (Exception e) {
+            // expected
+        }
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.json);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").type(UserJaxbPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeXmlTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeXmlTest.java
new file mode 100644
index 0000000..be99095
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpBindingModeXmlTest.java
@@ -0,0 +1,77 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpBindingModeXmlTest extends BaseNettyTest {
+
+    @Test
+    public void testBindingMode() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+        String body = "<user name=\"Donald Duck\" id=\"123\"></user>";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+        assertNotNull(user);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Test
+    public void testBindingModeWrong() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(0);
+
+        // we bind to xml, but send in json, which is not possible
+        String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
+        try {
+            template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+            fail("Should have thrown exception");
+        } catch (Exception e) {
+            // expected
+        }
+
+        assertMockEndpointsSatisfied();
+    }
+
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.xml);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").type(UserJaxbPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpContextPathMatchGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpContextPathMatchGetTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpContextPathMatchGetTest.java
new file mode 100644
index 0000000..5e50310
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpContextPathMatchGetTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.junit.Test;
+
+public class RestNettyHttpContextPathMatchGetTest extends BaseNettyTest {
+
+    @Test
+    public void testProducerGet() throws Exception {
+        String out = template.requestBody("netty4-http:http://localhost:{{port}}/users/123", null, String.class);
+        assertEquals("123;Donald Duck", out);
+
+        out = template.requestBody("netty4-http:http://localhost:{{port}}/users/list", null, String.class);
+        assertEquals("123;Donald Duck\n456;John Doe", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                restConfiguration().component("netty4-http").host("localhost").port(getPort());
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .get("{id}")
+                        .route()
+                        .to("mock:input")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                String id = exchange.getIn().getHeader("id", String.class);
+                                exchange.getOut().setBody(id + ";Donald Duck");
+                            }
+                        })
+                    .endRest()
+                    .get("list")
+                        .route()
+                        .to("mock:input")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                exchange.getOut().setBody("123;Donald Duck\n456;John Doe");
+                            }
+                        });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpGetTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpGetTest.java
new file mode 100644
index 0000000..fb2879f
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpGetTest.java
@@ -0,0 +1,56 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.junit.Test;
+
+public class RestNettyHttpGetTest extends BaseNettyTest {
+
+    @Test
+    public void testProducerGet() throws Exception {
+        String out = template.requestBody("netty4-http:http://localhost:{{port}}/users/123/basic", null, String.class);
+        assertEquals("123;Donald Duck", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                restConfiguration().component("netty4-http").host("localhost").port(getPort());
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .get("{id}/basic")
+                        .route()
+                        .to("mock:input")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                String id = exchange.getIn().getHeader("id", String.class);
+                                exchange.getOut().setBody(id + ";Donald Duck");
+                            }
+                        });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPojoInOutTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPojoInOutTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPojoInOutTest.java
new file mode 100644
index 0000000..a783b91
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPojoInOutTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpPojoInOutTest extends BaseNettyTest {
+
+    @Test
+    public void testJettyPojoInOut() throws Exception {
+        String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
+        String out = template.requestBody("netty4-http:http://localhost:" + getPort() + "/users/lives", body, String.class);
+
+        assertNotNull(out);
+        assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                // and enable auto binding mode
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("lives").type(UserPojo.class).outType(CountryPojo.class)
+                        .route()
+                        .bean(new UserService(), "livesWhere");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonJaxbPojoTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonJaxbPojoTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonJaxbPojoTest.java
new file mode 100644
index 0000000..1adcf33
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonJaxbPojoTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpPostJsonJaxbPojoTest extends BaseNettyTest {
+
+    @Test
+    public void testPostJaxbPojo() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+        String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+        assertNotNull(user);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                // and enable auto binding mode
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").type(UserJaxbPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoListTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoListTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoListTest.java
new file mode 100644
index 0000000..6eb8754
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoListTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.netty4.http.rest;
+
+import java.util.List;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpPostJsonPojoListTest extends BaseNettyTest {
+
+    @Test
+    public void testPostPojoList() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+
+        String body = "[ {\"id\": 123, \"name\": \"Donald Duck\"}, {\"id\": 456, \"name\": \"John Doe\"} ]";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        List list = mock.getReceivedExchanges().get(0).getIn().getBody(List.class);
+        assertNotNull(list);
+        assertEquals(2, list.size());
+
+        UserPojo user = (UserPojo) list.get(0);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+        user = (UserPojo) list.get(1);
+        assertEquals(456, user.getId());
+        assertEquals("John Doe", user.getName());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                // and enable auto binding mode
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").typeList(UserPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoTest.java
new file mode 100644
index 0000000..a6b8609
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostJsonPojoTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpPostJsonPojoTest extends BaseNettyTest {
+
+    @Test
+    public void testPostPojo() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserPojo.class);
+
+        String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        UserPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserPojo.class);
+        assertNotNull(user);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                // and enable auto binding mode
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").type(UserPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostXmlJaxbPojoTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostXmlJaxbPojoTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostXmlJaxbPojoTest.java
new file mode 100644
index 0000000..9202bdc
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestNettyHttpPostXmlJaxbPojoTest.java
@@ -0,0 +1,79 @@
+/**
+ * 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.netty4.http.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.netty4.http.BaseNettyTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestNettyHttpPostXmlJaxbPojoTest extends BaseNettyTest {
+
+    @Test
+    public void testPostJaxbPojo() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+        String body = "<user name=\"Donald Duck\" id=\"123\"></user>";
+        template.sendBodyAndHeader("netty4-http:http://localhost:" + getPort() + "/users/new", body, Exchange.CONTENT_TYPE, "text/xml");
+
+        assertMockEndpointsSatisfied();
+
+        UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+        assertNotNull(user);
+        assertEquals(123, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Test
+    public void testPostJaxbPojoNoContentType() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:input");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+        String body = "<user name=\"Donald Duck\" id=\"456\"></user>";
+        template.sendBody("netty4-http:http://localhost:" + getPort() + "/users/new", body);
+
+        assertMockEndpointsSatisfied();
+
+        UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+        assertNotNull(user);
+        assertEquals(456, user.getId());
+        assertEquals("Donald Duck", user.getName());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use netty4-http on localhost with the given port
+                // and enable auto binding mode
+                restConfiguration().component("netty4-http").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
+
+                // use the rest DSL to define the rest services
+                rest("/users/")
+                    .post("new").type(UserJaxbPojo.class)
+                        .to("mock:input");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestPathMatchingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestPathMatchingTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestPathMatchingTest.java
new file mode 100644
index 0000000..b297288
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/RestPathMatchingTest.java
@@ -0,0 +1,86 @@
+/**
+ * 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.netty4.http.rest;
+
+import junit.framework.TestCase;
+import org.apache.camel.component.netty4.http.RestContextPathMatcher;
+
+public class RestPathMatchingTest extends TestCase {
+
+    private RestContextPathMatcher matcher = new RestContextPathMatcher("", "", true);
+
+    public void testRestPathMatcher() throws Exception {
+        assertTrue(matcher.matchRestPath("/foo/", "/foo/", true));
+        assertTrue(matcher.matchRestPath("/foo/", "foo/", true));
+        assertTrue(matcher.matchRestPath("/foo/", "foo", true));
+        assertTrue(matcher.matchRestPath("foo/", "foo", true));
+        assertTrue(matcher.matchRestPath("foo", "foo", true));
+        assertTrue(matcher.matchRestPath("foo/", "foo", true));
+        assertTrue(matcher.matchRestPath("/foo/", "foo", true));
+
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2014", true));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2014", true));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2014/", true));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2014/", true));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014", "/foo/{user}/list/{year}", true));
+
+        assertFalse(matcher.matchRestPath("/foo/", "/bar/", true));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2015", true));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2015", true));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2015/", true));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2015/", true));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014", "/foo/{user}/list/", true));
+
+        assertTrue(matcher.matchRestPath("/foo/1/list/2", "/foo/{user}/list/{year}", true));
+        assertTrue(matcher.matchRestPath("/foo/1234567890/list/2", "/foo/{user}/list/{year}", true));
+        assertTrue(matcher.matchRestPath("/foo/1234567890/list/1234567890", "/foo/{user}/list/{year}", true));
+
+        assertTrue(matcher.matchRestPath("/123/list/2014", "/{user}/list/{year}", true));
+        assertTrue(matcher.matchRestPath("/1234567890/list/2014", "/{user}/list/{year}", true));
+    }
+
+    public void testRestPathMatcherNoWildcard() throws Exception {
+        assertTrue(matcher.matchRestPath("/foo/", "/foo/", false));
+        assertTrue(matcher.matchRestPath("/foo/", "foo/", false));
+        assertTrue(matcher.matchRestPath("/foo/", "foo", false));
+        assertTrue(matcher.matchRestPath("foo/", "foo", false));
+        assertTrue(matcher.matchRestPath("foo", "foo", false));
+        assertTrue(matcher.matchRestPath("foo/", "foo", false));
+        assertTrue(matcher.matchRestPath("/foo/", "foo", false));
+
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2014", false));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2014", false));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2014/", false));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2014/", false));
+        assertTrue(matcher.matchRestPath("/foo/1234/list/2014", "/foo/{user}/list/{year}", true));
+
+        assertFalse(matcher.matchRestPath("/foo/", "/bar/", false));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2015", false));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2015", false));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014", "/foo/1234/list/2015/", false));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014/", "/foo/1234/list/2015/", false));
+        assertFalse(matcher.matchRestPath("/foo/1234/list/2014", "/foo/{user}/list/", false));
+
+        assertFalse(matcher.matchRestPath("/foo/1/list/2", "/foo/{user}/list/{year}", false));
+        assertFalse(matcher.matchRestPath("/foo/1234567890/list/2", "/foo/{user}/list/{year}", false));
+        assertFalse(matcher.matchRestPath("/foo/1234567890/list/1234567890", "/foo/{user}/list/{year}", false));
+
+        assertFalse(matcher.matchRestPath("/123/list/2014", "/{user}/list/{year}", false));
+        assertFalse(matcher.matchRestPath("/1234567890/list/2014", "/{user}/list/{year}", false));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserJaxbPojo.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserJaxbPojo.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserJaxbPojo.java
new file mode 100644
index 0000000..a183312
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserJaxbPojo.java
@@ -0,0 +1,48 @@
+/**
+ * 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.netty4.http.rest;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "user")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class UserJaxbPojo {
+
+    @XmlAttribute
+    private int id;
+    @XmlAttribute
+    private String name;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserPojo.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserPojo.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserPojo.java
new file mode 100644
index 0000000..113b986
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserPojo.java
@@ -0,0 +1,40 @@
+/**
+ * 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.netty4.http.rest;
+
+public class UserPojo {
+
+    private int id;
+    private String name;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserService.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserService.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserService.java
new file mode 100644
index 0000000..0bf5397
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/rest/UserService.java
@@ -0,0 +1,33 @@
+/**
+ * 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.netty4.http.rest;
+
+public class UserService {
+
+    public CountryPojo livesWhere(UserPojo user) {
+        CountryPojo answer = new CountryPojo();
+        if (user.getId() < 500) {
+            answer.setIso("EN");
+            answer.setCountry("England");
+        } else {
+            answer.setIso("SE");
+            answer.setCountry("Sweden");
+        }
+        return answer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/resources/jsse/localhost.ks
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/jsse/localhost.ks b/components/camel-netty4-http/src/test/resources/jsse/localhost.ks
new file mode 100644
index 0000000..f285418
Binary files /dev/null and b/components/camel-netty4-http/src/test/resources/jsse/localhost.ks differ

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/log4j.properties b/components/camel-netty4-http/src/test/resources/log4j.properties
new file mode 100644
index 0000000..602b85e
--- /dev/null
+++ b/components/camel-netty4-http/src/test/resources/log4j.properties
@@ -0,0 +1,39 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing
+#
+log4j.rootLogger=INFO, file
+
+# uncomment the following to enable camel debugging
+#log4j.logger.org.apache.camel.component.netty=TRACE
+#log4j.logger.org.apache.camel.component.netty.http=DEBUG
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.jboss.netty=TRACE
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-netty4-http-test.log

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/resources/myjaas.config
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/myjaas.config b/components/camel-netty4-http/src/test/resources/myjaas.config
new file mode 100644
index 0000000..a01157e
--- /dev/null
+++ b/components/camel-netty4-http/src/test/resources/myjaas.config
@@ -0,0 +1,5 @@
+/** Test Login Configuration **/
+
+karaf {
+   org.apache.camel.component.netty4.http.MyLoginModule required debug=true;
+};

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml b/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml
new file mode 100644
index 0000000..b5910e7
--- /dev/null
+++ b/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml
@@ -0,0 +1,70 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <bean id="dynaPort" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+    <property name="targetClass">
+      <value>org.apache.camel.test.AvailablePortFinder</value>
+    </property>
+    <property name="targetMethod">
+      <value>getNextAvailable</value>
+    </property>
+    <property name="arguments">
+      <list>
+        <value>9000</value>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="constraint" class="org.apache.camel.component.netty4.http.SecurityConstraintMapping">
+    <!-- inclusions defines url -> roles restrictions -->
+    <!-- a * should be used for any role accepted (or even no roles) -->
+    <property name="inclusions">
+      <map>
+        <entry key="/*" value="*"/>
+        <entry key="/admin/*" value="admin"/>
+        <entry key="/guest/*" value="admin,guest"/>
+      </map>
+    </property>
+    <!-- exclusions is used to define public urls, which requires no authentication -->
+    <property name="exclusions">
+      <set>
+        <value>/public/*</value>
+      </set>
+    </property>
+  </bean>
+
+  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+    <endpoint id="input1" uri="netty4-http:http://0.0.0.0:#{dynaPort}/foo?matchOnUriPrefix=true&amp;securityConfiguration.realm=karaf&amp;securityConfiguration.securityConstraint=#constraint"/>
+
+    <route>
+      <from ref="input1"/>
+      <to uri="mock:input"/>
+      <transform>
+        <simple>Bye ${header.CamelHttpUri}</simple>
+      </transform>
+    </route>
+
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml b/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml
new file mode 100644
index 0000000..1fbc7eb
--- /dev/null
+++ b/components/camel-netty4-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml
@@ -0,0 +1,62 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <bean id="dynaPort" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+    <property name="targetClass">
+      <value>org.apache.camel.test.AvailablePortFinder</value>
+    </property>
+    <property name="targetMethod">
+      <value>getNextAvailable</value>
+    </property>
+    <property name="arguments">
+      <list>
+        <value>9000</value>
+      </list>
+    </property>
+  </bean>
+
+  <camel:sslContextParameters id="mySsl">
+    <camel:keyManagers keyPassword="changeit">
+      <camel:keyStore resource="jsse/localhost.ks" password="changeit"/>
+    </camel:keyManagers>
+    <camel:trustManagers>
+      <camel:keyStore resource="jsse/localhost.ks" password="changeit"/>
+    </camel:trustManagers>
+  </camel:sslContextParameters>
+
+  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+    <endpoint id="input1" uri="netty4-http:https://0.0.0.0:#{dynaPort}?ssl=true&amp;sslContextParameters=#mySsl"/>
+
+    <route>
+      <from ref="input1"/>
+      <to uri="mock:input"/>
+      <transform>
+        <simple>Bye World</simple>
+      </transform>
+    </route>
+
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 553f753..5fcfd61 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -145,6 +145,7 @@
     <module>camel-netty</module>
     <module>camel-netty4</module>
     <module>camel-netty-http</module>
+    <module>camel-netty4-http</module>
     <module>camel-ognl</module>
     <module>camel-olingo2</module>
     <module>camel-openshift</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d57f46b..3d65521 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1059,6 +1059,11 @@
         <version>${project.version}</version>
       </dependency>
       <dependency>
+         <groupId>org.apache.camel</groupId>
+         <artifactId>camel-netty4-http</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-ognl</artifactId>
         <version>${project.version}</version>


Mime
View raw message