camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r901519 [4/4] - in /websites/production/camel/content: book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache crypto.html jetty.html
Date Fri, 14 Mar 2014 06:21:59 GMT
Modified: websites/production/camel/content/jetty.html
==============================================================================
--- websites/production/camel/content/jetty.html (original)
+++ websites/production/camel/content/jetty.html Fri Mar 14 06:21:58 2014
@@ -0,0 +1,481 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+    <link href="//camel.apache.org/styles/site.css" rel="stylesheet" type="text/css">
+    <link href="//camel.apache.org/styles/type-settings.css" rel="stylesheet" type="text/css">
+    <script src="//camel.apache.org/styles/prototype.js" type="text/javascript"></script>
+    <script src="//camel.apache.org/styles/rico.js" type="text/javascript"></script>    
+    <script src="//camel.apache.org/styles/site.js" type="text/javascript"></script>
+
+    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
+
+    <style type="text/css">
+      .maincontent { overflow:hidden; }
+    </style>
+    <!--[if IE]>
+    <style type="text/css">
+      .maincontent { width:100%; }
+    </style>
+    <![endif]-->
+
+
+  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
+  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
+  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
+  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
+  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
+  
+  <script type="text/javascript">
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all();
+  </script>
+
+    <title>
+    Apache Camel: Jetty
+    </title>
+</head>
+<body>
+<div class="white_box">
+<div class="header">
+  <div class="header_l">
+    <div class="header_r">
+    </div>
+  </div>
+</div>
+<div class="content">
+  <div class="content_l">
+    <div class="content_r">
+      <div>
+          <!-- Banner -->
+<div id="banner-content"><div id="asf_logo">
+	<div id="activemq_logo" style="height:108px; background:transparent url(banner.data/apache-camel-7.png) no-repeat scroll left top;">
+            <a shape="rect" style="float:left; width:310px;display:block;text-indent:-5000px;text-decoration:none;line-height:140px; margin-top:20px; margin-left:18px;" href="http://camel.apache.org/">Camel</a>
+            <a shape="rect" style="float:right; width:180px;display:block;text-indent:-5000px;text-decoration:none;line-height:80px; margin-top:45px; margin-right:10px;" href="http://www.apache.org">Apache</a>
+	</div>
+</div></div>
+          <!-- Banner -->
+        <div class="top_red_bar">
+          <div id="site-breadcrumbs">
+                <!-- Breadcrumbs -->
+<a href="index.html">Apache Camel</a>&nbsp;&gt;&nbsp;<a href="documentation.html">Documentation</a>&nbsp;&gt;&nbsp;<a href="components.html">Components</a>&nbsp;&gt;&nbsp;<a href="jetty.html">Jetty</a>
+          </div>
+          <!-- Quicklinks -->
+<div id="site-quicklinks"><p><a shape="rect" href="download.html">Download</a> | <a shape="rect" href="javadoc.html">JavaDoc</a> | <a shape="rect" href="source.html">Source</a> | <a shape="rect" href="discussion-forums.html">Forums</a> | <a shape="rect" href="support.html">Support</a></p></div>
+          <!-- Quicklinks -->
+        </div>
+
+	<table border="0">
+	<tbody>
+        <tr>
+        <td valign="top" width="100%">
+<div class="wiki-content maincontent"><h2 id="Jetty-JettyComponent">Jetty Component</h2><p>The <strong>jetty</strong> component provides HTTP-based <a shape="rect" href="endpoint.html">endpoints</a> for consuming and producing HTTP requests. That is, the Jetty component behaves as a simple Web server.<br clear="none"> Jetty can also be used as a http client which mean you can also use it with Camel as a producer.</p>    <div class="aui-message hint shadowed information-macro">
+                    <p class="title">Stream</p>
+                            <span class="aui-icon icon-hint">Icon</span>
+                <div class="message-content">
+                            <p>Jetty 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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
+    &lt;artifactId&gt;camel-jetty&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;
+]]></script>
+</div></div><h3 id="Jetty-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[jetty:http://hostname[:port][/resourceUri][?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><h3 id="Jetty-Options">Options</h3><div class="confluenceTableSmall">
+<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>sessionSupport</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 the session manager on the server side of Jetty. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClient.XXX</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Configuration of Jetty's <a shape="rect" class="external-link" href="http://wiki.eclipse.org/Jetty/Tutorial/HttpClient" rel="nofollow">HttpClient</a>. For example, setting <code>httpClien
 t.idleTimeout=30000</code> sets the idle timeout to 30 seconds. And <code>httpClient.timeout=30000</code> sets the request timeout to 30 seconds, in case you want to timeout sooner if you have long running request/response calls. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClient</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 <code>org.eclipse.jetty.client.HttpClient</code> for all producers created by this endpoint. This option should only be used in special circumstances. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClientMinThreads</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong> <strong>Producer only</strong>: To set a value for minimum number of threads in <code>H
 ttpClient</code> thread pool. This setting override any setting configured on component level. Notice that both a min and max size must be configured. If not set it default to min 8 threads used in Jettys thread pool. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClientMaxThreads</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong> <strong>Producer only</strong>: To set a value for maximum number of threads in <code>HttpClient</code> thread pool. This setting override any setting configured on component level. Notice that both a min and max size must be configured. If not set it default to max 254 threads used in Jettys thread pool. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpBindingRef</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> Reference to an <code>org.apache.camel.component.http.HttpBinding</code> in the <a shape="rect" href="registry.html" title="Registry">Registry</a>. <code>HttpBinding</code> can be used to customize how a response should be written for the consumer. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>jettyHttpBindingRef</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.6.0+:</strong> Reference to an <code>org.apache.camel.component.jetty.JettyHttpBinding</code> in the <a shape="rect" href="registry.html" title="Registry">Registry</a>. <code>JettyHttpBinding</code> can be used to customize how a response should be written for the producer. </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> <co
 de>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Whether or not the <code>CamelServlet</code> should try to find a target consumer by matching the URI prefix if no exact match is found. See here <a shape="rect" href="how-do-i-let-jetty-match-wildcards.html" title="How do I let Jetty match wildcards">How do I let Jetty match wildcards</a>. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>handlers</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Specifies a comma-delimited set of <code>org.mortbay.jetty.Handler</code> instances in your <a shape="rect" href="registry.html" title="Registry">Registry</a> (such as your Spring <code>ApplicationContext</code>). These handlers are added to the Jetty servlet context (for example, to add security). <strong>Important:</strong> You can not use different handlers with different Jetty endpoint
 s using the same port number. The handlers is associated to the port number. If you need different handlers, then use different port numbers. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>chunked</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>Camel 2.2:</strong> If this option is false Jetty servlet will disable the HTTP streaming and set the content-length header on the response </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>enableJmx</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.3:</strong> If this option is true, Jetty JMX support will be enabled for this endpoint. See <a shape="rect" href="#Jetty-JettyJMXsupport">Jetty JMX support</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> <strong>Camel 2.3:</strong> Determines whether or not the raw input stream from Jetty is cached or not (Camel will read the stream into a in memory/overflow to file, <a shape="rect" href="stream-caching.html" title="Stream caching">Stream caching</a>) cache. By default Camel will cache the Jetty 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. DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is <code>false</code> to support reading the stream multiple times. If you use <a shape="rect" hr
 ef="jetty.html" title="Jetty">Jetty</a> to bridge/proxy an endpoint then consider enabling this option to improve performance, in case you do not need to read the message payload multiple times. </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>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> <strong>Camel 2.6:</strong>  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 <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>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> <strong>Camel 2.1:</strong> If the option is true , HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the <strong>throwExceptionOnFailure</strong> to be false to let the HttpProducer send all the fault response back. <br clear="none" class="atl-forced-newline">
