diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/BridgeHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/BridgeHandler.java
index 6cc290a3f5..757b64d66d 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/handler/BridgeHandler.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/BridgeHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ import org.springframework.messaging.Message;
*
* @author Mark Fisher
* @author Iwein Fuld
+ * @author Marius Bogoevici
*/
public class BridgeHandler extends AbstractReplyProducingMessageHandler {
@@ -44,4 +45,8 @@ public class BridgeHandler extends AbstractReplyProducingMessageHandler {
return requestMessage;
}
+ @Override
+ protected boolean shouldCopyRequestHeaders() {
+ return false;
+ }
}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java
index a5af2204df..268a3daf07 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderAtConfigTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.ConsumerEndpointFactoryBean;
import org.springframework.integration.config.EnableIntegration;
-import org.springframework.integration.handler.BridgeHandler;
+import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.message.MessageBuilderAtConfigTests.MBConfig;
import org.springframework.integration.support.MessageBuilderFactory;
import org.springframework.integration.support.MutableMessageBuilderFactory;
@@ -43,6 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Gary Russell
+ * @author Marius Bogoevici
*/
@ContextConfiguration(classes=MBConfig.class)
@RunWith(SpringJUnit4ClassRunner.class)
@@ -92,7 +93,7 @@ public class MessageBuilderAtConfigTests {
}
@Bean
- public ConsumerEndpointFactoryBean bridge1() throws Exception {
+ public ConsumerEndpointFactoryBean echo1() throws Exception {
ConsumerEndpointFactoryBean factory = new ConsumerEndpointFactoryBean();
factory.setHandler(handler1());
factory.setInputChannel(in());
@@ -100,14 +101,14 @@ public class MessageBuilderAtConfigTests {
}
@Bean
- public BridgeHandler handler1() {
- BridgeHandler handler = new BridgeHandler();
+ public AbstractReplyProducingMessageHandler handler1() {
+ AbstractReplyProducingMessageHandler handler = new RequestHeaderCopyingEchoHandler();
handler.setOutputChannel(pubSub());
return handler;
}
@Bean
- public ConsumerEndpointFactoryBean bridge2() throws Exception {
+ public ConsumerEndpointFactoryBean echo2() throws Exception {
ConsumerEndpointFactoryBean factory = new ConsumerEndpointFactoryBean();
factory.setHandler(handler2());
factory.setInputChannel(pubSub());
@@ -115,14 +116,14 @@ public class MessageBuilderAtConfigTests {
}
@Bean
- public BridgeHandler handler2() {
- BridgeHandler handler = new BridgeHandler();
+ public AbstractReplyProducingMessageHandler handler2() {
+ AbstractReplyProducingMessageHandler handler = new RequestHeaderCopyingEchoHandler();
handler.setOutputChannel(out());
return handler;
}
@Bean
- public ConsumerEndpointFactoryBean bridge3() throws Exception {
+ public ConsumerEndpointFactoryBean echo3() throws Exception {
ConsumerEndpointFactoryBean factory = new ConsumerEndpointFactoryBean();
factory.setHandler(handler3());
factory.setInputChannel(pubSub());
@@ -130,12 +131,18 @@ public class MessageBuilderAtConfigTests {
}
@Bean
- public BridgeHandler handler3() {
- BridgeHandler handler = new BridgeHandler();
+ public AbstractReplyProducingMessageHandler handler3() {
+ AbstractReplyProducingMessageHandler handler = new RequestHeaderCopyingEchoHandler();
handler.setOutputChannel(out());
return handler;
}
}
+ private static class RequestHeaderCopyingEchoHandler extends AbstractReplyProducingMessageHandler {
+ @Override
+ protected Object handleRequestMessage(Message> requestMessage) {
+ return requestMessage;
+ }
+ }
}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests-context.xml
index e69facb328..c61ebe4ace 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MessageBuilderTests-context.xml
@@ -7,7 +7,9 @@
-
+
+
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/TestHandlers.java b/spring-integration-core/src/test/java/org/springframework/integration/message/TestHandlers.java
index 6e04ff7309..5320b1c065 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/message/TestHandlers.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/message/TestHandlers.java
@@ -19,6 +19,7 @@ package org.springframework.integration.message;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
+import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.messaging.Message;
/**