Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 9e91c334e -> 0e2bf50e5


Camel component docs


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

Branch: refs/heads/camel-2.16.x
Commit: 0e2bf50e528bf69ebaa5482dacfd629aa24b8772
Parents: 9e91c33
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue Jan 5 18:25:13 2016 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Jan 5 18:26:47 2016 +0100

----------------------------------------------------------------------
 .../camel/component/http4/HttpComponent.java    |  8 ++++---
 .../camel/component/http4/HttpEndpoint.java     | 24 ++++++++++++++++++--
 .../http4/HttpReferenceParameterTest.java       |  4 ++--
 3 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0e2bf50e/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
index df47d50..ca50e9a 100644
--- 
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
+++ 
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
@@ -158,14 +158,15 @@ public class HttpComponent extends HttpCommonComponent {
         // http client can be configured from URI options
         HttpClientBuilder clientBuilder = HttpClientBuilder.create();
         // allow the builder pattern
-        IntrospectionSupport.setProperties(clientBuilder, parameters, 
"httpClient.", true);
+        Map<String, Object> httpClientOptions = 
IntrospectionSupport.extractProperties(parameters, "httpClient.");
+        IntrospectionSupport.setProperties(clientBuilder, httpClientOptions);
         // set the Request configure this way and allow the builder pattern
         RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
-        IntrospectionSupport.setProperties(requestConfigBuilder, parameters, 
"httpClient.", true);
+        IntrospectionSupport.setProperties(requestConfigBuilder, 
httpClientOptions);
         clientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
         
         // validate that we could resolve all httpClient. parameters as this 
component is lenient
-        validateParameters(uri, parameters, "httpClient.");
+        validateParameters(uri, httpClientOptions, null);
         
         // TODO cmueller: remove the "httpBindingRef" look up in Camel 3.0
         HttpBinding httpBinding = 
resolveAndRemoveReferenceParameter(parameters, "httpBindingRef", 
HttpBinding.class);
@@ -289,6 +290,7 @@ public class HttpComponent extends HttpCommonComponent {
         if (endpoint.getCookieStore() == null) {
             endpoint.setCookieStore(getCookieStore());
         }
+        endpoint.setHttpClientOptions(httpClientOptions);
         
         return endpoint;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/0e2bf50e/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
 
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
index b589e65..76a342c 100644
--- 
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
+++ 
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.http4;
 import java.io.Closeable;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Map;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.PollingConsumer;
@@ -51,12 +52,17 @@ public class HttpEndpoint extends HttpCommonEndpoint {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(HttpEndpoint.class);
 
-    // Note: all options must be documented with description in annotations so 
extended components can access the documentation
-
+    @UriParam(label = "advanced")
     private HttpContext httpContext;
+    @UriParam(label = "advanced")
     private HttpClientConfigurer httpClientConfigurer;
+    @UriParam(label = "advanced", prefix = "httpClient.", multiValue = true)
+    private Map<String, Object> httpClientOptions;
+    @UriParam(label = "advanced")
     private HttpClientConnectionManager clientConnectionManager;
+    @UriParam(label = "advanced")
     private HttpClientBuilder clientBuilder;
+    @UriParam(label = "advanced")
     private HttpClient httpClient;
 
     @UriParam(label = "producer")
@@ -220,6 +226,9 @@ public class HttpEndpoint extends HttpCommonEndpoint {
         this.httpClientConfigurer = httpClientConfigurer;
     }
 
+    /**
+     * To use a custom HttpContext instance
+     */
     public void setHttpContext(HttpContext httpContext) {
         this.httpContext = httpContext;
     }
@@ -272,4 +281,15 @@ public class HttpEndpoint extends HttpCommonEndpoint {
         this.authenticationPreemptive = authenticationPreemptive;
     }
 
+    public Map<String, Object> getHttpClientOptions() {
+        return httpClientOptions;
+    }
+
+    /**
+     * To configure the HttpClient using the key/values from the Map.
+     */
+    public void setHttpClientOptions(Map<String, Object> httpClientOptions) {
+        this.httpClientOptions = httpClientOptions;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/0e2bf50e/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
 
b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
index c750a4d..51bf27c 100644
--- 
a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
+++ 
b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
@@ -32,8 +32,8 @@ import org.junit.Test;
  */
 public class HttpReferenceParameterTest extends CamelTestSupport {
 
-    private static final String TEST_URI_1 = 
"http4://localhost:8080?httpBindingRef=#customBinding&httpClientConfigurerRef=#customConfigurer&httpContext=#customContext";
-    private static final String TEST_URI_2 = 
"http4://localhost:8081?httpBindingRef=customBinding&httpClientConfigurerRef=customConfigurer&httpContext=customContext";
+    private static final String TEST_URI_1 = 
"http4://localhost:8080?httpBinding=#customBinding&httpClientConfigurer=#customConfigurer&httpContext=#customContext";
+    private static final String TEST_URI_2 = 
"http4://localhost:8081?httpBinding=#customBinding&httpClientConfigurer=#customConfigurer&httpContext=#customContext";
 
     private HttpEndpoint endpoint1;
     private HttpEndpoint endpoint2;

Reply via email to