camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r791695 - in /camel/trunk/components: camel-http/src/main/java/org/apache/camel/component/http/ camel-jetty/src/test/java/org/apache/camel/component/jetty/
Date Tue, 07 Jul 2009 03:53:15 GMT
Author: ningjiang
Date: Tue Jul  7 03:53:14 2009
New Revision: 791695

URL: http://svn.apache.org/viewvc?rev=791695&view=rev
Log:
CAMEL-1806 put the request parameters into the message header

Modified:
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java?rev=791695&r1=791694&r2=791695&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
Tue Jul  7 03:53:14 2009
@@ -53,7 +53,7 @@
 
     public void readRequest(HttpServletRequest request, HttpMessage message) {
         // lets parser the parameterMap first to avoid consuming the POST parameters as InputStream
-        request.getParameterMap();
+        Map parameterMap = request.getParameterMap();
         
         // lets force a parse of the body and headers
         message.getBody();
@@ -75,8 +75,8 @@
             }
         }
 
-        //if the request method is Get, we also populate the http request parameters
-        if (request.getMethod().equalsIgnoreCase("GET")) {
+        //we populate the http request parameters for GET and POST etc method
+        if (parameterMap.size() > 0) {
             names = request.getParameterNames();
             while (names.hasMoreElements()) {
                 String name = (String)names.nextElement();

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java?rev=791695&r1=791694&r2=791695&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
Tue Jul  7 03:53:14 2009
@@ -22,11 +22,11 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.component.http.helper.LoadingByteArrayOutputStream;
 import org.apache.camel.impl.PollingConsumerSupport;
 import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java?rev=791695&r1=791694&r2=791695&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
Tue Jul  7 03:53:14 2009
@@ -142,8 +142,10 @@
                 Processor procPostParameters = new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
-                        String value = req.getParameter("request");                     
  
+                        String value = req.getParameter("request");
+                        String requestValue = exchange.getIn().getHeader("request", String.class);
                         if (value != null) {
+                            assertEquals("We should get the same request header value from
message", value, requestValue);
                             exchange.getOut().setBody(value);
                         } else {
                             exchange.getOut().setBody("Can't get a right parameter");

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java?rev=791695&r1=791694&r2=791695&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
Tue Jul  7 03:53:14 2009
@@ -18,11 +18,12 @@
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import static org.apache.camel.component.mock.MockEndpoint.expectsMessageCount;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.camel.component.mock.MockEndpoint.expectsMessageCount;
+
 public class JettyWithXPathChoiceTest extends CamelTestSupport {
     protected MockEndpoint x;
     protected MockEndpoint y;



Mime
View raw message