Permalink
Browse files

Populate HTTP params in the request

  • Loading branch information...
1 parent 5ed966c commit e9bbee9c8d27d6c5b3152c9d11288f22ae5466ea @jbonofre committed Mar 27, 2012
View
10 processor/src/main/java/org/apache/camel/processor/mashup/core/MashupProcessor.java
@@ -18,6 +18,7 @@
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.impl.cookie.BasicClientCookie;
+import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
@@ -73,14 +74,21 @@ public void process(Exchange exchange) throws Exception {
LOGGER.trace("Replace %{}% with {}", header, in.getHeader(header).toString());
url = url.replace("%" + header + "%", in.getHeader(header).toString());
}
-
+
LOGGER.trace("Constructing the HTTP request");
HttpUriRequest request = null;
if (page.getMethod() != null && page.getMethod().equalsIgnoreCase("POST")) {
request = new HttpPost(url);
} else {
request = new HttpGet(url);
}
+
+ BasicHttpParams httpParams = new BasicHttpParams();
+ for (Param param : page.getParams()) {
+ httpParams.setParameter(param.getName(), param.getValue());
+ }
+ request.setParams(httpParams);
+
if (mashup.getCookie() != null) {
LOGGER.trace("Looking for an existing cookie");
String cookieKey = (String) in.getHeader(mashup.getCookie().getKey());

0 comments on commit e9bbee9

Please sign in to comment.