+<strong>Camel 2.3:</strong> If the option is true, HttpProducer and CamelServlet will skip the gzip processing if the content-encoding is "gzip". Also consider setting <strong>disableStreamCache</strong> to true to optimize when bridging. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>enableMultipartFilter</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>Camel 2.5:</strong> Whether Jetty <code>org.eclipse.jetty.servlets.MultiPartFilter</code> is enabled or not. You should set this value to <code>false</code> when bridging endpoints, to ensure multipart requests is proxied/bridged as well. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>multipartFilterRef</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.6:
 </strong> Allows using a custom multipart filter. Note: setting <code>multipartFilterRef</code> forces the value of <code>enableMultipartFilter</code> to <code>true</code>. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>filtersRef</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.9:</strong> Allows using a custom filters which is putted into a list and can be find in the <a shape="rect" href="registry.html" title="Registry">Registry</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>continuationTimeout</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.6:</strong> Allows to set a timeout in millis when using <a shape="rect" href="jetty.html" title="Jetty">Jetty</a> as consumer (server). By default Je
 tty uses 30000. You can use a value of <code>&lt;= 0</code> to never expire. If a timeout occurs then the request will be expired and Jetty will return back a http error 503 to the client. This option is only in use when using <a shape="rect" href="jetty.html" title="Jetty">Jetty</a> with the <a shape="rect" href="asynchronous-routing-engine.html" title="Asynchronous Routing Engine">Asynchronous Routing Engine</a>. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>useContinuation</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>Camel 2.6:</strong> Whether or not to use <a shape="rect" class="external-link" href="http://wiki.eclipse.org/Jetty/Feature/Continuations" rel="nofollow">Jetty continuations</a> for the Jetty Server. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslContextParametersRef</code><br clear="none" clas
 s="atl-forced-newline"> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code><br clear="none" class="atl-forced-newline"> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8:</strong> Reference to a <code>org.apache.camel.util.jsse.SSLContextParameters</code> in the <a shape="rect" href="registry.html" title="Registry">Registry</a>.&#160; This reference overrides any configured SSLContextParameters at the component level.&#160; See <a shape="rect" href="#Jetty-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</a>. </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 Jetty consumer. By default TRACE is turned off. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"
 ><p> <code>headerFilterStrategy</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong> Reference to a instance of <code>org.apache.camel.spi.HeaderFilterStrategy</code> in the <a shape="rect" href="registry.html" title="Registry">Registry</a>. It will be used to apply the custom headerFilterStrategy on the new create HttpJettyEndpoint. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>urlRewrite</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong> <strong>Producer only</strong> Refers to a custom <code>org.apache.camel.component.http.UrlRewrite</code> which allows you to rewrite urls when you bridge/proxy endpoints. See more details at <a shape="rect" href="urlrewrite.html" title="UrlRewrite">UrlRewrite</a> and <
 a shape="rect" href="how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html" title="How to use Camel as a HTTP proxy between a client and server">How to use Camel as a HTTP proxy between a client and server</a>. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>responseBufferSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.12:</strong> To use a custom buffer size on the <code>javax.servlet.ServletResponse</code>. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>proxyHost</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong> <strong>Producer only</strong> The http proxy Host url which will be used by Jetty client. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd
 "><p> <code>proxyPort</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong> <strong>Producer only</strong> The http proxy port which will be used by Jetty client. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> {{sendServerVersion</p></td><th colspan="1" rowspan="1" class="confluenceTh"><p>&#160;</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>true</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.13:</strong> if the option is true, jetty will send the server header with the jetty version information to the client which sends the request. </p></td></tr></tbody></table>
+</div><h3 id="Jetty-MessageHeaders">Message Headers</h3><p>Camel uses the same message headers as the <a shape="rect" href="http.html">HTTP</a> component.<br clear="none"> From Camel 2.2, it also uses (Exchange.HTTP_CHUNKED,CamelHttpChunked) header to turn on or turn off the chuched encoding on the camel-jetty consumer.</p><p>Camel also populates <strong>all</strong> request.parameter and request.headers. For example, given a client request with the URL, <code><a shape="rect" class="external-link" href="http://myserver/myserver?orderid=123" rel="nofollow">http://myserver/myserver?orderid=123</a></code>, the exchange will contain a header named <code>orderid</code> with the value 123.</p><p>Starting with Camel 2.2.0, you can get the request.parameter from the message header not only from Get Method, but also other HTTP method.</p><h3 id="Jetty-Usage">Usage</h3><p>The Jetty component supports both consumer and producer endpoints. Another option for producing to other HTTP endpoints, i
 s to use the <a shape="rect" href="http.html">HTTP Component</a></p><h3 id="Jetty-ComponentOptions">Component Options</h3><p>The <code>JettyHttpComponent</code> provides the following options:</p><div class="confluenceTableSmall">
+<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>enableJmx</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.3:</strong> If this option is true, Jetty JMX support will be enabled for this endpoint. See <a shape="rect" href="#Jetty-JettyJMXsupport">Jetty JMX support</a> for more details. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslKeyPassword</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>: The password for the keystore when using S
 SL. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslPassword</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>: The password when using SSL. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslKeystore</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>: The path to the keystore. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>minThreads</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5</strong> <strong>Consumer only</strong>: To set a value for minimum number of threads in server thread pool. Notice that both a min and max siz
 e must be configured. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>maxThreads</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5</strong> <strong>Consumer only</strong>: To set a value for maximum number of threads in server thread pool. Notice that both a min and max size must be configured. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>threadPool</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5</strong> <strong>Consumer only</strong>: To use a custom thread pool for the server. This option should only be used in special circumstances. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslSocketConnectors</code> </p></td><td colspan="1" rowspan="1" class="confluenc
 eTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.3</strong> <strong>Consumer only:</strong> A map which contains per port number specific SSL connectors. See section <em>SSL support</em> for more details. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>socketConnectors</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5</strong> <strong>Consumer only:</strong> A map which contains per port number specific HTTP connectors. Uses the same principle as <code>sslSocketConnectors</code> and therefore see section <em>SSL support</em> for more details. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslSocketConnectorProperties</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenc
 eTd"><p> <strong>Camel 2.5</strong> <strong>Consumer only</strong>. A map which contains general SSL connector properties. See section <em>SSL support</em> for more details. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>socketConnectorProperties</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5</strong> <strong>Consumer only</strong>. A map which contains general HTTP connector properties. Uses the same principle as <code>sslSocketConnectorProperties</code> and therefore see section <em>SSL support</em> for more details. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClient</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>Deprecated:</strong> <strong>Producer only</strong>: To use a custom <code>Ht
 tpClient</code> with the jetty producer. This option is removed from Camel 2.11 onwards, instead you can set the option on the endpoint instead. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClientMinThreads</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>Producer only</strong>: To set a value for minimum number of threads in <code>HttpClient</code> thread pool. Notice that both a min and max size must be configured. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClientMaxThreads</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>Producer only</strong>: To set a value for maximum number of threads in <code>HttpClient</code> thread pool. Notice that both a min and max size must be configured. </p></td></t
 r><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>httpClientThreadPool</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>Deprecated:</strong> <strong>Producer only</strong>: To use a custom thread pool for the client. This option is removed from Camel 2.11 onwards. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>sslContextParameters</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8:</strong> To configure a custom SSL/TLS configuration options at the component level.&#160; See&#160; <a shape="rect" href="#Jetty-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</a> for more details. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>requestBufferSize</code> </p></td><td colsp
 an="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11.2:</strong> Allows to configure a custom value of the request buffer size on the Jetty connectors. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>requestHeaderSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11.2:</strong> Allows to configure a custom value of the request header size on the Jetty connectors. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>responseBufferSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11.2:</strong> Allows to configure a custom value of the response buffer size on the Jetty connectors. </p></td></tr><tr><td colspan
 ="1" rowspan="1" class="confluenceTd"><p> <code>responseHeaderSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11.2:</strong> Allows to configure a custom value of the response header size on the Jetty connectors. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>proxyHost</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.12.2/2.11.3</strong> To use a http proxy. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>proxyPort</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.12.2/2.11.3:</strong> To use a http proxy. </p></td></tr></tbody></table>
+</div><h3 id="Jetty-ProducerExample">Producer Example</h3><p>The following is a basic example of how to send an HTTP request to an existing HTTP endpoint.</p><p>in Java DSL</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from(&quot;direct:start&quot;).to(&quot;jetty://http://www.google.com&quot;);
+]]></script>
+</div></div><p>or in Spring XML</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+    &lt;from uri=&quot;direct:start&quot;/&gt;
+    &lt;to uri=&quot;jetty://http://www.google.com&quot;/&gt;
+&lt;route&gt;
+]]></script>
+</div></div><h3 id="Jetty-ConsumerExample">Consumer Example</h3><p>In this sample we define a route that exposes a HTTP service at <code><a shape="rect" class="external-link" href="http://localhost:8080/myapp/myservice" rel="nofollow">http://localhost:8080/myapp/myservice</a></code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+from(&quot;jetty:http://localhost:{{port}}/myapp/myservice&quot;).process(new MyBookService());
+]]></script>
+</div></div>    <div class="aui-message warning shadowed information-macro">
+                    <p class="title">Usage of localhost</p>
+                            <span class="aui-icon icon-warning">Icon</span>
+                <div class="message-content">
+                            <p>When you specify <code>localhost</code> in a URL, Camel exposes the endpoint only on the local TCP/IP network interface, so it cannot be accessed from outside the machine it operates on.</p><p>If you need to expose a Jetty endpoint on a specific network interface, the numerical IP address of this interface should be used as the host. If you need to expose a Jetty endpoint on all network interfaces, the <code>0.0.0.0</code> address should be used.</p>
+                    </div>
+    </div>
+<p>Our business logic is implemented in the <code>MyBookService</code> class, which accesses the HTTP request contents and then returns a response.<br clear="none"> <strong>Note:</strong> The <code>assert</code> call appears in this example, because the code is part of an unit test.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public class MyBookService implements Processor {
+    public void process(Exchange exchange) throws Exception {
+        // just get the body as a string
+        String body = exchange.getIn().getBody(String.class);
+
+        // we have access to the HttpServletRequest here and we can grab it if we need it
+        HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
+        assertNotNull(req);
+
+        // for unit testing
+        assertEquals(&quot;bookid=123&quot;, body);
+
+        // send a html response
+        exchange.getOut().setBody(&quot;&lt;html&gt;&lt;body&gt;Book 123 is Camel in Action&lt;/body&gt;&lt;/html&gt;&quot;);
+    }
+}
+]]></script>
+</div></div><p>The following sample shows a content-based route that routes all requests containing the URI parameter, <code>one</code>, to the endpoint, <code>mock:one</code>, and all others to <code>mock:other</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+from(&quot;jetty:&quot; + serverUri)
+    .choice()
+    .when().simple(&quot;${header.one}&quot;).to(&quot;mock:one&quot;)
+    .otherwise()
+    .to(&quot;mock:other&quot;);
+]]></script>
+</div></div><p>So if a client sends the HTTP request, <code><a shape="rect" class="external-link" href="http://serverUri?one=hello" rel="nofollow">http://serverUri?one=hello</a></code>, the Jetty component will copy the HTTP request parameter, <code>one</code> to the exchange's <code>in.header</code>. We can then use the <code>simple</code> language to route exchanges that contain this header to a specific endpoint and all others to another. If we used a language more powerful than <a shape="rect" href="simple.html">Simple</a>--<span style="text-decoration: line-through;">such as</span> <span style="text-decoration: line-through;"><a shape="rect" href="el.html">EL</a></span> <span style="text-decoration: line-through;">or</span> <span style="text-decoration: line-through;"><a shape="rect" href="ognl.html">OGNL</a></span>--we could also test for the parameter value and do routing based on the header value as well.</p><h3 id="Jetty-SessionSupport">Session Support</h3><p>The session su
 pport option, <code>sessionSupport</code>, can be used to enable a <code>HttpSession</code> object and access the session object while processing the exchange. For example, the following route enables sessions:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+    &lt;from uri=&quot;jetty:http://0.0.0.0/myapp/myservice/?sessionSupport=true&quot;/&gt;
