Allow AcceptHeaderLocaleResolver to fail on unsupported locales
See original GitHub issueI have configured in 5.2.0.RELEASE:
<beans:bean id="localeResolver" class="org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver">
<beans:property name="defaultLocale" value="de" />
<beans:property name="supportedLocales">
<beans:list>
<beans:value>cs</beans:value>
<beans:value>de</beans:value>
<beans:value>en</beans:value>
<beans:value>es</beans:value>
<beans:value>fr</beans:value>
<beans:value>pt</beans:value>
<beans:value>ru</beans:value>
</beans:list>
</beans:property>
</beans:bean>
I would like the system to use the default locale if and only if the Accept-Language
header has not been provided. In the case a user sends Accept-Language: pl, da
I want the resolver to return 400 because neither Polish not Danish is supported.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
AcceptHeaderLocaleResolver error - java - Stack Overflow
AcceptHeaderLocaleResolver will resolve the Locale from the request (using the accept header) and that's it. There is no way to set its locale...
Read more >Cannot change HTTP accept header - use a ... - Mkyong.com
UnsupportedOperationException : Cannot change HTTP accept header - use a different locale resolution strategy ...AcceptHeaderLocaleResolver.
Read more >AcceptHeaderLocaleResolver (Spring Framework 6.0.2 API)
LocaleResolver implementation that simply uses the primary locale specified in the Accept-Language header of the HTTP request (that is, the locale sent by ......
Read more >Cannot change HTTP accept header ... - ConcretePage.com
Hi, I am facing an error while creating my Spring MVC internationalization application. Any Clue? java.lang.UnsupportedOperationException: ...
Read more >Spring REST Handle locale change - iTecNote
I'm trying to handle locale change in a Spring 3 REST application. ... mockMvc.perform( get("/error/npe").headers(httpHeaders) .accept(MediaType.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Good catch!
Based on the “status: declined” label, this appears to be meant to be closed.