Allow early decoration of request and response in WebFlux #25633
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Current behaviour
WebHttpHandlerBuilder.build()
creates instance ofHttpWebHandlerAdapter
(https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/server/adapter/WebHttpHandlerBuilder.java#L356).However, HttpWebHandlerAdapter allows to override some of it's methods (e.g.
createExchange
).Proposed behaviour
Supply
HttpWebHandlerAdapterFactory
toWebHttpHandlerBuilder.build
and createHttpWebHandlerAdapter
via this factory. Naive approach could be as simple as:Motivation
Sometimes we need to decorate
ServerHttpResponse
andServerHttpRequest
(e.g. body logging/caching). Doing this inside aWebFilter
is not sufficient in case of thrown exception flow. We have to do it "earlier" thanExceptionHandlingWebHandler
The text was updated successfully, but these errors were encountered: