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 Details

  • Constructor Details

    • HttpLocaleResolutionConfigurationProperties

      public HttpLocaleResolutionConfigurationProperties()
  • Method Details

    • getFixed

      @NonNull public Optional<Locale> getFixed()
      Specified by:
      getFixed in interface LocaleResolutionConfiguration
      Returns:
      The fixed locale
    • setFixed

      public void setFixed(@Nullable Locale fixed)
      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

      @NonNull public Optional<String> getSessionAttribute()
      Specified by:
      getSessionAttribute in interface HttpLocaleResolutionConfiguration
      Returns:
      The key in the session that stores the locale
    • setSessionAttribute

      public void setSessionAttribute(@Nullable String sessionAttribute)
      Sets the key in the session to look for the locale.
      Parameters:
      sessionAttribute - The session attribute key
    • getDefaultLocale

      @NonNull public Locale getDefaultLocale()
      Specified by:
      getDefaultLocale in interface LocaleResolutionConfiguration
      Returns:
      The locale to be used if one cannot be resolved.
    • setDefaultLocale

      public void setDefaultLocale(@NonNull Locale defaultLocale)
      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

      @NonNull public Optional<String> getCookieName()
      Specified by:
      getCookieName in interface HttpLocaleResolutionConfiguration
      Returns:
      The name of the cookie that contains the locale.
    • setCookieName

      public void setCookieName(@Nullable String cookieName)
      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 interface HttpLocaleResolutionConfiguration
      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