camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r968304 - in /websites/production/camel/content: book-component-appendix.html book-in-one-page.html cache/main.pageCache http.html
Date Fri, 09 Oct 2015 12:21:16 GMT
Author: buildbot
Date: Fri Oct  9 12:21:09 2015
New Revision: 968304

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/book-component-appendix.html
    websites/production/camel/content/book-in-one-page.html
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/http.html

Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Fri Oct  9 12:21:09 2015
@@ -1195,11 +1195,11 @@ template.send("direct:alias-verify&
 ]]></script>
 </div></div><p></p><h3 id="BookComponentAppendix-SeeAlso.8">See
Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a
shape="rect" href="component.html">Component</a></li><li><a shape="rect"
href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting
Started</a></li></ul><ul><li><a shape="rect" href="crypto.html">Crypto</a>
Crypto is also available as a <a shape="rect" href="data-format.html">Data Format</a></li></ul>
<h2 id="BookComponentAppendix-CXFComponent">CXF Component</h2><div class="confluence-information-macro
confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning
confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When
using CXF as a consumer, the <a shape="rect" href="cxf-bean-component.html">CXF Bean
Component</a> allows you to factor out how message payloads are received from their
processing as a RESTful or SOAP web service. This has the potential of using a multitude of
transports to cons
 ume web services. The bean component's configuration is also simpler and provides the fastest
method to implement web services using Camel and CXF.</p></div></div><div
class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon
aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>When using CXF in streaming modes (see
DataFormat option), then also read about <a shape="rect" href="stream-caching.html">Stream
caching</a>.</p></div></div><p>The <strong>cxf:</strong>
component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache
CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1444378684335 {padding: 0px;}
-div.rbtoc1444378684335 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1444378684335 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1444393095942 {padding: 0px;}
+div.rbtoc1444393095942 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1444393095942 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1444378684335">
+/*]]>*/</style></p><div class="toc-macro rbtoc1444393095942">
 <ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-CXFComponent">CXF
Component</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-URIformat">URI
format</a></li><li><a shape="rect" href="#BookComponentAppendix-Options">Options</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-Thedescriptionsofthedataformats">The
descriptions of the dataformats</a>
@@ -4484,7 +4484,31 @@ HttpServletRequest response = exchange.g
    Message out = exchange.getOut();
    int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
 ]]></script>
-</div></div><h3 id="BookComponentAppendix-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect" href="content-enricher.html">enrich</a>
with data returned from a remote HTTP call. As we want any response from the remote server,
we set the <code>throwExceptionOnFailure</code> option to <code>false</code>
so we get any response in the <code>AggregationStrategy</code>. As the code is
based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.</p><div
class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException:
Index: 20, Size: 20</span> </div><h3 id="BookComponentAppendix-DisablingCookies">Disabling
Cookies</h3><p>To disable cookies you can set the HTTP Client to ignore cookies
by adding this URI option:<br clear="none"> <code>httpClient.cookiePolicy=ignoreCoo
 kies</code></p><h3 id="BookComponentAppendix-AdvancedUsage">Advanced Usage</h3><p>If
you need more control over the HTTP producer you should use the <code>HttpComponent</code>
where you can set various classes to give you custom behavior.</p><h4 id="BookComponentAppendix-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a <code>org.apache.commons.httpclient.HttpConnectionManager</code>
where you can configure various global configuration for the given component.<br clear="none">
By global, we mean that any endpoint the component creates has the same shared <code>HttpConnectionManager</code>.
So, if we want to set a different value for the max connection per host, we need to define
it on the HTTP component and <strong>not</strong> on the endpoint URI that we
usually use. So here comes:</p><p>First, we define the <code>http</code>
component in Spring XML. Yes, we use the same scheme name, <code>http</code>,
b
 ecause otherwise Camel will auto-discover and create the component with default settings.