+    &lt;processRef ref=&quot;myCode&quot;/&gt;
+&lt;route&gt;
+]]></script>
+</div></div><p>The <code>myCode</code> <a shape="rect" href="processor.html">Processor</a> can be instantiated by a Spring <code>bean</code> element:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;myCode&quot;class=&quot;com.mycompany.MyCodeProcessor&quot;/&gt;
+]]></script>
+</div></div><p>Where the processor implementation can access the <code>HttpSession</code> as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public void process(Exchange exchange) throws Exception {
+    HttpSession session = exchange.getIn(HttpMessage.class).getRequest().getSession();
+    ...
+}
+]]></script>
+</div></div><h3 id="Jetty-SSLSupport(HTTPS)">SSL Support (HTTPS)</h3><h5 id="Jetty-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</h5><p>As of Camel 2.8, the Jetty component supports SSL/TLS configuration through the <a shape="rect" href="camel-configuration-utilities.html">Camel JSSE Configuration Utility</a>.&#160; This utility greatly decreases the amount of component specific code you need to write and is configurable at the endpoint and component levels.&#160; The following examples demonstrate how to use the utility with the Jetty component.</p><h6 id="Jetty-Programmaticconfigurationofthecomponent">Programmatic configuration of the component</h6><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[KeyStoreParameters ksp = new KeyStoreParameters();
+ksp.setResource(&quot;/users/home/server/keystore.jks&quot;);
+ksp.setPassword(&quot;keystorePassword&quot;);
+
+KeyManagersParameters kmp = new KeyManagersParameters();
+kmp.setKeyStore(ksp);
+kmp.setKeyPassword(&quot;keyPassword&quot;);
+
+SSLContextParameters scp = new SSLContextParameters();
+scp.setKeyManagers(kmp);
+
+JettyComponent jettyComponent = getContext().getComponent(&quot;jetty&quot;, JettyComponent.class);
+jettyComponent.setSslContextParameters(scp);
+]]></script>
+</div></div><h6 id="Jetty-SpringDSLbasedconfigurationofendpoint">Spring DSL based configuration of endpoint</h6><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[...
+  &lt;camel:sslContextParameters
+      id=&quot;sslContextParameters&quot;&gt;
+    &lt;camel:keyManagers
+        keyPassword=&quot;keyPassword&quot;&gt;
+      &lt;camel:keyStore
+          resource=&quot;/users/home/server/keystore.jks&quot;
+          password=&quot;keystorePassword&quot;/&gt;
+    &lt;/camel:keyManagers&gt;
+  &lt;/camel:sslContextParameters&gt;...
+...
+  &lt;to uri=&quot;jetty:https://127.0.0.1/mail/?sslContextParametersRef=sslContextParameters&quot;/&gt;
+...
+]]></script>
+</div></div><h5 id="Jetty-ConfiguringJettyDirectly">Configuring Jetty Directly</h5><p>Jetty provides SSL support out of the box. To enable Jetty to run in SSL mode, simply format the URI with the <code>https://</code> prefix---for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;from uri=&quot;jetty:https://0.0.0.0/myapp/myservice/&quot;/&gt;
+]]></script>
+</div></div><p>Jetty also needs to know where to load your keystore from and what passwords to use in order to load the correct SSL certificate. Set the following JVM System Properties:</p><p><strong>until Camel 2.2</strong></p><ul><li><code>jetty.ssl.keystore</code> specifies the location of the Java keystore file, which contains the Jetty server's own X.509 certificate in a <em>key entry</em>. A key entry stores the X.509 certificate (effectively, the <em>public key</em>) and also its associated private key.</li><li><code>jetty.ssl.password</code> the store password, which is required to access the keystore file (this is the same password that is supplied to the <code>keystore</code> command's <code>-storepass</code> option).</li><li><code>jetty.ssl.keypassword</code> the key password, which is used to access the certificate's key entry in the keystore (this is the same password that is supplied to the <code>keystore</code> command's <code>-keypass</code> option).</li></ul><p><str
 ong>from Camel 2.3 onwards</strong></p><ul><li><code>org.eclipse.jetty.ssl.keystore</code> specifies the location of the Java keystore file, which contains the Jetty server's own X.509 certificate in a <em>key entry</em>. A key entry stores the X.509 certificate (effectively, the <em>public key</em>) and also its associated private key.</li><li><code>org.eclipse.jetty.ssl.password</code> the store password, which is required to access the keystore file (this is the same password that is supplied to the <code>keystore</code> command's <code>-storepass</code> option).</li><li><code>org.eclipse.jetty.ssl.keypassword</code> the key password, which is used to access the certificate's key entry in the keystore (this is the same password that is supplied to the <code>keystore</code> command's <code>-keypass</code> option).</li></ul><p>For details of how to configure SSL on a Jetty endpoint, read the following documentation at the Jetty Site: <a shape="rect" class="external-link" href="http
 ://docs.codehaus.org/display/JETTY/How+to+configure+SSL" rel="nofollow">http://docs.codehaus.org/display/JETTY/How+to+configure+SSL</a></p><p>Some SSL properties aren't exposed directly by Camel, however Camel does expose the underlying SslSocketConnector, which will allow you to set properties like needClientAuth for mutual authentication requiring a client certificate or wantClientAuth for mutual authentication where a client doesn't need a certificate but can have one. There's a slight difference between the various Camel versions:</p><p><strong>Up to Camel 2.2</strong></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jetty&quot; class=&quot;org.apache.camel.component.jetty.JettyHttpComponent&quot;&gt;
