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 d36db8ad96b CAMEL-22116: Make it possible for SB to provide special
logic in getRawPath
d36db8ad96b is described below
commit d36db8ad96b1ad546aa2995cbaa4d8367619c7ce
Author: Claus Ibsen <[email protected]>
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));