Repository: camel
Updated Branches:
  refs/heads/master 62e569632 -> dc139cdcf


CAMEL-10964: Add an itest for Jetty reverse proxy config with @BeanInject in 
RouteBuilder

Actual fix for the issue is provided by CAMEL-10513.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dc139cdc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dc139cdc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dc139cdc

Branch: refs/heads/master
Commit: dc139cdcf9e7aa5522a8606e3acf011d8a8a584c
Parents: 62e5696
Author: Tadayoshi Sato <sato.tadayo...@gmail.com>
Authored: Thu Mar 9 15:07:03 2017 +0900
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Mar 9 09:39:39 2017 +0100

----------------------------------------------------------------------
 .../camel/test/karaf/AbstractFeatureTest.java   | 39 ++++++++
 tests/camel-itest-osgi/pom.xml                  |  7 +-
 .../camel/itest/CamelTypeConverterTest.java     | 31 ++-----
 .../camel/itest/cxf/BeanInjectRouteBuilder.java | 35 +++++++
 .../camel/itest/cxf/CamelCxfBeanInjectTest.java | 98 ++++++++++++++++++++
 .../org/apache/camel/itest/cxf/SimpleBean.java  | 25 +++++
 .../apache/camel/itest/cxf/SimpleService.java   | 21 +++++
 .../camel/itest/cxf/CamelCxfBeanInjectTest.xml  | 80 ++++++++++++++++
 8 files changed, 311 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java
 
b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java
index 050a1d4..4a15d4c 100644
--- 
a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java
+++ 
b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.test.karaf;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.net.URL;
@@ -30,6 +31,7 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
 import java.util.Properties;
+import java.util.function.Consumer;
 import javax.inject.Inject;
 
 import org.apache.camel.CamelContext;
@@ -57,6 +59,8 @@ import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.util.tracker.ServiceTracker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -103,12 +107,17 @@ public abstract class AbstractFeatureTest {
     }
 
     protected Bundle installBlueprintAsBundle(String name, URL url, boolean 
start) throws BundleException {
+        return installBlueprintAsBundle(name, url, start, bundle -> {});
+    }
+
+    protected Bundle installBlueprintAsBundle(String name, URL url, boolean 
start, Consumer<TinyBundle> consumer) throws BundleException {
         TinyBundle bundle = TinyBundles.bundle();
         bundle.add("OSGI-INF/blueprint/blueprint-" + 
name.toLowerCase(Locale.ENGLISH) + ".xml", url);
         bundle.set("Manifest-Version", "2")
                 .set("Bundle-ManifestVersion", "2")
                 .set("Bundle-SymbolicName", name)
                 .set("Bundle-Version", "1.0.0");
+        consumer.accept(bundle);
         Bundle answer = bundleContext.installBundle(name, bundle.build());
 
         if (start) {
@@ -118,12 +127,17 @@ public abstract class AbstractFeatureTest {
     }
 
     protected Bundle installSpringAsBundle(String name, URL url, boolean 
start) throws BundleException {
+        return installSpringAsBundle(name, url, start, bundle -> {});
+    }
+
+    protected Bundle installSpringAsBundle(String name, URL url, boolean 
start, Consumer<TinyBundle> consumer) throws BundleException {
         TinyBundle bundle = TinyBundles.bundle();
         bundle.add("META-INF/spring/spring-" + 
name.toLowerCase(Locale.ENGLISH) + ".xml", url);
         bundle.set("Manifest-Version", "2")
                 .set("Bundle-ManifestVersion", "2")
                 .set("Bundle-SymbolicName", name)
                 .set("Bundle-Version", "1.0.0");
+        consumer.accept(bundle);
         Bundle answer = bundleContext.installBundle(name, bundle.build());
 
         if (start) {
@@ -142,6 +156,31 @@ public abstract class AbstractFeatureTest {
         featuresService.installFeature(mainFeature, 
EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
     }
 
+    protected void overridePropertiesWithConfigAdmin(String pid, Properties 
props) throws IOException {
+        ConfigurationAdmin configAdmin = getOsgiService(bundleContext, 
ConfigurationAdmin.class);
+        Configuration config = configAdmin.getConfiguration(pid);
+        if (config == null) {
+            throw new IllegalArgumentException("Cannot find configuration with 
pid " + pid + " in OSGi ConfigurationAdmin service.");
+        }
+
+        // let's merge configurations
+        Dictionary<String, Object> currentProperties = config.getProperties();
+        Dictionary newProps = new Properties();
+        if (currentProperties == null) {
+            currentProperties = newProps;
+        }
+        for (Enumeration<String> ek = currentProperties.keys(); 
ek.hasMoreElements(); ) {
+            String k = ek.nextElement();
+            newProps.put(k, currentProperties.get(k));
+        }
+        for (String p : props.stringPropertyNames()) {
+            newProps.put(p, props.getProperty(p));
+        }
+
+        LOG.info("Updating ConfigAdmin {} by overriding properties {}", 
config, newProps);
+        config.update(newProps);
+    }
+
     protected void testComponent(String component) throws Exception {
         testComponent("camel-" + component, component);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/pom.xml b/tests/camel-itest-osgi/pom.xml
index c3eed42..48a40fb 100644
--- a/tests/camel-itest-osgi/pom.xml
+++ b/tests/camel-itest-osgi/pom.xml
@@ -29,7 +29,7 @@
   <artifactId>camel-itest-osgi</artifactId>
   <name>Camel :: Integration Tests :: OSGi</name>
   <description>Performs OSGi compliance integration tests</description>
-  
+
   <dependencies>
     <dependency>
       <groupId>org.apache.camel</groupId>
@@ -41,6 +41,11 @@
       <artifactId>camel-jackson</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cxf</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelTypeConverterTest.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelTypeConverterTest.java
 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelTypeConverterTest.java
index 994e730..c17fc18 100644
--- 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelTypeConverterTest.java
+++ 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelTypeConverterTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.itest;
 
 import java.io.ByteArrayInputStream;
 import java.net.URL;
-import java.util.Locale;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.DefaultExchange;
@@ -35,9 +34,6 @@ import org.ops4j.pax.exam.ProbeBuilder;
 import org.ops4j.pax.exam.TestProbeBuilder;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.tinybundles.core.InnerClassStrategy;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 
 @RunWith(PaxExam.class)
@@ -46,23 +42,14 @@ public class CamelTypeConverterTest extends 
AbstractFeatureTest {
     @Test
     public void testTypeConverterInSameBundleAsCamelRoute() throws Exception {
         // install the camel blueprint xml file and the Camel converter we use 
in this test
-        TinyBundle bundle = TinyBundles.bundle();
-        // install blueprint
         URL blueprintUrl = 
ObjectHelper.loadResourceAsURL("org/apache/camel/itest/CamelTypeConverterTest.xml",
 CamelTypeConverterTest.class.getClassLoader());
-        String name = "CamelTypeConverterTest";
-        bundle.add("OSGI-INF/blueprint/blueprint-" + 
name.toLowerCase(Locale.ENGLISH) + ".xml", blueprintUrl);
-        // install converter
-        bundle.add("META-INF/services/org/apache/camel/TypeConverter", new 
ByteArrayInputStream("org.apache.camel.itest.typeconverter.MyConverter".getBytes()));
-        bundle.add(MyConverter.class, InnerClassStrategy.NONE);
-        // set bundle headers
-        bundle.set("Manifest-Version", "2")
-                .set("Bundle-ManifestVersion", "2")
-                .set("Bundle-SymbolicName", name)
-                .set("Bundle-Version", "1.0.0")
+        installBlueprintAsBundle("CamelTypeConverterTest", blueprintUrl, true, 
bundle -> {
+            // install converter
+            bundle
+                .add("META-INF/services/org/apache/camel/TypeConverter", new 
ByteArrayInputStream("org.apache.camel.itest.typeconverter.MyConverter".getBytes()))
+                .add(MyConverter.class, InnerClassStrategy.NONE)
                 .set(Constants.DYNAMICIMPORT_PACKAGE, "*");
-        // start bundle
-        Bundle answer = this.bundleContext.installBundle(name, bundle.build());
-        answer.start();
+        });
 
         // lookup Camel from OSGi
         CamelContext camel = getOsgiService(bundleContext, CamelContext.class);
@@ -91,8 +78,4 @@ public class CamelTypeConverterTest extends 
AbstractFeatureTest {
         return probe;
     }
 
-
-
-
-
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/BeanInjectRouteBuilder.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/BeanInjectRouteBuilder.java
 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/BeanInjectRouteBuilder.java
new file mode 100644
index 0000000..a95105e
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/BeanInjectRouteBuilder.java
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+package org.apache.camel.itest.cxf;
+
+import org.apache.camel.BeanInject;
+import org.apache.camel.builder.RouteBuilder;
+
+public class BeanInjectRouteBuilder extends RouteBuilder {
+
+    @BeanInject
+    private SimpleBean simpleBean;
+
+    @Override
+    public void configure() throws Exception {
+        from("cxf:bean:routerEndpoint")
+            .bean(simpleBean) // does nothing
+            .transform(simple("scheme: 
${headers.CamelCxfMessage.get(HTTP.REQUEST).scheme}"
+                + ", x-forwarded-proto: 
${headers.CamelCxfMessage.get(HTTP.REQUEST).getHeader(X-Forwarded-Proto)}"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.java
 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.java
new file mode 100644
index 0000000..42f61f1
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.java
@@ -0,0 +1,98 @@
+/**
+ * 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.
+ */
+package org.apache.camel.itest.cxf;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.karaf.AbstractFeatureTest;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.message.Message;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.tinybundles.core.InnerClassStrategy;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+@RunWith(PaxExam.class)
+public class CamelCxfBeanInjectTest extends AbstractFeatureTest {
+
+    private static final int PORT = AvailablePortFinder.getNextAvailable();
+    private static final String ENDPOINT_ADDRESS = String.format(
+        "http://localhost:%s/CamelCxfBeanInjectTest/router";, PORT);
+
+    @Before
+    public void installBlueprintXML() throws Exception {
+        // install the camel blueprint xml file we use in this test
+        URL url = 
ObjectHelper.loadResourceAsURL("org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.xml",
 CamelCxfBeanInjectTest.class.getClassLoader());
+        Bundle bundle = installBlueprintAsBundle("CamelCxfBeanInjectTest", 
url, false, b -> {
+            b.add(BeanInjectRouteBuilder.class, InnerClassStrategy.NONE)
+                .add(SimpleService.class, InnerClassStrategy.NONE)
+                .add(SimpleBean.class, InnerClassStrategy.NONE)
+                .set(Constants.DYNAMICIMPORT_PACKAGE, "*");
+        });
+
+        Properties props = new Properties();
+        props.put("router.address", ENDPOINT_ADDRESS);
+        props.put("router.port", Integer.toString(PORT));
+        overridePropertiesWithConfigAdmin("my-placeholders", props);
+
+        bundle.start();
+    }
+
+    @Configuration
+    public Option[] configure() {
+        return configure("camel-test-karaf", "camel-cxf");
+    }
+
+    @Test
+    public void testReverseProxy() {
+        SimpleService client = createClient();
+        setHttpHeaders(client, "X-Forwarded-Proto", "https");
+
+        String result = client.op("test");
+        Assert.assertEquals("Scheme should be set to 'https'",
+            "scheme: https, x-forwarded-proto: https", result);
+    }
+
+    private void setHttpHeaders(SimpleService client, String header, String 
value) {
+        Map<String, List<String>> headers = new HashMap<>();
+        headers.put(header, Arrays.asList(value));
+        
ClientProxy.getClient(client).getRequestContext().put(Message.PROTOCOL_HEADERS, 
headers);
+    }
+
+    private SimpleService createClient() {
+        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
+        factory.setAddress(ENDPOINT_ADDRESS);
+        factory.setServiceClass(SimpleService.class);
+        factory.setBus(BusFactory.getDefaultBus());
+        return (SimpleService) factory.create();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleBean.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleBean.java
 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleBean.java
new file mode 100644
index 0000000..606e2f0
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleBean.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.itest.cxf;
+
+public class SimpleBean {
+
+    public String op(String message) {
+        return "<<< " + message + " >>>";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleService.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleService.java
 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleService.java
new file mode 100644
index 0000000..c9036ae
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/cxf/SimpleService.java
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ */
+package org.apache.camel.itest.cxf;
+
+public interface SimpleService {
+    String op(String input);
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/dc139cdc/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.xml
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.xml
 
b/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.xml
new file mode 100644
index 0000000..c5df3ac
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/cxf/CamelCxfBeanInjectTest.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+           xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf";
+           
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration";
+           
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
+           xsi:schemaLocation="
+             http://camel.apache.org/schema/blueprint 
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
+             http://camel.apache.org/schema/blueprint/cxf 
http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
+             http://cxf.apache.org/transports/http-jetty/configuration 
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
+
+  <!-- blueprint property placeholders -->
+  <cm:property-placeholder persistent-id="my-placeholders" 
update-strategy="reload">
+    <cm:default-properties>
+      <cm:property name="router.address" 
value="http://localhost:9000/routerEndpoint"; />
+      <cm:property name="router.port" value="9000" />
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- configuration for reverse proxy -->
+  <httpj:engine-factory bus="cxf">
+    <httpj:engine port="${router.port}">
+      <httpj:connector>
+        <bean id="connector" class="org.eclipse.jetty.server.ServerConnector">
+          <argument ref="server" />
+          <argument>
+            <array>
+              <ref component-id="httpConnectionFactory" />
+            </array>
+          </argument>
+          <property name="port" value="${router.port}" />
+        </bean>
+      </httpj:connector>
+    </httpj:engine>
+  </httpj:engine-factory>
+
+  <bean id="server" class="org.eclipse.jetty.server.Server" />
+
+  <bean id="httpConfiguration" 
class="org.eclipse.jetty.server.HttpConfiguration">
+    <property name="customizers">
+      <list>
+        <bean class="org.eclipse.jetty.server.ForwardedRequestCustomizer" />
+      </list>
+    </property>
+  </bean>
+
+  <bean id="httpConnectionFactory" 
class="org.eclipse.jetty.server.HttpConnectionFactory">
+    <argument ref="httpConfiguration" />
+  </bean>
+
+  <cxf:cxfEndpoint id="routerEndpoint" address="{{router.address}}"
+                   serviceClass="org.apache.camel.itest.cxf.SimpleService" />
+
+  <bean id="routeBuilder" 
class="org.apache.camel.itest.cxf.BeanInjectRouteBuilder" />
+
+  <bean id="simpleBean" class="org.apache.camel.itest.cxf.SimpleBean" />
+
+  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint";>
+    <routeBuilder ref="routeBuilder" />
+  </camelContext>
+
+</blueprint>

Reply via email to