Author: buildbot
Date: Fri Aug 25 12:19:46 2017
New Revision: 1017275

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/servletlistener-component.html

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

Modified: websites/production/camel/content/servletlistener-component.html
==============================================================================
--- websites/production/camel/content/servletlistener-component.html (original)
+++ websites/production/camel/content/servletlistener-component.html Fri Aug 25 
12:19:46 2017
@@ -36,17 +36,6 @@
     <![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: ServletListener Component
@@ -86,59 +75,18 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="ServletListenerComponent-ServletListenerComponent">ServletListener 
Component</h2><p><strong>Available as of Camel 2.11</strong></p><p>This 
component is used for bootstrapping Camel applications in web applications. For 
example beforehand people would have to find their own way of bootstrapping 
Camel, or rely on 3rd party frameworks such as Spring to do it.</p><div 
class="confluence-information-macro confluence-information-macro-note"><p 
class="title">Sidebar</p><span class="aui-icon aui-icon-small 
aui-iconfont-warning confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>This component supports Servlet 
2.x onwards, which mean it works also in older web containers; which is the 
goal of this component.<br clear="none"> Though Servlet 2.x requires to use a 
web.xml file as configuration.</p><p>For Servlet 3.x containers you can use 
annotation driven configuration to boostrap Camel using the @WebListener,
  and implement your own class, where you boostrap Camel. Doing this still puts 
the challenge how to let end users easily configure Camel, which you get for 
free with the old school web.xml file.</p></div></div><p>Maven users will need 
to add the following dependency to their <code>pom.xml</code> for this 
component:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+<div class="wiki-content maincontent"><h2 
id="ServletListenerComponent-ServletListenerComponent">ServletListener 
Component</h2><p><strong>Available as of Camel 2.11</strong></p><p>This 
component is used for bootstrapping Camel applications in web applications. For 
example beforehand people would have to find their own way of bootstrapping 
Camel, or rely on 3rd party frameworks such as Spring to do it.</p><parameter 
ac:name="title">Sidebar</parameter><rich-text-body><p>This component supports 
Servlet 2.x onwards, which mean it works also in older web containers; which is 
the goal of this component.<br clear="none"> Though Servlet 2.x requires to use 
a web.xml file as configuration.</p><p>For Servlet 3.x containers you can use 
annotation driven configuration to boostrap Camel using the @WebListener, and 
implement your own class, where you boostrap Camel. Doing this still puts the 
challenge how to let end users easily configure Camel, which you get for free 
with the old school web.xml 
 file.</p></rich-text-body><p>Maven users will need to add the following 
dependency to their <code>pom.xml</code> for this component:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-servletlistener&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="ServletListenerComponent-Using">Using</h3><p>You would 
need to chose one of the following implementations of the abstract class 
<code>org.apache.camel.component.servletlistener.CamelServletContextListener</code>.</p><ul
 class="alternate"><li><code>JndiCamelServletContextListener</code> which uses 
the <code>JndiRegistry</code> to leverage JNDI for its 
registry.</li><li><code>SimpleCamelServletContextListener</code> which uses the 
<code>SimpleRegistry</code> to leverage a <code>java.util.Map</code> as its 
registry.</li></ul><p>To use this you need to configure the 
<code>org.apache.camel.component.servletlistener.CamelServletContextListener</code>
 in the <code>WEB-INF/web.xml</code> file as shown below:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;web-app&gt;
-
-  &lt;!-- the test parameter is only to be used for unit testing --&gt;
-  &lt;!-- you should not use this option for production usage --&gt;
-  &lt;context-param&gt;
-    &lt;param-name&gt;test&lt;/param-name&gt;
-    &lt;param-value&gt;true&lt;/param-value&gt;
-  &lt;/context-param&gt;
-
-  &lt;!-- you can configure any of the properties on CamelContext, eg setName 
will be configured as below --&gt;
-  &lt;context-param&gt;
-    &lt;param-name&gt;name&lt;/param-name&gt;
-    &lt;param-value&gt;MyCamel&lt;/param-value&gt;
-  &lt;/context-param&gt;
-
-  &lt;!-- configure a route builder to use --&gt;
-  &lt;!-- Camel will pickup any parameter names that start with routeBuilder 
(case ignored) --&gt;
-  &lt;context-param&gt;
+</plain-text-body><h3 id="ServletListenerComponent-Using">Using</h3><p>You 
would need to chose one of the following implementations of the abstract class 
<code>org.apache.camel.component.servletlistener.CamelServletContextListener</code>.</p><ul
 class="alternate"><li><code>JndiCamelServletContextListener</code> which uses 
the <code>JndiRegistry</code> to leverage JNDI for its 
registry.</li><li><code>SimpleCamelServletContextListener</code> which uses the 
<code>SimpleRegistry</code> to leverage a <code>java.util.Map</code> as its 
registry.</li></ul><p>To use this you need to configure the 
<code>org.apache.camel.component.servletlistener.CamelServletContextListener</code>
 in the <code>WEB-INF/web.xml</code> file as shown 
below:</p><plain-text-body>{snippet:id=web|lang=xml|url=camel/trunk/components/camel-servletlistener/src/test/resources/myweb.xml}</plain-text-body><h3
 id="ServletListenerComponent-Options">Options</h3><p>The 
<code>org.apache.camel.component.servletlistener.CamelServl
 etContextListener</code> supports the following options which can be 
configured as context-param in the web.xml file.</p><parameter 
ac:name="class">confluenceTableSmall</parameter><rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Option</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>propertyPlaceholder.XXX</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>To configure <a shape="rect" 
href="using-propertyplaceholder.html">property placeholders</a> in Camel. You 
should prefix the option with "propertyPlaceholder.", for example to configure 
the location, use propertyPlaceholder.location as name. You can configure all 
the options from the <a shape="rect" href="properties.h
 tml">Properties</a> component.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>jmx.XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To configure <a shape="rect" 
href="camel-jmx.html">JMX</a>. You should prefix the option with "jmx.", for 
example to disable JMX, use jmx.disabled as name. You can configure all the 
options from <code>org.apache.camel.spi.ManagementAgent</code>. As well the 
options mentioned on the <a shape="rect" href="camel-jmx.html">JMX</a> 
page.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>name</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To configure the name of the <a shape="rect" 
href="camelcontext.html">CamelContext</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>messageHistory</p></td><td colspan="1" 
rowspan="1" class
 ="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.12.2:</strong> Whether to enable or 
disable <a shape="rect" href="message-history.html">Message History</a> 
(enabled by default).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>streamCache</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to enable <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>trace</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to enable <a shape="rect" 
href="tracer.html">Tracer</a>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>delayer</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Long</code></p></td><td 
 colspan="1" rowspan="1" class="confluenceTd"><p>To set a delay value for <a 
shape="rect" href="delay-interceptor.html">Delay 
Interceptor</a>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>handleFault</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to enable handle 
fault.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>errorHandlerRef</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Refers to a context scoped <a shape="rect" 
href="error-handler.html">Error Handler</a> to be used.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>autoStartup</p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to start all routes when starting 
Camel.</p></t
 d></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>useMDCLogging</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to use <a shape="rect" 
href="mdc-logging.html">MDC logging</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>useBreadcrumb</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether to use <a shape="rect" 
href="mdc-logging.html">breadcrumb</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>managementNamePattern</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 a custom naming pattern 
for JMX MBeans.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>threadNamePattern</p></td><td colspan="1" rowspan="1" 
class="conf
 luenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To set a custom naming pattern for 
threads.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties.XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To set custom properties on 
<code>CamelContext.getProperties</code>. This is seldom in 
use.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>routebuilder.XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To configure routes to be used. See below for more 
details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>CamelContextLifecycle</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Refers to a FQN classname of an implementation of 
<code>org.apache
 .camel.component.servletlistener.CamelContextLifecycle</code>. Which allows to 
execute custom code before and after <a shape="rect" 
href="camelcontext.html">CamelContext</a> has been started or stopped. See 
below for further details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To set any option on <a shape="rect" 
href="camelcontext.html">CamelContext</a>.</p></td></tr></tbody></table></div></rich-text-body><h3
 id="ServletListenerComponent-Examples">Examples</h3><p>See <a shape="rect" 
href="servlet-tomcat-no-spring-example.html">Servlet Tomcat No Spring 
Example</a>.</p><h3 
id="ServletListenerComponent-AccessingthecreatedCamelContext">Accessing the 
created CamelContext</h3><p><strong>Available as of Camel 
2.14/2.13.3/2.12.5</strong></p><p>The created&#160;<code>CamelContext</code> is 
stored on the&#160;<code>ServletContext</code> a
 s an attribute with the key "CamelContext". You can get hold of the 
CamelContext if you can get hold of the&#160;<code>ServletContext</code> as 
shown below:</p><plain-text-body>ServletContext sc = ...
+CamelContext camel = (CamelContext) 
sc.getAttribute("CamelContext");</plain-text-body><p>&#160;</p><h3 
id="ServletListenerComponent-Configuringroutes">Configuring routes</h3><p>You 
need to configure which routes to use in the web.xml file. You can do this in a 
number of ways, though all the parameters must be prefixed with 
"routeBuilder".</p><h4 
id="ServletListenerComponent-UsingaRouteBuilderclass">Using a RouteBuilder 
class</h4><p>By default Camel will assume the param-value is a FQN classname 
for a Camel <a shape="rect" href="routebuilder.html">RouteBuilder</a> class, as 
shown below:</p><parameter ac:name="language">xml</parameter><plain-text-body>  
&lt;context-param&gt;
     &lt;param-name&gt;routeBuilder-MyRoute&lt;/param-name&gt;
     
&lt;param-value&gt;org.apache.camel.component.servletlistener.MyRoute&lt;/param-value&gt;
   &lt;/context-param&gt;
-
-  &lt;!-- register Camel as a listener so we can bootstrap Camel when the web 
application starts --&gt;
-  &lt;listener&gt;
-    
&lt;listener-class&gt;org.apache.camel.component.servletlistener.SimpleCamelServletContextListener&lt;/listener-class&gt;
-  &lt;/listener&gt;
-
-&lt;/web-app&gt;
-]]></script>
-</div></div><h3 id="ServletListenerComponent-Options">Options</h3><p>The 
<code>org.apache.camel.component.servletlistener.CamelServletContextListener</code>
 supports the following options which can be configured as context-param in the 
