You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2016/04/01 09:20:57 UTC

svn commit: r984391 [2/2] - in /websites/production/camel/content: book-component-appendix.html book-in-one-page.html cache/main.pageCache netty-http.html netty.html netty4-http.html

Modified: websites/production/camel/content/netty4-http.html
==============================================================================
--- websites/production/camel/content/netty4-http.html (original)
+++ websites/production/camel/content/netty4-http.html Fri Apr  1 07:20:57 2016
@@ -85,7 +85,7 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Netty4HTTP-Netty4HTTPComponent">Netty4 HTTP Component</h2><p><strong>Available as of Camel 2.14</strong></p><p class="confluence-link">The <strong>netty4-http</strong> component is an extension to&#160;<a shape="rect" href="netty4.html">Netty4</a> component to facilitiate HTTP transport with <a shape="rect" href="netty4.html">Netty4</a>.</p><p>This camel component supports both producer and consumer endpoints.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Stream</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Netty is stream based, which means the input it receives is submitted to Camel as a stream. That means you will only be able to read the content of the stream <strong>once</strong>.<br clear="none"> If you find a situation where the message body appears to be empty or you need
  to access the data multiple times (eg: doing multicasting, or redelivery error handling)<br clear="none"> you should use <a shape="rect" href="stream-caching.html">Stream caching</a> or convert the message body to a <code>String</code> which is safe to be re-read multiple times.</p></div></div><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="Netty4HTTP-Netty4HTTPComponent">Netty4 HTTP Component</h2><p><strong>Available as of Camel 2.14</strong></p><p class="confluence-link">The <strong>netty4-http</strong> component is an extension to&#160;<a shape="rect" href="netty4.html">Netty4</a> component to facilitiate HTTP transport with <a shape="rect" href="netty4.html">Netty4</a>.</p><p>This camel component supports both producer and consumer endpoints.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Stream</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Netty is stream based, which means the input it receives is submitted to Camel as a stream. That means you will only be able to read the content of the stream <strong>once</strong>.<br clear="none"> If you find a situation where the message body appears to be empty or you need
  to access the data multiple times (eg: doing multicasting, or redelivery error handling)<br clear="none"> you should use <a shape="rect" href="stream-caching.html">Stream caching</a> or convert the message body to a <code>String</code> which is safe to be re-read multiple times.</p><p>Notice Netty4 HTTP reads the entire stream into memory using <code>io.netty.handler.codec.http.HttpObjectAggregator</code> to build the entire full http message. But the resulting message is still a stream based message which is readable once.</p></div></div><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</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;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-netty4-http&lt;/artifactId&gt;
@@ -96,7 +96,7 @@
 </div></div><h3 id="Netty4HTTP-URIformat">URI format</h3><p>The URI scheme for a netty component is as follows</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[netty4-http:http://localhost:8080[?options]
 ]]></script>
-</div></div><p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Query parameters vs endpoint options</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>You may be wondering how Camel recognizes URI query parameters and endpoint options. For example you might create endpoint URI as follows - <code><a shape="rect" class="external-link" href="http://netty-httphttp" rel="nofollow">netty4-http:http//example.com?myParam=myValue&amp;compression=true</a></code> . In this example <code>myParam</code> is the HTTP parameter, while <code>compression</code> is the Camel endpoint option. The strategy used by Camel in such situations is to resolve available endpoint options and remove them from the URI. It means that for the discuss
 ed example, the HTTP request sent by Netty HTTP producer to the endpoint will look as follows -&#160;<code>http//example.com?myParam=myValue</code> , because <code>compression</code> endpoint option will be resolved and removed from the target URL.</p><p>Keep also in mind that you cannot specify endpoint options using dynamic headers (like <code>CamelHttpQuery</code>). Endpoint options can be specified only at the endpoint URI definition level (like <code>to</code> or <code>from</code> DSL elements).</p></div></div><h3 id="Netty4HTTP-HTTPOptions">HTTP Options</h3><div class="confluence-information-macro confluence-information-macro-information"><p class="title">A lot more options</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p class="confluence-link"><strong>Important:</strong> This component inherits all the options from <a shape="rect" href="netty4.html">Netty4</a>. So make sure t
 o look at the&#160;<a shape="rect" href="netty4.html">Netty4</a> documentation as well.<br clear="none"> Notice that some options from&#160;<a shape="rect" href="netty4.html">Netty4</a> is not applicable when using this&#160;Netty4 HTTP component, such as options related to UDP transport.</p></div></div><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>chunkedMaxContentLength</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1mb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Value in bytes the max content length per chunked frame received on the Netty HTTP server.</p></td></tr><tr><td colspan="1" rowspan="1" class="con
 fluenceTd"><p><code>compression</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allow using gzip/deflate for compression on the Netty HTTP server if the client supports it from the HTTP headers.</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>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a custom <code>org.apache.camel.spi.HeaderFilterStrategy</code> to filter headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpMethodRestrict</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To disable HTTP methods on the Netty HTTP consumer. You can specify multiple separated by comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="conflue
 nceTd"><p><code>mapHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If this option is enabled, then during binding from Netty to Camel <a shape="rect" href="message.html">Message</a> then the headers will be mapped as well (eg added as header to the Camel <a shape="rect" href="message.html">Message</a> as well). You can turn off this option to disable this. The headers can still be accessed from the <code>org.apache.camel.component.netty4.http.NettyHttpMessage</code> message with the method <code>getHttpRequest()</code> that returns the Netty HTTP request <code>io.netty.handler.codec.http.HttpRequest</code> instance.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>matchOnUriPrefix</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether or not Camel should tr
 y to find a target consumer by matching the URI prefix if no exact match is found. See further below for more details.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>nettyHttpBinding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a custom <code>org.apache.camel.component.netty4.http.NettyHttpBinding</code> for binding to/from Netty and Camel Message API.</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 <code>true</code>, the producer will ignore the <code>Exchange.HTTP_URI</code> header, and use the endpoint's URI for request. You may also set the <code>throwExceptionOnFailure</code> to be <code>false</code> to let the producer send all the fault response back.</
 p></td></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 <code>HttpOperationFailedException</code> in case of failed responses from the remote server. This allows you to get all responses regardles of the HTTP status code.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceEnabled</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether to enable HTTP TRACE for this Netty HTTP consumer. By default TRACE is turned off.</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>If enabled and an <a shape="rect" href="exchange.html">Exchange</a> failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a <code>application/x-java-serialized-object</code> content type. On the producer side the exception will be deserialized and thrown as is, instead of the <code>HttpOperationFailedException</code>. The caused exception is required to be serialized.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>urlDecodeHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If this option is enabled, then during binding from Netty to Camel <a shape="rect" href="message.html">Message</a> then the header values will be URL decoded (eg %20 will be a space character. Notice this option is used by the default <code>org.apache.camel.component.netty4.http.NettyHttpBinding</code> and therefore if you 
 implement a custom <code>org.apache.camel.component.netty4.http.NettyHttpBinding</code> then you would need to decode the headers accordingly to this option. <strong>Notice:</strong> This option is default <code>false</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>nettySharedHttpServer</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 shared Netty4 HTTP server. See <a shape="rect" href="netty-http-server-example.html">Netty HTTP Server Example</a> for more details.</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>Determines whether or not the raw input stream from Netty <code>HttpRequest#getContent()</code> is cached or not (Camel will read the stream into a
  in light-weight memory based Stream caching) cache. By default Camel will cache the Netty input stream to support reading it multiple times to ensure it Camel can retrieve all data from the stream. However you can set this option to <code>true</code> when you for example need to access the raw stream, such as streaming it directly to a file or other persistent store. Mind that if you enable this option, then you cannot read the Netty stream multiple times out of the box, and you would need manually to reset the reader index on the Netty raw stream.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>securityConfiguration</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>Consumer only</strong>. Refers to a <code>org.apache.camel.component.netty4.http.NettyHttpSecurityConfiguration</code> for configuring secure web resources.</p></td></tr><tr><td colspan="1" r
 owspan="1" class="confluenceTd"><p><code>send503whenSuspended</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Consumer only</strong>. Whether to send back HTTP status code 503 when the consumer has been suspended. If the option is <code>false</code> then the Netty Acceptor is unbound when the consumer is suspended, so clients cannot connect anymore.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>maxHeaderSize</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>8192</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15.3:</strong> <strong>Consumer only</strong>. The maximum length of all headers. If the sum of the length of each header exceeds this value, a io.netty.handler.codec.TooLongFrameException will be raised.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>okStatusCodeRange</code></td><td c
 olspan="1" rowspan="1" class="confluenceTd"><code>200-299</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong><span> The status codes which is considered a success response. The values are inclusive. The range must be defined as from-to with the dash included.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span class="hl_identifier">useRelativePath</span></td><td colspan="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.16: Producer only:</strong> Whether to use a path (/myapp) in the request line or an absolute URI (<a shape="rect" class="external-link" href="http://0.0.0.0:8080/myapp)," rel="nofollow">http://0.0.0.0:8080/myapp),</a> which is default.</td></tr></tbody></table></div></div><p>The <code>NettyHttpSecurityConfiguration</code> has the following options:</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>authenticate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether authentication is enabled. Can be used to quickly turn this off.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>constraint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Basic</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The constraint supported. Currently only <code>Basic</code> is implemented and supported.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>realm</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</cod
 e></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the JAAS security realm. This option is mandatory.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>securityConstraint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to plugin a security constraint mapper where you can define ACL to web resources.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>securityAuthenticator</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to plugin a authenticator that performs the authentication. If none has been configured then the <code>org.apache.camel.component.netty4.http.JAASSecurityAuthenticator</code> is used by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>loginDeniedLoggingLevel<
 /code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>DEBUG</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Logging level used when a login attempt failed, which allows to see more details why the login failed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>roleClassName</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 specify FQN class names of <code>Principal</code> implementations that contains user roles. If none has been specified, then the Netty4 HTTP component will by default assume a <code>Principal</code> is role based if its FQN classname has the lower-case word <code>role</code> in its classname. You can specify multiple class names separated by comma.</p></td></tr></tbody></table></div></div><h3 id="Netty4HTTP-MessageHeaders">Message Headers</h3><p>The following headers can be used on the producer to control 
 the HTTP request.</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>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>CamelHttpMethod</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allow to control what HTTP method to use such as GET, POST, TRACE etc. The type can also be a <code>io.netty.handler.codec.http.HttpMethod</code> instance.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpQuery</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to provide URI query parameters as a <code>S
 tring</code> value that overrides the endpoint configuration. Separate multiple parameters using the &amp; sign. For example: <code>foo=bar&amp;beer=yes</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpPath</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to provide URI context-path and query parameters as a <code>String</code> value that overrides the endpoint configuration. This allows to reuse the same producer for calling same remote http server, but using a dynamic context-path and query parameters.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>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>To set the content-type of the HTTP body. For example: <code>text/plain; charset="UTF-8"</code>.</p></td
 ></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>CamelHttpResponseCode</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>int</code></td><td colspan="1" rowspan="1" class="confluenceTd">Allows to set the HTTP Status code to use. By default 200 is used for success, and 500 for failure.</td></tr></tbody></table></div></div><p>The following headers is provided as meta-data when a route starts from an Netty4 HTTP endpoint:</p><p>The description in the table takes offset in a route having: <code>from("<a shape="rect" class="external-link" href="http://netty-httphttp:0.0.0.0:8080" rel="nofollow">netty4-http:http:0.0.0.0:8080/myapp</a>")...</code></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>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>CamelHttpMethod</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 method used, such as GET, POST, TRACE etc.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpUrl</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 URL including protocol, host and port, etc:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Query parameters vs endpoint options</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>You may be wondering how Camel recognizes URI query parameters and endpoint options. For example you might create endpoint URI as follows - <code><a shape="rect" class="external-link" href="http://netty-httphttp" rel="nofollow">netty4-http:http//example.com?myParam=myValue&amp;compression=true</a></code> . In this example <code>myParam</code> is the HTTP parameter, while <code>compression</code> is the Camel endpoint option. The strategy used by Camel in such situations is to resolve available endpoint options and remove them from the URI. It means that for the discuss
 ed example, the HTTP request sent by Netty HTTP producer to the endpoint will look as follows -&#160;<code>http//example.com?myParam=myValue</code> , because <code>compression</code> endpoint option will be resolved and removed from the target URL.</p><p>Keep also in mind that you cannot specify endpoint options using dynamic headers (like <code>CamelHttpQuery</code>). Endpoint options can be specified only at the endpoint URI definition level (like <code>to</code> or <code>from</code> DSL elements).</p></div></div><h3 id="Netty4HTTP-HTTPOptions">HTTP Options</h3><div class="confluence-information-macro confluence-information-macro-information"><p class="title">A lot more options</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p class="confluence-link"><strong>Important:</strong> This component inherits all the options from <a shape="rect" href="netty4.html">Netty4</a>. So make sure t
 o look at the&#160;<a shape="rect" href="netty4.html">Netty4</a> documentation as well.<br clear="none"> Notice that some options from&#160;<a shape="rect" href="netty4.html">Netty4</a> is not applicable when using this&#160;Netty4 HTTP component, such as options related to UDP transport.</p></div></div><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>chunkedMaxContentLength</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1mb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Value in bytes the max content length per chunked frame received on the Netty HTTP server.</p></td></tr><tr><td colspan="1" rowspan="1" class="con
 fluenceTd"><p><code>compression</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allow using gzip/deflate for compression on the Netty HTTP server if the client supports it from the HTTP headers.</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>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a custom <code>org.apache.camel.spi.HeaderFilterStrategy</code> to filter headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>httpMethodRestrict</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To disable HTTP methods on the Netty HTTP consumer. You can specify multiple separated by comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="conflue
 nceTd"><p><code>mapHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If this option is enabled, then during binding from Netty to Camel <a shape="rect" href="message.html">Message</a> then the headers will be mapped as well (eg added as header to the Camel <a shape="rect" href="message.html">Message</a> as well). You can turn off this option to disable this. The headers can still be accessed from the <code>org.apache.camel.component.netty4.http.NettyHttpMessage</code> message with the method <code>getHttpRequest()</code> that returns the Netty HTTP request <code>io.netty.handler.codec.http.HttpRequest</code> instance.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>matchOnUriPrefix</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether or not Camel should tr
 y to find a target consumer by matching the URI prefix if no exact match is found. See further below for more details.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>nettyHttpBinding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a custom <code>org.apache.camel.component.netty4.http.NettyHttpBinding</code> for binding to/from Netty and Camel Message API.</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 <code>true</code>, the producer will ignore the <code>Exchange.HTTP_URI</code> header, and use the endpoint's URI for request. You may also set the <code>throwExceptionOnFailure</code> to be <code>false</code> to let the producer send all the fault response back.</
 p></td></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 <code>HttpOperationFailedException</code> in case of failed responses from the remote server. This allows you to get all responses regardles of the HTTP status code.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceEnabled</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether to enable HTTP TRACE for this Netty HTTP consumer. By default TRACE is turned off.</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>If enabled and an <a shape="rect" href="exchange.html">Exchange</a> failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a <code>application/x-java-serialized-object</code> content type. On the producer side the exception will be deserialized and thrown as is, instead of the <code>HttpOperationFailedException</code>. The caused exception is required to be serialized.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>urlDecodeHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If this option is enabled, then during binding from Netty to Camel <a shape="rect" href="message.html">Message</a> then the header values will be URL decoded (eg %20 will be a space character. Notice this option is used by the default <code>org.apache.camel.component.netty4.http.NettyHttpBinding</code> and therefore if you 
 implement a custom <code>org.apache.camel.component.netty4.http.NettyHttpBinding</code> then you would need to decode the headers accordingly to this option. <strong>Notice:</strong> This option is default <code>false</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>nettySharedHttpServer</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 shared Netty4 HTTP server. See <a shape="rect" href="netty-http-server-example.html">Netty HTTP Server Example</a> for more details.</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>Determines whether or not the raw input stream from Netty <code>HttpRequest#getContent()</code> is cached or not (Camel will read the stream into a
  in light-weight memory based Stream caching) cache. By default Camel will cache the Netty input stream to support reading it multiple times to ensure it Camel can retrieve all data from the stream. However you can set this option to <code>true</code> when you for example need to access the raw stream, such as streaming it directly to a file or other persistent store. Mind that if you enable this option, then you cannot read the Netty stream multiple times out of the box, and you would need manually to reset the reader index on the Netty raw stream.</p><p><span>Notice Netty4 HTTP reads the entire stream into memory using </span><code>io.netty.handler.codec.http.HttpObjectAggregator</code><span> to build the entire full http message. But the resulting message is still a stream based message which is readable once.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>securityConfiguration</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>Consumer only</strong>. Refers to a <code>org.apache.camel.component.netty4.http.NettyHttpSecurityConfiguration</code> for configuring secure web resources.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>send503whenSuspended</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Consumer only</strong>. Whether to send back HTTP status code 503 when the consumer has been suspended. If the option is <code>false</code> then the Netty Acceptor is unbound when the consumer is suspended, so clients cannot connect anymore.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>maxHeaderSize</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>8192</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15.3:</strong> <strong>Consumer
  only</strong>. The maximum length of all headers. If the sum of the length of each header exceeds this value, a io.netty.handler.codec.TooLongFrameException will be raised.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>okStatusCodeRange</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>200-299</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong><span> The status codes which is considered a success response. The values are inclusive. The range must be defined as from-to with the dash included.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span class="hl_identifier">useRelativePath</span></td><td colspan="1" rowspan="1" class="confluenceTd">false</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.16: Producer only:</strong> Whether to use a path (/myapp) in the request line or an absolute URI (<a shape="rect" class="external-link" href="http://0.0.0.0:8080/myapp)," rel=
 "nofollow">http://0.0.0.0:8080/myapp),</a> which is default.</td></tr></tbody></table></div></div><p>The <code>NettyHttpSecurityConfiguration</code> has the following options:</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>authenticate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether authentication is enabled. Can be used to quickly turn this off.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>constraint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Basic</code></p></td><td colspan="1" rowspan="1" c
 lass="confluenceTd"><p>The constraint supported. Currently only <code>Basic</code> is implemented and supported.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>realm</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 name of the JAAS security realm. This option is mandatory.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>securityConstraint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to plugin a security constraint mapper where you can define ACL to web resources.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>securityAuthenticator</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to plugin a authen
 ticator that performs the authentication. If none has been configured then the <code>org.apache.camel.component.netty4.http.JAASSecurityAuthenticator</code> is used by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>loginDeniedLoggingLevel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>DEBUG</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Logging level used when a login attempt failed, which allows to see more details why the login failed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>roleClassName</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 specify FQN class names of <code>Principal</code> implementations that contains user roles. If none has been specified, then the Netty4 HTTP component will by default assume a <code>Principal</code> is role based if its FQN classname h
 as the lower-case word <code>role</code> in its classname. You can specify multiple class names separated by comma.</p></td></tr></tbody></table></div></div><h3 id="Netty4HTTP-MessageHeaders">Message Headers</h3><p>The following headers can be used on the producer to control the HTTP request.</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>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>CamelHttpMethod</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allow to control what HTTP method to use such as GET, POST, TRACE etc. The type can also be a <code>io.netty.handler.codec.http.HttpMethod</code> instance.</p></td></tr
 ><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpQuery</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to provide URI query parameters as a <code>String</code> value that overrides the endpoint configuration. Separate multiple parameters using the &amp; sign. For example: <code>foo=bar&amp;beer=yes</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpPath</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows to provide URI context-path and query parameters as a <code>String</code> value that overrides the endpoint configuration. This allows to reuse the same producer for calling same remote http server, but using a dynamic context-path and query parameters.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceT
 d"><p><code>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>To set the content-type of the HTTP body. For example: <code>text/plain; charset="UTF-8"</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>CamelHttpResponseCode</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>int</code></td><td colspan="1" rowspan="1" class="confluenceTd">Allows to set the HTTP Status code to use. By default 200 is used for success, and 500 for failure.</td></tr></tbody></table></div></div><p>The following headers is provided as meta-data when a route starts from an Netty4 HTTP endpoint:</p><p>The description in the table takes offset in a route having: <code>from("<a shape="rect" class="external-link" href="http://netty-httphttp:0.0.0.0:8080" rel="nofollow">netty4-http:http:0.0.0.0:8080/myapp</a>")...</code></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>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>CamelHttpMethod</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 method used, such as GET, POST, TRACE etc.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpUrl</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 URL including protocol, host and port, 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[http://0.0.0.0:8080/myapp]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelHttpUri</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 URI without protocol, host and port, 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[/myapp]]></script>