What we need is to overrule this so we can set our options. In the sample below we set the
max connection to 5 instead of the default of 2.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookComponentAppendix-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect" href="content-enricher.html">enrich</a>
with data returned from a remote HTTP call. As we want any response from the remote server,
we set the <code>throwExceptionOnFailure</code> option to <code>false</code>
so we get any response in the <code>AggregationStrategy</code>. As the code is
based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+// We set throwExceptionOnFailure to false to let Camel return any response from the remove
HTTP server without thrown
+// HttpOperationFailedException in case of failures.
+// This allows us to handle all responses in the aggregation strategy where we can check
the HTTP response code
+// and decide what to do. As this is based on an unit test we assert the code is 404
+from(&quot;direct:start&quot;).enrich(&quot;http://localhost:8222/myserver?throwExceptionOnFailure=false&amp;user=Camel&quot;,
new AggregationStrategy() {
+    public Exchange aggregate(Exchange original, Exchange resource) {
+        // get the response code
+        Integer code = resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
+        assertEquals(404, code.intValue());
+        return resource;
+    }
+}).to(&quot;mock:result&quot;);
+
+// this is our jetty server where we simulate the 404
+from(&quot;jetty://http://localhost:8222/myserver&quot;)
+        .process(new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getOut().setBody(&quot;Page not found&quot;);
+                exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+            }
+        });
+]]></script>
+</div></div><h3 id="BookComponentAppendix-DisablingCookies">Disabling Cookies</h3><p>To
disable cookies you can set the HTTP Client to ignore cookies by adding this URI option:<br
clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><h3
id="BookComponentAppendix-AdvancedUsage">Advanced Usage</h3><p>If you need
more control over the HTTP producer you should use the <code>HttpComponent</code>
where you can set various classes to give you custom behavior.</p><h4 id="BookComponentAppendix-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a <code>org.apache.commons.httpclient.HttpConnectionManager</code>
where you can configure various global configuration for the given component.<br clear="none">
By global, we mean that any endpoint the component creates has the same shared <code>HttpConnectionManager</code>.
So, if we want to set a different value for the max connection per host, we need to defi
 ne it on the HTTP component and <strong>not</strong> on the endpoint URI that
we usually use. So here comes:</p><p>First, we define the <code>http</code>
component in Spring XML. Yes, we use the same scheme name, <code>http</code>,
because otherwise Camel will auto-discover and create the component with default settings.
What we need is to overrule this so we can set our options. In the sample below we set the
max connection to 5 instead of the default of 2.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;bean id=&quot;http&quot; class=&quot;org.apache.camel.component.http.HttpComponent&quot;&gt;
     &lt;property name=&quot;camelContext&quot; ref=&quot;camel&quot;/&gt;

Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Fri Oct  9 12:21:09 2015
@@ -3700,11 +3700,11 @@ The tutorial has been designed in two pa
 While not actual tutorials you might find working through the source of the various <a
shape="rect" href="examples.html">Examples</a> useful.</li></ul>
 
 <h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting
with JMS</h2><p>&#160;</p><div class="confluence-information-macro
confluence-information-macro-information"><p class="title">Thanks</p><span
class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This tutorial was kindly donated to
Apache Camel by Martin Gilday.</p></div></div><h2 id="BookInOnePage-Preface">Preface</h2><p>This
tutorial aims to guide the reader through the stages of creating a project which uses Camel
to facilitate the routing of messages from a JMS queue to a <a shape="rect" class="external-link"
href="http://www.springramework.org" rel="nofollow">Spring</a> service. The route
works in a synchronous fashion returning a response to the client.</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1444378695275 {padding: 0px;}
-div.rbtoc1444378695275 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1444378695275 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1444393116318 {padding: 0px;}
+div.rbtoc1444393116318 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1444393116318 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1444378695275">
+/*]]>*/</style></p><div class="toc-macro rbtoc1444393116318">
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial
on Spring Remoting with JMS</a></li><li><a shape="rect" href="#BookInOnePage-Preface">Preface</a></li><li><a
shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a
shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a
shape="rect" href="#BookInOnePage-About">About</a></li><li><a shape="rect"
href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-UpdatethePOMwithDependencies">Update
the POM with Dependencies</a></li></ul>
 </li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing
