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

Allow hiding model attributes in redirects #299

Open
wants to merge 1 commit into
base: 3.1-dev
Choose a base branch
from

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