Modified: websites/production/camel/content/netty4-http.html
==============================================================================
--- websites/production/camel/content/netty4-http.html (original)
+++ websites/production/camel/content/netty4-http.html Thu Jul 16 14:18:34 2015
@@ -86,113 +86,113 @@
         <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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;dependency&gt;
+<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;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
-</pre>
+]]></script>
 </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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">netty4-http:http://localhost:8080[?options]
-</pre>
-</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></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</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 cols
 pan="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><co
 de>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></t
 h></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><cod
 e>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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">http://0.0.0.0:8080/myapp</pre>
+<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>maxHeadersSize</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></tbody></table></div></div><p>The 
<code>NettyHttpSecurityConfiguration</code> has the follo
 wing 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" clas
 s="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 
authenticator that performs the authentication. If none has been configured 
then the 
<code>org.apache.camel.component.netty4.http.JAASSecurityAuthenticator</code> 
is us
 ed 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 i
 d="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</cod
 e></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="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="conflue
 nceTd"><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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">/myapp</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[/myapp]]></script>
 </div></div></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>Any query parameters, such as 
<code>foo=bar&amp;beer=yes</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelHttpRawQuery</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Any query parameters, such as 
<code>foo=bar&amp;beer=yes</code>. Stored in the raw form, as they arrived to 
the consumer (i.e. before URL decoding).</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>Additional context-path. This 
value is empty if the client cal
 led the context-path <code>/myapp</code>. If the client calls 
<code>/myapp/mystuff</code>, then this header value is <code>/mystuff</code>. 
In other words its the value after the context-path configured on the route 
endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelHttpCharacterEncoding</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 charset from the 
content-type header.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelHttpAuthentication</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>If the user was authenticated 
using HTTP Basic then this header is added with the value 
<code>Basic</code>.</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>The content type if provided. For example: 
<code>text/plain; 
charset="UTF-8"</code>.</p></td></tr></tbody></table></div></div><h3 
id="Netty4HTTP-AccesstoNettytypes">Access to Netty types</h3><p>This component 
uses the <code>org.apache.camel.component.netty4.http.NettyHttpMessage</code> 
as the message implementation on the <a shape="rect" 
href="exchange.html">Exchange</a>. This allows end users to get access to the 
original Netty request/response instances if needed, as shown below.&#160;Mind 
that the original response may not be accessible at all times.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">io.netty.handler.codec.http.HttpRequest request = 
exchange.getIn(NettyHttpMessage.class).getHttpRequest();
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[io.netty.handler.codec.http.HttpRequest 
request = exchange.getIn(NettyHttpMessage.class).getHttpRequest();
+]]></script>
 </div></div><h3 id="Netty4HTTP-Examples">Examples</h3><p>In the route below we 
use Netty4 HTTP as a HTTP server, which returns back a hardcoded "Bye World" 
message.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">    from("netty4-http:http://0.0.0.0:8080/foo";)
-      .transform().constant("Bye World");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[    
from(&quot;netty4-http:http://0.0.0.0:8080/foo&quot;)
+      .transform().constant(&quot;Bye World&quot;);
+]]></script>
 </div></div><p>And we can call this HTTP server using Camel also, with the <a 
shape="rect" href="producertemplate.html">ProducerTemplate</a> as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">    String out = 
template.requestBody("netty4-http:http://localhost:8080/foo";, "Hello World", 
String.class);
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[    String out = 
template.requestBody(&quot;netty4-http:http://localhost:8080/foo&quot;, 
&quot;Hello World&quot;, String.class);
     System.out.println(out);
-</pre>
+]]></script>
 </div></div><p>And we get back "Bye World" as the output.</p><h3 
id="Netty4HTTP-HowdoIletNettymatchwildcards">How do I let Netty match 
wildcards</h3><p class="confluence-link">By default Netty4 HTTP will only match 
on exact uri's. But you can instruct Netty to match prefixes. For 
example</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("netty4-http:http://0.0.0.0:8123/foo";).to("mock:foo");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;netty4-http:http://0.0.0.0:8123/foo&quot;).to(&quot;mock:foo&quot;);
+]]></script>
 </div></div><p>In the route above Netty4 HTTP will only match if the uri is an 
exact match, so it will match if you enter<br clear="none"> <code><a 
shape="rect" class="external-link" href="http://0.0.0.0:8123/foo"; 
rel="nofollow">http://0.0.0.0:8123/foo</a></code> but not match if you do 
<code><a shape="rect" class="external-link" href="http://0.0.0.0:8123/foo/bar"; 
rel="nofollow">http://0.0.0.0:8123/foo/bar</a></code>.</p><p>So if you want to 
enable wildcard matching you do as follows:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("netty4-http:http://0.0.0.0:8123/foo?matchOnUriPrefix=true";).to("mock:foo");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;netty4-http:http://0.0.0.0:8123/foo?matchOnUriPrefix=true&quot;).to(&quot;mock:foo&quot;);
+]]></script>
 </div></div><p>So now Netty matches any endpoints with starts with 
<code>foo</code>.</p><p>To match <strong>any</strong> endpoint you can 
do:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("netty4-http:http://0.0.0.0:8123?matchOnUriPrefix=true";).to("mock:foo");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;netty4-http:http://0.0.0.0:8123?matchOnUriPrefix=true&quot;).to(&quot;mock:foo&quot;);
+]]></script>
 </div></div><h3 id="Netty4HTTP-Usingmultiplerouteswithsameport">Using multiple 
routes with same port</h3><p class="confluence-link">In the same <a 
shape="rect" href="camelcontext.html">CamelContext</a> you can have multiple 
routes from Netty4 HTTP that shares the same port (eg a <code 
class="confluence-link">io.netty.bootstrap.ServerBootstrap</code> instance). 
Doing this requires a number of bootstrap options to be identical in the 
routes, as the routes will share the same 
<code>io.netty.bootstrap.ServerBootstrap</code> instance. The instance will be 
configured with the options from the first route created.</p><p>The options the 
routes must be identical configured is all the options defined in the 
<code>org.apache.camel.component.netty4.NettyServerBootstrapConfiguration</code>
 configuration class. If you have configured another route with different 
options, Camel will throw an exception on startup, indicating the options is 
not identical. To mitigate this ensure all options is ident
 ical.</p><p>Here is an example with two routes that share the same 
port.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Two 
routes sharing the same port</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("netty4-http:http://0.0.0.0:{{port}}/foo";)
-  .to("mock:foo")
-  .transform().constant("Bye World");
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;netty4-http:http://0.0.0.0:{{port}}/foo&quot;)
+  .to(&quot;mock:foo&quot;)
+  .transform().constant(&quot;Bye World&quot;);
 
-from("netty4-http:http://0.0.0.0:{{port}}/bar";)
-  .to("mock:bar")
-  .transform().constant("Bye Camel");
-</pre>
+from(&quot;netty4-http:http://0.0.0.0:{{port}}/bar&quot;)
+  .to(&quot;mock:bar&quot;)
+  .transform().constant(&quot;Bye Camel&quot;);
+]]></script>
 </div></div><p>And here is an example of a mis configured 2nd route that do 
not have identical 
<code>org.apache.camel.component.netty4.NettyServerBootstrapConfiguration</code>
 option as the 1st route. This will cause Camel to fail on startup.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Two routes sharing the 
same port, but the 2nd route is misconfigured and will fail on 
starting</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("netty4-http:http://0.0.0.0:{{port}}/foo";)
-  .to("mock:foo")
-  .transform().constant("Bye World");
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;netty4-http:http://0.0.0.0:{{port}}/foo&quot;)
+  .to(&quot;mock:foo&quot;)
+  .transform().constant(&quot;Bye World&quot;);
 
 // we cannot have a 2nd route on same port with SSL enabled, when the 1st 
route is NOT
-from("netty4-http:http://0.0.0.0:{{port}}/bar?ssl=true";)
-  .to("mock:bar")
-  .transform().constant("Bye Camel");
-</pre>
+from(&quot;netty4-http:http://0.0.0.0:{{port}}/bar?ssl=true&quot;)
+  .to(&quot;mock:bar&quot;)
+  .transform().constant(&quot;Bye Camel&quot;);
+]]></script>
 </div></div><h4 
id="Netty4HTTP-Reusingsameserverbootstrapconfigurationwithmultipleroutes">Reusing
 same server bootstrap configuration with multiple routes</h4><p>By configuring 
the common server bootstrap option in an single instance of a 
<code>org.apache.camel.component.netty4.NettyServerBootstrapConfiguration</code>
 type, we can use the <code>bootstrapConfiguration</code> option on the Netty4 
HTTP consumers to refer and reuse the same options across all 
consumers.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;bean id="nettyHttpBootstrapOptions" 
class="org.apache.camel.component.netty4.NettyServerBootstrapConfiguration"&gt;
-  &lt;property name="backlog" value="200"/&gt;
-  &lt;property name="connectionTimeout" value="20000"/&gt;
-  &lt;property name="workerCount" value="16"/&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;bean 
id=&quot;nettyHttpBootstrapOptions&quot; 
class=&quot;org.apache.camel.component.netty4.NettyServerBootstrapConfiguration&quot;&gt;
+  &lt;property name=&quot;backlog&quot; value=&quot;200&quot;/&gt;
+  &lt;property name=&quot;connectionTimeout&quot; value=&quot;20000&quot;/&gt;
+  &lt;property name=&quot;workerCount&quot; value=&quot;16&quot;/&gt;
 &lt;/bean&gt;
-</pre>
+]]></script>
 </div></div><p>And in the routes you refer to this option as shown 
below</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-  &lt;from 
uri="netty4-http:http://0.0.0.0:{{port}}/foo?bootstrapConfiguration=#nettyHttpBootstrapOptions"/&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+  &lt;from 
uri=&quot;netty4-http:http://0.0.0.0:{{port}}/foo?bootstrapConfiguration=#nettyHttpBootstrapOptions&quot;/&gt;
   ...
 &lt;/route&gt;
 
 &lt;route&gt;
-  &lt;from 
uri="netty4-http:http://0.0.0.0:{{port}}/bar?bootstrapConfiguration=#nettyHttpBootstrapOptions"/&gt;
+  &lt;from 
uri=&quot;netty4-http:http://0.0.0.0:{{port}}/bar?bootstrapConfiguration=#nettyHttpBootstrapOptions&quot;/&gt;
   ...
 &lt;/route&gt;
 
 &lt;route&gt;
-  &lt;from 
uri="netty4-http:http://0.0.0.0:{{port}}/beer?bootstrapConfiguration=#nettyHttpBootstrapOptions"/&gt;
+  &lt;from 
uri=&quot;netty4-http:http://0.0.0.0:{{port}}/beer?bootstrapConfiguration=#nettyHttpBootstrapOptions&quot;/&gt;
   ...
 &lt;/route&gt;
-</pre>
+]]></script>
 </div></div><h4 
id="Netty4HTTP-ReusingsameserverbootstrapconfigurationwithmultipleroutesacrossmultiplebundlesinOSGicontainer">Reusing
 same server bootstrap configuration with multiple routes across multiple 
bundles in OSGi container</h4><p>See the <a shape="rect" 
href="netty-http-server-example.html">Netty HTTP Server Example</a> for more 
details and example how to do that.</p><h3 
id="Netty4HTTP-UsingHTTPBasicAuthentication">Using HTTP Basic 
Authentication</h3><p class="confluence-link">The Netty HTTP consumer supports 
HTTP basic authentication by specifying the security realm name to use, as 
shown below</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-   &lt;from 
uri="netty4-http:http://0.0.0.0:{{port}}/foo?securityConfiguration.realm=karaf"/&gt;
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+   &lt;from 
uri=&quot;netty4-http:http://0.0.0.0:{{port}}/foo?securityConfiguration.realm=karaf&quot;/&gt;
    ...
 &lt;/route&gt;
-</pre>
+]]></script>
 </div></div><p>The realm name is mandatory to enable basic authentication. By 
default the JAAS based authenticator is used, which will use the realm name 
specified (karaf in the example above) and use the JAAS realm and the JAAS 
{{LoginModule}}s of this realm for authentication.</p><p>End user of Apache 
Karaf / ServiceMix has a karaf realm out of the box, and hence why the example 
above would work out of the box in these containers.</p><h4 
id="Netty4HTTP-SpecifyingACLonwebresources">Specifying ACL on web 
resources</h4><p>The 
<code>org.apache.camel.component.netty4.http.SecurityConstraint</code> allows 
to define constrains on web resources. And the 
<code>org.apache.camel.component.netty.http.SecurityConstraintMapping</code> is 
provided out of the box, allowing to easily define inclusions and exclusions 
with roles.</p><p>For example as shown below in the XML DSL, we define the 
constraint bean:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelConte
 nt pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">  &lt;bean id="constraint" 
class="org.apache.camel.component.netty4.http.SecurityConstraintMapping"&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;bean id=&quot;constraint&quot; 
class=&quot;org.apache.camel.component.netty4.http.SecurityConstraintMapping&quot;&gt;
     &lt;!-- inclusions defines url -&gt; roles restrictions --&gt;
     &lt;!-- a * should be used for any role accepted (or even no roles) --&gt;
-    &lt;property name="inclusions"&gt;
+    &lt;property name=&quot;inclusions&quot;&gt;
       &lt;map&gt;
