Croway opened a new pull request, #1842:
URL: https://github.com/apache/camel-spring-boot/pull/1842

   # Description
   
   This PR addresses the findings of a code review of 
`camel-platform-http-starter`. Each finding is an isolated commit so they can 
be reviewed (or reverted) independently:
   
   1. **Honor `CookieHandler` contract in `SpringBootCookieHandler`** — 
`getCookieValue` returned the sentinel string `"Cookie not found"` and 
`removeCookie` returned the cookie *name*; the `CookieHandler` contract (and 
the Vert.x implementation) return the value, or `null` when the cookie does not 
exist.
   2. **Do not widen `httpMethodRestrict` to all methods on unparsable verbs** 
— `httpMethodRestrict=GET, POST` (note the space) silently registered a mapping 
serving **all** HTTP methods because the unresolved token became a null 
`RequestMethod`. Tokens are now trimmed/upper-cased and an unknown verb fails 
closed. Also fixes a latent NPE (`model.getVerbs()` vs the local `verbs` 
variable).
   3. **Fix consumer exchange lifecycle** — `createExchange(true)` combined 
with the manual `releaseExchange(exchange, false)` in `afterProcess` 
double-releases pooled exchanges (`camel.main.exchange-factory=pooled`); 
aligned with `CamelServlet`/`VertxPlatformHttpConsumer` 
(`createExchange(false)` + manual release). Also releases the exchange when 
request parsing or `createUoW` fails.
   4. **Fix consumer executor ownership** — every consumer allocated a 
throwaway single-thread `ExecutorService` that was immediately overwritten; 
when the fallback executor *was* used it was never shut down; an engine created 
via the port-only constructor produced consumers that NPE'd on the first 
request.
   5. **Write only the ByteBuffer window in direct responses** — `bb.array()` 
dumped the whole backing array (sliced/partially-consumed buffers leaked 
adjacent bytes; direct buffers threw). Also replaces the visibly decompiled 
`doWriteDirectResponse` body (`var19` locals) with readable source re-aligned 
to `DefaultHttpBinding`.
   6. **Unregister Spring MVC mappings when a route stops** — 
`unregisterHttpEndpoint` was a noop, so stopped/removed routes kept dispatching 
to a stopped consumer instead of returning 404. Mappings are now tracked per 
consumer, which keeps same-path/different-method consumers independent and 
sidesteps the shared-OPTIONS-handler issue noted in the code.
   7. **Align auto-configuration with Spring Boot 4 idioms** — 
`@AutoConfiguration` for the imports-file-registered WebMvc configuration, 
`Threading.VIRTUAL.isActive()` instead of manual property parsing, 
`ServerProperties` instead of raw `server.port` parsing, type-safe `after =` 
references, no re-enabling of Boot-owned `WebMvcProperties`, specific 
exceptions. Executor selection semantics are unchanged.
   
   Every fix comes with tests (new test classes: 
`SpringBootPlatformHttpMethodRestrictTest`, 
`SpringBootPlatformHttpPooledExchangeTest`, 
`SpringBootPlatformHttpConsumerExecutorTest`, 
`SpringBootPlatformHttpByteBufferResponseTest`, 
`SpringBootPlatformHttpRouteLifecycleTest`, plus extended cookie tests). Full 
`mvn verify` on the module passes.
   
   # Target
   
   - [x] main
   - [ ] backport needed
   
   _Claude Code on behalf of Federico Mariani (@Croway)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to