the Server</a>
@@ -5809,11 +5809,11 @@ So we completed the last piece in the pi
 <p>This example has been removed from <strong>Camel 2.9</strong> onwards.
Apache Axis 1.4 is a very old and unsupported framework. We encourage users to use <a shape="rect"
href="cxf.html">CXF</a> instead of Axis.</p></div></div>
 
 <style type="text/css">/*<![CDATA[*/
-div.rbtoc1444378695533 {padding: 0px;}
-div.rbtoc1444378695533 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1444378695533 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1444393117060 {padding: 0px;}
+div.rbtoc1444393117060 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1444393117060 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style><div class="toc-macro rbtoc1444378695533">
+/*]]>*/</style><div class="toc-macro rbtoc1444393117060">
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial
using Axis 1.4 with Apache Camel</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a
shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a
shape="rect" href="#BookInOnePage-Introduction">Introduction</a></li><li><a
shape="rect" href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project
to run Axis</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Maven2">Maven
2</a></li><li><a shape="rect" href="#BookInOnePage-wsdl">wsdl</a></li><li><a
shape="rect" href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a
shape="rect" href="#BookInOnePage-RunningtheExample">Running the Example</a></li></ul>
@@ -17428,11 +17428,11 @@ template.send(&quot;direct:alias-verify&
 ]]></script>
 </div></div><p></p><h3 id="BookInOnePage-SeeAlso.28">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a
shape="rect" href="component.html">Component</a></li><li><a shape="rect"
href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting
Started</a></li></ul><ul><li><a shape="rect" href="crypto.html">Crypto</a>
Crypto is also available as a <a shape="rect" href="data-format.html">Data Format</a></li></ul>
<h2 id="BookInOnePage-CXFComponent">CXF Component</h2><div class="confluence-information-macro
confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning
confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When
using CXF as a consumer, the <a shape="rect" href="cxf-bean-component.html">CXF Bean
Component</a> allows you to factor out how message payloads are received from their
processing as a RESTful or SOAP web service. This has the potential of using a multitude of
transports to consume web 
 services. The bean component's configuration is also simpler and provides the fastest method
to implement web services using Camel and CXF.</p></div></div><div class="confluence-information-macro
confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When
using CXF in streaming modes (see DataFormat option), then also read about <a shape="rect"
href="stream-caching.html">Stream caching</a>.</p></div></div><p>The
<strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache
CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1444378700779 {padding: 0px;}
-div.rbtoc1444378700779 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1444378700779 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1444393157106 {padding: 0px;}
+div.rbtoc1444393157106 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1444393157106 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1444378700779">
+/*]]>*/</style></p><div class="toc-macro rbtoc1444393157106">
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-CXFComponent">CXF
Component</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-URIformat">URI
format</a></li><li><a shape="rect" href="#BookInOnePage-Options">Options</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Thedescriptionsofthedataformats">The
descriptions of the dataformats</a>
@@ -20717,7 +20717,31 @@ HttpServletRequest response = exchange.g
    Message out = exchange.getOut();
    int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
 ]]></script>
-</div></div><h3 id="BookInOnePage-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect" href="content-enricher.html">enrich</a>
with data returned from a remote HTTP call. As we want any response from the remote server,
we set the <code>throwExceptionOnFailure</code> option to <code>false</code>
so we get any response in the <code>AggregationStrategy</code>. As the code is
based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.</p><div
class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException:
Index: 20, Size: 20</span> </div><h3 id="BookInOnePage-DisablingCookies">Disabling
Cookies</h3><p>To disable cookies you can set the HTTP Client to ignore cookies
by adding this URI option:<br clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><
 h3 id="BookInOnePage-AdvancedUsage">Advanced Usage</h3><p>If you need more
