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/00d62d3a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/00d62d3a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/00d62d3a Branch: refs/heads/camel-2.16.x Commit: 00d62d3a77fb9989aba9cc1f254bf49f2eeba42b Parents: af14ebf Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Jan 5 17:58:50 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Jan 5 18:12:17 2016 +0100 ---------------------------------------------------------------------- .../camel/http/common/HttpCommonEndpoint.java | 30 +++++++++++++------- .../apache/camel/http/common/HttpConsumer.java | 2 +- .../apache/camel/http/common/HttpMessage.java | 4 +-- .../http/HttpReferenceParameterTest.java | 8 +++--- 4 files changed, 27 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/00d62d3a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java index 22b9017..2856c48 100644 --- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java +++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpCommonEndpoint.java @@ -37,7 +37,7 @@ public abstract class HttpCommonEndpoint extends DefaultEndpoint implements Head @UriParam(description = "To use a custom HeaderFilterStrategy to filter header to and from Camel message.") HeaderFilterStrategy headerFilterStrategy = new HttpHeaderFilterStrategy(); @UriParam(description = "To use a custom HttpBinding to control the mapping between Camel message and HttpClient.") - HttpBinding binding; + HttpBinding httpBinding; @UriParam(label = "producer", defaultValue = "true", description = "Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server." + " This allows you to get all responses regardless of the HTTP status code.") @@ -138,25 +138,35 @@ public abstract class HttpCommonEndpoint extends DefaultEndpoint implements Head // Properties //------------------------------------------------------------------------- + @Deprecated public HttpBinding getBinding() { - if (binding == null) { + return httpBinding; + } + + @Deprecated + public void setBinding(HttpBinding httpBinding) { + setHttpBinding(httpBinding); + } + + public HttpBinding getHttpBinding() { + if (httpBinding == null) { // create a new binding and use the options from this endpoint - binding = new DefaultHttpBinding(); - binding.setHeaderFilterStrategy(getHeaderFilterStrategy()); - binding.setTransferException(isTransferException()); + httpBinding = new DefaultHttpBinding(); + httpBinding.setHeaderFilterStrategy(getHeaderFilterStrategy()); + httpBinding.setTransferException(isTransferException()); if (getComponent() != null) { - binding.setAllowJavaSerializedObject(getComponent().isAllowJavaSerializedObject()); + httpBinding.setAllowJavaSerializedObject(getComponent().isAllowJavaSerializedObject()); } - binding.setEagerCheckContentAvailable(isEagerCheckContentAvailable()); + httpBinding.setEagerCheckContentAvailable(isEagerCheckContentAvailable()); } - return binding; + return httpBinding; } /** * To use a custom HttpBinding to control the mapping between Camel message and HttpClient. */ - public void setBinding(HttpBinding binding) { - this.binding = binding; + public void setHttpBinding(HttpBinding httpBinding) { + this.httpBinding = httpBinding; } public String getPath() { http://git-wip-us.apache.org/repos/asf/camel/blob/00d62d3a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpConsumer.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpConsumer.java index f389081..3a2da8e 100644 --- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpConsumer.java +++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpConsumer.java @@ -37,7 +37,7 @@ public class HttpConsumer extends DefaultConsumer implements SuspendableService } public HttpBinding getBinding() { - return getEndpoint().getBinding(); + return getEndpoint().getHttpBinding(); } public String getPath() { http://git-wip-us.apache.org/repos/asf/camel/blob/00d62d3a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpMessage.java ---------------------------------------------------------------------- diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpMessage.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpMessage.java index b2f4527..a56f886 100644 --- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpMessage.java +++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpMessage.java @@ -49,7 +49,7 @@ public class HttpMessage extends DefaultMessage { // use binding to read the request allowing end users to use their // implementation of the binding - getEndpoint().getBinding().readRequest(request, this); + getEndpoint().getHttpBinding().readRequest(request, this); } public HttpServletRequest getRequest() { @@ -63,7 +63,7 @@ public class HttpMessage extends DefaultMessage { @Override protected Object createBody() { try { - return getEndpoint().getBinding().parseBody(this); + return getEndpoint().getHttpBinding().parseBody(this); } catch (IOException e) { throw new RuntimeCamelException(e); } http://git-wip-us.apache.org/repos/asf/camel/blob/00d62d3a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java index 5e93ee3..1313800 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java @@ -28,9 +28,9 @@ import org.junit.Test; */ public class HttpReferenceParameterTest extends CamelTestSupport { - private static final String TEST_URI_1 = "http://localhost:8080?httpBindingRef=#customBinding&httpClientConfigurerRef=#customConfigurer"; - private static final String TEST_URI_2 = "http://localhost:8081?httpBindingRef=customBinding&httpClientConfigurerRef=customConfigurer"; - + private static final String TEST_URI_1 = "http://localhost:8080?httpBinding=#customBinding&httpClientConfigurer=#customConfigurer"; + private static final String TEST_URI_2 = "http://localhost:8081?httpBinding=#customBinding&httpClientConfigurer=#customConfigurer"; + private HttpEndpoint endpoint1; private HttpEndpoint endpoint2; @@ -53,7 +53,7 @@ public class HttpReferenceParameterTest extends CamelTestSupport { } @Test - public void testHttpClientConfigurerRef() { + public void testHttpClientConfigurer() { assertSame(testConfigurer, endpoint1.getHttpClientConfigurer()); assertSame(testConfigurer, endpoint2.getHttpClientConfigurer()); }