oscerd commented on code in PR #27377:
URL: https://github.com/apache/camel/pull/27377#discussion_r4187887337
##########
components/camel-spring-parent/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilter.java:
##########
@@ -27,16 +28,50 @@
import org.apache.camel.Exchange;
import org.apache.camel.attachment.AttachmentMessage;
import org.apache.camel.component.spring.ws.SpringWebserviceConstants;
+import
org.apache.camel.component.spring.ws.SpringWebserviceHeaderFilterStrategy;
import org.apache.camel.component.spring.ws.filter.MessageFilter;
+import org.apache.camel.spi.HeaderFilterStrategy;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.soap.SoapHeader;
import org.springframework.ws.soap.SoapMessage;
/**
* This class populates a SOAP header and attachments in the WebServiceMessage
instance.
+ * <p>
+ * A message header is written into the SOAP header only when the {@link
HeaderFilterStrategy} does not filter it, so by
+ * default the internal {@code Camel} and {@code camel} header namespace is
not written.
*/
public class BasicMessageFilter implements MessageFilter {
+ private final Supplier<HeaderFilterStrategy> headerFilterStrategy;
+
+ /**
+ * Creates a filter that applies a {@link
SpringWebserviceHeaderFilterStrategy} to the message headers it writes
+ * into the SOAP header.
+ */
+ public BasicMessageFilter() {
Review Comment:
Thanks, agreed. This is the intended trade-off. A `messageFilter` bean can
be shared by several endpoints (the global one always is), and a filter has no
reference to the endpoint it runs for. So the component binds the endpoint's
`headerFilterStrategy` only to the `BasicMessageFilter` it creates itself.
A filter created in application code, including a subclass that calls
`super()` like `GlobalMessageFilter`, applies a
`SpringWebserviceHeaderFilterStrategy`. It can take another strategy through
the `BasicMessageFilter(Supplier<HeaderFilterStrategy>)` constructor, or by
overriding `getHeaderFilterStrategy()`.
I added a paragraph saying exactly that to the "custom header and attachment
filtering" section of the component doc (and its catalog copy) in 01247489b386.
_Claude Code on behalf of oscerd_
--
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]