You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/07/07 06:48:21 UTC
svn commit: r791698 - in /camel/branches/camel-1.x/components:
camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
Author: ningjiang
Date: Tue Jul 7 04:48:20 2009
New Revision: 791698
URL: http://svn.apache.org/viewvc?rev=791698&view=rev
Log:
CAMEL-1806 put the request parameters into the message header
Modified:
camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
Modified: camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java?rev=791698&r1=791697&r2=791698&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java (original)
+++ camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java Tue Jul 7 04:48:20 2009
@@ -52,7 +52,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();
@@ -71,7 +71,7 @@
}
//if the request method is Get, we also populate the http request parameters
- if (request.getMethod().equalsIgnoreCase("GET")) {
+ if (parameterMap.size() > 0) {
names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = (String)names.nextElement();
Modified: camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java?rev=791698&r1=791697&r2=791698&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java (original)
+++ camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java Tue Jul 7 04:48:20 2009
@@ -121,8 +121,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");