Package io.micronaut.http.server
Class HttpServerConfiguration.HttpLocaleResolutionConfigurationProperties
java.lang.Object
io.micronaut.http.server.HttpServerConfiguration.HttpLocaleResolutionConfigurationProperties
- All Implemented Interfaces:
LocaleResolutionConfiguration
,HttpLocaleResolutionConfiguration
- Enclosing class:
- HttpServerConfiguration
@ConfigurationProperties("locale-resolution")
public static class HttpServerConfiguration.HttpLocaleResolutionConfigurationProperties
extends Object
implements HttpLocaleResolutionConfiguration
Configuration for locale resolution used by
HttpLocaleResolver
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetFixed()
boolean
isHeader()
void
setCookieName
(@Nullable String cookieName) Sets the name of the cookie that is used to store the locale.void
setDefaultLocale
(@NonNull Locale defaultLocale) Sets the locale that will be used if the locale cannot be resolved through any means.void
Set the language tag for the locale.void
setHeader
(boolean header) Set to true if the locale should be resolved from the `Accept-Language` header.void
setSessionAttribute
(@Nullable String sessionAttribute) Sets the key in the session to look for the locale.
-
Field Details
-
PREFIX
- See Also:
-
-
Constructor Details
-
HttpLocaleResolutionConfigurationProperties
public HttpLocaleResolutionConfigurationProperties()
-
-
Method Details
-
getFixed
- Specified by:
getFixed
in interfaceLocaleResolutionConfiguration
- Returns:
- The fixed locale
-
setFixed
Set the language tag for the locale. Supports BCP 47 language tags (e.g. "en-US") and ISO standard (e.g "en_US").- Parameters:
fixed
- The fixed locale
-
getSessionAttribute
- Specified by:
getSessionAttribute
in interfaceHttpLocaleResolutionConfiguration
- Returns:
- The key in the session that stores the locale
-
setSessionAttribute
Sets the key in the session to look for the locale.- Parameters:
sessionAttribute
- The session attribute key
-
getDefaultLocale
- Specified by:
getDefaultLocale
in interfaceLocaleResolutionConfiguration
- Returns:
- The locale to be used if one cannot be resolved.
-
setDefaultLocale
Sets the locale that will be used if the locale cannot be resolved through any means. Defaults to the system default.- Parameters:
defaultLocale
- The default locale.
-
getCookieName
- Specified by:
getCookieName
in interfaceHttpLocaleResolutionConfiguration
- Returns:
- The name of the cookie that contains the locale.
-
setCookieName
Sets the name of the cookie that is used to store the locale.- Parameters:
cookieName
- The name of the cookie used to store the locale
-
isHeader
public boolean isHeader()- Specified by:
isHeader
in interfaceHttpLocaleResolutionConfiguration
- Returns:
- True if the accept header should be searched for the locale.
-
setHeader
public void setHeader(boolean header) Set to true if the locale should be resolved from the `Accept-Language` header. Default value (true).- Parameters:
header
- Header resolution
-