camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r579644 - in /activemq/camel/trunk/components/camel-http/src: main/java/org/apache/camel/component/http/ test/java/org/apache/camel/component/http/
Date Wed, 26 Sep 2007 12:41:49 GMT
Author: jstrachan
Date: Wed Sep 26 05:41:48 2007
New Revision: 579644

URL: http://svn.apache.org/viewvc?rev=579644&view=rev
Log:
applied patch from https://issues.apache.org/activemq/browse/CAMEL-156 by Nicky Sandhu to
support the use of HTTP query options

Added:
    activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
  (with props)
Modified:
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
    activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=579644&r1=579643&r2=579644&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
(original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
Wed Sep 26 05:41:48 2007
@@ -34,6 +34,7 @@
  * @version $Revision: 1.1 $
  */
 public class HttpProducer extends DefaultProducer<HttpExchange> implements Producer<HttpExchange>
{
+    public static final String QUERY = "org.apache.camel.component.http.query";
     private HttpClient httpClient = new HttpClient();
 
     public HttpProducer(HttpEndpoint endpoint) {
@@ -64,7 +65,11 @@
         String uri = ((HttpEndpoint)getEndpoint()).getHttpUri().toString();
         RequestEntity requestEntity = createRequestEntity(exchange);
         if (requestEntity == null) {
-            return new GetMethod(uri);
+            GetMethod method = new GetMethod(uri);
+            if (exchange.getIn().getHeader(QUERY) != null){
+                method.setQueryString(exchange.getIn().getHeader(QUERY, String.class));
+            }
+            return method;
         }
         // TODO we might be PUT? - have some better way to explicitly choose
         // method

Modified: activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java?rev=579644&r1=579643&r2=579644&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
(original)
+++ activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
Wed Sep 26 05:41:48 2007
@@ -61,8 +61,8 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").to("http://www.google.com").to("mock:results");
+                from("direct:start").setHeader(HttpProducer.QUERY,constant("hl=en&q=activemq")).to("http://www.google.com/search").to("mock:results");
             }
         };
     }
-}
\ No newline at end of file
+}

Added: activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java?rev=579644&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
(added)
+++ activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
Wed Sep 26 05:41:48 2007
@@ -0,0 +1,19 @@
+/**
+ * 
+ */
+package org.apache.camel.component.http;
+
+
+/**
+ * TODO Provide description for HttpGetWithQueryParamsTest.
+ * 
+ * @author <a href="mailto:nsandhu@raleys.com">nsandhu</a>
+ *
+ */
+public class HttpGetWithQueryParamsTest extends HttpGetTest{
+    protected void setUp() throws Exception {
+        super.setUp();
+        expectedText = "activemq.apache.org";
+    }
+    
+}

Propchange: activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message