1
1
/*
2
- * Copyright 2002-2021 the original author or authors.
2
+ * Copyright 2002-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
33
33
* specified in the "accept-language" header of the HTTP request (that is,
34
34
* the locale sent by the client browser, normally that of the client's OS).
35
35
*
36
- * <p>Note: Does not support {@code setLocale}, since the accept header
36
+ * <p>Note: Does not support {@code setLocale}, since the " accept- header"
37
37
* can only be changed through changing the client's locale settings.
38
38
*
39
39
* @author Juergen Hoeller
40
40
* @author Rossen Stoyanchev
41
41
* @since 27.02.2003
42
42
* @see jakarta.servlet.http.HttpServletRequest#getLocale()
43
43
*/
44
- public class AcceptHeaderLocaleResolver implements LocaleResolver {
44
+ public class AcceptHeaderLocaleResolver extends AbstractLocaleResolver {
45
45
46
46
private final List <Locale > supportedLocales = new ArrayList <>(4 );
47
47
48
- @ Nullable
49
- private Locale defaultLocale ;
50
-
51
48
52
49
/**
53
50
* Configure supported locales to check against the requested locales
@@ -69,29 +66,6 @@ public List<Locale> getSupportedLocales() {
69
66
return this .supportedLocales ;
70
67
}
71
68
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
-
95
69
96
70
@ Override
97
71
public Locale resolveLocale (HttpServletRequest request ) {
0 commit comments