This is an automated email from the ASF dual-hosted git repository.

onders pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 71d64e7  CAMEL-12097- handle if both path and query params set and 
supress with the value in the path
71d64e7 is described below

commit 71d64e7d706f578b8a363539a2e6583007f9e2be
Author: onders86 <ondersez...@gmail.com>
AuthorDate: Tue Jan 2 18:12:44 2018 +0300

    CAMEL-12097- handle if both path and query params set and supress with the 
value in the path
---
 .../java/org/apache/camel/component/restlet/RestletProducer.java | 9 +++++----
 .../org/apache/camel/component/restlet/RestletProducerTest.java  | 8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
 
b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
index 47c0293..b4c3b25 100644
--- 
a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
+++ 
b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
@@ -211,10 +211,6 @@ public class RestletProducer extends DefaultAsyncProducer {
         if (uri == null) {
             uri = endpoint.getProtocol() + "://" + endpoint.getHost() + ":" + 
endpoint.getPort() + endpoint.getUriPattern();
         }
-        // include any query parameters if needed
-        if (endpoint.getQueryParameters() != null) {
-            uri = URISupport.appendParametersToURI(uri, 
endpoint.getQueryParameters());
-        }
 
         // substitute { } placeholders in uri and use mandatory headers
         LOG.trace("Substituting '{value}' placeholders in uri: {}", uri);
@@ -235,6 +231,11 @@ public class RestletProducer extends DefaultAsyncProducer {
             // we replaced uri so reset and go again
             matcher.reset(uri);
         }
+        
+        // include any query parameters if needed
+        if (endpoint.getQueryParameters() != null) {
+            uri = URISupport.appendParametersToURI(uri, 
endpoint.getQueryParameters());
+        }
 
         // rest producer may provide an override query string to be used which 
we should discard if using (hence the remove)
         String query = (String) 
exchange.getIn().removeHeader(Exchange.REST_HTTP_QUERY);
diff --git 
a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
 
b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
index 34ccd05..f2e6828 100644
--- 
a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
+++ 
b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
@@ -33,6 +33,12 @@ public class RestletProducerTest extends RestletTestSupport {
     }
     
     @Test
+    public void testRestletProducerGetWithPathQueryParams() throws Exception {
+        String out = 
template.requestBodyAndHeader("direct:startWithPathQueryParams", null, "id", 
123, String.class);
+        assertEquals("1235;Donald Duck", out);
+    }
+    
+    @Test
     public void testRestletProducerDelete() throws Exception {
         String out = template.requestBodyAndHeader("direct:delete", null, 
"id", 123, String.class);
         assertEquals("123;Donald Duck", out);
@@ -45,6 +51,8 @@ public class RestletProducerTest extends RestletTestSupport {
             public void configure() throws Exception {
                 from("direct:start").to("restlet:http://localhost:"; + portNum 
+ "/users/{id}/basic").to("log:reply");
                 
+                
from("direct:startWithPathQueryParams").to("restlet:http://localhost:"; + 
portNum + "/users/{id}/basic?id=1235").to("log:reply");
+                
                 from("direct:delete").to("restlet:http://localhost:"; + portNum 
+ "/users/{id}/basic?restletMethod=DELETE");
 
                 from("restlet:http://localhost:"; + portNum + 
"/users/{id}/basic?restletMethods=GET,DELETE")

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Reply via email to