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/06/14 06:28:09 UTC

svn commit: r784507 - in /camel/trunk/components/camel-restlet: ./ src/main/java/org/apache/camel/component/restlet/ src/main/java/org/apache/camel/component/restlet/converter/ src/test/java/org/apache/camel/component/restlet/ src/test/resources/org/ap...

Author: wtam
Date: Sun Jun 14 04:28:08 2009
New Revision: 784507

URL: http://svn.apache.org/viewvc?rev=784507&view=rev
Log:
[CAMEL-1730] Single Restlet consumer endpoint to service multiple methods and uri patterns.

Added:
    camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java   (with props)
    camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java   (with props)
    camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest-context.xml   (with props)
    camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest-context.xml   (with props)
Modified:
    camel/trunk/components/camel-restlet/pom.xml
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/MethodBasedRouter.java
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/converter/RestletConverter.java
    camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerConcurrentTest.java

Modified: camel/trunk/components/camel-restlet/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/pom.xml?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/pom.xml (original)
+++ camel/trunk/components/camel-restlet/pom.xml Sun Jun 14 04:28:08 2009
@@ -96,6 +96,12 @@
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
   <repositories>
     <repository>
@@ -105,4 +111,4 @@
     </repository>
   </repositories>
 
-</project>
\ No newline at end of file
+</project>

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java (original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java Sun Jun 14 04:28:08 2009
@@ -67,6 +67,12 @@
         if (query != null) {
             inMessage.setHeader(RestletConstants.RESTLET_QUERY_STRING, query);
         }
+        
+        // copy URI to header
+        inMessage.setHeader(Exchange.HTTP_URI, request.getResourceRef().getIdentifier(true));
+        
+        // copy HTTP method to header
+        inMessage.setHeader(Exchange.HTTP_METHOD, request.getMethod().toString());
 
         if (!request.isEntityAvailable()) {
             return;

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/MethodBasedRouter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/MethodBasedRouter.java?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/MethodBasedRouter.java (original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/MethodBasedRouter.java Sun Jun 14 04:28:08 2009
@@ -36,6 +36,7 @@
 class MethodBasedRouter extends Restlet {
     private static final Log LOG = LogFactory.getLog(MethodBasedRouter.class);
     private String uriPattern;
+    
     private Map<Method, Restlet> routes = new ConcurrentHashMap<Method, Restlet>();
     private AtomicBoolean hasBeenAttachedFlag = new AtomicBoolean(false);
 
@@ -81,4 +82,7 @@
         return hasBeenAttachedFlag.getAndSet(true);
     }
     
+    String getUriPattern() {
+        return uriPattern;
+    }
 }

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java (original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java Sun Jun 14 04:28:08 2009
@@ -17,12 +17,13 @@
 package org.apache.camel.component.restlet;
 
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.HeaderFilterStrategyComponent;
-import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.URISupport;
 import org.apache.camel.util.UnsafeUriCharactersEncoder;
 import org.apache.commons.logging.Log;
@@ -32,6 +33,7 @@
 import org.restlet.Restlet;
 import org.restlet.Server;
 import org.restlet.data.ChallengeScheme;
+import org.restlet.data.Method;
 import org.restlet.data.Protocol;
 
 /**
@@ -103,44 +105,47 @@
     public void connect(RestletConsumer consumer) throws Exception {
         RestletEndpoint endpoint = (RestletEndpoint)consumer.getEndpoint();
         addServerIfNeccessary(endpoint);
-        MethodBasedRouter router = getMethodRouter(endpoint.getUriPattern());
         
-        Map<String, String> realm = endpoint.getRestletRealm();
-        Restlet target = consumer.getRestlet();
-        if (realm != null && realm.size() > 0) {
-            Guard guard = new Guard(component.getContext().createChildContext(), 
-                    ChallengeScheme.HTTP_BASIC, "Camel-Restlet Endpoint Realm");
-            for (Map.Entry<String, String> entry : realm.entrySet()) {
-                guard.getSecrets().put(entry.getKey(), entry.getValue().toCharArray());
-            }
-            guard.setNext(target);
-            target = guard;
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Target has been set to guard: " + guard);
-            }
+        if (endpoint.getUriPattern() != null && endpoint.getUriPattern().length() > 0) {
+            attachUriPatternToRestlet(endpoint.getUriPattern(), endpoint, consumer.getRestlet());
         }
         
-        router.addRoute(endpoint.getRestletMethod(), target);
-        
-        if (!router.hasBeenAttached()) {
-            component.getDefaultHost().attach(endpoint.getUriPattern(), router);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Attached methodRouter uriPattern: " + endpoint.getUriPattern());
+        if (endpoint.getUriPatterns() != null) {
+            for (String uriPattern : endpoint.getUriPatterns()) {
+                attachUriPatternToRestlet(uriPattern, endpoint, consumer.getRestlet());
             }
         }
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Attached restlet uriPattern: " + endpoint.getUriPattern() + " method: " + endpoint.getRestletMethod());
-        }
     }
 
     public void disconnect(RestletConsumer consumer) throws Exception {
         RestletEndpoint endpoint = (RestletEndpoint)consumer.getEndpoint();
-        MethodBasedRouter router = getMethodRouter(endpoint.getUriPattern());
-        router.removeRoute(endpoint.getRestletMethod());
+        
+        List<MethodBasedRouter> routers = new ArrayList<MethodBasedRouter>();
+        
+        if (endpoint.getUriPattern() != null && endpoint.getUriPattern().length() > 0) {
+            routers.add(getMethodRouter(endpoint.getUriPattern()));
+        }
+        
+        if (endpoint.getUriPatterns() != null) {
+            for (String uriPattern : endpoint.getUriPatterns()) {
+                routers.add(getMethodRouter(uriPattern));
+            }
+        }
+        
+        for (MethodBasedRouter router : routers) {
+            if (endpoint.getRestletMethods() != null) {
+                Method[] methods = endpoint.getRestletMethods();
+                for (Method method : methods) {
+                    router.removeRoute(method);
+                }
+            } else {
+                router.removeRoute(endpoint.getRestletMethod());
+            }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Detached restlet uriPattern: " + endpoint.getUriPattern() + " method: " + endpoint.getRestletMethod());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Detached restlet uriPattern: " + router.getUriPattern() 
+                          + " method: " + endpoint.getRestletMethod());
+            }
         }
     }    
     
@@ -177,6 +182,51 @@
     private static String buildKey(RestletEndpoint endpoint) {
         return endpoint.getHost() + ":" + endpoint.getPort();
     }
+    
+    /**
+     * @param uriPattern
+     * @param endpoint 
+     * @param target 
+     */
+    private void attachUriPatternToRestlet(String uriPattern, RestletEndpoint endpoint, Restlet target) {
+        MethodBasedRouter router = getMethodRouter(uriPattern);
+        
+        Map<String, String> realm = endpoint.getRestletRealm();
+        if (realm != null && realm.size() > 0) {
+            Guard guard = new Guard(component.getContext().createChildContext(), 
+                    ChallengeScheme.HTTP_BASIC, "Camel-Restlet Endpoint Realm");
+            for (Map.Entry<String, String> entry : realm.entrySet()) {
+                guard.getSecrets().put(entry.getKey(), entry.getValue().toCharArray());
+            }
+            guard.setNext(target);
+            target = guard;
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Target has been set to guard: " + guard);
+            }
+        }
+        
+        if (endpoint.getRestletMethods() != null) {
+            Method[] methods = endpoint.getRestletMethods();
+            for (Method method : methods) {
+                router.addRoute(method, target);   
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Attached restlet uriPattern: " + uriPattern + " method: " + method);
+                }
+            }
+        } else {
+            router.addRoute(endpoint.getRestletMethod(), target);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Attached restlet uriPattern: " + uriPattern + " method: " + endpoint.getRestletMethod());
+            }
+        }
+        
+        if (!router.hasBeenAttached()) {
+            component.getDefaultHost().attach(uriPattern, router);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Attached methodRouter uriPattern: " + uriPattern);
+            }
+        }
+    }
 
 }
 

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java (original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java Sun Jun 14 04:28:08 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.restlet;
 
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -43,10 +44,20 @@
     private static final String DEFAULT_HOST = "localhost";
     
     private Method restletMethod = Method.GET;
+
+    // Optional and for consumer only.  This allows a single route to service multiple 
+    // methods.  If it is non-null, restletMethod is ignored.
+    private Method[] restletMethods;
+    
     private String protocol = DEFAULT_PROTOCOL;
     private String host = DEFAULT_HOST;
     private int port = DEFAULT_PORT;
     private String uriPattern;
+    
+    // Optional and for consumer only.  This allows a single route to service multiple 
+    // uriPatterns.  The uriPattern defined in the endpoint will still be honored.
+    private List<String> uriPatterns;
+    
     private Map<String, String> restletRealm;
     private HeaderFilterStrategy headerFilterStrategy;
     private RestletBinding restletBinding;
@@ -172,4 +183,36 @@
         // should always use in out for restlet
         return ExchangePattern.InOut;
     }
