Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GlobalFilter for Gateway MVC #3281

Closed
wants to merge 2 commits into from
Closed

Conversation

Andross96
Copy link

Replicate the Spring Cloud Gateway Reactive GlobalFilter interface behavior in Gateway MVC.
Only the interface is created (and not every implementation, which are already handled within the FilterDiscoverer).

The GlobalFilter interface allows applications to create a filter bean which will be executed only on matched gateway routes. It also supports for Order annotation.

Exemple implementation:

@Configuration
public class CustomGlobalFilter implements GlobalFilter {
    @Override
    public HandlerFilterFunction<ServerResponse, ServerResponse> filter() {
        return (request, next) -> {
            LOGGER.info("Routing to route '{}'", request.attribute(MvcUtils.GATEWAY_ROUTE_ID_ATTR));
            return next.handle(request);
        };
    }
}

Fixes #3239 and #3143

@spencergibb
Copy link
Member

I'm not sure mvc gateway requires a separate implementation of filters besides what mvc.fn provides

@spencergibb
Copy link
Member

Sorry, I'll keep conversation in issue rather than pr

@spencergibb
Copy link
Member

Closing in favor of #3177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global filters for MVC Gateway
3 participants