+    &lt;property name=&quot;sslSocketConnectors&quot;&gt;
+        &lt;map&gt;
+            &lt;entry key=&quot;8043&quot;&gt;
+                &lt;bean class=&quot;org.mortbay.jetty.security.SslSocketConnector&quot;&gt;
+                    &lt;property name=&quot;password&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;keyPassword&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;keystore&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;needClientAuth&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;truststore&quot;value=&quot;...&quot;/&gt;
+                &lt;/bean&gt;
+            &lt;/entry&gt;
+        &lt;/map&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><p><strong>Camel 2.3, 2.4</strong></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jetty&quot; class=&quot;org.apache.camel.component.jetty.JettyHttpComponent&quot;&gt;
+    &lt;property name=&quot;sslSocketConnectors&quot;&gt;
+        &lt;map&gt;
+            &lt;entry key=&quot;8043&quot;&gt;
+                &lt;bean class=&quot;org.eclipse.jetty.server.ssl.SslSocketConnector&quot;&gt;
+                    &lt;property name=&quot;password&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;keyPassword&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;keystore&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;needClientAuth&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;truststore&quot;value=&quot;...&quot;/&gt;
+                &lt;/bean&gt;
+            &lt;/entry&gt;
+        &lt;/map&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><p>*From Camel 2.5 we switch to use SslSelectChannelConnector *</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jetty&quot; class=&quot;org.apache.camel.component.jetty.JettyHttpComponent&quot;&gt;
+    &lt;property name=&quot;sslSocketConnectors&quot;&gt;
+        &lt;map&gt;
+            &lt;entry key=&quot;8043&quot;&gt;
+                &lt;bean class=&quot;org.eclipse.jetty.server.ssl.SslSelectChannelConnector&quot;&gt;
+                    &lt;property name=&quot;password&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;keyPassword&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;keystore&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;needClientAuth&quot;value=&quot;...&quot;/&gt;
+                    &lt;property name=&quot;truststore&quot;value=&quot;...&quot;/&gt;
+                &lt;/bean&gt;
+            &lt;/entry&gt;
+        &lt;/map&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><p>The value you use as keys in the above map is the port you configure Jetty to listen on.</p><h4 id="Jetty-ConfiguringgeneralSSLproperties">Configuring general SSL properties</h4><p><strong>Available as of Camel 2.5</strong></p><p>Instead of a per port number specific SSL socket connector (as shown above) you can now configure general properties which applies for all SSL socket connectors (which is not explicit configured as above with the port number as entry).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jetty&quot; class=&quot;org.apache.camel.component.jetty.JettyHttpComponent&quot;&gt;
+    &lt;property name=&quot;sslSocketConnectorProperties&quot;&gt;
+        &lt;map&gt;
+            &lt;entry key=&quot;password&quot;value=&quot;...&quot;/&gt;
+            &lt;entry key=&quot;keyPassword&quot;value=&quot;...&quot;/&gt;
+            &lt;entry key=&quot;keystore&quot;value=&quot;...&quot;/&gt;
+            &lt;entry key=&quot;needClientAuth&quot;value=&quot;...&quot;/&gt;
+            &lt;entry key=&quot;truststore&quot;value=&quot;...&quot;/&gt;
+        &lt;/map&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><h4 id="Jetty-HowtoobtainreferencetotheX509Certificate">How to obtain reference to the X509Certificate</h4><p>Jetty stores a reference to the certificate in the HttpServletRequest which you can access from code as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
+X509Certificate cert = (X509Certificate) req.getAttribute(&quot;javax.servlet.request.X509Certificate&quot;)
+]]></script>
+</div></div><h4 id="Jetty-ConfiguringgeneralHTTPproperties">Configuring general HTTP properties</h4><p><strong>Available as of Camel 2.5</strong></p><p>Instead of a per port number specific HTTP socket connector (as shown above) you can now configure general properties which applies for all HTTP socket connectors (which is not explicit configured as above with the port number as entry).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jetty&quot; class=&quot;org.apache.camel.component.jetty.JettyHttpComponent&quot;&gt;
+    &lt;property name=&quot;socketConnectorProperties&quot;&gt;
+        &lt;map&gt;
+            &lt;entry key=&quot;acceptors&quot; value=&quot;4&quot;/&gt;
+            &lt;entry key=&quot;maxIdleTime&quot; value=&quot;300000&quot;/&gt;
+        &lt;/map&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><h3 id="Jetty-DefaultbehaviorforreturningHTTPstatuscodes">Default behavior for returning HTTP status codes</h3><p>The default behavior of HTTP status codes is defined by the <code>org.apache.camel.component.http.DefaultHttpBinding</code> class, which handles how a response is written and also sets the HTTP status code.</p><p>If the exchange was processed successfully, the 200 HTTP status code is returned.<br clear="none"> If the exchange failed with an exception, the 500 HTTP status code is returned, and the stacktrace is returned in the body. If you want to specify which HTTP status code to return, set the code in the <code>HttpProducer.HTTP_RESPONSE_CODE</code> header of the OUT message.</p><h3 id="Jetty-CustomizingHttpBinding">Customizing HttpBinding</h3><p>By default, Camel uses the <code>org.apache.camel.component.http.DefaultHttpBinding</code> to handle how a response is written. If you like, you can customize this behavior either by implementing your own <code>Htt
 pBinding</code> class or by extending <code>DefaultHttpBinding</code> and overriding the appropriate methods.</p><p>The following example shows how to customize the <code>DefaultHttpBinding</code> in order to change how exceptions are returned:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public class MyHttpBinding extends DefaultHttpBinding {
+    public MyHttpBinding(HttpEndpoint ep) {
+        super(ep);
+    }
+    @Override
+    public void doWriteExceptionResponse(Throwable exception, HttpServletResponse response) throws IOException {
+        // we override the doWriteExceptionResponse as we only want to alter the binding how exceptions is
+        // written back to the client. 
+
+        // we just return HTTP 200 so the client thinks its okay
+        response.setStatus(200);
+        // and we return this fixed text
+        response.getWriter().write(&quot;Something went wrong but we dont care&quot;);
+    }
+}
+]]></script>
+</div></div><p>We can then create an instance of our binding and register it in the Spring registry as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;mybinding&quot;class=&quot;com.mycompany.MyHttpBinding&quot;/&gt;
+]]></script>
+</div></div><p>And then we can reference this binding when we define the route:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;route&gt;&lt;from uri=&quot;jetty:http://0.0.0.0:8080/myapp/myservice?httpBindingRef=mybinding&quot;/&gt;&lt;to uri=&quot;bean:doSomething&quot;/&gt;&lt;/route&gt;
+]]></script>
+</div></div><h3 id="Jetty-Jettyhandlersandsecurityconfiguration">Jetty handlers and security configuration</h3><p>You can configure a list of Jetty handlers on the endpoint, which can be useful for enabling advanced Jetty security features. These handlers are configured in Spring XML as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;-- Jetty Security handling --&gt;
+&lt;bean id=&quot;userRealm&quot; class=&quot;org.mortbay.jetty.plus.jaas.JAASUserRealm&quot;&gt;
+    &lt;property name=&quot;name&quot; value=&quot;tracker-users&quot;/&gt;
+    &lt;property name=&quot;loginModuleName&quot; value=&quot;ldaploginmodule&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;constraint&quot; class=&quot;org.mortbay.jetty.security.Constraint&quot;&gt;
+    &lt;property name=&quot;name&quot; value=&quot;BASIC&quot;/&gt;
+    &lt;property name=&quot;roles&quot; value=&quot;tracker-users&quot;/&gt;
+    &lt;property name=&quot;authenticate&quot; value=&quot;true&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;constraintMapping&quot; class=&quot;org.mortbay.jetty.security.ConstraintMapping&quot;&gt;
+    &lt;property name=&quot;constraint&quot; ref=&quot;constraint&quot;/&gt;
+    &lt;property name=&quot;pathSpec&quot; value=&quot;/*&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;securityHandler&quot; class=&quot;org.mortbay.jetty.security.SecurityHandler&quot;&gt;
+    &lt;property name=&quot;userRealm&quot; ref=&quot;userRealm&quot;/&gt;
+    &lt;property name=&quot;constraintMappings&quot; ref=&quot;constraintMapping&quot;/&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><p><strong>And from Camel 2.3 onwards</strong> you can configure a list of Jetty handlers as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;-- Jetty Security handling --&gt;
+&lt;bean id=&quot;constraint&quot; class=&quot;org.eclipse.jetty.http.security.Constraint&quot;&gt;
+    &lt;property name=&quot;name&quot; value=&quot;BASIC&quot;/&gt;
+    &lt;property name=&quot;roles&quot; value=&quot;tracker-users&quot;/&gt;
+    &lt;property name=&quot;authenticate&quot; value=&quot;true&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;constraintMapping&quot; class=&quot;org.eclipse.jetty.security.ConstraintMapping&quot;&gt;
+    &lt;property name=&quot;constraint&quot; ref=&quot;constraint&quot;/&gt;
+    &lt;property name=&quot;pathSpec&quot; value=&quot;/*&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;securityHandler&quot; class=&quot;org.eclipse.jetty.security.ConstraintSecurityHandler&quot;&gt;
+    &lt;property name=&quot;authenticator&quot;&gt;
+        &lt;bean class=&quot;org.eclipse.jetty.security.authentication.BasicAuthenticator&quot;/&gt;
+    &lt;/property&gt;
+    &lt;property name=&quot;constraintMappings&quot;&gt;
+        &lt;list&gt;
+            &lt;ref bean=&quot;constraintMapping&quot;/&gt;
+        &lt;/list&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+]]></script>
+</div></div><p>You can then define the endpoint as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from(&quot;jetty:http://0.0.0.0:9080/myservice?handlers=securityHandler&quot;)
+]]></script>
+</div></div><p>If you need more handlers, set the <code>handlers</code> option equal to a comma-separated list of bean IDs.</p><h3 id="Jetty-HowtoreturnacustomHTTP500replymessage">How to return a custom HTTP 500 reply message</h3><p>You may want to return a custom reply message when something goes wrong, instead of the default reply message Camel <a shape="rect" href="jetty.html">Jetty</a> replies with.<br clear="none"> You could use a custom <code>HttpBinding</code> to be in control of the message mapping, but often it may be easier to use Camel's <a shape="rect" href="exception-clause.html">Exception Clause</a> to construct the custom reply message. For example as show here, where we return <code>Dude something went wrong</code> with HTTP error code 500:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+from(&quot;jetty://http://localhost:{{port}}/myserver&quot;)
+    // use onException to catch all exceptions and return a custom reply message
+    .onException(Exception.class)
+        .handled(true)
+        // create a custom failure response
+        .transform(constant(&quot;Dude something went wrong&quot;))
+        // we must remember to set error code 500 as handled(true)
+        // otherwise would let Camel thing its a OK response (200)
+        .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(500))
+    .end()
+    // now just force an exception immediately
+    .throwException(new IllegalArgumentException(&quot;I cannot do this&quot;));
+]]></script>
+</div></div><h3 id="Jetty-Multi-partFormsupport">Multi-part Form support</h3><p>From Camel 2.3.0, camel-jetty support to multipart form post out of box. The submitted form-data are mapped into the message header. Camel-jetty creates an attachment for each uploaded file. The file name is mapped to the name of the attachment. The content type is set as the content type of the attachment file name. You can find the example here.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Note: getName() functions as shown below in versions 2.5 and higher. In earlier versions you receive the temporary file name for the attachment instead</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// Set the jetty temp directory which store the file for multi part form
+// camel-jetty will clean up the file after it handled the request.
+// The option works rightly from Camel 2.4.0
+getContext().getProperties().put(&quot;CamelJettyTempDir&quot;, &quot;target&quot;);
+
+from(&quot;jetty://http://localhost:{{port}}/test&quot;).process(new Processor() {
+
+    public void process(Exchange exchange) throws Exception {
+        Message in = exchange.getIn();
+        assertEquals(&quot;Get a wrong attachement size&quot;, 1, in.getAttachments().size());
+        // The file name is attachment id
+        DataHandler data = in.getAttachment(&quot;NOTICE.txt&quot;);
+
+        assertNotNull(&quot;Should get the DataHandle NOTICE.txt&quot;, data);
+        // This assert is wrong, but the correct content-type (application/octet-stream)
+        // will not be returned until Jetty makes it available - currently the content-type
+        // returned is just the default for FileDataHandler (for the implentation being used)
+        //assertEquals(&quot;Get a wrong content type&quot;, &quot;text/plain&quot;, data.getContentType());
+        assertEquals(&quot;Got the wrong name&quot;, &quot;NOTICE.txt&quot;, data.getName());
+
+        assertTrue(&quot;We should get the data from the DataHandle&quot;, data.getDataSource()
+            .getInputStream().available() &gt; 0);
+
+        // The other form date can be get from the message header
+        exchange.getOut().setBody(in.getHeader(&quot;comment&quot;));
+    }
+
+});
+]]></script>
+</div></div><h3 id="Jetty-JettyJMXsupport">Jetty JMX support</h3><p>From Camel 2.3.0, camel-jetty supports the enabling of Jetty's JMX capabilities at the component and endpoint level with the endpoint configuration taking priority. Note that JMX must be enabled within the Camel context in order to enable JMX support in this component as the component provides Jetty with a reference to the MBeanServer registered with the Camel context. Because the camel-jetty component caches and reuses Jetty resources for a given protocol/host/port pairing, this configuration option will only be evaluated during the creation of the first endpoint to use a protocol/host/port pairing. For example, given two routes created from the following XML fragments, JMX support would remain enabled for all endpoints listening on "https://0.0.0.0".</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;from uri=&quot;jetty:https://0.0.0.0/myapp/myservice1/?enableJmx=true&quot;/&gt;
+]]></script>
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;from uri=&quot;jetty:https://0.0.0.0/myapp/myservice2/?enableJmx=false&quot;/&gt;
+]]></script>
+</div></div><p>The camel-jetty component also provides for direct configuration of the Jetty MBeanContainer. Jetty creates MBean names dynamically. If you are running another instance of Jetty outside of the Camel context and sharing the same MBeanServer between the instances, you can provide both instances with a reference to the same MBeanContainer in order to avoid name collisions when registering Jetty MBeans.</p><p></p><h3 id="Jetty-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="http.html">HTTP</a></li></ul></div>
+        </td>
+        <td valign="top">
+          <div class="navigation">
+            <div class="navigation_top">
+                <!-- NavigationBar -->
+<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">
+    <input type="text" name="q" size="21">
+    <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-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>
+        </td>
+        </tr>
+	</tbody>
+        </table>
+
+
+        <div class="bottom_red_bar"></div>
+      </div>
+    </div>
+  </div>
+</div>
+<div class="black_box">
+<div class="footer">
+  <div class="footer_l">
+    <div class="footer_r">
+      <div>
+        <a href="$base/privacy-policy.html">Privacy Policy</a> -
+        (<a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=64903">edit page</a>)
+   	 (<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=64903&amp;showComments=true&amp;showCommentArea=true#addcomment">add comment</a>)
+      </div>
+    </div>
+  </div>
+</div>
+</div>
+</div>
+<div class="design_attribution">
+&copy; 2004-2011 The Apache Software Foundation.
+<br>          
+Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation.  All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+<br>
+<a href="http://hiramchirino.com">Graphic Design By Hiram</a>
+</div>
+
+<!-- Camel committers that would like access to the Analytics, send a note to private@camel.apache.org -->
+<script type="text/javascript">
+
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-25976253-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>
+
+</body>
+</html>
+
+



Mime
View raw message