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 Summary
Modifier and TypeFieldDescriptionstatic final String
Default message bundle prefix for authentication-failure messages. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionA list of strings representing base names for this message bundle.Cache size.A list of strings representing common names for this message bundle.Message bundle character encoding.boolean
Flag that controls whether to fallback to the default system locale if no locale is specified explicitly.boolean
Flag that controls whether to use code message.setBaseNames
(List<String> baseNames) A list of strings representing base names for this message bundle.setCacheSeconds
(String cacheSeconds) Cache size.setCommonNames
(List<String> commonNames) A list of strings representing common names for this message bundle.setEncoding
(String encoding) Message bundle character encoding.setFallbackSystemLocale
(boolean fallbackSystemLocale) Flag that controls whether to fallback to the default system locale if no locale is specified explicitly.setUseCodeMessage
(boolean useCodeMessage) Flag that controls whether to use code message.
-
Field Details
-
DEFAULT_BUNDLE_PREFIX_AUTHN_FAILURE
Default message bundle prefix for authentication-failure messages.- See Also:
-
-
Constructor Details
-
MessageBundleProperties
public MessageBundleProperties()
-
-
Method Details
-
getEncoding
Message bundle character encoding. -
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 ofResourceBundle
. 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 tofalse
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 aNoSuchMessageException
. Useful for development and debugging. Note: In case of aMessageSourceResolvable
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
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
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
Message bundle character encoding.- Returns:
this
.
-
setCacheSeconds
Cache size.- Returns:
this
.
-
setFallbackSystemLocale
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 ofResourceBundle
. 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 tofalse
in such a scenario.- Returns:
this
.
-
setUseCodeMessage
Flag that controls whether to use code message. Set whether to use the message code as default message instead of throwing aNoSuchMessageException
. Useful for development and debugging. Note: In case of aMessageSourceResolvable
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
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
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
.
-