Skip to content

Conversation

@genie137
Copy link

Possible implementation of #3177, global filters, to provide feature parity with the reactive server.

This implementation provides the following:

  • An interface for a GlobalRequestFilter, that provides an entry point to manipulate requests.
    • Users should implement this interface in their own class, that provide as bean.
  • An interface for a GlobalResponseFilter, that provides an entry point to manipulate responses.
  • A GlobalFilterProcessor, that wraps the GlobalRequestFilter and GlobalResponseFilter with Function and BiFunction respectively.
  • Modified the RouterFunctionHolderFactory to inject the global filters into the router function of the route.
  • Modified the GatewayServerMvcAutoConfiguration to create a GlobalFilterProcessor bean and inject that bean into the RouterFunctionHolderFactory.

I would like some feedback on the implementation. If you are happy with the implementation i will write more detailed unittests

…ud#3177)

Signed-off-by: Joris Oosterhuis <2430786+genie137@users.noreply.github.com>
…ud#3177)

Signed-off-by: Joris Oosterhuis <2430786+genie137@users.noreply.github.com>
Signed-off-by: Joris Oosterhuis <2430786+genie137@users.noreply.github.com>
Signed-off-by: Joris Oosterhuis <2430786+genie137@users.noreply.github.com>
@spencergibb
Copy link
Member

The issue you mentioned is for default filters, not global filters. I don't think mvc gateway server needs global filters and this is much more involved than what I would consider for default filters

@huxiyu
Copy link

huxiyu commented Jan 26, 2026

How to customize default filters? I couldn't find default filters in the MVC gateway

The issue you mentioned is for default filters, not global filters. I don't think mvc gateway server needs global filters and this is much more involved than what I would consider for default filters

@huxiyu
Copy link

huxiyu commented Jan 26, 2026

The issue you mentioned is for default filters, not global filters. I don't think mvc gateway server needs global filters and this is much more involved than what I would consider for default filters

I want to use custom global filters or default filters to log internal interface call time, entry headers, and other information. I implemented it using GlbalFilter in Webflux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants