Skip to content

Conversation

fabien-chebel
Copy link

Context

Spring Web MVC allows performing redirections by returning a String prefixed by redirect:// in the controller.

This String is intercepted by ThymeleafViewResolver which maps it to an instance of RedirectView.

Problem

The default behaviour of RedirectView is to include all model attributes as query parameters.

This behaviour may not be desirable and thymeleaf-spring does not provide a way to easily change it.

Suggested fix

Expose a method called setRedirectExposeModelAttributes in ThymeleafViewResolver to allow overriding this behaviour.

Context
-------

Spring Web MVC allows performing redirections by returning a String prefixed by `redirect://` in the controller.

This String is intercepted by `ThymeleafViewResolver` which maps it to an instance of `RedirectView`.

Problem
-------

The default behaviour of `RedirectView` is to include all model attributes as query parameters.

This behaviour may not be desirable and thymeleaf-spring does not provide a way to easily change it.

Suggested fix
-------------

Expose a method called `setRedirectExposeModelAttributes` in `ThymeleafViewResolver` to allow overriding this behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant