CAMEL-24360: camel-undertow - use UndertowHeaderFilterStrategy as the endpoint default - #25367
Open
oscerd wants to merge 1 commit into
Open
CAMEL-24360: camel-undertow - use UndertowHeaderFilterStrategy as the endpoint default#25367oscerd wants to merge 1 commit into
oscerd wants to merge 1 commit into
Conversation
… endpoint default
DefaultUndertowHttpBinding installs an UndertowHeaderFilterStrategy in its
constructor, but UndertowEndpoint defaulted its own headerFilterStrategy to the
base HttpHeaderFilterStrategy and pushed that into the binding when lazily
creating it, overwriting the undertow-specific strategy. Unless the user
supplied a custom binding or a custom headerFilterStrategy, the binding ran the
base strategy and the undertow-specific filtering never executed.
Two behaviours that are documented as shipped were therefore inert on
endpoint-configured routes:
* the legacy websocket.* Exchange-header prefix added to the in and out
filters by CAMEL-23588 (4.14.8 / 4.18.3 / 4.21.0);
* the io.undertow.util.HttpString.tryFromString header-name validation in
UndertowHeaderFilterStrategy.applyFilterToExternalHeaders, which skips
header names undertow does not accept.
The endpoint now defaults to UndertowHeaderFilterStrategy, so both take effect.
Rest DSL consumers are unchanged: UndertowComponent already assigns
UndertowRestHeaderFilterStrategy, which extends UndertowHeaderFilterStrategy.
Endpoints that configure headerFilterStrategy or undertowHttpBinding explicitly
keep their existing behaviour.
Adds three UndertowEndpointTest cases covering the endpoint default, the
strategy the lazily created binding ends up running together with the websocket
prefixes actually being filtered, and an explicitly configured strategy still
reaching the binding. Adds a 4.22 upgrade-guide entry describing the change and
how to restore the previous behaviour.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 39 tested, 28 compile-only — current: 38 all testedMaveniverse Scalpel detected 67 affected modules (current approach: 38).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
DefaultUndertowHttpBindinginstalls anUndertowHeaderFilterStrategyin its constructor:but
UndertowEndpointdefaulted its own field to the baseHttpHeaderFilterStrategyand pushed that into the binding when creating it lazily, overwriting what the binding had just set:Unless the user supplied a custom binding or a custom
headerFilterStrategy, the binding ran the base strategy and the undertow-specific filtering never executed.Impact
Two behaviours documented as shipped were inert on endpoint-configured routes:
websocket.*Exchange-header prefix added to the in/out filters by CAMEL-23588 (released in 4.14.8 / 4.18.3 / 4.21.0 and described in the 4.18 upgrade guide);io.undertow.util.HttpString.tryFromStringheader-name validation inUndertowHeaderFilterStrategy.applyFilterToExternalHeaders, which skips header names undertow does not accept.Documentation and runtime behaviour had therefore diverged since CAMEL-23588.
Fix
UndertowEndpointnow defaults toUndertowHeaderFilterStrategy, so both take effect.UndertowComponentalready assignsUndertowRestHeaderFilterStrategy, which extendsUndertowHeaderFilterStrategy.headerFilterStrategyorundertowHttpBindingexplicitly keep their behaviour.The now-unused
HttpHeaderFilterStrategyimport is removed. No generated metadata changes, since the catalog records only theHeaderFilterStrategyinterface and not the default implementation class.Changes
UndertowEndpoint- default strategy, unused importUndertowEndpointTest- three cases: the endpoint default is undertow-specific; the lazily created binding keeps it and actually filtersUndertowConstants.CONNECTION_KEY/CONNECTION_KEY_LIST/SEND_TO_ALL; an explicitly configured strategy still reaches the bindingTesting
camel-undertowmodule build green: 191 tests pass, 0 failures, 1 skipped. The websocket suites (UndertowWsConsumerRouteTest,UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest, ...) all still pass, since the producer reads those headers viain.getHeader(...), which does not go through theHeaderFilterStrategy.mvn clean install -DskipTests) green, no regenerated-artifact drift.Backport
UndertowEndpointline 88 andDefaultUndertowHttpBindingline 86 are identical onmain,camel-4.18.xandcamel-4.14.x, so this should be backported to both LTS lines (with the matching 4.18 / 4.14 upgrade-guide entries doc-synced back tomainper the backport policy). Backporting matters here because CAMEL-23588 shipped on those branches and its documented effect is what this restores.Claude Code on behalf of oscerd