You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2017/08/22 06:41:15 UTC

[1/2] camel git commit: [CAMEL-11688]ensure transport endpoint configuration will be take into account when create JettyRestHttpBinding from REST DSL

Repository: camel
Updated Branches:
  refs/heads/master 716928ced -> 183d642c5


[CAMEL-11688]ensure transport endpoint configuration will be take into account when create JettyRestHttpBinding from REST DSL


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/441bf37d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/441bf37d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/441bf37d

Branch: refs/heads/master
Commit: 441bf37dde25a5c5ab08307afaa9eb290c86554e
Parents: dc4f20b
Author: Freeman Fang <fr...@gmail.com>
Authored: Tue Aug 22 14:40:44 2017 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Tue Aug 22 14:40:44 2017 +0800

----------------------------------------------------------------------
 .../component/jetty/JettyRestHttpBinding.java   |  5 ++
 ...stJettyPostNotMapHttpMessageHeadersTest.java | 62 ++++++++++++++++++++
 2 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/441bf37d/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyRestHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyRestHttpBinding.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyRestHttpBinding.java
index 401b834..b89a7a5 100644
--- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyRestHttpBinding.java
+++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyRestHttpBinding.java
@@ -28,6 +28,11 @@ public class JettyRestHttpBinding extends DefaultHttpBinding {
     }
     public JettyRestHttpBinding(HttpCommonEndpoint ep) {
         super(ep);
+        setHeaderFilterStrategy(ep.getHeaderFilterStrategy());
+        setTransferException(ep.isTransferException());
+        setEagerCheckContentAvailable(ep.isEagerCheckContentAvailable());
+        setMapHttpMessageBody(ep.isMapHttpMessageBody());
+        setMapHttpMessageHeaders(ep.isMapHttpMessageHeaders());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/441bf37d/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java
new file mode 100644
index 0000000..61ee548
--- /dev/null
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/rest/RestJettyPostNotMapHttpMessageHeadersTest.java
@@ -0,0 +1,62 @@
+/**
+ * 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.jetty.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jetty.BaseJettyTest;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+public class RestJettyPostNotMapHttpMessageHeadersTest extends BaseJettyTest {
+
+    @Test
+    public void testPostNotMapHttpMessageHeadersTest() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(Exchange.HTTP_METHOD, "POST");
+        headers.put(Exchange.CONTENT_TYPE, "application/x-www-form-urlencoded");
+        String out = template.requestBodyAndHeaders("http://localhost:" + getPort() + "/rest/test", "{\"msg\": \"TEST\"}", headers, String.class);
+        assertEquals("\"OK\"", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // configure to use jetty on localhost with the given port
+                //ensure we don't extract key=value pairs from form bodies 
+                //(application/x-www-form-urlencoded)
+                restConfiguration().component("jetty").host("localhost").port(getPort()).bindingMode(RestBindingMode.json)
+                    .endpointProperty("mapHttpMessageBody", "false")
+                    .endpointProperty("mapHttpMessageHeaders", "false");
+                    
+                // use the rest DSL to define the rest services
+                rest("/rest")
+                    .post("/test").produces("application/json")
+                        .to("direct:test");
+                from("direct:test").log("*** ${body}").removeHeaders("Content-Type*")
+                    .setBody().simple("OK");
+            }
+        };
+    }
+
+}

[2/2] camel git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/camel

Posted by ff...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/camel


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/183d642c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/183d642c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/183d642c

Branch: refs/heads/master
Commit: 183d642c54907a53de44ed54d39b0b4c4d95760a
Parents: 441bf37 716928c
Author: Freeman Fang <fr...@gmail.com>
Authored: Tue Aug 22 14:40:52 2017 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Tue Aug 22 14:40:52 2017 +0800

----------------------------------------------------------------------
 .../apache/camel/component/ahc/AhcProducer.java |  2 +-
 .../component/couchbase/CouchbaseConsumer.java  |  3 ++
 .../component/couchbase/CouchbaseProducer.java  |  8 ++++
 .../main/docs/hazelcast-queue-component.adoc    | 40 +++++++++++++++++++-
 .../component/hazelcast/HazelcastOperation.java |  1 +
 .../hazelcast/queue/HazelcastQueueProducer.java | 20 +++++++++-
 .../hazelcast/HazelcastQueueProducerTest.java   | 23 +++++++++++
 .../src/main/docs/nagios-component.adoc         |  3 +-
 .../component/nagios/NagiosConfiguration.java   | 35 +++++++++--------
 .../component/restlet/MethodBasedRouter.java    |  6 ++-
 .../component/restlet/RestletComponent.java     | 26 +++++++------
 .../restlet/RestRestletHttpOptionsTest.java     |  5 +--
 parent/pom.xml                                  | 16 ++++----
 .../NagiosComponentConfiguration.java           | 18 +++++++++
 14 files changed, 161 insertions(+), 45 deletions(-)
----------------------------------------------------------------------