Skip to content

Allow AcceptHeaderLocaleResolver to fail on unsupported locales #24225

@michael-o

Description

@michael-o

I 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.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions