Package org.imixs.workflow.faces.util
Class ResourceBundleHandler
- java.lang.Object
-
- org.imixs.workflow.faces.util.ResourceBundleHandler
-
@Named @RequestScoped public class ResourceBundleHandler extends Object
The ResourceBundleHandler provides helper method to lookup a label in different bundles. This simplifies the front end implementation as the client does not have to know the bundle a specific resource is located:<h1>#{resourceBundleHandler.findMessage('application_title')}</h1>The ResourceBundleHandler load the bundles based on the current user locale.
Resource bundle instances created by the getBundle factory methods are cached by default, and the factory methods return the same resource bundle instance multiple times if it has been cached. For that reason a RequestScoped bean is used here.
The class searches for the resource bundles named 'bundle.messages', 'bundle.app' and 'bundle.custom'. You can overwrite the bundle names with the imixs property value 'resourcebundle.names'. The later entries have a higher priority in case a key is stored in multiple bundles.
- Version:
- 1.0
- Author:
- rsoika
-
-
Constructor Summary
Constructors Constructor Description ResourceBundleHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringfindMessage(String key)This helper method findes a message by key searching all bundles.Stringget(String key)Default getter methodLocalegetBrowserLocale()ResourceBundlegetMessagesBundleByName(String name)voidinit()This method finds the browser locale
-
-
-
Method Detail
-
init
@PostConstruct public void init()
This method finds the browser locale
-
getBrowserLocale
public Locale getBrowserLocale()
-
getMessagesBundleByName
public ResourceBundle getMessagesBundleByName(String name)
-
-