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 2013/06/04 15:19:18 UTC

svn commit: r864347 - in /websites/production/camel/content: cache/main.pageCache netty-http.html

Author: buildbot
Date: Tue Jun  4 13:19:18 2013
New Revision: 864347

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/netty-http.html

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

Modified: websites/production/camel/content/netty-http.html
==============================================================================
--- websites/production/camel/content/netty-http.html (original)
+++ websites/production/camel/content/netty-http.html Tue Jun  4 13:19:18 2013
@@ -112,8 +112,8 @@ netty-http:http:<span class="code-commen
 
 <h3><a shape="rect" name="NettyHTTP-HTTPOptions"></a>HTTP Options</h3>
 
-<p><b>Important:</b> This component inherits all the options from <a shape="rect" href="netty.html" title="Netty">Netty</a>. So make sure to look at the <a shape="rect" href="netty.html" title="Netty">Netty</a> documentation as well.<br clear="none">
-Notice that some options from <a shape="rect" href="netty.html" title="Netty">Netty</a> is not applicable when using this <a shape="rect" href="netty-http.html" title="Netty HTTP">Netty HTTP</a> component, such as options related to UDP transport.</p>
+<div class="panelMacro"><table class="infoMacro"><colgroup span="1"><col span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" valign="top"><img align="middle" src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1"><b>A lot more options</b><br clear="none"><b>Important:</b> This component inherits all the options from <a shape="rect" href="netty.html" title="Netty">Netty</a>. So make sure to look at the <a shape="rect" href="netty.html" title="Netty">Netty</a> documentation as well.<br clear="none">
+Notice that some options from <a shape="rect" href="netty.html" title="Netty">Netty</a> is not applicable when using this <a shape="rect" href="netty-http.html" title="Netty HTTP">Netty HTTP</a> component, such as options related to UDP transport.</td></tr></table></div>
 
 <div class="confluenceTableSmall"><div class="table-wrap">
 <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Name </th><th colspan="1" rowspan="1" class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>chunked</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> Allow using chunked transfer if the client supports it from the HTTP headers. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>compression</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> Allow using gzip/deflate for compression if the client supports it from the HTTP headers. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>headerFilterStrategy</tt> </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1
 " rowspan="1" class="confluenceTd"> To use a custom  <tt>org.apache.camel.spi.HeaderFilterStrategy</tt> to filter headers. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>httpMethodRestrict</tt> </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"> To disable HTTP methods on the Netty HTTP consumer. You can specify multiple separated by comma. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>mapHeaders</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> If this option is enabled, then during binding from Netty to Camel <a shape="rect" href="message.html" title="Message">Message</a> then the headers will be mapped as well (eg added as header to the Camel <a shape="rect" href="message.html" title="Message">Message</a> as well). You can turn off this option to disable this. The headers can still be acces
 sed from the <tt>org.apache.camel.component.netty.http.NettyHttpMessage</tt> message with the method <tt>getHttpRequest()</tt> that returns the Netty HTTP request <tt>org.jboss.netty.handler.codec.http.HttpRequest</tt> instance. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>nettyHttpBinding</tt> </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"> To use a custom <tt>org.apache.camel.component.netty.http.NettyHttpBinding</tt> for binding to/from Netty and Camel Message API. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>throwExceptionOnFailure</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> Option to disable throwing the <tt>HttpOperationFailedException</tt> in case of failed responses from the remote server. This allows you to get all responses regardles of the HTTP status code. </td></tr><t
 r><td colspan="1" rowspan="1" class="confluenceTd"> <tt>traceEnabled</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> Specifies whether to enable HTTP TRACE for this Netty HTTP consumer. By default TRACE is turned off. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <tt>transferException</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> If enabled and an <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a <tt>application/x-java-serialized-object</tt> content type. On the producer side the exception will be deserialized and thrown as is, instead of the <tt>HttpOperationFailedException</tt>. The caused exception is required to be serialized. </td></tr><tr><td colspan="1" rowsp
 an="1" class="confluenceTd"> <tt>urlDecodeHeaders</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> If this option is enabled, then during binding from Netty to Camel <a shape="rect" href="message.html" title="Message">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 <tt>org.apache.camel.component.netty.http.NettyHttpBinding</tt> and therefore if you implement a custom <tt>org.apache.camel.component.netty.http.NettyHttpBinding</tt> then you would need to decode the headers accordingly to this option. </td></tr></tbody></table>
@@ -129,7 +129,35 @@ Notice that some options from <a shape="
 </div>
 </div>
 
+<h3><a shape="rect" name="NettyHTTP-AccesstoNettytypes"></a>Access to Netty types</h3>
 
+<p>This component uses the <tt>org.apache.camel.component.netty.http.NettyHttpMessage</tt> as the message implementation on the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>. This allows end users to get access to the original Netty request/response instances if needed, as shown below:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+org.jboss.netty.handler.codec.http.HttpRequest request = exchange.getIn(NettyHttpMessage.class).getHttpRequest();
+</pre>
+</div></div>
+
+<h3><a shape="rect" name="NettyHTTP-Examples"></a>Examples</h3>
+
+<p>In the route below we use <a shape="rect" href="netty-http.html" title="Netty HTTP">Netty HTTP</a> as a HTTP server, which returns back a hardcoded "Bye World" message. </p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+    from(<span class="code-quote">"netty-http:http:<span class="code-comment">//0.0.0.0:8080/foo"</span>)
+</span>      .transform().constant(<span class="code-quote">"Bye World"</span>);
+</pre>
+</div></div>
+
+<p>And we can call this HTTP server using Camel also, with the <a shape="rect" href="producertemplate.html" title="ProducerTemplate">ProducerTemplate</a> as shown below:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+    <span class="code-object">String</span> out = template.requestBody(<span class="code-quote">"netty-http:http:<span class="code-comment">//localhost:8080/foo"</span>, <span class="code-quote">"Hello World"</span>, <span class="code-object">String</span>.class);
+</span>    <span class="code-object">System</span>.out.println(out);
+</pre>
+</div></div>
+
+<p>And we get back "Bye World" as the output.</p>
 
 
 <h3><a shape="rect" name="NettyHTTP-SeeAlso"></a>See Also</h3>