control over the HTTP producer you should use the <code>HttpComponent</code> where
you can set various classes to give you custom behavior.</p><h4 id="BookInOnePage-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a <code>org.apache.commons.httpclient.HttpConnectionManager</code>
where you can configure various global configuration for the given component.<br clear="none">
By global, we mean that any endpoint the component creates has the same shared <code>HttpConnectionManager</code>.
So, if we want to set a different value for the max connection per host, we need to define
it on the HTTP component and <strong>not</strong> on the endpoint URI that we
usually use. So here comes:</p><p>First, we define the <code>http</code>
component in Spring XML. Yes, we use the same scheme name, <code>http</code>,
because otherwise Camel will auto
 -discover and create the component with default settings. What we need is to overrule this
so we can set our options. In the sample below we set the max connection to 5 instead of the
default of 2.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><h3 id="BookInOnePage-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect" href="content-enricher.html">enrich</a>
with data returned from a remote HTTP call. As we want any response from the remote server,
we set the <code>throwExceptionOnFailure</code> option to <code>false</code>
so we get any response in the <code>AggregationStrategy</code>. As the code is
based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+// We set throwExceptionOnFailure to false to let Camel return any response from the remove
HTTP server without thrown
+// HttpOperationFailedException in case of failures.
+// This allows us to handle all responses in the aggregation strategy where we can check
the HTTP response code
+// and decide what to do. As this is based on an unit test we assert the code is 404
+from(&quot;direct:start&quot;).enrich(&quot;http://localhost:8222/myserver?throwExceptionOnFailure=false&amp;user=Camel&quot;,
new AggregationStrategy() {
+    public Exchange aggregate(Exchange original, Exchange resource) {
+        // get the response code
+        Integer code = resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
+        assertEquals(404, code.intValue());
+        return resource;
+    }
+}).to(&quot;mock:result&quot;);
+
+// this is our jetty server where we simulate the 404
+from(&quot;jetty://http://localhost:8222/myserver&quot;)
+        .process(new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getOut().setBody(&quot;Page not found&quot;);
+                exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+            }
+        });
+]]></script>
+</div></div><h3 id="BookInOnePage-DisablingCookies">Disabling Cookies</h3><p>To
disable cookies you can set the HTTP Client to ignore cookies by adding this URI option:<br
clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><h3
id="BookInOnePage-AdvancedUsage">Advanced Usage</h3><p>If you need more control
over the HTTP producer you should use the <code>HttpComponent</code> where you
can set various classes to give you custom behavior.</p><h4 id="BookInOnePage-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a <code>org.apache.commons.httpclient.HttpConnectionManager</code>
where you can configure various global configuration for the given component.<br clear="none">
By global, we mean that any endpoint the component creates has the same shared <code>HttpConnectionManager</code>.
So, if we want to set a different value for the max connection per host, we need to define
it on the HTTP compon
 ent and <strong>not</strong> on the endpoint URI that we usually use. So here
comes:</p><p>First, we define the <code>http</code> component in Spring
XML. Yes, we use the same scheme name, <code>http</code>, because otherwise Camel
will auto-discover and create the component with default settings. What we need is to overrule
this so we can set our options. In the sample below we set the max connection to 5 instead
of the default of 2.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;bean id=&quot;http&quot; class=&quot;org.apache.camel.component.http.HttpComponent&quot;&gt;
     &lt;property name=&quot;camelContext&quot; ref=&quot;camel&quot;/&gt;

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/http.html
==============================================================================
--- websites/production/camel/content/http.html (original)
+++ websites/production/camel/content/http.html Fri Oct  9 12:21:09 2015
@@ -164,7 +164,31 @@ HttpServletRequest response = exchange.g
    Message out = exchange.getOut();
    int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
 ]]></script>
-</div></div><h3 id="HTTP-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect" href="content-enricher.html">enrich</a>
with data returned from a remote HTTP call. As we want any response from the remote server,
we set the <code>throwExceptionOnFailure</code> option to <code>false</code>
so we get any response in the <code>AggregationStrategy</code>. As the code is
based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.</p><div
class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException:
Index: 20, Size: 20</span> </div><h3 id="HTTP-DisablingCookies">Disabling
Cookies</h3><p>To disable cookies you can set the HTTP Client to ignore cookies
by adding this URI option:<br clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><h3
id="HTTP-Advanc
 edUsage">Advanced Usage</h3><p>If you need more control over the HTTP producer
