camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1337470 - in /camel/branches/camel-2.8.x: ./ components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
Date Sat, 12 May 2012 07:56:10 GMT
Author: davsclaus
Date: Sat May 12 07:56:09 2012
New Revision: 1337470

URL: http://svn.apache.org/viewvc?rev=1337470&view=rev
Log:
CAMEL-5274: Fixed jetty http client issue with streams may be corrupt. Code aligned like http/http4
producers.

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1337464
  Merged /camel/branches/camel-2.9.x:r1337466

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java?rev=1337470&r1=1337469&r2=1337470&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
Sat May 12 07:56:09 2012
@@ -115,10 +115,14 @@ public class JettyHttpProducer extends D
                 httpExchange.setRequestContent(new ByteArrayBuffer(bos.toByteArray()));
                 IOHelper.close(bos);
             } else {
-                // try with String at first
-                String data = exchange.getIn().getBody(String.class);
-                if (data != null) {
-                    String charset = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
+                Object body = exchange.getIn().getBody();
+                if (body instanceof String) {
+                    String data = (String) body;
+                    // be a bit careful with String as any type can most likely be converted
to String
+                    // so we only do an instanceof check and accept String if the body is
really a String
+                    // do not fallback to use the default charset as it can influence the
request
+                    // (for example application/x-www-form-urlencoded forms being sent)
+                    String charset = IOHelper.getCharsetName(exchange, false);
                     if (charset != null) {
                         httpExchange.setRequestContent(new ByteArrayBuffer(data, charset));
                     } else {



Mime
View raw message