Class MessageBundleProperties

java.lang.Object
org.apereo.cas.configuration.model.core.web.MessageBundleProperties
All Implemented Interfaces:
Serializable

@RequiresModule(name="cas-server-core-web", automated=true) public class MessageBundleProperties extends Object implements Serializable
Configuration properties class for message.bundle.
Since:
5.0.0
See Also:
  • Field Details

    • DEFAULT_BUNDLE_PREFIX_AUTHN_FAILURE

      public static final String DEFAULT_BUNDLE_PREFIX_AUTHN_FAILURE
      Default message bundle prefix for authentication-failure messages.
      See Also:
  • Constructor Details

    • MessageBundleProperties

      public MessageBundleProperties()
  • Method Details

    • getEncoding

      public String getEncoding()
      Message bundle character encoding.
    • getCacheSeconds

      public String getCacheSeconds()
      Cache size.
    • isFallbackSystemLocale

      public boolean isFallbackSystemLocale()
      Flag that controls whether to fallback to the default system locale if no locale is specified explicitly. Set whether to fall back to the system Locale if no files for a specific Locale have been found. If this is turned off, the only fallback will be the default file (e.g. "messages.properties" for basename "messages"). Falling back to the system Locale is the default behavior of ResourceBundle. However, this is often not desirable in an application server environment, where the system Locale is not relevant to the application at all: set this flag to false in such a scenario.
    • isUseCodeMessage

      public boolean isUseCodeMessage()
      Flag that controls whether to use code message. Set whether to use the message code as default message instead of throwing a NoSuchMessageException. Useful for development and debugging. Note: In case of a MessageSourceResolvable with multiple codes (like a FieldError) and a MessageSource that has a parent MessageSource, do not activate "useCodeAsDefaultMessage" in the parent: Else, you'll get the first code returned as message by the parent, without attempts to check further codes.
    • getBaseNames

      public List<String> getBaseNames()
      A list of strings representing base names for this message bundle. Set an array of basenames, each following the basic ResourceBundle convention of not specifying file extension or language codes. The resource location format is up to the specific MessageSource implementation. Regular and XMl properties files are supported: e.g. "messages" will find a "messages.properties", "messages_en.properties" etc arrangement as well as "messages.xml", "messages_en.xml" etc. The associated resource bundles will be checked sequentially when resolving a message code. Note that message definitions in a previous resource bundle will override ones in a later bundle, due to the sequential lookup.
    • getCommonNames

      public List<String> getCommonNames()
      A list of strings representing common names for this message bundle. Specify locale-independent common messages, with the message code as key and the full message String (may contain argument placeholders) as value.

      Entries in last common names override first values (as opposed to baseNames used in message bundles).

    • setEncoding

      public MessageBundleProperties setEncoding(String encoding)
      Message bundle character encoding.
      Returns:
      this.
    • setCacheSeconds

      public MessageBundleProperties setCacheSeconds(String cacheSeconds)
      Cache size.
      Returns:
      this.
    • setFallbackSystemLocale

      public MessageBundleProperties setFallbackSystemLocale(boolean fallbackSystemLocale)
      Flag that controls whether to fallback to the default system locale if no locale is specified explicitly. Set whether to fall back to the system Locale if no files for a specific Locale have been found. If this is turned off, the only fallback will be the default file (e.g. "messages.properties" for basename "messages"). Falling back to the system Locale is the default behavior of ResourceBundle. However, this is often not desirable in an application server environment, where the system Locale is not relevant to the application at all: set this flag to false in such a scenario.
      Returns:
      this.
    • setUseCodeMessage

      public MessageBundleProperties setUseCodeMessage(boolean useCodeMessage)
      Flag that controls whether to use code message. Set whether to use the message code as default message instead of throwing a NoSuchMessageException. Useful for development and debugging. Note: In case of a MessageSourceResolvable with multiple codes (like a FieldError) and a MessageSource that has a parent MessageSource, do not activate "useCodeAsDefaultMessage" in the parent: Else, you'll get the first code returned as message by the parent, without attempts to check further codes.
      Returns:
      this.
    • setBaseNames

      public MessageBundleProperties setBaseNames(List<String> baseNames)
      A list of strings representing base names for this message bundle. Set an array of basenames, each following the basic ResourceBundle convention of not specifying file extension or language codes. The resource location format is up to the specific MessageSource implementation. Regular and XMl properties files are supported: e.g. "messages" will find a "messages.properties", "messages_en.properties" etc arrangement as well as "messages.xml", "messages_en.xml" etc. The associated resource bundles will be checked sequentially when resolving a message code. Note that message definitions in a previous resource bundle will override ones in a later bundle, due to the sequential lookup.
      Returns:
      this.
    • setCommonNames

      public MessageBundleProperties setCommonNames(List<String> commonNames)
      A list of strings representing common names for this message bundle. Specify locale-independent common messages, with the message code as key and the full message String (may contain argument placeholders) as value.

      Entries in last common names override first values (as opposed to baseNames used in message bundles).

      Returns:
      this.