+
+    /**
+     * @param restletMethods the restletMethods to set
+     */
+    public void setRestletMethods(Method[] restletMethods) {
+        this.restletMethods = restletMethods;
+    }
+
+    /**
+     * @return the restletMethods
+     */
+    public Method[] getRestletMethods() {
+        return restletMethods;
+    }
+
+    /**
+     * @param uriPatterns the uriPatterns to set
+     */
+    public void setUriPatterns(List<String> uriPatterns) {
+        this.uriPatterns = uriPatterns;
+    }
+
+    /**
+     * @return the uriPatterns
+     */
+    public List<String> getUriPatterns() {
+        return uriPatterns;
+    }
+
+
+
+
 }

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/converter/RestletConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/converter/RestletConverter.java?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/converter/RestletConverter.java (original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/converter/RestletConverter.java Sun Jun 14 04:28:08 2009
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.restlet.converter;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.camel.Converter;
 import org.restlet.data.MediaType;
 import org.restlet.data.Method;
@@ -33,6 +36,18 @@
     }
     
     @Converter
+    public Method[] toMethods(String name) {
+        
+        String[] strings = name.split(",");
+        List<Method> methods = new ArrayList<Method>();
+        for (String string : strings) {
+            methods.add(toMethod(string));
+        }
+        
+        return methods.toArray(new Method[methods.size()]);
+    }
+    
+    @Converter
     public MediaType toMediaType(String name) {
         return MediaType.valueOf(name);
     }

Added: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java?rev=784507&view=auto
==============================================================================
--- camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java (added)
+++ camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java Sun Jun 14 04:28:08 2009
@@ -0,0 +1,102 @@
+/**
+ * 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.restlet;
+
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+/**
+ * This unit test verifies a single route can service multiple methods.
+ * 
+ * @version $Revision$
+ */
+@ContextConfiguration
+public class RestletMultiMethodsEndpointTest extends AbstractJUnit38SpringContextTests {
+
+    @Autowired
+    protected CamelContext context;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        context.addRoutes(createRouteBuilder());
+        context.start();
+    }
+    
+    @Override
+    public void tearDown() throws Exception {
+        context.stop();
+        super.tearDown();
+    }
+
+    public void testPostMethod() throws Exception {
+        HttpMethod method = new PostMethod("http://localhost:9080/users/homer");
+        try {
+            HttpClient client = new HttpClient();
+            assertEquals(200, client.executeMethod(method));
+            assertTrue(method.getResponseHeader("Content-Type").getValue().startsWith("text/plain"));
+            assertEquals("POST", method.getResponseBodyAsString());
+        } finally {
+            method.releaseConnection();
+        }
+
+    }
+
+    public void testGetMethod() throws Exception {
+        HttpMethod method = new GetMethod("http://localhost:9080/users/homer");
+        try {
+            HttpClient client = new HttpClient();
+            assertEquals(200, client.executeMethod(method));
+            assertTrue(method.getResponseHeader("Content-Type").getValue().startsWith("text/plain"));
+            assertEquals("GET", method.getResponseBodyAsString());
+        } finally {
+            method.releaseConnection();
+        }
+
+    }
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+                // START SNIPPET: routeDefinition
+                from("restlet:http://localhost:9080/users/{username}?restletMethods=post,get")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            // echo the method
+                            exchange.getOut().setBody(exchange.getIn().getHeader(Exchange.HTTP_METHOD,
+                                                                                 String.class));
+
+                        }
+                    });
+                // END SNIPPET: routeDefinition
+                
+            }
+        };
+    }
+
+}

