You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by wt...@apache.org on 2009/02/24 05:10:50 UTC

svn commit: r747271 - in /camel/trunk/components: camel-cxf/ camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/ camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/ camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/...

Author: wtam
Date: Tue Feb 24 04:10:49 2009
New Revision: 747271

URL: http://svn.apache.org/viewvc?rev=747271&view=rev
Log:
[CAMEL-1308] camel-cxf to support jaxrs consumer

Added:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java   (with props)
    camel/trunk/components/camel-cxf/src/main/resources/META-INF/services/org/apache/camel/component/cxfbean
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java   (with props)
    camel/trunk/components/camel-cxf/src/test/resources/log4j.properties   (with props)
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml   (with props)
Removed:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/
    camel/trunk/components/camel-cxf/src/main/resources/META-INF/services/org/apache/camel/component/cxf-jaxrs
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfJaxrsConsumerTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/
Modified:
    camel/trunk/components/camel-cxf/pom.xml
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java

Modified: camel/trunk/components/camel-cxf/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/pom.xml?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/pom.xml (original)
+++ camel/trunk/components/camel-cxf/pom.xml Tue Feb 24 04:10:49 2009
@@ -75,7 +75,7 @@
   </pluginRepositories>
 
   <dependencies>
-
+  
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
@@ -83,34 +83,12 @@
 
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-core</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.camel</groupId>
       <artifactId>camel-spring</artifactId>
     </dependency>
-
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-http</artifactId>
-      <scope>test</scope>
-    </dependency>
     
     <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
-      <version>3.1</version>
-      <scope>test</scope>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
     </dependency>
     
     <dependency>
@@ -119,11 +97,6 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-jaxrs</artifactId>
       <version>${cxf-version}</version>