web.xml file.</p><div class="confluenceTableSmall"><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Option</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>propertyPlaceholder.XXX</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>To configure <a shape="rect" 
href="using-propertyplaceholder.html">property placeholders</a> in Camel. You 
should prefix the option with "propertyPlaceholder.", for example to configure 
the location, use propertyPlaceholder.loca
 tion as name. You can configure all the options from the <a shape="rect" 
href="properties.html">Properties</a> component.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>jmx.XXX</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To configure <a shape="rect" 
href="camel-jmx.html">JMX</a>. You should prefix the option with "jmx.", for 
example to disable JMX, use jmx.disabled as name. You can configure all the 
options from <code>org.apache.camel.spi.ManagementAgent</code>. As well the 
options mentioned on the <a shape="rect" href="camel-jmx.html">JMX</a> 
page.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>name</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To configure the name of the <a shape="rect" 
href="camelcontext.html">CamelContext</a>.</p></td></tr><tr><td colspan="1" r
 owspan="1" class="confluenceTd"><p>messageHistory</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12.2:</strong> 
Whether to enable or disable <a shape="rect" 
href="message-history.html">Message History</a> (enabled by 
default).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>streamCache</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to enable <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>trace</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to enable <a shape="rect" 
href="tracer.html">Tracer</a>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>delayer
 </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Long</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To set a delay value for <a shape="rect" 
