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/02/10 06:13:26 UTC
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/
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<String, Object> 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<String, String> 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() {
}