Modified: websites/production/camel/content/http.html ============================================================================== --- websites/production/camel/content/http.html (original) +++ websites/production/camel/content/http.html Mon Jun 12 17:18:49 2017 @@ -110,6 +110,7 @@ </div></div></td></tr></tbody></table></div><p>URI parameters can either be set directly on the endpoint URI or as a header:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Java DSL</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><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[from("direct:start") .to("http://oldhost?order=123&detail=short"); + from("direct:start") .setHeader(Exchange.HTTP_QUERY, constant("order=123&detail=short")) .to("http://oldhost"); @@ -127,7 +128,7 @@ from("direct:start") <to uri="http://www.google.com"/> <to uri="mock:results"/> ]]></script> -</div></div></td></tr></tbody></table></div><h3 id="HTTP-HttpEndpointOptions"><code>HttpEndpoint</code> Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>throwExceptionOnFailure</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Option to disable throwing the <strong><code>HttpOperationFailedException</code></strong> in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bridgeEndpoint</code></p></td><td colspan="1 " rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If the option is <strong><code>true</code></strong>, <strong><code>HttpProducer</code></strong> will ignore the <strong><code>Exchange.HTTP_URI</code></strong> header, and use the endpoint's URI for request. You may also set <strong><code>throwExceptionOnFailure=false</code></strong> to ensure all responses are propagated back to the  <strong><code>HttpProducer</code></strong>.</p><p>From<strong> Camel 2.3:</strong> when <strong><code>true</code></strong> the <strong><code>HttpProducer</code></strong> and <strong><code>CamelServlet</code></strong> will skip <strong><code>gzip</code></strong> processing when <strong><code>content-encoding=gzip</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>disableStreamCache</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td ><td colspan="1" rowspan="1" >class="confluenceTd"><p>When <strong><code>false</code></strong> >the <strong><code>DefaultHttpBinding</code></strong> will copy the >request input stream into a stream cache and put it into message body which >allows it to be read more than >once.</p><p>When <strong><code>true</code></strong> the ><strong><code>DefaultHttpBinding</code></strong> will set the request input >stream direct into the message body.</p><p>From<strong> Camel 2.17:</strong> >this options is now also support by the producer to allow using the response >stream directly instead of stream caching as by default.</p></td></tr><tr><td >colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: >rgb(255,0,0);"><s><code>httpBindingRef</code></s></span></p></td><td >colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: >rgb(255,0,0);"><s><code>null</code></s></span></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s> <strong>Deprecated and removed in Camel 2.17:</strong> Reference to a <code>org.apache.camel.component.http.HttpBinding</code> in the <a shape="rect" href="registry.html"><span style="color: rgb(255,0,0);">Registry</span></a>. Use the <code>httpBinding</code> option instead.</s></span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpBinding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.3:</strong> reference to a <strong><code>org.apache.camel.component.http.HttpBinding</code></strong> in the <a shape="rect" href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s><code>httpClientConfigurerRef</code></s></span></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s><code>null</code></s></span></p></td><td cols pan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s><strong>Deprecated and removed in Camel 2.17:</strong> Reference to a <code>org.apache.camel.component.http.HttpClientConfigurer</code> in the <a shape="rect" href="registry.html"><span style="color: rgb(255,0,0);">Registry</span></a>. Use the <code>httpClientConfigurer</code> option instead.</s></span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpClientConfigurer</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.3:</strong> reference to a <strong><code>org.apache.camel.component.http.HttpClientConfigurer</code></strong> in the <a shape="rect" href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpClient.XXX</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></ td><td colspan="1" rowspan="1" class="confluenceTd"><p>Setting options on the <a shape="rect" class="external-link" href="http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpClientParams.html">HttpClientParams</a>. For instance <strong><code>httpClient.soTimeout=5000</code></strong> will set the <strong><code>SO_TIMEOUT</code></strong> to 5 seconds.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>clientConnectionManager</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a custom <strong><code>org.apache.http.conn.ClientConnectionManager</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>transferException</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.6:</strong> If e nabled and an <a shape="rect" href="exchange.html">Exchange</a> failed processing on the consumer side, and if the caused <strong><code>Exception</code></strong> was send back serialized in the response as a <strong><code>application/x-java-serialized-object</code></strong> content type (for example using <a shape="rect" href="jetty.html">Jetty</a> or <a shape="rect" href="servlet.html">SERVLET</a> Camel components).</p><p>On the producer side the exception will be deserialized and thrown as is, instead of the <strong><code>HttpOperationFailedException</code></strong>. The caused exception will be serialized.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>headerFilterStrategy</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.11:</strong> reference to a instance of <strong><code>org.apache.camel.spi.HeaderFilterStrategy</code></strong> in the <a shape="rect" href="registry.html">Registry</a>. It will be used to apply the custom <strong><code>headerFilterStrategy</code></strong> on the new create <strong><code>HttpEndpoint</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>urlRewrite</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.11:</strong> <em><strong>Producer only!</strong> </em></p><p>Refers to a custom <strong><code>org.apache.camel.component.http.UrlRewrite</code></strong> which allows you to rewrite URLs when you bridge/proxy endpoints.</p><p>See more details at <a shape="rect" href="urlrewrite.html">UrlRewrite</a> and <a shape="rect" href="how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html">How to use Camel as a HTTP proxy between a client and server</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>eagerC heckContentAvailable</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.15.3/2.16:</strong> <em><strong>Consumer only</strong>!</em></p><p>Whether to eager check whether the HTTP requests has content when <strong><code>content-length=0</code></strong> or is not present.</p><p>This option should be set to <strong><code>true</code></strong> for those HTTP clients that do not send streamed data.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>copyHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.16:</strong> if this option is true then <strong><code>IN</code></strong> exchange headers will be copied to <strong><code>OUT</code></strong> exchange headers according to copy strategy.</p><p>Setting this to <strong><cod e>false</code></strong>, allows to only include the headers from the HTTP response (not propagating <strong><code>IN</code></strong> headers).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>okStatusCodeRange</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>200-299</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.16:</strong> the range of HTTP status codes for which a response is considered a success. The values are inclusive. The range must be defined as from-to with the dash included.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreResponseBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.16:</strong> when <strong><code>true</code></strong> the <strong><code>HttpProducer</code></strong> will not read the response body nor cache th e input stream.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cookieHandler</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel: 2.19:</strong> configure a cookie handler to maintain a HTTP session</p></td></tr></tbody></table></div></div> +</div></div></td></tr></tbody></table></div><h3 id="HTTP-HttpEndpointOptions"><code>HttpEndpoint</code> Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>throwExceptionOnFailure</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Option to disable throwing the <strong><code>HttpOperationFailedException</code></strong> in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bridgeEndpoint</code></p></td><td colspan="1 " rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If the option is <strong><code>true</code></strong>, <strong><code>HttpProducer</code></strong> will ignore the <strong><code>Exchange.HTTP_URI</code></strong> header, and use the endpoint's URI for request. You may also set <strong><code>throwExceptionOnFailure=false</code></strong> to ensure all responses are propagated back to the  <strong><code>HttpProducer</code></strong>.</p><p>From<strong> Camel 2.3:</strong> when <strong><code>true</code></strong> the <strong><code>HttpProducer</code></strong> and <strong><code>CamelServlet</code></strong> will skip <strong><code>gzip</code></strong> processing when <strong><code>content-encoding=gzip</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>disableStreamCache</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td ><td colspan="1" rowspan="1" >class="confluenceTd"><p>When <strong><code>false</code></strong> >the <strong><code>DefaultHttpBinding</code></strong> will copy the >request input stream into a stream cache and put it into message body which >allows it to be read more than >once.</p><p>When <strong><code>true</code></strong> the ><strong><code>DefaultHttpBinding</code></strong> will set the request input >stream direct into the message body.</p><p>From<strong> Camel 2.17:</strong> >this options is now also support by the producer to allow using the response >stream directly instead of stream caching as by default.</p></td></tr><tr><td >colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: >rgb(255,0,0);"><s><code>httpBindingRef</code></s></span></p></td><td >colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: >rgb(255,0,0);"><s><code>null</code></s></span></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s> <strong>Deprecated and removed in Camel 2.17:</strong> Reference to a <code>org.apache.camel.component.http.HttpBinding</code> in the <a shape="rect" href="registry.html"><span style="color: rgb(255,0,0);">Registry</span></a>. Use the <code>httpBinding</code> option instead.</s></span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpBinding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.3:</strong> reference to a <strong><code>org.apache.camel.component.http.HttpBinding</code></strong> in the <a shape="rect" href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s><code>httpClientConfigurerRef</code></s></span></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s><code>null</code></s></span></p></td><td cols pan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><s><strong>Deprecated and removed in Camel 2.17:</strong> Reference to a <code>org.apache.camel.component.http.HttpClientConfigurer</code> in the <a shape="rect" href="registry.html"><span style="color: rgb(255,0,0);">Registry</span></a>. Use the <code>httpClientConfigurer</code> option instead.</s></span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpClientConfigurer</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.3:</strong> reference to a <strong><code>org.apache.camel.component.http.HttpClientConfigurer</code></strong> in the <a shape="rect" href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpClient.XXX</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></ td><td colspan="1" rowspan="1" class="confluenceTd"><p>Use this to option to configure the underlying <a shape="rect" class="external-link" href="http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpClientParams.html">HttpClientParams</a>.</p><p>Example: <strong><code>httpClient.soTimeout=5000</code></strong> will set the <strong><code>SO_TIMEOUT</code></strong> to 5 seconds.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>clientConnectionManager</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a custom <strong><code>org.apache.http.conn.ClientConnectionManager</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>transferException</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <stron g>Camel 2.6:</strong> If enabled and an <a shape="rect" href="exchange.html">Exchange</a> failed processing on the consumer side, and if the caused <strong><code>Exception</code></strong> was send back serialized in the response as a <strong><code>application/x-java-serialized-object</code></strong> content type (for example using <a shape="rect" href="jetty.html">Jetty</a> or <a shape="rect" href="servlet.html">SERVLET</a> Camel components).</p><p>On the producer side the exception will be deserialized and thrown as is, instead of the <strong><code>HttpOperationFailedException</code></strong>. The caused exception will be serialized.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>headerFilterStrategy</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.11:</strong> reference to a instance of <strong><code>org.apache.camel.spi.HeaderFilterStrat egy</code></strong> in the <a shape="rect" href="registry.html">Registry</a>. It will be used to apply the custom <strong><code>headerFilterStrategy</code></strong> on the new create <strong><code>HttpEndpoint</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>urlRewrite</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.11:</strong> <em><strong>Producer only!</strong> </em></p><p>Refers to a custom <strong><code>org.apache.camel.component.http.UrlRewrite</code></strong> which allows you to rewrite URLs when you bridge/proxy endpoints.</p><p>See more details at <a shape="rect" href="urlrewrite.html">UrlRewrite</a> and <a shape="rect" href="how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html">How to use Camel as a HTTP proxy between a client and server</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="con fluenceTd"><p><code>eagerCheckContentAvailable</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From <strong>Camel 2.15.3/2.16:</strong> <em><strong>Consumer only</strong>!</em></p><p>Whether to eager check whether the HTTP requests has content when <strong><code>content-length=0</code></strong> or is not present.</p><p>This option should be set to <strong><code>true</code></strong> for those HTTP clients that do not send streamed data.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>copyHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.16:</strong> if this option is true then <strong><code>IN</code></strong> exchange headers will be copied to <strong><code>OUT</code></strong> exchange headers according to copy strategy.</p><p>Se tting this to <strong><code>false</code></strong>, allows to only include the headers from the HTTP response (not propagating <strong><code>IN</code></strong> headers).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>okStatusCodeRange</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>200-299</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.16:</strong> the range of HTTP status codes for which a response is considered a success. The values are inclusive. The range must be in the form <strong><code>from-to</code></strong>, dash included.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreResponseBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel 2.16:</strong> when <strong><code>true</code></strong> the <strong><code>HttpProducer</code></str ong> will not read the response body nor cache the input stream.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cookieHandler</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From<strong> Camel: 2.19:</strong> configure a cookie handler to maintain a HTTP session</p></td></tr></tbody></table></div></div> <h3 id="HTTP-AuthenticationandProxy">Authentication and Proxy</h3><p>The following authentication options can also be set on the <strong><code>HttpEndpoint</code></strong>:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>authMethod</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Authentication method, either as <strong><code>Basic</code></strong>, <strong><code>Digest</code></strong> or <strong><code>NTLM</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>authMethodPriority</code></p></td><td colspan="1" rowspan="1" clas s="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Priority of authentication methods. Is a list separated with comma.</p><p>For example: <code><strong>Basic</strong>,<strong>Digest</strong></code> to exclude <strong><code>NTLM</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>authUsername</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Username for authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>authPassword</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Password for authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>authDomain</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><t d colspan="1" rowspan="1" class="confluenceTd"><p>Domain for <strong><code>NTLM</code></strong> authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>authHost</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Optional host for <strong><code>NTLM</code></strong> authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxyHost</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The proxy host name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxyPort</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The proxy port number.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><cod e>proxyAuthMethod</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Authentication method for proxy, either as <strong><code>Basic</code></strong>, <strong><code>Digest</code></strong> or <strong><code>NTLM</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxyAuthUsername</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Username for proxy authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxyAuthPassword</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Password for proxy authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxyAuthDomain</code></p></td><td colspan="1" rowspan="1 " class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Domain for proxy <strong><code>NTLM</code></strong> authentication.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxyAuthHost</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Optional host for proxy <strong><code>NTLM</code></strong> authentication.</p></td></tr></tbody></table></div></div> @@ -159,22 +160,24 @@ HttpServletRequest response = exchange.g </properties> </camelContext> ]]></script> -</div></div></td></tr></tbody></table></div><p>Options on <strong><code>Endpoint</code></strong> will override options on the context.</p><h3 id="HTTP-Configuringcharset">Configuring <code>charset</code></h3><p>If you are using <strong><code>POST</code></strong> to send data you can configure the <strong><code>charset</code></strong></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[setProperty(Exchange.CHARSET_NAME, "iso-8859-1"); +</div></div></td></tr></tbody></table></div><p>Options on <strong><code>Endpoint</code></strong> will override options on the context.</p><h3 id="HTTP-Configuringcharset">Configuring <code>charset</code></h3><p>If you are using <strong><code>POST</code></strong> to send data you can configure the <strong><code>charset</code></strong>:</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[.setProperty(Exchange.CHARSET_NAME, "iso-8859-1"); ]]></script> </div></div><h3 id="HTTP-SamplewithScheduledPoll">Sample with Scheduled Poll</h3><p>The sample polls the Google homepage every 10 seconds and write the page to the file <strong><code>message.html</code></strong>:</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[from("timer://foo?fixedRate=true&delay=0&period=10000") .to("http://www.google.com") - .setHeader(FileComponent.HEADER_FILE_NAME, "message.html").to("file:target/google"); + .setHeader(FileComponent.HEADER_FILE_NAME, "message.html") + .to("file:target/google"); ]]></script> </div></div><h3 id="HTTP-GettingtheResponseCode">Getting the Response Code</h3><p>You can get the HTTP response code from the HTTP component by getting the value from the <strong><code>OUT</code></strong> message header with <strong><code>Exchange.HTTP_RESPONSE_CODE</code></strong>:</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[ Exchange exchange = template.send("http://www.google.com/search", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(Exchange.HTTP_QUERY, constant("hl=en&q=activemq")); - } - }); - Message out = exchange.getOut(); - int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class); +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[Exchange exchange = template.send("http://www.google.com/search", new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(Exchange.HTTP_QUERY, constant("hl=en&q=activemq")); + } +}); + +Message out = exchange.getOut(); +int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class); ]]></script> </div></div><h3 id="HTTP-UsingthrowExceptionOnFailure=falseToObtainAllServerResponses">Using <code>throwExceptionOnFailure=false</code> To Obtain All Server Responses</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 all responses from the remote server, we set the <strong><code>throwExceptionOnFailure=false</code></strong> so we get any response in the <strong><code>AggregationStrategy</code></strong>. 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[ @@ -200,7 +203,7 @@ from("jetty://http://localhost:8222 } }); ]]></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"> <strong><code>httpClient.cookiePolicy=ignoreCookies</code></strong></p><h3 id="HTTP-AdvancedUsage">Advanced Usage</h3><p>If you need more control over the HTTP producer you should use the <strong><code>HttpComponent</code></strong> where you can set various classes to give you custom behavior.</p><h4 id="HTTP-SettingMaxConnectionsPerHost">Setting <code>MaxConnectionsPerHost</code></h4><p>The <a shape="rect" href="http.html">HTTP</a> Component has a <strong><code>org.apache.commons.httpclient.HttpConnectionManager</code></strong> where you can configure various global configuration for the given component. By global, we mean that any endpoint the component creates has the same shared <strong><code>HttpConnectionManager</code></strong>. So, if we want to set a different value for the max connection per hos t, we need to define it on the HTTP component and <em>not</em> on the endpoint URI that we usually use. So here comes:</p><p>First, we define the <strong><code>http</code></strong> component in Spring XML. Yes, we use the same scheme name, <strong><code>http</code></strong>, 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="HTTP-DisablingCookies">Disabling Cookies</h3><p>To disable cookies you can set the HTTP Client to ignore cookies by adding this URI option: <strong><code>httpClient.cookiePolicy=ignoreCookies</code></strong></p><h3 id="HTTP-AdvancedUsage">Advanced Usage</h3><p>If you need more control over the HTTP producer you should use the <strong><code>HttpComponent</code></strong> where you can set various classes to give you custom behavior.</p><h4 id="HTTP-SettingMaxConnectionsPerHost">Setting <code>MaxConnectionsPerHost</code></h4><p>The <a shape="rect" href="http.html">HTTP</a> Component has a <strong><code>org.apache.commons.httpclient.HttpConnectionManager</code></strong> where you can configure various global configuration for the given component. By global, we mean that any endpoint the component creates has the same shared <strong><code>HttpConnectionManager</code></strong>. So, if we want to set a different value for the max connection per host, we need to def ine it on the HTTP component and <em>not</em> on the endpoint URI that we usually use. So here comes:</p><p>First, we define the <strong><code>http</code></strong> component in Spring XML. Yes, we use the same scheme name, <strong><code>http</code></strong>, 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[ <bean id="http" class="org.apache.camel.component.http.HttpComponent"> <property name="camelContext" ref="camel"/> @@ -238,22 +241,18 @@ kmp.setKeyPassword("keyPassword&quo SSLContextParameters scp = new SSLContextParameters(); scp.setKeyManagers(kmp); -ProtocolSocketFactory factory = - new SSLContextParametersSecureProtocolSocketFactory(scp); +ProtocolSocketFactory factory = new SSLContextParametersSecureProtocolSocketFactory(scp); -Protocol.registerProtocol("https", - new Protocol( -Â Â Â Â Â Â Â "https", -Â Â Â Â Â Â Â factory, -Â Â Â Â Â Â Â 443)); +Protocol.registerProtocol("https", new Protocol("https", factory, 443)); from("direct:start") - .to("https://mail.google.com/mail/").to("mock:results"); + .to("https://mail.google.com/mail/") + .to("mock:results"); ]]></script> </div></div><h5 id="HTTP-ConfiguringApacheHTTPClientDirectly">Configuring Apache HTTP Client Directly</h5><p>Basically <strong><code>camel-http</code></strong> component is built on the top of Apache HTTP client, and you can implement a custom <strong><code>org.apache.camel.component.http.HttpClientConfigurer</code></strong> to do some configuration on the HTTP client if you need full control of it.</p><p>However, if you <em>just</em> want to specify the <strong><code>keystore</code></strong> and <strong><code>truststore</code></strong> you can do this with Apache HTTP <strong><code>HttpClientConfigurer</code></strong>, for example:</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[Protocol authhttps = new Protocol("https", new AuthSSLProtocolSocketFactory( - new URL("file:my.keystore"), "mypassword", - new URL("file:my.truststore"), "mypassword"), 443); +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[Protocol authhttps = new Protocol("https", + new AuthSSLProtocolSocketFactory(new URL("file:my.keystore"), "mypassword", new URL("file:my.truststore"), "mypassword"), + 443); Protocol.registerProtocol("https", authhttps); ]]></script> @@ -262,9 +261,7 @@ Protocol.registerProtocol("https&qu httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer()); ]]></script> </div></div><p>If you are doing this using the Spring DSL, you can specify your <strong><code>HttpClientConfigurer</code></strong> using the URI. For example:</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[<bean id="myHttpClientConfigurer" - class="my.https.HttpClientConfigurer"> -</bean> +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<bean id="myHttpClientConfigurer" class="my.https.HttpClientConfigurer"/> <to uri="https://myhostname.com:443/myURL?httpClientConfigurerRef=myHttpClientConfigurer"/> ]]></script>