-        &lt;entry key="/*" value="*"/&gt;
-        &lt;entry key="/admin/*" value="admin"/&gt;
-        &lt;entry key="/guest/*" value="admin,guest"/&gt;
+        &lt;entry key=&quot;/*&quot; value=&quot;*&quot;/&gt;
+        &lt;entry key=&quot;/admin/*&quot; value=&quot;admin&quot;/&gt;
+        &lt;entry key=&quot;/guest/*&quot; value=&quot;admin,guest&quot;/&gt;
       &lt;/map&gt;
     &lt;/property&gt;
     &lt;!-- exclusions is used to define public urls, which requires no 
authentication --&gt;
-    &lt;property name="exclusions"&gt;
+    &lt;property name=&quot;exclusions&quot;&gt;
       &lt;set&gt;
         &lt;value&gt;/public/*&lt;/value&gt;
       &lt;/set&gt;
     &lt;/property&gt;
   &lt;/bean&gt;
-</pre>
+]]></script>
 </div></div><p>The constraint above is define so that</p><ul 
class="alternate"><li>access to /* is restricted and any roles is accepted 
(also if user has no roles)</li><li>access to /admin/* requires the admin 
role</li><li>access to /guest/* requires the admin or guest role</li><li>access 
to /public/* is an exclusion which means no authentication is needed, and is 
therefore public for everyone without logging in</li></ul><p>To use this 
constraint we just need to refer to the bean id as shown below:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-   &lt;from 
uri="netty4-http:http://0.0.0.0:{{port}}/foo?matchOnUriPrefix=true&amp;amp;securityConfiguration.realm=karaf&amp;amp;securityConfiguration.securityConstraint=#constraint"/&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+   &lt;from 
uri=&quot;netty4-http:http://0.0.0.0:{{port}}/foo?matchOnUriPrefix=true&amp;amp;securityConfiguration.realm=karaf&amp;amp;securityConfiguration.securityConstraint=#constraint&quot;/&gt;
    ...
 &lt;/route&gt;
-</pre>
+]]></script>
 </div></div><p></p><h3 id="Netty4HTTP-SeeAlso">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul><ul 
class="alternate"><li><a shape="rect" href="netty.html">Netty</a></li><li><a 
shape="rect" href="netty-http-server-example.html">Netty HTTP Server 
Example</a></li><li><a shape="rect" href="jetty.html">Jetty</a></li></ul></div>
         </td>
@@ -200,7 +200,7 @@ from("netty4-http:http://0.0.0.0:{{port}
           <div class="navigation">
             <div class="navigation_top">
                 <!-- NavigationBar -->
-<div class="navigation_bottom" id="navigation_bottom"><h3 
id="Navigation-Overviewhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49132";><a
 shape="rect" href="overview.html">Overview</a></h3><ul 
class="alternate"><li><a shape="rect" href="index.html">Home</a></li><li><a 
shape="rect" href="download.html">Download</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li><li><a shape="rect" 
href="faq.html">FAQ</a></li></ul><h3 
id="Navigation-Documentationhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49534";><a
 shape="rect" href="documentation.html">Documentation</a></h3><ul 
class="alternate"><li><a shape="rect" href="user-guide.html">User 
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a 
shape="rect" href="books.html">Books</a></li><li><a shape="rect" 
href="tutorials.html">Tutorials</a></li><li><a shape="rect" 
href="examples.html">Examples</a></li><li><a shape="rect" 
href="cookbook.html">Cookbook</a></li>
 <li><a shape="rect" href="architecture.html">Architecture</a></li><li><a 
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration 
Patterns</a></li><li><a shape="rect" href="dsl.html">DSL</a></li><li><a 
shape="rect" href="components.html">Components</a></li><li><a shape="rect" 
href="data-format.html">Data Format</a></li><li><a shape="rect" 
href="languages.html">Languages</a></li><li><a shape="rect" 
href="security.html">Security</a></li><li><a shape="rect" 
href="security-advisories.html">Security Advisories</a></li></ul><h3 
id="Navigation-Search">Search</h3><form 
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" 
action="http://www.google.com/cse";>
+<div class="navigation_bottom" id="navigation_bottom"><h3 
id="Navigation-Overview"><a shape="rect" 
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect" 
href="index.html">Home</a></li><li><a shape="rect" 
href="download.html">Download</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li><li><a shape="rect" 
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a 
shape="rect" href="documentation.html">Documentation</a></h3><ul 
class="alternate"><li><a shape="rect" href="user-guide.html">User 
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a 
shape="rect" href="books.html">Books</a></li><li><a shape="rect" 
href="tutorials.html">Tutorials</a></li><li><a shape="rect" 
href="examples.html">Examples</a></li><li><a shape="rect" 
href="cookbook.html">Cookbook</a></li><li><a shape="rect" 
href="architecture.html">Architecture</a></li><li><a shape="rect" 
href="enterprise-integration-patterns.html">Enterprise
  Integration Patterns</a></li><li><a shape="rect" 
href="dsl.html">DSL</a></li><li><a shape="rect" 
href="components.html">Components</a></li><li><a shape="rect" 
href="data-format.html">Data Format</a></li><li><a shape="rect" 
href="languages.html">Languages</a></li><li><a shape="rect" 
href="security.html">Security</a></li><li><a shape="rect" 
href="security-advisories.html">Security Advisories</a></li></ul><h3 
id="Navigation-Search">Search</h3><form 
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" 
action="http://www.google.com/cse";>
   <div>
     <input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
     <input type="hidden" name="ie" value="UTF-8">
@@ -208,7 +208,7 @@ from("netty4-http:http://0.0.0.0:{{port}
     <input type="submit" name="sa" value="Search">
   </div>
 </form>
-<script type="text/javascript" 
src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en";></script><h3
 
id="Navigation-Communityhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49115";><a
 shape="rect" href="community.html">Community</a></h3><ul 
class="alternate"><li><a shape="rect" 
href="support.html">Support</a></li><li><a shape="rect" 
href="contributing.html">Contributing</a></li><li><a shape="rect" 
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect" 
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect" 
href="user-stories.html">User Stories</a></li><li><a shape="rect" 
href="news.html">News</a></li><li><a shape="rect" 
href="articles.html">Articles</a></li><li><a shape="rect" 
href="site.html">Site</a></li><li><a shape="rect" 
href="team.html">Team</a></li><li><a shape="rect" class="external-link" 
href="http://camel-extra.googlecode.com/"; rel="nofollow">Camel 
Extra</a></li></ul><h3 id="Navigation-Developershttps://cwi
 ki.apache.org/confluence/pages/viewpage.action?pageId=49124"><a shape="rect" 
href="developers.html">Developers</a></h3><ul class="alternate"><li><a 
shape="rect" href="developers.html">Developer Guide</a></li><li><a shape="rect" 
href="source.html">Source</a></li><li><a shape="rect" 
href="building.html">Building</a></li><li><a shape="rect" 
href="javadoc.html">JavaDoc</a></li><li><a shape="rect" 
href="irc-room.html">IRC Room</a></li></ul><h3 
id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul 
class="alternate"><li><a shape="rect" class="external-link" 
href="http://www.apache.org/licenses/";>License</a></li><li><a shape="rect" 
class="external-link" 
href="http://www.apache.org/foundation/sponsorship.html";>Sponsorship</a></li><li><a
 shape="rect" class="external-link" 
href="http://www.apache.org/foundation/thanks.html";>Thanks</a></li><li><a 
shape="rect" class="external-link" 
href="http://www.apache.org/security/";>Security</a></li></ul></div>
+<script type="text/javascript" 
src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en";></script><h3
 id="Navigation-Community"><a shape="rect" 
href="community.html">Community</a></h3><ul class="alternate"><li><a 
shape="rect" href="support.html">Support</a></li><li><a shape="rect" 
href="contributing.html">Contributing</a></li><li><a shape="rect" 
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect" 
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect" 
href="user-stories.html">User Stories</a></li><li><a shape="rect" 
href="news.html">News</a></li><li><a shape="rect" 
href="articles.html">Articles</a></li><li><a shape="rect" 
href="site.html">Site</a></li><li><a shape="rect" 
href="team.html">Team</a></li><li><a shape="rect" class="external-link" 
href="http://camel-extra.googlecode.com/"; rel="nofollow">Camel 
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect" 
href="developers.html">Developers</a></h3><ul class="alternate"
 ><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a 
 >shape="rect" href="source.html">Source</a></li><li><a shape="rect" 
 >href="building.html">Building</a></li><li><a shape="rect" 
 >href="javadoc.html">JavaDoc</a></li><li><a shape="rect" 
 >href="irc-room.html">IRC Room</a></li></ul><h3 
 >id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul 
 >class="alternate"><li><a shape="rect" class="external-link" 
 >href="http://www.apache.org/licenses/";>License</a></li><li><a shape="rect" 
 >class="external-link" 
 >href="http://www.apache.org/foundation/sponsorship.html";>Sponsorship</a></li><li><a
 > shape="rect" class="external-link" 
 >href="http://www.apache.org/foundation/thanks.html";>Thanks</a></li><li><a 
 >shape="rect" class="external-link" 
 >href="http://www.apache.org/security/";>Security</a></li></ul></div>
                 <!-- NavigationBar -->
             </div>
           </div>


Reply via email to