Skip to content

Commit 9a0eb8d

Browse files
vpavicsbrannen
authored andcommitted
Update AcceptHeaderLocaleResolver to extend AbstractLocaleResolver
This commit updates AcceptHeaderLocaleResolver to extend AbstractLocaleResolver, which allows the removal of defaultLocale managing code in AcceptHeaderLocaleResolver. See gh-27609
1 parent 73acab7 commit 9a0eb8d

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,10 @@
4141
* @since 27.02.2003
4242
* @see jakarta.servlet.http.HttpServletRequest#getLocale()
4343
*/
44-
public class AcceptHeaderLocaleResolver implements LocaleResolver {
44+
public class AcceptHeaderLocaleResolver extends AbstractLocaleResolver {
4545

4646
private final List<Locale> supportedLocales = new ArrayList<>(4);
4747

48-
@Nullable
49-
private Locale defaultLocale;
50-
5148

5249
/**
5350
* Configure supported locales to check against the requested locales
@@ -69,29 +66,6 @@ public List<Locale> getSupportedLocales() {
6966
return this.supportedLocales;
7067
}
7168

72-
/**
73-
* Configure a fixed default locale to fall back on if the request does not
74-
* have an "Accept-Language" header.
75-
* <p>By default this is not set in which case when there is no "Accept-Language"
76-
* header, the default locale for the server is used as defined in
77-
* {@link HttpServletRequest#getLocale()}.
78-
* @param defaultLocale the default locale to use
79-
* @since 4.3
80-
*/
81-
public void setDefaultLocale(@Nullable Locale defaultLocale) {
82-
this.defaultLocale = defaultLocale;
83-
}
84-
85-
/**
86-
* The configured default locale, if any.
87-
* <p>This method may be overridden in subclasses.
88-
* @since 4.3
89-
*/
90-
@Nullable
91-
public Locale getDefaultLocale() {
92-
return this.defaultLocale;
93-
}
94-
9569

9670
@Override
9771
public Locale resolveLocale(HttpServletRequest request) {

0 commit comments

Comments
 (0)