href="delay-interceptor.html">Delay Interceptor</a>.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>handleFault</p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to enable handle 
fault.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>errorHandlerRef</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Refers to a context scoped <a shape="rect" 
href="error-handler.html">Error Handler</a> to be used.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>autoStartup</p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
 rowspan="1" class="confluenceTd"><p>Whether to start all routes when starting 
Camel.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>useMDCLogging</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to use <a shape="rect" 
href="mdc-logging.html">MDC logging</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>useBreadcrumb</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether to use <a shape="rect" 
href="mdc-logging.html">breadcrumb</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>managementNamePattern</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 a custom naming pattern 
for JMX MBeans.</p></td></tr><tr><td colspan="1" rowspan="1
 " class="confluenceTd"><p>threadNamePattern</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 a custom naming pattern for 
threads.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties.XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To set custom properties on 
<code>CamelContext.getProperties</code>. This is seldom in 
use.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>routebuilder.XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To configure routes to be used. See below for more 
details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>CamelContextLifecycle</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1"
  class="confluenceTd"><p>Refers to a FQN classname of an implementation of 
<code>org.apache.camel.component.servletlistener.CamelContextLifecycle</code>. 
Which allows to execute custom code before and after <a shape="rect" 
href="camelcontext.html">CamelContext</a> has been started or stopped. See 
below for further details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>XXX</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>To set any option on <a shape="rect" 
href="camelcontext.html">CamelContext</a>.</p></td></tr></tbody></table></div></div>
-
-
-<h3 id="ServletListenerComponent-Examples">Examples</h3><p>See <a shape="rect" 
href="servlet-tomcat-no-spring-example.html">Servlet Tomcat No Spring 
Example</a>.</p><h3 
id="ServletListenerComponent-AccessingthecreatedCamelContext">Accessing the 
created CamelContext</h3><p><strong>Available as of Camel 
2.14/2.13.3/2.12.5</strong></p><p>The created&#160;<code>CamelContext</code> is 
stored on the&#160;<code>ServletContext</code> as an attribute with the key 
"CamelContext". You can get hold of the CamelContext if you can get hold of 
the&#160;<code>ServletContext</code> as shown below:</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[ServletContext sc = ...
-CamelContext camel = (CamelContext) 
sc.getAttribute(&quot;CamelContext&quot;);]]></script>
-</div></div><p>&#160;</p><h3 
id="ServletListenerComponent-Configuringroutes">Configuring routes</h3><p>You 
need to configure which routes to use in the web.xml file. You can do this in a 
number of ways, though all the parameters must be prefixed with 
"routeBuilder".</p><h4 
id="ServletListenerComponent-UsingaRouteBuilderclass">Using a RouteBuilder 
class</h4><p>By default Camel will assume the param-value is a FQN classname 
for a Camel <a shape="rect" href="routebuilder.html">RouteBuilder</a> class, as 
shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;context-param&gt;
-    &lt;param-name&gt;routeBuilder-MyRoute&lt;/param-name&gt;
-    
&lt;param-value&gt;org.apache.camel.component.servletlistener.MyRoute&lt;/param-value&gt;
-  &lt;/context-param&gt;
-]]></script>
-</div></div><p>You can specify multiple classes in the same param-value as 
shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;context-param&gt;
+</plain-text-body><p>You can specify multiple classes in the same param-value 
as shown below:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>  &lt;context-param&gt;
     &lt;param-name&gt;routeBuilder-routes&lt;/param-name&gt;
     &lt;!-- we can define multiple values separated by comma --&gt;
     &lt;param-value&gt;