@@ -133,115 +106,50 @@
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-core</artifactId>
       <version>${cxf-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>com.sun.xml.bind</groupId>
-          <artifactId>jaxb-impl</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-http</artifactId>
       <version>${cxf-version}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-http-jetty</artifactId>
       <version>${cxf-version}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-local</artifactId>
       <version>${cxf-version}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-simple</artifactId>
       <version>${cxf-version}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-jaxws</artifactId>
       <version>${cxf-version}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-management</artifactId>
       <version>${cxf-version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-testutils</artifactId>
-      <version>${cxf-version}</version>
-      <scope>test</scope>
-    </dependency>
+    
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-tools-common</artifactId>
       <version>${cxf-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>com.sun.xml.bind</groupId>
-          <artifactId>jaxb-impl</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <!-- TODO for some reason the jaxb used by CXF is unavailable so we have to provide our own -->
-    <dependency>
-      <groupId>com.sun.xml.bind</groupId>
-      <artifactId>jaxb-impl</artifactId>
-      <version>${jaxb-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.xml</groupId>
-          <artifactId>jsr173</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.jws</groupId>
-          <artifactId>jsr181-api</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.activation</groupId>
-          <artifactId>activation</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>javax.xml.bind</groupId>
-      <artifactId>jaxb-api</artifactId>
-      <version>${jaxb-api-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.xml</groupId>
-          <artifactId>jsr173</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.activation</groupId>
-          <artifactId>activation</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
-      <scope>test</scope>
     </dependency>
 
-    <!--dependency>
-    	<groupId>org.codehaus.woodstox</groupId>
-    	<artifactId>wstx-asl</artifactId>
-    	<version>3.2.4</version>
-    	<exclusions>
-    		<exclusion>
-    			<groupId>stax</groupId>
-    			<artifactId>stax-api</artifactId>
-    		</exclusion>
-    	</exclusions>
-    </dependency-->
-
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
@@ -250,12 +158,71 @@
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
-     </dependency>
+    </dependency>
 
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
-     </dependency>
+    </dependency>
+        
+    <!--  Test Dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-http</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-jetty</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+      <version>3.1</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-testutils</artifactId>
+      <version>${cxf-version}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <scope>test</scope>
+    </dependency>
      
      <dependency>
        <groupId>org.springframework</groupId>
@@ -280,12 +247,10 @@
       <artifactId>easymockclassextension</artifactId>
       <scope>test</scope>
     </dependency>
-
   </dependencies>
 
   <build>
     <defaultGoal>install</defaultGoal>
-
     <resources>
       <resource>
         <directory>src/main/resources</directory>

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,39 @@
+/**
+ * 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.cxfbean;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.cxf.message.Message;
+
+/**
+ * A Strategy to bind a Camel exchange to a CXF message used by {@link CxfBeanDestination}. 
+ * 
+ * @version $Revision$
+ */
+public interface CxfBeanBinding {
+
+    /**
+     * Create a CXF {@link Message} from a Camel exchange.
+     * 
+     * @param camelExchange
+     * @param headerFilterStrategy
+     */
+    Message createCxfMessageFromCamelExchange(Exchange camelExchange, 
+            HeaderFilterStrategy headerFilterStrategy);
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,79 @@
+/**
+ * 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.cxfbean;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+/**
+ * CXF Bean component creates {@link CxfBeanEndpoint} which represents a
+ * bean.  <b>Currently, only JAXRS annotated beans are supported.  In the
+ * future, JAXwS annotated beans and POJO can be supported</b>.
+ * 
+ * @version $Revision$
+ */
+public class CxfBeanComponent extends DefaultComponent {
+
+    private Map<String, CxfBeanEndpoint> endpoints = new HashMap<String, CxfBeanEndpoint>();
+    
+    @SuppressWarnings("unchecked")
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining,
+            Map parameters) throws Exception {
+        CxfBeanEndpoint answer = new CxfBeanEndpoint(remaining, this);
+        setProperties(answer, parameters);
+
+        // add to the endpoints map before calling the endpoint's init() method to 
+        // make sure the the CxfBeanDestination activate() method can find the endpoint 
+        // from the map.
+        endpoints.put(answer.createEndpointUri(), answer);
+        answer.init();
+
+        return answer;
+    }
+
+    @Override
+    protected boolean useIntrospectionOnEndpoint() {
+        // we invoke setProperties ourselves so the bus is set for CxfBeanEndpoint.init()
+        return false;
+    }
+    
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        for (CxfBeanEndpoint endpoint : endpoints.values()) {
+            endpoint.start();
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        for (CxfBeanEndpoint endpoint : endpoints.values()) {
+            endpoint.stop();
+        }
+        super.doStop();
+    }
+    
+    public CxfBeanEndpoint getEndpoint(String endpointUri) {
+        return endpoints.get(endpointUri);
+    }
+
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,87 @@
+/**
+ * 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.cxfbean;
+
+import java.io.IOException;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.cxf.CxfConstants;
+import org.apache.camel.component.cxf.transport.CamelDestination;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.Bus;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.ConduitInitiator;
+
+/**
+ * A CXF transport {@link org.apache.cxf.transport.Destination} that listens 
+ * Camel {@link Exchange} from an associated {@link CxfBeanEndpoint}.
+ *  
+ * @version $Revision$
+ */
+public class CxfBeanDestination extends CamelDestination implements Processor {
+    private static final Log LOG = LogFactory.getLog(CxfBeanDestination.class);
+    private CxfBeanComponent cxfBeanComponent;
+    private CxfBeanEndpoint endpoint;
+
+    public CxfBeanDestination(CxfBeanComponent cxfBeanComponent, Bus bus,
+            ConduitInitiator conduitInitiator,
+            EndpointInfo endpointInfo) throws IOException {
+        super(null, bus, conduitInitiator, endpointInfo);
+        this.cxfBeanComponent = cxfBeanComponent;
+    }
+
+    @Override
+    public void activate() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Activating CxfBeanDestination " + getCamelDestinationUri());
+        }
+
+        endpoint = cxfBeanComponent.getEndpoint(getCamelDestinationUri());
+        
+        if (endpoint == null) {
+            LOG.error("Failed to find endpoint " + getCamelDestinationUri());
+            return;
+        }
+            
+        endpoint.setProcessor(this);
+    }
+
+    @Override
+    public void deactivate() {
+    }
+
+    public void process(Exchange camelExchange) throws Exception {
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Received request : " + camelExchange);
+        }
+        
+        org.apache.cxf.message.Message cxfMessage = 
+            endpoint.getCxfBeanBinding().createCxfMessageFromCamelExchange(camelExchange,
+                    endpoint.getHeaderFilterStrategy());
+                      
+        cxfMessage.put(CxfConstants.CAMEL_EXCHANGE, camelExchange);
+        ((MessageImpl)cxfMessage).setDestination(this);
+
+        // Handling the incoming message
+        // The response message will be send back by the outgoing chain
+        incomingObserver.onMessage(cxfMessage);
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanDestination.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,156 @@
+/**
+ * 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.cxfbean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.component.cxf.CxfHeaderFilterStrategy;
+import org.apache.camel.impl.ProcessorEndpoint;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.util.CamelContextHelper;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.DestinationFactoryManager;
+
+/**
+ * CXF Bean Endpoint is a {@link ProcessorEndpoint} which associated with 
+ * a {@link CxfBeanDestination}.  It delegates the processing of Camel 
+ * Exchanges to the associated CxfBeanDestination.
+ *  
+ * @version $Revision$
+ */
+public class CxfBeanEndpoint extends ProcessorEndpoint {
+    private static final String URI_PREFIX = "cxfbean";
+    private Server server;
+    private Bus bus;
+    private boolean isSetDefaultBus;
+    private CxfBeanBinding cxfBeanBinding = new DefaultCxfBeanBinding();
+    private HeaderFilterStrategy headerFilterStrategy = new CxfHeaderFilterStrategy();
+    
+    public CxfBeanEndpoint(String remaining, CxfBeanComponent component) {
+        super(remaining, component);
+    }
+    
+    public void stop() {
+        server.stop();
+    }
+    
+    public void start() {
+        server.start();
+    }
+
+    @SuppressWarnings("unchecked")
+    public void init() {
+        Object obj = CamelContextHelper.mandatoryLookup(getCamelContext(), getEndpointUri());
+        
+        List<Object> serviceBeans;
+        if (obj instanceof List) {
+            serviceBeans = (List)obj;
+        } else {
+            serviceBeans = new ArrayList<Object>();
+            serviceBeans.add(obj);
+        }
+        
+        if (bus == null) {
+            bus = BusFactory.getDefaultBus();
+        }
+        
+        if (isSetDefaultBus) {
+            BusFactory.setDefaultBus(bus);
+        }
+        
+        registerTransportFactory((CxfBeanComponent)this.getComponent());
+        server = createServerFactoryBean(serviceBeans).create();
+        
+    }
+    
+    @Override
+    protected String createEndpointUri() {
+        return URI_PREFIX + ":" + getEndpointUri();
+    }
+    
+    private JAXRSServerFactoryBean createServerFactoryBean(List<Object> serviceBeans) {
+        JAXRSServerFactoryBean answer = new JAXRSServerFactoryBean();
+        answer.setServiceBeans(serviceBeans);
+        answer.setAddress("camel://" + createEndpointUri());
+        answer.setStart(true);
+        answer.setTransportId(CxfBeanTransportFactory.TRANSPORT_ID);
+        answer.setBus(bus);
+        return answer;
+        
+    }
+    
+    /**
+     * @param cxfBeanComponent 
+     * 
+     */
+    private void registerTransportFactory(CxfBeanComponent cxfBeanComponent) {
+        
+        CxfBeanTransportFactory transportFactory = new CxfBeanTransportFactory();
+        transportFactory.setCxfBeanComponent(cxfBeanComponent);
+        transportFactory.setBus(bus);
+        
+        // register the conduit initiator
+        ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
+        cim.registerConduitInitiator(CxfBeanTransportFactory.TRANSPORT_ID, transportFactory);
+        
+        // register the destination factory
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+        dfm.registerDestinationFactory(CxfBeanTransportFactory.TRANSPORT_ID, transportFactory);    
+        
+    }
+
+    // Properties
+    // -------------------------------------------------------------------------
+
+    public Bus getBus() {
+        return bus;
+    }
+
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
+
+    public void setSetDefaultBus(boolean isSetDefaultBus) {
+        this.isSetDefaultBus = isSetDefaultBus;
+    }
+
+    public boolean isSetDefaultBus() {
+        return isSetDefaultBus;
+    }
+
+    public void setCxfBeanBinding(CxfBeanBinding cxfBeanBinding) {
+        this.cxfBeanBinding = cxfBeanBinding;
+    }
+
+    public CxfBeanBinding getCxfBeanBinding() {
+        return cxfBeanBinding;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) {
+        this.headerFilterStrategy = headerFilterStrategy;
+    }
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,30 @@
+/**
+ * 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.cxfbean;
+
+/**
+ * @version $Revision$
+ */
+public interface CxfBeanHeaderNames {
+    
+    String VERB = "CamelCxfBeanVerb";
+    String CONTENT_TYPE = "CamelCxfBeanContextType";
+    String CHARACTER_ENCODING = "CamelCxfBeanCharacterEncoding";
+    String PATH = "CamelCxfBeanRequestPath";
+    String BASE_PATH = "CamelCxfBeanRequestBasePath";
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,57 @@
+/**
+ * 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.cxfbean;
+
+import java.io.IOException;
+
+import org.apache.camel.component.cxf.transport.CamelTransportFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Destination;
+
+/**
+ * CXF Bean TransportFactory that overrides CamelTransportFactory to create
+ * a specific Destination (@link CxfBeanDestination}.
+ * 
+ * @version $Revision$
+ */
+public class CxfBeanTransportFactory extends CamelTransportFactory  {
+    public static final String TRANSPORT_ID = "http://cxf.apache.org/transports/camel/cxfbean";
+    private static final Log LOG = LogFactory.getLog(CxfBeanTransportFactory.class);
+    private CxfBeanComponent cxfBeanComponent;
+ 
+    @Override
+    public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Create CxfBeanDestination: " + endpointInfo);
+        }
+        
+        // lookup endpoint from component instead of CamelContext because it may not
+        // be added to the CamelContext yet.
+        return new CxfBeanDestination(cxfBeanComponent, getBus(), this, endpointInfo);
+    }
+
+    /**
+     * @param cxfBeanComponent
+     */
+    public void setCxfBeanComponent(CxfBeanComponent cxfBeanComponent) {
+        this.cxfBeanComponent = cxfBeanComponent;
+        
+    }
+    
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTransportFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,146 @@
+/**
+ * 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.cxfbean;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.cxf.CxfSoapBinding;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.message.Message;
+
+/**
+ *
+ * @version $Revision$
+ */
+public class DefaultCxfBeanBinding implements CxfBeanBinding {
+    private static final Log LOG = LogFactory.getLog(DefaultCxfBeanBinding.class);
+
+    public Message createCxfMessageFromCamelExchange(Exchange camelExchange, 
+            HeaderFilterStrategy headerFilterStrategy) {
+        
+        org.apache.camel.Message camelMessage = camelExchange.getIn();
+
+        // request content types
+        String requestContentType = getRequestContentType(camelMessage); 
+        
+        // accept content types
+        String acceptContentTypes = camelMessage.getHeader("Accept", String.class);
+        if (acceptContentTypes == null) {
+            acceptContentTypes = "*/*";
+        }
+        
+        String enc = getCharacterEncoding(camelMessage); 
+        
+        // path
+        String path = getPath(camelMessage);
+
+        // base path
+        String basePath = getBasePath(camelExchange);
+        
+        // verb
+        String verb = getVerb(camelMessage);
+        
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Processing " + camelExchange + ", requestContentType = " + requestContentType 
+                    + ", acceptContentTypes = " + acceptContentTypes + ", encoding = " + enc
+                    + ", path = " + path + ", basePath = " + basePath + ", verb = " + verb); 
+        }
+        
+    
+        org.apache.cxf.message.Message answer = 
+            CxfSoapBinding.getCxfInMessage(headerFilterStrategy, camelExchange, false);
+        
+        answer.put(org.apache.cxf.message.Message.REQUEST_URI, path);
+        answer.put(org.apache.cxf.message.Message.BASE_PATH, basePath);
+        answer.put(org.apache.cxf.message.Message.HTTP_REQUEST_METHOD, verb);
+        answer.put(org.apache.cxf.message.Message.PATH_INFO, path);
+        answer.put(org.apache.cxf.message.Message.CONTENT_TYPE, requestContentType);
+        answer.put(org.apache.cxf.message.Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
+        answer.put(org.apache.cxf.message.Message.ENCODING, enc);
+        
+        // TODO propagate security context
+
+        return answer;
+    }
+
+    protected String getPath(org.apache.camel.Message camelMessage) {
+        String answer = camelMessage.getHeader(CxfBeanHeaderNames.PATH, String.class);
+
+        if (answer == null) {
+            // try http component header
+            answer = camelMessage.getHeader("org.apache.camel.component.http.path", String.class);
+        }
+        
+        return answer;
+    }
+    
+    protected String getBasePath(Exchange camelExchange) {
+        String answer = camelExchange.getIn().getHeader(CxfBeanHeaderNames.BASE_PATH, String.class);
+
+        if (answer == null) {
+            answer = camelExchange.getFromEndpoint().getEndpointUri();
+        }
+        
+        return answer;
+    }
+
+    protected String getVerb(org.apache.camel.Message camelMessage) {
+        String answer = camelMessage.getHeader(CxfBeanHeaderNames.VERB, String.class);
+
+        if (answer == null) {
+            // try http component header
+            answer = camelMessage.getHeader("http.requestMethod", String.class);
+        }
+        
+        return answer;
+    }
+
+    protected String getCharacterEncoding(org.apache.camel.Message camelMessage) {
+        String answer = camelMessage.getHeader(CxfBeanHeaderNames.CHARACTER_ENCODING, String.class);
+       
+        if (answer == null) {
+            // try http component header
+            answer = camelMessage.getHeader("org.apache.camel.component.http.characterEncoding", 
+                    String.class);
+        }
+        
+        return answer;
+
+    }
+
+    protected String getRequestContentType(org.apache.camel.Message camelMessage) {
+        String answer = camelMessage.getHeader(CxfBeanHeaderNames.CONTENT_TYPE, String.class);
+
+        if (answer != null) {
+            return answer;
+        }
+        
+        if (answer == null) {
+            // try http component header
+            answer = camelMessage.getHeader("org.apache.camel.component.http.contentType", String.class);
+        }
+        
+        if (answer != null) {
+            return answer;
+        }
+        
+        // return default
+        return answer = "*/*";
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java Tue Feb 24 04:10:49 2009
@@ -58,6 +58,7 @@
     CamelContext camelContext;
     Consumer consumer;
     String camelDestinationUri;
+
     private ProducerTemplate camelTemplate;
     private Endpoint distinationEndpoint;
     private HeaderFilterStrategy headerFilterStrategy;
@@ -164,6 +165,10 @@
         }
         return endpointInfo.getName().toString() + BASE_BEAN_NAME_SUFFIX;
     }
+    
+    public String getCamelDestinationUri() {
+        return camelDestinationUri;
+    }
 
     private void initConfig() {
         //we could configure the camel context here

Added: camel/trunk/components/camel-cxf/src/main/resources/META-INF/services/org/apache/camel/component/cxfbean
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/resources/META-INF/services/org/apache/camel/component/cxfbean?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/resources/META-INF/services/org/apache/camel/component/cxfbean (added)
+++ camel/trunk/components/camel-cxf/src/main/resources/META-INF/services/org/apache/camel/component/cxfbean Tue Feb 24 04:10:49 2009
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.cxf.cxfbean.CxfBeanComponent

Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java Tue Feb 24 04:10:49 2009
@@ -0,0 +1,119 @@
+/**
+ * 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.cxfbean;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+/**
+ *
+ * @version $Revision$
+ */
+@ContextConfiguration
+public class CxfBeanTest extends AbstractJUnit38SpringContextTests {
+    private static final String PUT_REQUEST = "<Customer><name>Mary</name><id>123</id></Customer>";
+    private static final String POST_REQUEST = "<Customer><name>Jack</name></Customer>";
+    
+    @Autowired
+    protected CamelContext context;
+    
+    @Override
+    public void setUp() throws Exception {
+        RouteBuilder builder = createRouteBuilder();
+        context.addRoutes(builder);
+    }
+    
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://localhost:9000?matchOnUriPrefix=true").to("cxfbean:customerServiceBean");   
+
+            }
+            
+        };
+    }   
+    
+    public void testGetConsumer() throws Exception {
+        
+        URL url = new URL("http://localhost:9000/customerservice/customers/123");
+
+        InputStream in = url.openStream();
+        assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}", getStringFromInputStream(in));
+
+        url = new URL("http://localhost:9000/customerservice/orders/223/products/323");
+        in = url.openStream();
+        assertEquals("{\"Product\":{\"description\":\"product 323\",\"id\":323}}", getStringFromInputStream(in));
+        
+    }
+
+    
+    public void testPutConsumer() throws Exception {
+        PutMethod put = new PutMethod("http://localhost:9000/customerservice/customers");
+        RequestEntity entity = new StringRequestEntity(PUT_REQUEST, "text/xml", "ISO-8859-1");
+        put.setRequestEntity(entity);
+        HttpClient httpclient = new HttpClient();
+
+        try {
+            assertEquals(200, httpclient.executeMethod(put));
+            assertEquals("", put.getResponseBodyAsString());
+        } finally {
+            put.releaseConnection();
+        }
+    }
+    
+    public void testPostConsumer() throws Exception {
+        PostMethod post = new PostMethod("http://localhost:9000/customerservice/customers");
+        post.addRequestHeader("Accept" , "text/xml");
+        RequestEntity entity = new StringRequestEntity(POST_REQUEST, "text/xml", "ISO-8859-1");
+        post.setRequestEntity(entity);
+        HttpClient httpclient = new HttpClient();
+
+        try {
+            assertEquals(200, httpclient.executeMethod(post));
+            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
+                    post.getResponseBodyAsString());
+        } finally {
+            post.releaseConnection();
+        }
+
+    }
+    
+    private static String getStringFromInputStream(InputStream in) throws Exception {
+        CachedOutputStream bos = new CachedOutputStream();
+        IOUtils.copy(in, bos);
+        in.close();
+        bos.close();
+        return bos.getOut().toString();
+    }
+
+
+}

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: camel/trunk/components/camel-cxf/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/log4j.properties?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/log4j.properties (added)
+++ camel/trunk/components/camel-cxf/src/test/resources/log4j.properties Tue Feb 24 04:10:49 2009
@@ -0,0 +1,38 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, file
+
+log4j.logger.org.apache.activemq.spring=WARN
+#log4j.logger.org.apache.camel.component=TRACE
+log4j.logger.org.apache.camel.impl.converter=WARN
+log4j.logger.org.apache.camel.component.cxf=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-cxf-test.log
+log4j.appender.file.append=true

Propchange: camel/trunk/components/camel-cxf/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-cxf/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml?rev=747271&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml (added)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml Tue Feb 24 04:10:49 2009
@@ -0,0 +1,35 @@
+<?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/cxfEndpoint"
+	xmlns:util="http://www.springframework.org/schema/util"
+	xsi:schemaLocation="
+       http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring  http://camel.apache.org/schema/spring/camel-spring.xsd
+       http://camel.apache.org/schema/cxfEndpoint http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
+    ">
+    
+	<camelContext id="camelContext"
+		xmlns="http://camel.apache.org/schema/spring">
+	</camelContext>
+	
+	<util:list id="customerServiceBean">
+		<bean class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" />
+	</util:list>
+	
+</beans>
\ No newline at end of file

Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java Tue Feb 24 04:10:49 2009
@@ -30,10 +30,19 @@
 public class CamelServlet extends HttpServlet {
 
     private ConcurrentHashMap<String, HttpConsumer> consumers = new ConcurrentHashMap<String, HttpConsumer>();
+    private boolean matchOnUriPrefix;
 
-    public CamelServlet() {
+    /**
+     * @param matchOnUriPrefix the matchOnUriPrefix to set
+     */
+    public void setMatchOnUriPrefix(boolean matchOnUriPrefix) {
+        this.matchOnUriPrefix = matchOnUriPrefix;
     }
 
+    public CamelServlet(boolean matchOnUriPrefix) {
+        this.matchOnUriPrefix = matchOnUriPrefix;
+    }
+    
     @Override
     protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         try {
@@ -64,7 +73,17 @@
 
     protected HttpConsumer resolve(HttpServletRequest request) {
         String path = request.getPathInfo();
-        return consumers.get(path);
+        HttpConsumer answer = consumers.get(path);
+               
+        if (answer == null && matchOnUriPrefix) {
+            for (String key : consumers.keySet()) {
+                if (path.startsWith(key)) {
+                    answer = consumers.get(key);
+                    break;
+                }
+            }
+        }
+        return answer;
     }
 
     public void connect(HttpConsumer consumer) {
@@ -75,4 +94,9 @@
         consumers.remove(consumer.getPath());
     }
 
+    public boolean isMatchOnUriPrefix() {
+        return matchOnUriPrefix;
+    }
+    
+
 }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Tue Feb 24 04:10:49 2009
@@ -39,6 +39,7 @@
     protected HttpClientConfigurer httpClientConfigurer;
     protected HttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
     protected HttpBinding httpBinding;
+    private boolean matchOnUriPrefix;
 
     /**
      * Connects the URL specified on the endpoint to the specified processor.
@@ -85,6 +86,8 @@
         if (ref != null) {
             httpClientConfigurer = CamelContextHelper.mandatoryLookup(getCamelContext(), ref, HttpClientConfigurer.class);
         }
+        
+        matchOnUriPrefix = Boolean.parseBoolean(getAndRemoveParameter(parameters, "matchOnUriPrefix", String.class));
     }
     
     @Override
@@ -148,4 +151,9 @@
     public void setHttpBinding(HttpBinding httpBinding) {
         this.httpBinding = httpBinding;
     }
+
+    public boolean isMatchOnUriPrefix() {
+        return matchOnUriPrefix;
+    }
+    
 }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java Tue Feb 24 04:10:49 2009
@@ -77,9 +77,13 @@
                 map.put(name, value);
             }
         }
-
-        // store the method and query as well
+        
+        // store the method and query and other info in headers
         map.put(HttpMethods.HTTP_METHOD, request.getMethod());
         map.put(HttpProducer.QUERY, request.getQueryString());
+        map.put(HttpProducer.PATH, request.getPathInfo());
+        map.put(HttpProducer.CONTENT_TYPE, request.getContentType());
+        map.put(HttpProducer.CHARACTER_ENCODING, request.getCharacterEncoding());
+
     }
 }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java Tue Feb 24 04:10:49 2009
@@ -48,6 +48,10 @@
     public static final String HTTP_URI = "http.uri";
     public static final String HTTP_RESPONSE_CODE = "http.responseCode";
     public static final String QUERY = "org.apache.camel.component.http.query";    
+    public static final String PATH = "org.apache.camel.component.http.path";  
+    public static final String CONTENT_TYPE = "org.apache.camel.component.http.contentType";
+    public static final String CHARACTER_ENCODING = "org.apache.camel.component.http.characterEncoding";
+
     private static final transient Log LOG = LogFactory.getLog(HttpProducer.class);
     private HttpClient httpClient;
 

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java (original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java Tue Feb 24 04:10:49 2009
@@ -36,6 +36,11 @@
 
     private static final long serialVersionUID = 1L;
 
+     
+    public CamelContinuationServlet(boolean matchOnUriPrefix) {
+        super(matchOnUriPrefix);
+    }
+        
     @Override
     protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         try {

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java?rev=747271&r1=747270&r2=747271&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java (original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java Tue Feb 24 04:10:49 2009
@@ -27,6 +27,7 @@
 import org.apache.camel.component.http.HttpEndpoint;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.URISupport;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
 import org.apache.commons.httpclient.params.HttpClientParams;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -88,7 +89,7 @@
         configureParameters(parameters);
 
         // restructure uri to be based on the parameters left as we dont want to include the Camel internal options
-        URI httpUri = URISupport.createRemainingURI(new URI(uri), parameters);
+        URI httpUri = URISupport.createRemainingURI(new URI(UnsafeUriCharactersEncoder.encode(uri)), parameters);
         uri = httpUri.toString();
 
         JettyHttpEndpoint result = new JettyHttpEndpoint(this, uri, httpUri, params, getHttpConnectionManager(), httpClientConfigurer);
@@ -248,7 +249,7 @@
     }
 
     protected CamelServlet createServletForConnector(Connector connector) throws Exception {
-        CamelServlet camelServlet = new CamelContinuationServlet();
+        CamelServlet camelServlet = new CamelContinuationServlet(isMatchOnUriPrefix());
         
         Context context = new Context(server, "/", Context.NO_SECURITY | Context.NO_SESSIONS);
         context.setConnectorNames(new String[] {connector.getName()});