Modified: websites/production/camel/content/properties.html ============================================================================== --- websites/production/camel/content/properties.html (original) +++ websites/production/camel/content/properties.html Fri Jul 8 21:25:13 2016 @@ -195,8 +195,7 @@ from("direct:start") .transform().simple("Hi ${body}. ${properties:com/mycompany/bar.properties:bar.quote}."); ]]></script> </div></div><h3 id="Properties-AdditionalpropertyplaceholdersupportedinSpringXML">Additional property placeholder supported in Spring XML</h3><p>The property placeholders is also supported in many of the Camel Spring XML tags such as <code><package>, <packageScan>, <contextScan>, <jmxAgent>, <endpoint>, <routeBuilder>, <proxy></code> and the others.</p><p>The example below has property placeholder in the <jmxAgent> tag:</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[ -<camelContext xmlns="http://camel.apache.org/schema/spring"> +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<camelContext xmlns="http://camel.apache.org/schema/spring"> <propertyPlaceholder id="properties" location="org/apache/camel/spring/jmx.properties"/> <!-- we can use propery placeholders when we define the JMX agent --> @@ -211,11 +210,9 @@ from("direct:start") <to uri="mock:result"/> </route> -</camelContext> -]]></script> -</div></div>You can also define property placeholders in the various attributes on the <camelContext> tag such as <code>trace</code> as shown here:<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[ -<camelContext trace="{{foo.trace}}" xmlns="http://camel.apache.org/schema/spring"> +</camelContext>]]></script> +</div></div><p>You can also define property placeholders in the various attributes on the <camelContext> tag such as <code>trace</code> as shown here:</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[<camelContext trace="{{foo.trace}}" xmlns="http://camel.apache.org/schema/spring"> <propertyPlaceholder id="properties" location="org/apache/camel/spring/processor/myprop.properties"/> <template id="camelTemplate" defaultEndpoint="{{foo.cool}}"/> @@ -227,8 +224,7 @@ from("direct:start") </setHeader> <to uri="mock:result"/> </route> -</camelContext> -]]></script> +</camelContext>]]></script> </div></div><h3 id="Properties-OverridingapropertysettingusingaJVMSystemProperty">Overriding a property setting using a JVM System Property</h3><p><strong>Available as of Camel 2.5</strong><br clear="none"> It is possible to override a property value at runtime using a JVM System property without the need to restart the application to pick up the change. This may also be accomplished from the command line by creating a JVM System property of the same name as the property it replaces with a new value. An example of this is given 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[PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class); pc.setCache(false); @@ -256,8 +252,7 @@ System.clearProperty("cool.result&q assertMockEndpointsSatisfied(); ]]></script> </div></div><h3 id="Properties-UsingpropertyplaceholdersforanykindofattributeintheXMLDSL">Using property placeholders for any kind of attribute in the XML DSL</h3><p><strong>Available as of Camel 2.7</strong></p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you use OSGi Blueprint then this only works from <strong>2.11.1</strong> or <strong>2.10.5</strong> onwards.</p></div></div><p>Previously it was only the <code>xs:string</code> type attributes in the XML DSL that support placeholders. For example often a timeout attribute would be a <code>xs:int</code> type and thus you cannot set a string value as the placeholder key. This is now possible from Camel 2.7 onwards using a special placeholder namespace.</p><p>In the example below we use the <code>prop</code> prefix for the namespace <code><a shape=" rect" class="external-link" href="http://camel.apache.org/schema/placeholder">http://camel.apache.org/schema/placeholder</a></code> by which we can use the <code>prop</code> prefix in the attributes in the XML DSLs. Notice how we use that in the <a shape="rect" href="multicast.html">Multicast</a> to indicate that the option <code>stopOnException</code> should be the value of the placeholder with the key "stop".</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[ -<beans xmlns="http://www.springframework.org/schema/beans" +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:prop="http://camel.apache.org/schema/placeholder" xsi:schemaLocation=" @@ -290,19 +285,16 @@ assertMockEndpointsSatisfied(); </camelContext> -</beans> -]]></script> -</div></div>In our properties file we have the value defined as<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</beans>]]></script> +</div></div><p>In our properties file we have the value defined as</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[stop=true ]]></script> </div></div><h3 id="Properties-UsingpropertyplaceholderintheJavaDSL">Using property placeholder in the Java DSL</h3><p><strong>Available as of Camel 2.7</strong></p><p>Likewise we have added support for defining placeholders in the Java DSL using the new <code>placeholder</code> DSL as shown in the following equivalent example:</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[ -from("direct:start") - // use a property placeholder for the option stopOnException on the Multicast EIP - // which should have the value of {{stop}} key being looked up in the properties file - .multicast().placeholder("stopOnException", "stop") - .to("mock:a").throwException(new IllegalAccessException("Damn")).to("mock:b"); -]]></script> +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ from("direct:start") + // use a property placeholder for the option stopOnException on the Multicast EIP + // which should have the value of {{stop}} key being looked up in the properties file + .multicast().placeholder("stopOnException", "stop") + .to("mock:a").throwException(new IllegalAccessException("Damn")).to("mock:b");]]></script> </div></div><h3 id="Properties-UsingBlueprintpropertyplaceholderwithCamelroutes">Using Blueprint property placeholder with Camel routes</h3><p><strong>Available as of Camel 2.7</strong></p><p>Camel supports <a shape="rect" href="using-osgi-blueprint-with-camel.html">Blueprint</a> which also offers a property placeholder service. Camel supports convention over configuration, so all you have to do is to define the OSGi Blueprint property placeholder in the XML file as shown below:</p><div class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>By default Camel detects and uses OSGi blueprint property placeholder service. You can disable this by setting the attribute <code>useBlueprintPropertyResolver</code> to false on the <code><camelContext></code> definition.<div class="confluence-information-macro confluence-information-macro-information"><p class="title">About placeholder syntaxes</p><span clas s="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Notice how we can use the Camel syntax for placeholders {{ }} in the Camel route, which will lookup the value from OSGi blueprint.<br clear="none"> The blueprint syntax for placeholders is ${ }. So outside the <camelContext> you must use the ${ } syntax. Where as inside <camelContext> you must use {{ }} syntax.<br clear="none"> OSGi blueprint allows you to configure the syntax, so you can actually align those if you want.</p></div></div><p>You can also explicit refer to a specific OSGi blueprint property placeholder by its id. For that you need to use the Camel's <propertyPlaceholder> as shown in the example below:</p><div class="error"><span class="error">Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>Notice how we use the <code>blueprint</code> scheme to refer to the OSGi b lueprint placeholder by its id. This allows you to mix and match, for example you can also have additional schemes in the location. For example to load a file from the classpath you can do:<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[location="blueprint:myblueprint.placeholder,classpath:myproperties.properties" ]]></script>
Modified: websites/production/camel/content/servlet-tomcat-example.html ============================================================================== --- websites/production/camel/content/servlet-tomcat-example.html (original) +++ websites/production/camel/content/servlet-tomcat-example.html Fri Jul 8 21:25:13 2016 @@ -123,7 +123,7 @@ </web-app> ]]></script> -</div></div><p>The route is a simple <a shape="rect" href="content-based-router.html">Content Based Router</a> defined in the DSL XML as shown:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>camel-config.xml</b></div><div class="codeContent panelContent pdl"> +</div></div>The route is a simple <a shape="rect" href="content-based-router.html">Content Based Router</a> defined in the DSL XML as shown:<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>camel-config.xml</b></div><div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"