@@ -146,39 +94,31 @@ CamelContext camel = (CamelContext) sc.g
       org.apache.camel.component.servletlistener.routes.BarRouteBuilder
     &lt;/param-value&gt;
   &lt;/context-param&gt;
-]]></script>
-</div></div><p>The name of the parameter does not have a meaning at runtime. 
It just need to be unique and start with "routeBuilder". In the example above 
we have "routeBuilder-routes". But you could just as well have named it 
"routeBuilder.foo".</p><h4 
id="ServletListenerComponent-Usingpackagescanning">Using package 
scanning</h4><p>You can also tell Camel to use package scanning, which mean it 
will look in the given package for all classes of <a shape="rect" 
href="routebuilder.html">RouteBuilder</a> types and automatic adding them as 
Camel routes. To do that you need to prefix the value with "packagescan:" as 
shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;context-param&gt;
+</plain-text-body><p>The name of the parameter does not have a meaning at 
runtime. It just need to be unique and start with "routeBuilder". In the 
example above we have "routeBuilder-routes". But you could just as well have 
named it "routeBuilder.foo".</p><h4 
id="ServletListenerComponent-Usingpackagescanning">Using package 
scanning</h4><p>You can also tell Camel to use package scanning, which mean it 
will look in the given package for all classes of <a shape="rect" 
href="routebuilder.html">RouteBuilder</a> types and automatic adding them as 
Camel routes. To do that you need to prefix the value with "packagescan:" as 
shown below:</p><parameter ac:name="language">xml</parameter><plain-text-body>  
&lt;context-param&gt;
     &lt;param-name&gt;routeBuilder-MyRoute&lt;/param-name&gt;
     &lt;!-- define the routes using package scanning by prefixing with 
packagescan: --&gt;
     
&lt;param-value&gt;packagescan:org.apache.camel.component.servletlistener.routes&lt;/param-value&gt;
   &lt;/context-param&gt;
