You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/02/03 19:52:28 UTC

(camel-spring-boot) branch main updated: CAMEL-21704: camel-spring-boot - Platform HTTP does not add attchments that stays on the current exchange

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new b574e94745d CAMEL-21704: camel-spring-boot - Platform HTTP does not add attchments that stays on the current exchange
b574e94745d is described below

commit b574e94745d19df9a35b5f70312508ae868d4120
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 3 20:38:08 2025 +0100

    CAMEL-21704: camel-spring-boot - Platform HTTP does not add attchments that stays on the current exchange
---
 .../component/platform/http/springboot/PlatformHttpMessage.java      | 3 ++-
 .../platform/http/springboot/SpringBootPlatformHttpConsumer.java     | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpMessage.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpMessage.java
index 00060236dfc..e106bb554ce 100644
--- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpMessage.java
+++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpMessage.java
@@ -40,7 +40,7 @@ public class PlatformHttpMessage extends DefaultMessage {
         this.init(exchange, binding, request, response);
     }
 
-    private PlatformHttpMessage(HttpServletRequest request, HttpServletResponse response, Exchange exchange,
+    public PlatformHttpMessage(HttpServletRequest request, HttpServletResponse response, Exchange exchange,
                                 HttpBinding binding, boolean requestRead) {
         super(exchange);
         this.request = request;
@@ -51,6 +51,7 @@ public class PlatformHttpMessage extends DefaultMessage {
 
     public void init(Exchange exchange, HttpBinding binding, HttpServletRequest request, HttpServletResponse response) {
         this.setExchange(exchange);
+        exchange.setIn(this);
         this.requestRead = false;
         this.binding = binding;
         this.request = request;
diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
index af5c2e9ea7c..cd892d4fc84 100644
--- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
+++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
@@ -27,6 +27,7 @@ import jakarta.servlet.http.HttpServletResponse;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.Suspendable;
 import org.apache.camel.SuspendableService;
@@ -116,7 +117,9 @@ public class SpringBootPlatformHttpConsumer extends DefaultConsumer implements P
         Exchange exchange = createExchange(true);
         exchange.setPattern(ExchangePattern.InOut);
         HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
-        exchange.setIn(new PlatformHttpMessage(exchange, binding, request, response));
+        PlatformHttpMessage msg = new PlatformHttpMessage(request, response, exchange,binding, false);
+        exchange.setIn(msg);
+        msg.init(exchange, binding, request, response);
         String contextPath = getEndpoint().getPath();
         exchange.getIn().setHeader(SpringBootPlatformHttpConstants.CONTEXT_PATH, contextPath);
         // set context path as header