You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add HttpHeaders getter and setter for Content-Language [SPR-14536] #19105
Now that content negotiation is in place at the View/ViewResolver mechanism and therefore View implementations don't need to manually create the Content-Type HTTP header, it would be nice to have a similar mechanism that avoided the manual creation of the Content-Language header.
The current code at the reactive version of ThymeleafView (see here) does something like:
However, in Spring MVC thanks to the HttpServletResponse#setLocale(Locale) method, all it had to do is:
response.setLocale(templateLocale);
It's not that creating this header is extremely ugly code, but anyway IMHO it would be great if Spring Reactive included some kind of higher-level mechanism for setting this Content-Language that kept View implementations from having to create it manually.
It might make sense to start with support in HttpHeaders for Accept-Language and Content-Language accepting and returning Locale or List<Locale> in the case of Accept-Language.
That might even be all that needs to be done for this ticket since setContentLanguage can check the input locale for null.
Activity
spring-projects-issues commentedon Nov 7, 2016
Sébastien Deleuze commented
Rossen Stoyanchev I think I can take care of this one if you don't mind.
spring-projects-issues commentedon Dec 9, 2016
Rossen Stoyanchev commented
It might make sense to start with support in HttpHeaders for
Accept-LanguageandContent-Languageaccepting and returningLocaleorList<Locale>in the case ofAccept-Language.That might even be all that needs to be done for this ticket since setContentLanguage can check the input locale for null.
spring-projects-issues commentedon Dec 15, 2016
Sébastien Deleuze commented
Fixed by this commit. See also #19591 that adds
Accept-Languagegetter and setter.