-]]></script>
-</div></div><h4 id="ServletListenerComponent-UsingaXMLfile">Using a XML 
file</h4><p>You can also define Camel routes using XML DSL, though as we are 
not using Spring or Blueprint the XML file can only contain Camel route(s). <br 
clear="none"> In the web.xml you refer to the XML file which can be from 
"classpath", "file" or a "http" url, as shown below:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;context-param&gt;
+</plain-text-body><h4 id="ServletListenerComponent-UsingaXMLfile">Using a XML 
file</h4><p>You can also define Camel routes using XML DSL, though as we are 
not using Spring or Blueprint the XML file can only contain Camel route(s). <br 
clear="none"> In the web.xml you refer to the XML file which can be from 
"classpath", "file" or a "http" url, as shown below:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>  &lt;context-param&gt;
     &lt;param-name&gt;routeBuilder-MyRoute&lt;/param-name&gt;
     &lt;param-value&gt;classpath:routes/myRoutes.xml&lt;/param-value&gt;
   &lt;/context-param&gt;
-]]></script>
-</div></div><p>And the XML file is:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>routes/myRoutes.xml</b></div><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;?xml version=&quot;1.0&quot; 
encoding=&quot;UTF-8&quot;?&gt;
-&lt;!-- the xmlns=&quot;http://camel.apache.org/schema/spring&quot; is needed 
--&gt;
-&lt;routes xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-
-  &lt;route id=&quot;foo&quot;&gt;
-    &lt;from uri=&quot;direct:foo&quot;/&gt;
-    &lt;to uri=&quot;mock:foo&quot;/&gt;
+</plain-text-body><p>And the XML file is:</p><parameter 
ac:name="xml:title">routes/myRoutes.xml</parameter><parameter 
ac:name="language">xml</parameter><parameter 
ac:name="title">routes/myRoutes.xml</parameter><plain-text-body>&lt;?xml 
version="1.0" encoding="UTF-8"?&gt;
+&lt;!-- the xmlns="http://camel.apache.org/schema/spring"; is needed --&gt;
+&lt;routes xmlns="http://camel.apache.org/schema/spring"&gt;
+
+  &lt;route id="foo"&gt;
+    &lt;from uri="direct:foo"/&gt;
+    &lt;to uri="mock:foo"/&gt;
   &lt;/route&gt;
 
-  &lt;route id=&quot;bar&quot;&gt;
-    &lt;from uri=&quot;direct:bar&quot;/&gt;
-    &lt;to uri=&quot;mock:bar&quot;/&gt;
+  &lt;route id="bar"&gt;
+    &lt;from uri="direct:bar"/&gt;
+    &lt;to uri="mock:bar"/&gt;
   &lt;/route&gt;
 
 &lt;/routes&gt;
-]]></script>
-</div></div><p>Notice that in the XML file the root tag is &lt;routes&gt; 
which must use the namespace "http://camel.apache.org/schema/spring";. This 
namespace is having the spring in the name, but that is because of historical 
reasons, as Spring was the first and only XML DSL back in the time. At runtime 
no Spring JARs is needed. Maybe in Camel 3.0 the namespace can be renamed to a 
generic name.</p><h4 
id="ServletListenerComponent-Configuringpropertplaceholders">Configuring 
propert placeholders</h4><p>Here is a snippet of a web.xml configuration for 
setting up property placeholders to load <code>myproperties.properties</code> 
from the classpath</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;!-- setup property placeholder to load 
properties from classpath --&gt;
+</plain-text-body><p>Notice that in the XML file the root tag is 
&lt;routes&gt; which must use the namespace 
"http://camel.apache.org/schema/spring";. This namespace is having the spring in 
the name, but that is because of historical reasons, as Spring was the first 
and only XML DSL back in the time. At runtime no Spring JARs is needed. Maybe 
in Camel 3.0 the namespace can be renamed to a generic name.</p><h4 
id="ServletListenerComponent-Configuringpropertplaceholders">Configuring 
propert placeholders</h4><p>Here is a snippet of a web.xml configuration for 
setting up property placeholders to load <code>myproperties.properties</code> 
from the classpath</p><parameter 
ac:name="language">xml</parameter><plain-text-body>  &lt;!-- setup property 
placeholder to load properties from classpath --&gt;
   &lt;!-- we do this by setting the param-name with propertyPlaceholder. as 
prefix and then any options such as location, cache etc --&gt;
   &lt;context-param&gt;
     &lt;param-name&gt;propertyPlaceholder.location&lt;/param-name&gt;
@@ -189,75 +129,25 @@ CamelContext camel = (CamelContext) sc.g
     &lt;param-name&gt;propertyPlaceholder.cache&lt;/param-name&gt;
     &lt;param-value&gt;false&lt;/param-value&gt;
   &lt;/context-param&gt;
-]]></script>
-</div></div><h4 id="ServletListenerComponent-ConfiguringJMX">Configuring 
JMX</h4><p>Here is a snippet of a web.xml configuration for configuring JMX, 
such as disabling JMX.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;!-- configure JMX by using names that 
is prefixed with jmx. --&gt;
+</plain-text-body><h4 id="ServletListenerComponent-ConfiguringJMX">Configuring 
JMX</h4><p>Here is a snippet of a web.xml configuration for configuring JMX, 
such as disabling JMX.</p><parameter 
ac:name="language">xml</parameter><plain-text-body>  &lt;!-- configure JMX by 
using names that is prefixed with jmx. --&gt;
   &lt;!-- in this example we disable JMX --&gt;
   &lt;context-param&gt;
     &lt;param-name&gt;jmx.disabled&lt;/param-name&gt;
     &lt;param-value&gt;true&lt;/param-value&gt;
   &lt;/context-param&gt;
-]]></script>
-</div></div><h3 id="ServletListenerComponent-JNDIorSimpleasCamel">JNDI or 
Simple as Camel <a shape="rect" href="registry.html">Registry</a></h3><p>This 
component uses either JNDI or Simple as the <a shape="rect" 
href="registry.html">Registry</a>.<br clear="none"> This allows you to lookup 
<a shape="rect" href="bean.html">Bean</a>s and other services in JNDI, and as 
well to bind and unbind your own <a shape="rect" 
href="bean.html">Bean</a>s.</p><p>This is done from Java code by implementing 
the 
<code>org.apache.camel.component.servletlistener.CamelContextLifecycle</code>.</p><h4
 id="ServletListenerComponent-UsingcustomCamelContextLifecycle">Using custom 
CamelContextLifecycle</h4><p>In the code below we use the callbacks 
<code>beforeStart</code> and <code>afterStop</code> to enlist our custom bean 
in the Simple <a shape="rect" href="registry.html">Registry</a>, and as well to 
cleanup when we stop.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelC
 ontent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-/**
- * Our custom {@link CamelContextLifecycle} which allows us to enlist beans in 
the {@link JndiContext}
- * so the Camel application can lookup the beans in the {@link 
org.apache.camel.spi.Registry}.
- * &lt;p/&gt;
- * We can of course also do other kind of custom logic as well.
- */
-public class MyLifecycle implements 
CamelContextLifecycle&lt;SimpleRegistry&gt; {
-
-    @Override
-    public void beforeStart(ServletCamelContext camelContext, SimpleRegistry 
registry) throws Exception {
-        // enlist our bean(s) in the registry
-        registry.put(&quot;myBean&quot;, new HelloBean());
-    }
-
-    @Override
-    public void afterStart(ServletCamelContext camelContext, SimpleRegistry 
registry) throws Exception {
-        // noop
-    }
-
-    @Override
-    public void beforeStop(ServletCamelContext camelContext, SimpleRegistry 
registry) throws Exception {
-        // noop
-    }
-
-    @Override
-    public void afterStop(ServletCamelContext camelContext, SimpleRegistry 
registry) throws Exception {
-        // unbind our bean when Camel has been stopped
-        registry.remove(&quot;myBean&quot;);
-    }
-
-    @Override
-    public void beforeAddRoutes(ServletCamelContext camelContext, 
SimpleRegistry registry) throws Exception {
-        // noop
-    }
-
-    @Override
-    public void afterAddRoutes(ServletCamelContext camelContext, 
SimpleRegistry registry) throws Exception {
-        // noop
-    }
-}
-]]></script>
-</div></div><p>Then we need to register this class in the web.xml file as 
shown below, using the parameter name "CamelContextLifecycle". The value must 
be a FQN which refers to the class implementing the 
<code>org.apache.camel.component.servletlistener.CamelContextLifecycle</code> 
interface.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;context-param&gt;
+</plain-text-body><h3 id="ServletListenerComponent-JNDIorSimpleasCamel">JNDI 
or Simple as Camel <a shape="rect" 
href="registry.html">Registry</a></h3><p>This component uses either JNDI or 
Simple as the <a shape="rect" href="registry.html">Registry</a>.<br 
clear="none"> This allows you to lookup <a shape="rect" 
href="bean.html">Bean</a>s and other services in JNDI, and as well to bind and 
unbind your own <a shape="rect" href="bean.html">Bean</a>s.</p><p>This is done 
from Java code by implementing the 
<code>org.apache.camel.component.servletlistener.CamelContextLifecycle</code>.</p><h4
 id="ServletListenerComponent-UsingcustomCamelContextLifecycle">Using custom 
