This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-spring-boot-4.10.x in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit 9c81f08cea967ef7ef08b1eef1a6f4415a5725ae Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jun 3 13:05:31 2025 +0200 CAMEL-22116: Make it possible for SB to provide special logic in getRawPath --- .../platform/http/springboot/SpringBootPlatformHttpBinding.java | 8 ++++++-- .../platform/http/springboot/SpringBootPlatformHttpConsumer.java | 6 ------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java index 33f47d85ab2..d74d4ab0c2e 100644 --- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java +++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java @@ -297,8 +297,12 @@ public class SpringBootPlatformHttpBinding extends DefaultHttpBinding { @Override protected String getRawPath(HttpServletRequest request) { + String uri = request.getRequestURI(); String contextPath = request.getContextPath() == null ? "" : request.getContextPath(); - String servletPath = request.getServletPath() == null ? "" : request.getServletPath(); - return contextPath + servletPath; + if (contextPath.isEmpty() || contextPath.equals("/")) { + return uri; + } + // skip context-path + return uri.substring(contextPath.length()); } } 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 cd892d4fc84..271425e3e06 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 @@ -122,12 +122,6 @@ public class SpringBootPlatformHttpConsumer extends DefaultConsumer implements P msg.init(exchange, binding, request, response); String contextPath = getEndpoint().getPath(); exchange.getIn().setHeader(SpringBootPlatformHttpConstants.CONTEXT_PATH, contextPath); - // set context path as header - String httpPath = (String) exchange.getIn().getHeader(Exchange.HTTP_PATH); - // here we just remove the CamelServletContextPath part from the HTTP_PATH - if (contextPath != null && httpPath.startsWith(contextPath)) { - exchange.getIn().setHeader(Exchange.HTTP_PATH, httpPath.substring(contextPath.length())); - } if (getEndpoint().isUseCookieHandler()) { cookieConfiguration = getEndpoint().getCookieConfiguration(); exchange.setProperty(Exchange.COOKIE_HANDLER, new SpringBootCookieHandler(request, response));