You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/10/28 04:22:36 UTC

[5/5] git commit: CAMEL-7971 Merged the patch into camel-restlet

CAMEL-7971 Merged the patch into camel-restlet


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

Branch: refs/heads/master
Commit: 4697d022862f09e830a4b415be49170f170d57e6
Parents: 617a898
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Oct 28 11:22:02 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Oct 28 11:22:02 2014 +0800

----------------------------------------------------------------------
 .../apache/camel/component/restlet/RestletComponent.java | 11 +++++++----
 .../camel/component/restlet/RestRestletGetTest.java      | 10 +++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4697d022/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index 6681f13..c5f582a 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -20,6 +20,7 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
@@ -557,12 +558,14 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R
         String query = URISupport.createQueryString(map);
 
         String url = "restlet:%s://%s:%s/%s?restletMethod=%s";
+        // must use upper case for restrict
+        String restrict = verb.toUpperCase(Locale.US);
+        // get the endpoint
+        url = String.format(url, scheme, host, port, path, restrict);
         if (!query.isEmpty()) {
-            url = url + "?" + query;
+            url = url + "&" + query;
         }
-
-        // get the endpoint
-        url = String.format(url, scheme, host, port, path, verb);
+        
         RestletEndpoint endpoint = camelContext.getEndpoint(url, RestletEndpoint.class);
         setProperties(endpoint, parameters);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/4697d022/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletGetTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletGetTest.java
index 5c1809e..0e73b54 100644
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletGetTest.java
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletGetTest.java
@@ -19,12 +19,20 @@ package org.apache.camel.component.restlet;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
 
 /**
  * @version 
  */
 public class RestRestletGetTest extends RestletTestSupport {
+    
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBinding", new DefaultRestletBinding());
+        return jndi;
+    }
 
     @Test
     public void testRestletProducerGet() throws Exception {
@@ -38,7 +46,7 @@ public class RestRestletGetTest extends RestletTestSupport {
             @Override
             public void configure() throws Exception {
                 // configure to use restlet on localhost with the given port
-                restConfiguration().component("restlet").host("localhost").port(portNum);
+                restConfiguration().component("restlet").host("localhost").port(portNum).endpointProperty("restletBinding", "#myBinding");
 
                 // use the rest DSL to define the rest services
                 rest("/users/")