Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 11353 invoked from network); 10 Feb 2009 05:13:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Feb 2009 05:13:50 -0000 Received: (qmail 96911 invoked by uid 500); 10 Feb 2009 05:13:50 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 96863 invoked by uid 500); 10 Feb 2009 05:13:50 -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 96854 invoked by uid 99); 10 Feb 2009 05:13:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2009 21:13:50 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Feb 2009 05:13:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A6E9823889F3; Tue, 10 Feb 2009 05:13:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r742855 - in /camel/branches/camel-1.x: ./ components/camel-restlet/src/main/java/org/apache/camel/component/restlet/ components/camel-restlet/src/test/java/org/apache/camel/component/restlet/ Date: Tue, 10 Feb 2009 05:13:26 -0000 To: commits@camel.apache.org From: wtam@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090210051326.A6E9823889F3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: wtam Date: Tue Feb 10 05:13:25 2009 New Revision: 742855 URL: http://svn.apache.org/viewvc?rev=742855&view=rev Log: Merged revisions 742854 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk ........ r742854 | wtam | 2009-02-10 00:08:31 -0500 (Tue, 10 Feb 2009) | 1 line [CAMEL-1329] Restlet default binding to propagate query string to Camel message ........ Added: camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletQueryTest.java - copied unchanged from r742854, camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletQueryTest.java Modified: camel/branches/camel-1.x/ (props changed) camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java Propchange: camel/branches/camel-1.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Feb 10 05:13:25 2009 @@ -1 +1 @@ -/camel/trunk:739733,739904,740251,740295,740306,740596,740663,741848,742231,742705 +/camel/trunk:739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742854 Propchange: camel/branches/camel-1.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java?rev=742855&r1=742854&r2=742855&view=diff ============================================================================== --- camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java (original) +++ camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java Tue Feb 10 05:13:25 2009 @@ -33,6 +33,7 @@ import org.restlet.data.ChallengeScheme; import org.restlet.data.Form; import org.restlet.data.MediaType; +import org.restlet.data.Parameter; import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; @@ -56,12 +57,13 @@ public void populateExchangeFromRestletRequest(Request request, Exchange exchange) throws Exception { + Message inMessage = exchange.getIn(); // extract headers from restlet for (Map.Entry entry : request.getAttributes().entrySet()) { if (!headerFilterStrategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue())) { - exchange.getIn().setHeader(entry.getKey(), entry.getValue()); + inMessage.setHeader(entry.getKey(), entry.getValue()); if (LOG.isDebugEnabled()) { LOG.debug("Populate exchange from Restlet request header: " + entry.getKey() + " value: " + entry.getValue()); @@ -70,6 +72,12 @@ } } + // copy query string to header + String query = request.getResourceRef().getQuery(); + if (null != query) { + inMessage.setHeader(RestletConstants.QUERY_STRING, query); + } + if (!request.isEntityAvailable()) { return; } @@ -79,7 +87,7 @@ for (Map.Entry entry : form.getValuesMap().entrySet()) { // extract body added to the form as the key which has null value if (entry.getValue() == null) { - exchange.getIn().setBody(entry.getKey()); + inMessage.setBody(entry.getKey()); if (LOG.isDebugEnabled()) { LOG.debug("Populate exchange from Restlet request body: " + entry.getValue()); } @@ -87,7 +95,7 @@ if (!headerFilterStrategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue())) { - exchange.getIn().setHeader(entry.getKey(), entry.getValue()); + inMessage.setHeader(entry.getKey(), entry.getValue()); if (LOG.isDebugEnabled()) { LOG.debug("Populate exchange from Restlet request user header: " + entry.getKey() + " value: " + entry.getValue()); @@ -95,8 +103,7 @@ } } } - } - + } } /** Modified: camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java?rev=742855&r1=742854&r2=742855&view=diff ============================================================================== --- camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java (original) +++ camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java Tue Feb 10 05:13:25 2009 @@ -27,6 +27,7 @@ public static final String PASSWORD = "org.apache.camel.restlet.auth.password"; public static final String MEDIA_TYPE = "org.apache.camel.restlet.mediaType"; public static final String RESPONSE_CODE = "org.apache.camel.restlet.responseCode"; + public static final String QUERY_STRING = "org.apache.camel.restlet.queryString"; private RestletConstants() { }