Propchange: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java?rev=784507&view=auto
==============================================================================
--- camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java (added)
+++ camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java Sun Jun 14 04:28:08 2009
@@ -0,0 +1,110 @@
+/**
+ * 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.restlet;
+
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+/**
+ * This unit test verifies a single route can service multiple templates.
+ * 
+ * @version $Revision$
+ */
+@ContextConfiguration
+public class RestletMultiUriTemplatesEndpointTest extends AbstractJUnit38SpringContextTests {
+
+    @Autowired
+    protected CamelContext context;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        context.addRoutes(createRouteBuilder());
+        context.start();
+    }
+    
+    @Override
+    public void tearDown() throws Exception {
+        context.stop();
+        super.tearDown();
+    }
+
+    public void testPostUserUriPattern() throws Exception {
+        HttpMethod method = new PostMethod("http://localhost:9080/users/homer");
+        try {
+            HttpClient client = new HttpClient();
+            assertEquals(200, client.executeMethod(method));
+            assertTrue(method.getResponseHeader("Content-Type").getValue().startsWith("text/plain"));
+            assertEquals("POST homer", method.getResponseBodyAsString());
+        } finally {
+            method.releaseConnection();
+        }
+
+    }
+
+    public void testGetAtomUriPattern() throws Exception {
+        HttpMethod method = new GetMethod("http://localhost:9080/atom/collection/foo/component/bar");
+        try {
+            HttpClient client = new HttpClient();
+            assertEquals(200, client.executeMethod(method));
+            assertTrue(method.getResponseHeader("Content-Type").getValue().startsWith("text/plain"));
+            assertEquals("GET foo bar", method.getResponseBodyAsString());
+        } finally {
+            method.releaseConnection();
+        }
+
+    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+                               
+                // START SNIPPET: routeDefinition
+                from("restlet:http://localhost:9080?restletMethods=post,get&uriPatterns=#uriTemplates")
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws Exception {
+                            // echo the method
+                            String uri = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
+                            String out = exchange.getIn().getHeader(Exchange.HTTP_METHOD, String.class);
+                            if ("http://localhost:9080/users/homer".equals(uri)) {
+                                exchange.getOut().setBody(out + " " + exchange.getIn().getHeader("username", String.class));
+                            } else if ("http://localhost:9080/atom/collection/foo/component/bar".equals(uri)) {
+                                exchange.getOut().setBody(out + " " + exchange.getIn().getHeader("id", String.class)
+                                                          + " " + exchange.getIn().getHeader("cid", String.class));
+                                                          
+                            }
+
+                        }
+                    });
+                // END SNIPPET: routeDefinition
+            }
+        };
+    }
+
+}

Propchange: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerConcurrentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerConcurrentTest.java?rev=784507&r1=784506&r2=784507&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerConcurrentTest.java (original)
+++ camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerConcurrentTest.java Sun Jun 14 04:28:08 2009
@@ -32,7 +32,7 @@
 import org.apache.camel.builder.RouteBuilder;
 
 /**
- * Resltet producer concurrent test
+ * Restlet producer concurrent test
  * 
  * @version $Revision$
  */

Added: camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest-context.xml?rev=784507&view=auto
==============================================================================
--- camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest-context.xml (added)
+++ camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest-context.xml Sun Jun 14 04:28:08 2009
@@ -0,0 +1,33 @@
+<?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:context="http://www.springframework.org/schema/context"
+	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://www.springframework.org/schema/context
+           http://www.springframework.org/schema/context/spring-context-2.5.xsd
+       http://camel.apache.org/schema/spring 
+       http://camel.apache.org/schema/spring/camel-spring.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>
+	
+	
+</beans>
\ No newline at end of file

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

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

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

Added: camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest-context.xml?rev=784507&view=auto
==============================================================================
--- camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest-context.xml (added)
+++ camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest-context.xml Sun Jun 14 04:28:08 2009
@@ -0,0 +1,39 @@
+<?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:context="http://www.springframework.org/schema/context"
+	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://www.springframework.org/schema/context
+           http://www.springframework.org/schema/context/spring-context-2.5.xsd
+       http://camel.apache.org/schema/spring 
+       http://camel.apache.org/schema/spring/camel-spring.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>
+	
+	<!-- START SNIPPET: uriTemplates  -->
+	<util:list id="uriTemplates">
+		<value>/users/{username}</value>
+		<value>/atom/collection/{id}/component/{cid}</value>
+	</util:list>
+	<!-- END SNIPPET: uriTemplates -->
+	
+</beans>
\ No newline at end of file

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

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

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