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/01/23 03:42:42 UTC

svn commit: r736894 - in /camel/branches/camel-1.x: ./ components/camel-restlet/ 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: Thu Jan 22 18:42:41 2009
New Revision: 736894

URL: http://svn.apache.org/viewvc?rev=736894&view=rev
Log:
Merged revisions 736562 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r736562 | wtam | 2009-01-21 23:58:43 -0500 (Wed, 21 Jan 2009) | 1 line
  
  [CAMEL-1284] Restlet binding does not properly insert/extract Restlet message.
........

Added:
    camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletPostContentTest.java
      - copied unchanged from r736562, camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletPostContentTest.java
    camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java
      - copied unchanged from r736562, camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java
Removed:
    camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRouteBuilderTest.java
Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/components/camel-restlet/pom.xml
    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/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 22 18:42:41 2009
@@ -1,2 +1,2 @@
 /activemq/camel/trunk:732943,733749,734053,734057-734058,734064,734130,734309,734340-734342,734348,734392,734422,734727,734903,734932,735421,735427,735732
-/camel/trunk:735847,735888,736227,736617-736620
+/camel/trunk:735847,735888,736227,736562,736617-736620

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-1.x/components/camel-restlet/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-restlet/pom.xml?rev=736894&r1=736893&r2=736894&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-restlet/pom.xml (original)
+++ camel/branches/camel-1.x/components/camel-restlet/pom.xml Thu Jan 22 18:42:41 2009
@@ -75,6 +75,13 @@
     </dependency>
 
     <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+      <version>3.1</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
       <scope>test</scope>

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=736894&r1=736893&r2=736894&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 Thu Jan 22 18:42:41 2009
@@ -42,7 +42,6 @@
  */
 public class DefaultRestletBinding implements RestletBinding, HeaderFilterStrategyAware {
     private static final Log LOG = LogFactory.getLog(DefaultRestletBinding.class);
-    private static final String CAMEL_REQUEST = "camel.request";
     private HeaderFilterStrategy headerFilterStrategy;
 
     /**
@@ -68,13 +67,13 @@
 
             }
         }
-
-        // extract our header and body
+        
         Form form = new Form(request.getEntity());
         if (form != null) {
             for (Map.Entry<String, String> entry : form.getValuesMap().entrySet()) {
-                if (CAMEL_REQUEST.equals(entry.getKey())) {
-                    exchange.getIn().setBody(entry.getValue());
+                // extract body added to the form as the key which has null value
+                if (entry.getValue() == null) {
+                    exchange.getIn().setBody(entry.getKey());
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Populate exchange from Restlet request body: " + entry.getValue());
                     }
@@ -91,6 +90,7 @@
                 }
             }
         }
+        
     }   
 
     /**
@@ -104,7 +104,8 @@
         request.setReferrerRef("camel-restlet");
         String body = exchange.getIn().getBody(String.class);
         Form form = new Form();
-        form.add(CAMEL_REQUEST, body);
+        // add the body as the key in the form with null value
+        form.add(body, null);
         
         if (LOG.isDebugEnabled()) {
             LOG.debug("Populate Restlet request from exchange body: " + body);

Modified: camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java?rev=736894&r1=736893&r2=736894&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java (original)
+++ camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java Thu Jan 22 18:42:41 2009
@@ -53,6 +53,7 @@
         assertTrue(response.contains("requires user authentication"));
     }
 
+    @Override
     protected ClassPathXmlApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext(
                 "org/apache/camel/component/restlet/camel-context.xml");