Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C46A9160C15 for ; Wed, 3 Jan 2018 14:36:04 +0100 (CET) Received: (qmail 79207 invoked by uid 500); 3 Jan 2018 13:36:04 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 79198 invoked by uid 99); 3 Jan 2018 13:36:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2018 13:36:03 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 4E013850C9; Wed, 3 Jan 2018 13:36:03 +0000 (UTC) Date: Wed, 03 Jan 2018 13:36:03 +0000 To: "commits@camel.apache.org" Subject: [camel] branch camel-2.20.x updated: CAMEL-12097- handle if both path and query params set and supress with the value in the path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <151498656304.9842.15334885080391393752@gitbox.apache.org> From: davsclaus@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: camel X-Git-Refname: refs/heads/camel-2.20.x X-Git-Reftype: branch X-Git-Oldrev: 83280c75ed0c6dbfc490a9d0fb9c1d659aff7d6e X-Git-Newrev: b0ed33d049368510b0901d57ef046d2edefd5051 X-Git-Rev: b0ed33d049368510b0901d57ef046d2edefd5051 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Wed, 03 Jan 2018 13:36:05 -0000 This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-2.20.x in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/camel-2.20.x by this push: new b0ed33d CAMEL-12097- handle if both path and query params set and supress with the value in the path b0ed33d is described below commit b0ed33d049368510b0901d57ef046d2edefd5051 Author: onders86 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" '].