CamelContextLifecycle</h4><p>In the code below we use the callbacks 
<code>beforeStart</code> and <code>afterStop</code> to enlist our custom bean 
in the Simple <a shape="rect" href="registry.html">Registry</a>, and as well to 
cleanup when we 
stop.</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-serv
 
letlistener/src/test/java/org/apache/camel/component/servletlistener/MyLifecycle.java}</plain-text-body><p>Then
 we need to register this class in the web.xml file as shown below, using the 
parameter name "CamelContextLifecycle". The value must be a FQN which refers to 
the class implementing the 
<code>org.apache.camel.component.servletlistener.CamelContextLifecycle</code> 
interface.</p><parameter ac:name="language">xml</parameter><plain-text-body>  
&lt;context-param&gt;
     &lt;param-name&gt;CamelContextLifecycle&lt;/param-name&gt;
     
&lt;param-value&gt;org.apache.camel.component.servletlistener.MyLifecycle&lt;/param-value&gt;
   &lt;/context-param&gt;
-]]></script>
-</div></div><p>As we enlisted our HelloBean <a shape="rect" 
href="bean.html">Bean</a> using the name "myBean" we can refer to this <a 
shape="rect" href="bean.html">Bean</a> in the Camel routes as shown 
below:</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[public class MyBeanRoute extends RouteBuilder 
{
+</plain-text-body><p>As we enlisted our HelloBean <a shape="rect" 
href="bean.html">Bean</a> using the name "myBean" we can refer to this <a 
shape="rect" href="bean.html">Bean</a> in the Camel routes as shown 
below:</p><parameter ac:name="language">java</parameter><plain-text-body>public 
class MyBeanRoute extends RouteBuilder {
     @Override
     public void configure() throws Exception {
-        from(&quot;seda:foo&quot;).routeId(&quot;foo&quot;)
-            .to(&quot;bean:myBean&quot;)
-            .to(&quot;mock:foo&quot;);
+        from("seda:foo").routeId("foo")
+            .to("bean:myBean")
+            .to("mock:foo");
     }
 }
-]]></script>
-</div></div><p><strong>Important:</strong> If you use 
<code>org.apache.camel.component.servletlistener.JndiCamelServletContextListener</code>
 then the <code>CamelContextLifecycle</code> must use the 
<code>JndiRegistry</code> as well. And likewise if the servlet is 
<code>org.apache.camel.component.servletlistener.SimpleCamelServletContextListener</code>
 then the <code>CamelContextLifecycle</code> must use the 
<code>SimpleRegistry</code></p><h3 id="ServletListenerComponent-SeeAlso">See 
Also</h3><ul class="alternate"><li><a shape="rect" 
href="servlet.html">SERVLET</a></li><li><a shape="rect" 
href="servlet-tomcat-example.html">Servlet Tomcat Example</a></li><li><a 
shape="rect" href="servlet-tomcat-no-spring-example.html">Servlet Tomcat No 
Spring Example</a></li></ul></div>
+</plain-text-body><p><strong>Important:</strong> If you use 
<code>org.apache.camel.component.servletlistener.JndiCamelServletContextListener</code>
 then the <code>CamelContextLifecycle</code> must use the 
<code>JndiRegistry</code> as well. And likewise if the servlet is 
<code>org.apache.camel.component.servletlistener.SimpleCamelServletContextListener</code>
 then the <code>CamelContextLifecycle</code> must use the 
<code>SimpleRegistry</code></p><h3 id="ServletListenerComponent-SeeAlso">See 
Also</h3><ul class="alternate"><li><a shape="rect" 
href="servlet.html">SERVLET</a></li><li><a shape="rect" 
href="servlet-tomcat-example.html">Servlet Tomcat Example</a></li><li><a 
shape="rect" href="servlet-tomcat-no-spring-example.html">Servlet Tomcat No 
Spring Example</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to