Currently HttpWebHandlerAdapter
handles requests as follows
- handle x forwarded header which manipulates the request
- instanciates exchange
- instanciates observation context
- run handle
My need was to populate traceparent
from a X-Correlation-Id
header. I was stuck as I would have need to insert something before point 3
and nothing was possible.
I ended by implementing a BeanPostProcessor
which wraps the HttpHandler
instance and manipulates request before anything, hence before point 1.
I would suggest something like
- create an interface the describe the manipulation of entering http request
- make the
ForwardedHeaderTransformer
implement it - get all implementation when the
HttpHandler
is instanciated (instead of getting a nullable instance ofForwardedHeaderTransformer
Is this understandable?
I also think that it may lead ti misunderstanding with WebFilter
.
Maybe the issue is with points 1
and 2
doing things out of the common lifecycle.
Comment From: bclozel
This feature is already available. When building the HttpHandler
with WebHttpHandlerBuilder
, you can decorate it with the httpHandlerDecorator
on that builder. In Spring Boot, you can contribute a WebHttpHandlerBuilderCustomizer
bean to do that.
Comment From: antechrestos
@bclozel ah ok thanks; my bad, I was looking 3.2.5
code version. I cannot migrate due to an issue I found in spring data mongo ..