public enum FacesConfigXml extends Enum<FacesConfigXml>
This configuration enum parses the /WEB-INF/faces-config.xml
and all
/META-INF/faces-config.xml
files found in the classpath and offers methods to obtain information from
them which is not available by the standard JSF API.
Some examples:
// Get a mapping of all <resource-bundle> vars and base names. Map<String, String> resourceBundles = FacesConfigXml.INSTANCE.getResourceBundles();
// Get an ordered list of all <supported-locale> values with <default-locale> as first item. List<Locale> supportedLocales = FacesConfigXml.INSTANCE.getSupportedLocales();
Enum Constant and Description |
---|
INSTANCE
Returns the lazily loaded enum singleton instance.
|
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getResourceBundles()
Returns a mapping of all resource bundle base names by var.
|
List<Locale> |
getSupportedLocales()
Returns an ordered list of all supported locales on this application, with the default locale as the first
item, if any.
|
FacesConfigXml |
init(ServletContext servletContext)
Perform manual initialization with the given servlet context, if not null and not already initialized yet.
|
static FacesConfigXml |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static FacesConfigXml[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final FacesConfigXml INSTANCE
Note: if this is needed in e.g. a Filter
which is called before the FacesServlet
is invoked,
then it won't work if the INSTANCE
hasn't been referenced before. Since JSF installs a special
"init" FacesContext
during startup, one option for doing this initial referencing is in a
ServletContextListener
. The data this enum encapsulates will then be available even where there is no
FacesContext
available. If there's no other option, then you need to manually invoke
init(ServletContext)
whereby you pass the desired ServletContext
.
public static FacesConfigXml[] values()
for (FacesConfigXml c : FacesConfigXml.values()) System.out.println(c);
public static FacesConfigXml valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic FacesConfigXml init(ServletContext servletContext)
servletContext
- The servlet context to obtain the faces-config.xml from.FacesConfigXml
instance, initialized and all.public Map<String,String> getResourceBundles()
public List<Locale> getSupportedLocales()
faces-config.xml
.Application.getDefaultLocale()
,
Application.getSupportedLocales()
Copyright © 2012–2015 OmniFaces. All rights reserved.