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/05/20 14:11:02 UTC
svn commit: r946605 - in /camel/trunk/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: Thu May 20 12:11:01 2010
New Revision: 946605
URL: http://svn.apache.org/viewvc?rev=946605&view=rev
Log:
CAMEL-2738 should not try to convert the message body into StreamCache in the DefaultHttpBinding
Modified:
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.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=946605&r1=946604&r2=946605&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 Thu May 20 12:11:01 2010
@@ -90,10 +90,10 @@ public class DefaultHttpBinding implemen
popluateRequestParameters(request, message);
- // reset the stream cache
- StreamCache cache = message.getBody(StreamCache.class);
- if (cache != null) {
- cache.reset();
+ Object body = message.getBody();
+ // reset the stream cache if the body is the instance of StreamCache
+ if (body instanceof StreamCache) {
+ ((StreamCache)body).reset();
}
// store the method and query and other info in headers
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=946605&r1=946604&r2=946605&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 Thu May 20 12:11:01 2010
@@ -220,9 +220,10 @@ public class HttpRouteTest extends Camel
from("jetty:http://localhost:9083/noStreamCache?disableStreamCache=true").noStreamCaching().process(new Processor() {
public void process(Exchange exchange) throws Exception {
- InputStream is = (InputStream)exchange.getIn().getBody();
- System.out.println(is.getClass());
+ InputStream is = (InputStream)exchange.getIn().getBody();
assertTrue("It should be a raw inputstream", is instanceof org.eclipse.jetty.server.HttpInput);
+ String request = exchange.getIn().getBody(String.class);
+ assertEquals("Get a wrong request", "This is a test", request);
exchange.getOut().setBody("OK");
}