you should use the <code>HttpComponent</code> where you can set various classes
to give you custom behavior.</p><h4 id="HTTP-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a <code>org.apache.commons.httpclient.HttpConnectionManager</code>
where you can configure various global configuration for the given component.<br clear="none">
By global, we mean that any endpoint the component creates has the same shared <code>HttpConnectionManager</code>.
So, if we want to set a different value for the max connection per host, we need to define
it on the HTTP component and <strong>not</strong> on the endpoint URI that we
usually use. So here comes:</p><p>First, we define the <code>http</code>
component in Spring XML. Yes, we use the same scheme name, <code>http</code>,
because otherwise Camel will auto-discover and create the component w
 ith default settings. What we need is to overrule this so we can set our options. In the
sample below we set the max connection to 5 instead of the default of 2.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h3 id="HTTP-UsingthrowExceptionOnFailure=falsetogetanyresponseback">Using
<code>throwExceptionOnFailure=false</code> to get any response back</h3><p>In
the route below we want to route a message that we <a shape="rect" href="content-enricher.html">enrich</a>
with data returned from a remote HTTP call. As we want any response from the remote server,
we set the <code>throwExceptionOnFailure</code> option to <code>false</code>
so we get any response in the <code>AggregationStrategy</code>. As the code is
based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+// We set throwExceptionOnFailure to false to let Camel return any response from the remove
HTTP server without thrown
+// HttpOperationFailedException in case of failures.
+// This allows us to handle all responses in the aggregation strategy where we can check
the HTTP response code
+// and decide what to do. As this is based on an unit test we assert the code is 404
+from(&quot;direct:start&quot;).enrich(&quot;http://localhost:8222/myserver?throwExceptionOnFailure=false&amp;user=Camel&quot;,
new AggregationStrategy() {
+    public Exchange aggregate(Exchange original, Exchange resource) {
+        // get the response code
+        Integer code = resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
+        assertEquals(404, code.intValue());
+        return resource;
+    }
+}).to(&quot;mock:result&quot;);
+
+// this is our jetty server where we simulate the 404
+from(&quot;jetty://http://localhost:8222/myserver&quot;)
+        .process(new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getOut().setBody(&quot;Page not found&quot;);
+                exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+            }
+        });
+]]></script>
+</div></div><h3 id="HTTP-DisablingCookies">Disabling Cookies</h3><p>To
disable cookies you can set the HTTP Client to ignore cookies by adding this URI option:<br
clear="none"> <code>httpClient.cookiePolicy=ignoreCookies</code></p><h3
id="HTTP-AdvancedUsage">Advanced Usage</h3><p>If you need more control over
the HTTP producer you should use the <code>HttpComponent</code> where you can
set various classes to give you custom behavior.</p><h4 id="HTTP-SettingMaxConnectionsPerHost">Setting
MaxConnectionsPerHost</h4><p>The <a shape="rect" href="http.html">HTTP</a>
Component has a <code>org.apache.commons.httpclient.HttpConnectionManager</code>
where you can configure various global configuration for the given component.<br clear="none">
By global, we mean that any endpoint the component creates has the same shared <code>HttpConnectionManager</code>.
So, if we want to set a different value for the max connection per host, we need to define
it on the HTTP component and <strong>not</strong
 > on the endpoint URI that we usually use. So here comes:</p><p>First, we
define the <code>http</code> component in Spring XML. Yes, we use the same scheme
name, <code>http</code>, because otherwise Camel will auto-discover and create
the component with default settings. What we need is to overrule this so we can set our options.
In the sample below we set the max connection to 5 instead of the default of 2.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;bean id=&quot;http&quot; class=&quot;org.apache.camel.component.http.HttpComponent&quot;&gt;
     &lt;property name=&quot;camelContext&quot; ref=&quot;camel&quot;/&gt;



Mime
View raw message