Author: ningjiang
Date: Thu Jun 17 11:38:19 2010
New Revision: 955559
URL: http://svn.apache.org/viewvc?rev=955559&view=rev
Log:
CAMEL-2785, CAMEL-2827 fixed the unit tests
Modified:
camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
camel/branches/camel-1.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
camel/branches/camel-1.x/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml
Modified:
camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java?rev=955559&r1=955558&r2=955559&view=diff
==============================================================================
---
camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
(original)
+++
camel/branches/camel-1.x/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
Thu Jun 17 11:38:19 2010
@@ -24,6 +24,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.camel.Exchange;
+
/**
* @version $Revision$
*/
@@ -46,13 +48,18 @@ public class CamelServlet extends HttpSe
}
// Have the camel process the HTTP exchange.
- HttpExchange exchange = new HttpExchange(consumer.getEndpoint(),
request, response);
+ HttpExchange exchange = new HttpExchange(consumer.getEndpoint(),
request, response);
consumer.getProcessor().process(exchange);
// HC: The getBinding() is interesting because it illustrates the
// impedance miss-match between
// HTTP's stream oriented protocol, and Camels more message
oriented
// protocol exchanges.
+
+ // set the header value from endpoint
+ if (exchange.getOut().getHeader(Exchange.HTTP_CHUNKED) == null) {
+ exchange.getOut().setHeader(Exchange.HTTP_CHUNKED,
consumer.getEndpoint().isChunked());
+ }
// now lets output to the response
consumer.getBinding().writeResponse(exchange, response);
Modified:
camel/branches/camel-1.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java?rev=955559&r1=955558&r2=955559&view=diff
==============================================================================
---
camel/branches/camel-1.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
(original)
+++
camel/branches/camel-1.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
Thu Jun 17 11:38:19 2010
@@ -52,9 +52,7 @@ public class CamelContinuationServlet ex
// Have the camel process the HTTP exchange.
final HttpExchange exchange = new
HttpExchange(consumer.getEndpoint(), request, response);
- if (!consumer.getEndpoint().isChunked()) {
- exchange.getIn().setHeader(Exchange.HTTP_CHUNKED, false);
- }
+
boolean sync = consumer.getAsyncProcessor().process(exchange,
new AsyncCallback() {
public void done(boolean sync) {
if (sync) {
@@ -75,7 +73,12 @@ public class CamelContinuationServlet ex
// HC: The getBinding() is interesting because it illustrates
the
// impedance miss-match between HTTP's stream oriented
protocol, and
// Camels more message oriented protocol exchanges.
-
+
+ // set the header value from endpoint
+ if (exchange.getOut().getHeader(Exchange.HTTP_CHUNKED) ==
null) {
+ exchange.getOut().setHeader(Exchange.HTTP_CHUNKED,
consumer.getEndpoint().isChunked());
+ }
+
// now lets output to the response
consumer.getBinding().writeResponse(exchange, response);
return;
Modified:
camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java?rev=955559&r1=955558&r2=955559&view=diff
==============================================================================
---
camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
(original)
+++
camel/branches/camel-1.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
Thu Jun 17 11:38:19 2010
@@ -55,7 +55,7 @@ public class HttpClientRouteTest extends
MockEndpoint mockEndpoint = getMockEndpoint("mock:a");
mockEndpoint.expectedBodiesReceived("<b>Hello World</b>");
- template.sendBodyAndHeader("direct:start", new
ByteArrayInputStream("This is a test".getBytes()), "Content-Type",
"application/xml");
+ template.sendBodyAndHeader(uri, new ByteArrayInputStream("This is a
test".getBytes()), "Content-Type", "application/xml");
mockEndpoint.assertIsSatisfied();
List<Exchange> list = mockEndpoint.getReceivedExchanges();
Modified:
camel/branches/camel-1.x/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml
URL:
http://svn.apache.org/viewvc/camel/branches/camel-1.x/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml?rev=955559&r1=955558&r2=955559&view=diff
==============================================================================
---
camel/branches/camel-1.x/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml
(original)
+++
camel/branches/camel-1.x/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml
Thu Jun 17 11:38:19 2010
@@ -32,7 +32,7 @@
<camelContext id="dest_context"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
- <from
uri="jetty:http://localhost:9091/GreeterContext/GreeterPort"/>
+ <from
uri="jetty:http://localhost:9091/GreeterContext/GreeterPort?chunked=false"/>
<loadBalance ref="roundRobinRef">
<to uri="direct:EndpointA"/>
<to uri="direct:EndpointB"/>