camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1164095 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/component/language/ test/java/org/apache/camel/component/language/
Date Thu, 01 Sep 2011 14:51:23 GMT
Author: hadrian
Date: Thu Sep  1 14:51:23 2011
New Revision: 1164095

URL: http://svn.apache.org/viewvc?rev=1164095&view=rev
Log:
CAMEL-4404. URL decode script in language: uris

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageComponent.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageComponent.java?rev=1164095&r1=1164094&r2=1164095&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageComponent.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageComponent.java
Thu Sep  1 14:51:23 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.language;
 
+import java.net.URLDecoder;
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
@@ -47,10 +48,9 @@ public class LanguageComponent extends D
 
         Expression expression = null;
         if (ObjectHelper.isNotEmpty(script)) {
-            expression = language.createExpression(script);
+            expression = language.createExpression(URLDecoder.decode(script, "UTF-8"));
         }
 
         return new LanguageEndpoint(uri, this, language, expression);
     }
-
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java?rev=1164095&r1=1164094&r2=1164095&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
Thu Sep  1 14:51:23 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.language;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Expression;
@@ -72,7 +75,13 @@ public class LanguageEndpoint extends De
 
     @Override
     protected String createEndpointUri() {
-        return languageName + ":" + script;
+        String s = script;
+        try {
+            s = URLEncoder.encode(s, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            // ignore
+        }
+        return languageName + ":" + s;
     }
 
     public Language getLanguage() {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java?rev=1164095&r1=1164094&r2=1164095&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteNoTransformTest.java
Thu Sep  1 14:51:23 2011
@@ -37,7 +37,7 @@ public class LanguageRouteNoTransformTes
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("direct:start").to("language:simple:Hello ${body}?transform=false").to("mock:result");
+                from("direct:start").to("language:simple:Hello+${body}?transform=false").to("mock:result");
             }
         };
     }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java?rev=1164095&r1=1164094&r2=1164095&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageRouteTest.java
Thu Sep  1 14:51:23 2011
@@ -38,7 +38,7 @@ public class LanguageRouteTest extends C
             @Override
             public void configure() throws Exception {
                 // START SNIPPET: e1
-                from("direct:start").to("language:simple:Hello ${body}").to("mock:result");
+                from("direct:start").to("language:simple:Hello+${body}").to("mock:result");
                 // END SNIPPET: e1
             }
         };

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java?rev=1164095&r1=1164094&r2=1164095&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/language/LanguageScriptInHeaderRouteTakePrecedenceTest.java
Thu Sep  1 14:51:23 2011
@@ -46,7 +46,7 @@ public class LanguageScriptInHeaderRoute
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("direct:start").to("language:simple:Bye ${body}").to("mock:result");
+                from("direct:start").to("language:simple:Bye+${body}").to("mock:result");
             }
         };
     }



Mime
View raw message