Author: buildbot Date: Fri Oct 21 20:18:44 2016 New Revision: 999758 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/ahc.html websites/production/camel/content/cache/main.pageCache Modified: websites/production/camel/content/ahc.html ============================================================================== --- websites/production/camel/content/ahc.html (original) +++ websites/production/camel/content/ahc.html Fri Oct 21 20:18:44 2016 @@ -41,7 +41,6 @@ <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script> <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script> <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script> - <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script> <script type="text/javascript"> SyntaxHighlighter.defaults['toolbar'] = false; @@ -104,7 +103,7 @@ ahc:https://hostname[:port][/resourceUri <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>binding</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.camel.component.ahc.AhcBinding</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>client</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>com.ning.http.client.AsyncHttpClient</code>.</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>clientConfig</code></p></td><td colspan="1" rows pan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To configure the <strong><code>AsyncHttpClient</code></strong> to use a custom <strong><code>com.ning.http.client.AsyncHttpClientConfig</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sslContextParameters</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To configure custom SSL/TLS configuration options at the component level. </p><p>See  <a shape="rect" href="#AHC-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</a> for more details. </p><p><strong>Note</strong>: configuring this option will override any SSL/TLS configuration options provided through the <strong><code>clientConfig</code></strong> option at the endpoint or component level.</p></td></tr></tbody></table> </div></div><p><strong>Note</strong>: setting any of the options on the <strong><code>AhcComponent</code></strong> will propagate those options to the <strong><code>AhcEndpoint</code></strong>(s) being created. However, the <strong><code>AhcEndpoint</code></strong> can also configure/override a custom option. Options set on endpoints will always take precedence over options from the <strong><code>AhcComponent</code>.</strong></p><h3 id="AHC-MessageHeaders">Message Headers</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>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.CONTENT_ENCODING</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HTTP content encoding. Is set on both the <strong><code>IN</code></strong> and <strong><code>OUT</code></strong> message to provide a content encoding, such as <strong><code>gzip</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.CONTENT_TYPE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HTTP content type. Is set on both the <strong><co de>IN</code></strong> and <strong><code>OUT</code></strong> message to provide a content type, such as <strong><code>text/html</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.HTTP_CHARACTER_ENCODING</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Character encoding.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.HTTP_PATH</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Request URI's path, the header will be used to build the request URI with the <strong><code>HTTP_URI</code></strong>.</p><p>However, if the path is start with <strong><code>"/"</code></strong>, the HTTP producer will try to find the relative path based on the <strong><code>Exchange.HTTP_BASE_URI</code></strong> header or the <code><strong>exchange.getFromEndpoint().getEndpointUri()</strong>;</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.HTTP_QUERY</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11</strong>: URI parameters. Will override existing URI parameters set directly on the endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.HTTP_RESPONSE_CODE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>int</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HTTP response code from the external server. Is <strong><code>200</code></strong> for <strong><code>OK</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange.HTTP_URI</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>URI to call. Will override existing URI set directly on the endpoint.</p></td></tr></tbody></table> -</div></div><h3 id="AHC-MessageBody">Message Body</h3><p>Camel will store the HTTP response from the external server on the <strong><code>OUT</code></strong> body. All headers from the <strong><code>IN</code></strong> message will be copied to the <strong><code>OUT</code></strong> message, so headers are preserved during routing. Additionally Camel will add the HTTP response headers as well to the <strong><code>OUT</code></strong> message headers.</p><h3 id="AHC-ResponseCodes">Response Codes</h3><p>The value of the HTTP response code governs how Camel behaves:</p><ul class="alternate"><li><p>If in the range <strong><code>100..299</code></strong> Camel will regard it as a successful response.</p></li><li><p>If in the range <strong><code>300..399</code></strong> Camel will regard it as a redirection response and throw an <strong><code>AhcOperationFailedException</code></strong> containing the relevant information.</p></li><li><p>If greater than <strong><code>400</c ode></strong> Camel regards it as an external server failure and throw an <strong><code>AhcOperationFailedException</code></strong> containing the relevant information.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">throwExceptionOnFailure</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The option, <strong><code>throwExceptionOnFailure</code></strong>, can be set to <strong><code>false</code></strong> to prevent the <strong><code>AhcOperationFailedException</code></strong> from being thrown for failed response codes. This allows you to get any response from the remote server.</p></div></div></li></ul><h3 id="AHC-AhcOperationFailedExceptionDetails"><code>AhcOperationFailedException</code> Details</h3><p>This exception contains the following information:</p><ul class="alternate"><li>The HTTP status code.</li><li>The HTTP status line ( text of the status code).</li><li>Redirect location, if server returned a redirect.</li><li>Response body as a <strong><code>java.lang.String</code></strong>, if the server provides a response body.</li></ul><h3 id="AHC-CallingusingGETorPOST">Calling using <code>GET</code> or <code>POST</code></h3><p>The following algorithm is used to determine if either <strong><code>GET</code></strong> or <strong><code>POST</code></strong> HTTP method should be used:</p><ol><li>  Use method provided in header.</li><li>  <strong><code>GET</code></strong> if query string is provided in header.</li><li>  <strong><code>GET</code></strong> if endpoint is configured with a query string.</li><li>  <strong><code>POST</code></strong> if there is data to send (body is not <strong><code>null</code></strong>).</li><li><strong>  <code>GET</code> </strong>otherwise<strong>.</strong></li></ol><h3 id="AHC-ConfiguringtheURItoCall">Configuring the URI to Call</h3><p>You can s et the HTTP producer's URI directly form the endpoint URI. In the route below, Camel will call out to the external server, <strong><code>oldhost</code></strong>, using HTTP.</p><p><strong>Java DSL</strong>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="AHC-MessageBody">Message Body</h3><p>Camel will store the HTTP response from the external server on the <strong><code>OUT</code></strong> body. All headers from the <strong><code>IN</code></strong> message will be copied to the <strong><code>OUT</code></strong> message, so headers are preserved during routing. Additionally Camel will add the HTTP response headers as well to the <strong><code>OUT</code></strong> message headers.</p><h3 id="AHC-ResponseCodes">Response Codes</h3><p>The value of the HTTP response code governs how Camel behaves:</p><ul class="alternate"><li><p>If in the range <strong><code>100..299</code></strong> Camel will regard it as a successful response.</p></li><li><p>If in the range <strong><code>300..399</code></strong> Camel will regard it as a redirection response and throw an <strong><code>AhcOperationFailedException</code></strong> containing the relevant information.</p></li><li><p>If greater than <strong><code>400</c ode></strong> Camel regards it as an external server failure and throw an <strong><code>AhcOperationFailedException</code></strong> containing the relevant information.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">throwExceptionOnFailure</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The option, <strong><code>throwExceptionOnFailure</code></strong>, can be set to <strong><code>false</code></strong> to prevent the <strong><code>AhcOperationFailedException</code></strong> from being thrown for failed response codes. This allows you to get any response from the remote server.</p></div></div></li></ul><h3 id="AHC-AhcOperationFailedExceptionDetails"><code>AhcOperationFailedException</code> Details</h3><p>This exception contains the following information:</p><ul class="alternate"><li><p>The HTTP status code.</p></li><li><p>The HTTP sta tus line (text of the status code).</p></li><li><p>Redirect location, if server returned a redirect.</p></li><li><p>Response body as a <strong><code>java.lang.String</code></strong>, if the server provides a response body.</p></li></ul><h3 id="AHC-CallingusingGETorPOST">Calling using <code>GET</code> or <code>POST</code></h3><p>The following algorithm is used to determine if either <strong><code>GET</code></strong> or <strong><code>POST</code></strong> HTTP method should be used:</p><ol><li><p>  Use method provided in header.</p></li><li><p>  <strong><code>GET</code></strong> if query string is provided in header.</p></li><li><p>  <strong><code>GET</code></strong> if endpoint is configured with a query string.</p></li><li><p>  <strong><code>POST</code></strong> if there is data to send (body is not <strong><code>null</code></strong>).</p></li><li><p><strong>  <code>GET</code> </strong>otherwise<strong>.</strong></p></li></ol><h3 id="AHC-Config uringtheURItoCall">Configuring the URI to Call</h3><p>You can set the HTTP producer's URI directly form the endpoint URI. In the route below, Camel will call out to the external server, <strong><code>oldhost</code></strong>, using HTTP.</p><p><strong>Java DSL</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("direct:start") .to("ahc:http://oldhost"); ]]></script> @@ -173,18 +172,17 @@ Message out = exchange.getOut(); int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class); ]]></script> </div></div><h3 id="AHC-ConfiguringAsyncHttpClient">Configuring AsyncHttpClient</h3><p>The <strong><code>AsyncHttpClient</code></strong> client uses a <strong><code>AsyncHttpClientConfig</code></strong> to configure the client. See the documentation at<a shape="rect" class="external-link" href="http://github.com/sonatype/async-http-client" rel="nofollow"> Async Http Client</a> for more details.</p><p>In Camel <strong>2.8</strong>, configuration is limited to using the builder pattern provided by <strong><code>AsyncHttpClientConfig.Builder</code></strong>. In Camel <strong>2.8</strong>, the <strong><code>AsyncHttpClientConfig</code></strong> doesn't support getters/setters so its not easy to create/configure using a Spring bean style e.g., the <strong><code><bean></code></strong> tag in the XML file.</p><p>The example below shows how to use a builder to create the <strong><code>AsyncHttpClientConfig</code></strong> which we configure on the <strong><code>AhcComponent</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[ -// create a client config builder +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Create a client config builder. DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder(); -// use the builder to set the options we want, in this case we want to follow redirects and try -// at most 3 retries to send a request to the host + +// Use the builder to set the desired options. DefaultAsyncHttpClientConfig config = builder.setFollowRedirect(true).setMaxRequestRetry(3).build(); -// lookup AhcComponent +// Lookup the AhcComponent... AhcComponent component = context.getComponent("ahc", AhcComponent.class); -// and set our custom client config to be used -component.setClientConfig(config); -]]></script> + +// ...and set the custom client config. +component.setClientConfig(config);]]></script> </div></div>In Camel <strong>2.9</strong>, the <strong><code>ahc</code></strong> component uses <code>Async HTTP library 1.6.4</code>. This newer version provides added support for plain bean style configuration. The <strong><code>AsyncHttpClientConfigBean</code></strong> class provides getters and setters for the configuration options available in <strong><code>AsyncHttpClientConfig</code></strong>. An instance of <strong><code>AsyncHttpClientConfigBean</code></strong> may be passed directly to the <strong><code>ahc</code></strong> component or referenced in an endpoint URI using the <strong><code>clientConfig</code></strong> URI parameter.<p>Also available in Camel <strong>2.9</strong> is the ability to set configuration options directly in the URI. URI options starting with <strong><code>clientConfig</code></strong> can be used to set the various configurable properties of <strong><code>AsyncHttpClientConfig</code></strong>. Options specified in the endpoint URI are mer ged with those specified by the <strong><code>clientConfig</code></strong> option. These options take precedence over the options specified on the URI endpoint. A copy of the <strong><code>AsyncHttpClientConfig</code></strong> is made for each new endpoint. The example below shows how to configure the <strong><code>ahc</code></strong> component using the <strong><code>clientConfig</code></strong> URI options.</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("direct:start") .to("ahc:http://localhost:8080/foo?clientConfig.maxRequestRetry=3&clientConfig.followRedirects=true") Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available.