Author: wtam
Date: Sat Sep 10 03:23:25 2011
New Revision: 1167448

URL: http://svn.apache.org/viewvc?rev=1167448&view=rev
Log:
[CAMEL-4436] CxfRsProducer clientFactoryBean's bus should be initialized

Added:
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Bethal.jks
   (with props)
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Morpit.jks
   (with props)
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Truststore.jks
   (with props)
Modified:
    
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointUtils.java
    
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
    
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1167448&r1=1167447&r2=1167448&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
 Sat Sep 10 03:23:25 2011
@@ -43,7 +43,6 @@ import org.apache.camel.impl.DefaultEndp
 import org.apache.camel.impl.SynchronousDelegateProducer;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
-import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
 
@@ -82,7 +81,6 @@ import org.apache.cxf.service.model.Bind
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
 
 /**
  * Defines the <a href="http://camel.apache.org/cxf.html";>CXF Endpoint</a>.
@@ -303,19 +301,6 @@ public class CxfEndpoint extends Default
         };
     }
 
-    protected Bus doGetBus() {
-        BusFactory busFactory = BusFactory.newInstance();
-        // need to check if the camelContext is SpringCamelContext and
-        // update the bus configuration with the applicationContext
-        // which SpringCamelContext holds
-        if (getCamelContext() instanceof SpringCamelContext) {
-            SpringCamelContext springCamelContext = (SpringCamelContext) 
getCamelContext();
-            ApplicationContext applicationContext = 
springCamelContext.getApplicationContext();
-            busFactory = new 
org.apache.cxf.bus.spring.SpringBusFactory(applicationContext);
-        }
-        return busFactory.createBus();
-    }
-
     protected void setupHandlers(ClientFactoryBean factoryBean, Client client) 
{
 
         if (factoryBean instanceof JaxWsClientFactoryBean && handlers != null) 
{
@@ -638,7 +623,7 @@ public class CxfEndpoint extends Default
 
     public Bus getBus() {
         if (bus == null) {
-            bus = doGetBus();
+            bus = CxfEndpointUtils.createBus(getCamelContext());
             LOG.debug("Using DefaultBus {}", bus);
         }
 

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointUtils.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointUtils.java?rev=1167448&r1=1167447&r2=1167448&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointUtils.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointUtils.java
 Sat Sep 10 03:23:25 2011
@@ -22,17 +22,23 @@ import javax.jws.WebService;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceProvider;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.CamelException;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.cxf.common.message.CxfConstants;
 import org.apache.camel.component.cxf.util.WSDLSoapServiceFactoryBean;
+import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
 
 public final class CxfEndpointUtils {
     private static final Logger LOG = 
LoggerFactory.getLogger(CxfEndpointUtils.class);
@@ -170,6 +176,24 @@ public final class CxfEndpointUtils {
         }
         return retval;
     }
+    
+    /**
+     * Create a CXF bus with either BusFactory or SpringBusFactory if Camel 
Context
+     * is SpringCamelContext.  In the latter case, this method updates the bus 
+     * configuration with the applicationContext which SpringCamelContext 
holds 
+     * 
+     * @param context - the Camel Context
+     */
+    public static Bus createBus(CamelContext context) {
+        BusFactory busFactory = BusFactory.newInstance();
+
+        if (context instanceof SpringCamelContext) {
+            SpringCamelContext springCamelContext = (SpringCamelContext) 
context;
+            ApplicationContext applicationContext = 
springCamelContext.getApplicationContext();
+            busFactory = new SpringBusFactory(applicationContext);
+        }
+        return busFactory.createBus();
+    }
 }
 
 

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java?rev=1167448&r1=1167447&r2=1167448&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
 Sat Sep 10 03:23:25 2011
@@ -26,9 +26,12 @@ import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.component.cxf.CxfEndpointUtils;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
@@ -38,6 +41,8 @@ import org.slf4j.LoggerFactory;
 public class CxfRsEndpoint extends DefaultEndpoint implements 
HeaderFilterStrategyAware {
     private static final Logger LOG = 
LoggerFactory.getLogger(CxfRsEndpoint.class);
 
+    protected Bus bus;
+
     private Map<String, String> parameters;
     private List<Class<?>> resourceClasses;
     private HeaderFilterStrategy headerFilterStrategy;
@@ -48,6 +53,9 @@ public class CxfRsEndpoint extends Defau
     private int maxClientCacheSize = 10;
     
     private AtomicBoolean bindingInitialized = new AtomicBoolean(false);
+    private AtomicBoolean getBusHasBeenCalled = new AtomicBoolean(false);
+
+       private boolean isSetDefaultBus;
 
     public CxfRsEndpoint(String endpointUri, CamelContext camelContext) {
         super(endpointUri, camelContext);
@@ -224,4 +232,29 @@ public class CxfRsEndpoint extends Defau
     public int getMaxClientCacheSize() {
         return maxClientCacheSize;
     }
+    
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
+
+    public Bus getBus() {
+        if (bus == null) {
+            bus = CxfEndpointUtils.createBus(getCamelContext());
+            LOG.debug("Using DefaultBus {}", bus);
+        }
+
+        if (!getBusHasBeenCalled.getAndSet(true) && isSetDefaultBus) {
+            BusFactory.setDefaultBus(bus);
+            LOG.debug("Set bus {} as thread default bus", bus);
+        }
+        return bus;
+    }
+    
+    public void setSetDefaultBus(boolean isSetDefaultBus) {
+        this.isSetDefaultBus = isSetDefaultBus;
+    }
+
+    public boolean isSetDefaultBus() {
+        return isSetDefaultBus;
+    }
 }

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java?rev=1167448&r1=1167447&r2=1167448&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
 Sat Sep 10 03:23:25 2011
@@ -17,7 +17,6 @@
 package org.apache.camel.component.cxf.jaxrs;
 
 import java.io.UnsupportedEncodingException;
-import java.lang.ref.SoftReference;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -38,7 +37,6 @@ import org.apache.camel.component.cxf.Cx
 import org.apache.camel.component.cxf.common.message.CxfConstants;
 import org.apache.camel.converter.IOConverter;
 import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.LRUCache;
 import org.apache.camel.util.LRUSoftCache;
 import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean;
 import org.apache.cxf.jaxrs.client.Client;
@@ -98,6 +96,7 @@ public class CxfRsProducer extends Defau
         JAXRSClientFactoryBean cfb = 
clientFactoryBeanCache.get(CxfEndpointUtils
             .getEffectiveAddress(exchange, 
((CxfRsEndpoint)getEndpoint()).getAddress()));
         
+        cfb.setBus(((CxfRsEndpoint)getEndpoint()).getBus());
         WebClient client = cfb.createWebClient();
         String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, 
String.class);
         Class responseClass = 
inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Class.class);

Added: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java?rev=1167448&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
 Sat Sep 10 03:23:25 2011
@@ -0,0 +1,109 @@
+/**
+ * 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.component.cxf.jaxrs;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.cxf.CXFTestSupport;
+import org.apache.camel.component.cxf.common.message.CxfConstants;
+import org.apache.camel.component.cxf.jaxrs.testbean.Customer;
+import org.apache.camel.spring.SpringCamelContext;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ *
+ */
+public class CxfRsProducerClientFactoryCacheTest extends Assert {
+    private static int port1 = CXFTestSupport.getPort1(); 
+    
+    private CamelContext context1;
+    private CamelContext context2;
+    private ProducerTemplate template1;
+    private ProducerTemplate template2;
+
+    @Before
+    public void setUp() throws Exception {
+       AbstractApplicationContext ac = new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml");
+       context1 = SpringCamelContext.springCamelContext(ac, false);
+               context1.start();       
+               
+               template1 = context1.createProducerTemplate();
+               template1.start();
+
+       ac = new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml");
+       context2 = SpringCamelContext.springCamelContext(ac, false);
+       context2.start();       
+               
+               template2 = context2.createProducerTemplate();
+               template2.start();
+               
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+       context1.stop();        
+       template1.stop();
+       
+       context2.stop();        
+       template2.stop();
+       
+    }
+    
+    @Test
+    public void testGetConstumerWithHttpCentralClientAPI() throws Exception {
+
+       doRunTest(template2);
+       doRunTest(template1);
+
+    }
+
+       private void doRunTest(ProducerTemplate template) {
+        Exchange exchange = template.send("direct://http", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.setPattern(ExchangePattern.InOut);
+                Message inMessage = exchange.getIn();
+                inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, 
Boolean.TRUE);
+                inMessage.setHeader(Exchange.HTTP_METHOD, "GET");
+                inMessage.setHeader(Exchange.HTTP_PATH, 
"/customerservice/customers/123");                
+                inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, 
Customer.class);
+                inMessage.setBody(null);                
+            }
+        });
+     
+        // get the response message 
+        Customer response = (Customer) exchange.getOut().getBody();
+        
+        assertNotNull("The response should not be null ", response);
+        assertEquals("Get a wrong customer id ", 
String.valueOf(response.getId()), "123");
+        assertEquals("Get a wrong customer name", response.getName(), "John");
+        assertEquals("Get a wrong response code", 200, 
exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+               
+       }
+
+       public int getPort1() {
+        return port1;
+    }
+}

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Bethal.jks
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Bethal.jks?rev=1167448&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Bethal.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml?rev=1167448&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml
 Sat Sep 10 03:23:25 2011
@@ -0,0 +1,49 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:cxf="http://camel.apache.org/schema/cxf";
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs";
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+  <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <jaxrs:server id="restService"
+                       
address="http://localhost:${CXFTestSupport.port1}/CxfRsProducerTest/"; 
+                       staticSubresourceResolution="true">
+    <jaxrs:serviceBeans>
+      <ref bean="customerService"/>
+    </jaxrs:serviceBeans>       
+  </jaxrs:server>
+  
+  <bean id="customerService" 
class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" />
+   
+  <cxf:rsClient id="rsClientHttp" 
address="http://localhost:${CXFTestSupport.port1}/CxfRsProducerTest/"/>
+
+  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
+    <route>
+       <from uri="direct://http"/>
+       <to uri="cxfrs://bean://rsClientHttp"/>
+    </route>
+  </camelContext>
+  
+</beans>

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml?rev=1167448&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml
 Sat Sep 10 03:23:25 2011
@@ -0,0 +1,73 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:cxf="http://camel.apache.org/schema/cxf"; 
xmlns:jaxrs="http://cxf.apache.org/jaxrs";
+       xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"; 
xmlns:sec="http://cxf.apache.org/configuration/security";
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"; 
xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd 
http://camel.apache.org/schema/spring
+       http://camel.apache.org/schema/spring/camel-spring.xsd 
http://cxf.apache.org/transports/http-jetty/configuration
+       http://cxf.apache.org/schemas/configuration/http-jetty.xsd 
http://cxf.apache.org/configuration/security
+       http://cxf.apache.org/schemas/configuration/security.xsd 
http://cxf.apache.org/transports/http/configuration
+       http://cxf.apache.org/schemas/configuration/http-conf.xsd ">
+       <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+       <jaxrs:server id="restService" 
address="https://localhost:8181/CxfRsProducerTest/";
+               staticSubresourceResolution="true">
+               <jaxrs:serviceBeans>
+                       <ref bean="customerService"/>
+               </jaxrs:serviceBeans>
+       </jaxrs:server>
+
+       <bean id="customerService" 
class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/>
+       
+       <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
+               <route>
+                       <from uri="direct://http"/>
+                       <to 
uri="cxfrs://https://localhost:8181/CxfRsProducerTest/"/>
+                       
+               </route>
+       </camelContext>
+
+       <httpj:engine-factory id="tls-config">
+               <httpj:engine port="8181">
+                       <httpj:tlsServerParameters>
+                               <sec:keyManagers keyPassword="password">
+                                       <sec:keyStore type="JKS" 
password="password"  
file="src/test/resources/org/apache/camel/component/cxf/jaxrs/Bethal.jks"/>
+                               </sec:keyManagers>
+                               <sec:trustManagers>
+                                       <sec:keyStore type="JKS" 
password="password" 
file="src/test/resources/org/apache/camel/component/cxf/jaxrs/Truststore.jks"/>
+                               </sec:trustManagers>
+                       </httpj:tlsServerParameters>
+               </httpj:engine>
+       </httpj:engine-factory>
+
+       <http:conduit name="*.http-conduit">
+               <http:client ConnectionTimeout="3000000" 
ReceiveTimeout="3000000"/>
+               <http:tlsClientParameters disableCNCheck="true">
+                       <sec:keyManagers keyPassword="password">
+                               <sec:keyStore type="JKS" password="password"  
file="src/test/resources/org/apache/camel/component/cxf/jaxrs/Morpit.jks"/>
+                       </sec:keyManagers>
+                       <sec:trustManagers>
+                               <sec:keyStore type="JKS" password="password" 
file="src/test/resources/org/apache/camel/component/cxf/jaxrs/Truststore.jks"/>
+                       </sec:trustManagers>
+               </http:tlsClientParameters>
+       </http:conduit>
+
+</beans>

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Morpit.jks
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Morpit.jks?rev=1167448&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Morpit.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Truststore.jks
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Truststore.jks?rev=1167448&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/Truststore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to