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 2010/12/20 06:09:08 UTC
svn commit: r1050992 - in
/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4:
CamelServlet.java HttpProducer.java
Author: ningjiang
Date: Mon Dec 20 05:09:08 2010
New Revision: 1050992
URL: http://svn.apache.org/viewvc?rev=1050992&view=rev
Log:
CAMEL-3443 Ported the patch into camel-http4 module
Modified:
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
Modified: camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java?rev=1050992&r1=1050991&r2=1050992&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java (original)
+++ camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java Mon Dec 20 05:09:08 2010
@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRes
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.component.http4.helper.HttpHelper;
import org.apache.camel.impl.DefaultExchange;
/**
@@ -56,6 +57,7 @@ public class CamelServlet extends HttpSe
if (consumer.getEndpoint().isDisableStreamCache()) {
exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE);
}
+ HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
exchange.setIn(new HttpMessage(exchange, request, response));
consumer.getProcessor().process(exchange);
Modified: camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java?rev=1050992&r1=1050991&r2=1050992&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java (original)
+++ camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java Mon Dec 20 05:09:08 2010
@@ -31,6 +31,7 @@ import org.apache.camel.Message;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.http4.helper.GZIPHelper;
+import org.apache.camel.component.http4.helper.HttpHelper;
import org.apache.camel.component.http4.helper.HttpProducerHelper;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.converter.stream.CachedOutputStream;
@@ -222,11 +223,7 @@ public class HttpProducer extends Defaul
if (header != null) {
String contentType = header.getValue();
// find the charset and set it to the Exchange
- int index = contentType.indexOf("charset=");
- if (index > 0) {
- String charset = contentType.substring(index + 8);
- exchange.setProperty(Exchange.CHARSET_NAME, IOConverter.normalizeCharset(charset));
- }
+ HttpHelper.setCharsetFromContentType(contentType, exchange);
}
return doExtractResponseBody(is, exchange);
}