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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFixed()booleanisHeader()voidsetCookieName(@Nullable String cookieName) Sets the name of the cookie that is used to store the locale.voidsetDefaultLocale(@NonNull Locale defaultLocale) Sets the locale that will be used if the locale cannot be resolved through any means.voidSet the language tag for the locale.voidsetHeader(boolean header) Set to true if the locale should be resolved from the `Accept-Language` header.voidsetSessionAttribute(@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:
getFixedin 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:
getSessionAttributein 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:
getDefaultLocalein 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:
getCookieNamein 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:
isHeaderin 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
-