public class Util
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Util.TreeTraversalCallback |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
APPLICATION_LOGGER |
static java.lang.String |
CONFIG_LOGGER |
static java.lang.String |
CONTEXT_LOGGER |
static java.lang.String |
FACES_LOG_STRINGS |
static java.lang.String |
FACES_LOGGER |
static java.lang.String |
LIFECYCLE_LOGGER |
static java.lang.String |
RENDERKIT_LOGGER |
static java.lang.String |
TAGLIB_LOGGER |
static java.lang.String |
TIMING_LOGGER |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
componentIsDisabled(javax.faces.component.UIComponent component) |
static boolean |
componentIsDisabledOrReadonly(javax.faces.component.UIComponent component) |
static java.lang.Object |
createInstance(java.lang.String className) |
static java.lang.Object |
createInstance(java.lang.String className,
java.lang.Class rootType,
java.lang.Object root) |
static java.lang.String |
getContentTypeFromResponse(java.lang.Object response)
PRECONDITION: argument
response is non-null and
has a method called getContentType that takes no
arguments and returns a String, with no side-effects. |
static javax.faces.convert.Converter |
getConverterForClass(java.lang.Class converterClass,
javax.faces.context.FacesContext context) |
static javax.faces.convert.Converter |
getConverterForIdentifer(java.lang.String converterId,
javax.faces.context.FacesContext context) |
static java.lang.ClassLoader |
getCurrentLoader(java.lang.Object fallbackClass) |
static java.lang.String |
getFacesMapping(javax.faces.context.FacesContext context)
Returns the URL pattern of the
FacesServlet that
is executing the current request. |
static java.beans.FeatureDescriptor |
getFeatureDescriptor(java.lang.String name,
java.lang.String displayName,
java.lang.String desc,
boolean expert,
boolean hidden,
boolean preferred,
java.lang.Object type,
java.lang.Boolean designTime) |
static java.lang.Object |
getListenerInstance(javax.el.ValueExpression type,
javax.el.ValueExpression binding)
Factory method for creating the varius JSF listener
instances that may be referenced by
type
or binding. |
static java.util.Locale |
getLocaleFromContextOrSystem(javax.faces.context.FacesContext context)
If the FacesContext has a UIViewRoot, and this UIViewRoot has a Locale,
return it.
|
static java.util.Locale |
getLocaleFromString(java.lang.String localeStr) |
static java.util.logging.Logger |
getLogger(java.lang.String loggerName) |
static java.lang.String |
getStackTraceString(java.lang.Throwable e)
Leverage the Throwable.getStackTrace() method to produce a
String version of the stack trace, with a "\n" before each
line.
|
static javax.faces.application.StateManager |
getStateManager(javax.faces.context.FacesContext context) |
static javax.faces.application.ViewHandler |
getViewHandler(javax.faces.context.FacesContext context) |
static int |
indexOfSet(java.lang.String str,
char[] set,
int fromIndex) |
static boolean |
isCoreTLVActive() |
static boolean |
isHtmlTLVActive() |
static boolean |
isPrefixMapped(java.lang.String mapping)
Returns true if the provided
url-mapping is
a prefix path mapping (starts with /). |
static boolean |
isUnitTestModeEnabled() |
static java.lang.Class |
loadClass(java.lang.String name,
java.lang.Object fallbackClass) |
static void |
parameterNonEmpty(java.lang.String param) |
static void |
parameterNonNull(java.lang.Object param) |
static boolean |
prefixViewTraversal(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent root,
Util.TreeTraversalCallback action) |
static void |
setCoreTLVActive(boolean active) |
static void |
setHtmlTLVActive(boolean active) |
static void |
setUnitTestModeEnabled(boolean enabled) |
static java.lang.String[] |
split(java.lang.String toSplit,
java.lang.String regex)
A slightly more efficient version of
String.split() which caches
the Patterns in an LRUMap instead of
creating a new Pattern on each
invocation. |
static void |
verifyFactoriesAndInitDefaultRenderKit(javax.servlet.ServletContext context)
Verify the existence of all the factories needed by faces.
|
static void |
verifyRequiredClasses(javax.faces.context.FacesContext facesContext)
Verifies that the required classes are available on either the
ContextClassLoader, or the local ClassLoader.
|
public static final java.lang.String FACES_LOGGER
public static final java.lang.String FACES_LOG_STRINGS
public static final java.lang.String RENDERKIT_LOGGER
public static final java.lang.String TAGLIB_LOGGER
public static final java.lang.String APPLICATION_LOGGER
public static final java.lang.String CONTEXT_LOGGER
public static final java.lang.String CONFIG_LOGGER
public static final java.lang.String LIFECYCLE_LOGGER
public static final java.lang.String TIMING_LOGGER
public static java.lang.Object getListenerInstance(javax.el.ValueExpression type,
javax.el.ValueExpression binding)
Factory method for creating the varius JSF listener
instances that may be referenced by type
or binding.
If binding is not null
and the evaluation result is not null return
that instance. Otherwise try to instantiate an instances
based on type.
type - the Listener typebinding - a ValueExpression which resolves
to a Listener instanceListener instance based off the provided
type and public static void setUnitTestModeEnabled(boolean enabled)
public static boolean isUnitTestModeEnabled()
public static void setCoreTLVActive(boolean active)
public static boolean isCoreTLVActive()
public static void setHtmlTLVActive(boolean active)
public static boolean isHtmlTLVActive()
public static java.lang.Class loadClass(java.lang.String name,
java.lang.Object fallbackClass)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic static java.lang.ClassLoader getCurrentLoader(java.lang.Object fallbackClass)
public static java.util.logging.Logger getLogger(java.lang.String loggerName)
public static void verifyFactoriesAndInitDefaultRenderKit(javax.servlet.ServletContext context)
throws javax.faces.FacesException
javax.faces.FacesExceptionFactoryFinderpublic static void verifyRequiredClasses(javax.faces.context.FacesContext facesContext)
throws javax.faces.FacesException
Verifies that the required classes are available on either the ContextClassLoader, or the local ClassLoader. Currently only checks for the class "javax.servlet.jsp.jstl.fmt.LocalizationContext", which is used for Localization.
The result of the check is saved in the ServletContext attribute RIConstants.HAS_REQUIRED_CLASSES_ATTR.
Algorithm:
Check the ServletContext for the attribute, if found, and the value is false, that means we've checked before, and we don't have the classes, just throw FacesException. If the value is true, we've checked before and we have the classes, just return.
javax.faces.FacesExceptionpublic static java.util.Locale getLocaleFromContextOrSystem(javax.faces.context.FacesContext context)
If the FacesContext has a UIViewRoot, and this UIViewRoot has a Locale, return it. Otherwise return Locale.getDefault().
public static javax.faces.convert.Converter getConverterForClass(java.lang.Class converterClass,
javax.faces.context.FacesContext context)
public static javax.faces.convert.Converter getConverterForIdentifer(java.lang.String converterId,
javax.faces.context.FacesContext context)
public static javax.faces.application.StateManager getStateManager(javax.faces.context.FacesContext context)
throws javax.faces.FacesException
javax.faces.FacesExceptionpublic static javax.faces.application.ViewHandler getViewHandler(javax.faces.context.FacesContext context)
throws javax.faces.FacesException
javax.faces.FacesExceptionpublic static boolean componentIsDisabled(javax.faces.component.UIComponent component)
public static boolean componentIsDisabledOrReadonly(javax.faces.component.UIComponent component)
public static java.lang.Object createInstance(java.lang.String className)
public static java.lang.Object createInstance(java.lang.String className,
java.lang.Class rootType,
java.lang.Object root)
public static java.util.Locale getLocaleFromString(java.lang.String localeStr)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static int indexOfSet(java.lang.String str,
char[] set,
int fromIndex)
fromIndex, the index of the
first occurrence of any substring from set in
toSearch, or -1 if no such match is foundpublic static void parameterNonNull(java.lang.Object param)
throws javax.faces.FacesException
javax.faces.FacesExceptionpublic static void parameterNonEmpty(java.lang.String param)
throws javax.faces.FacesException
javax.faces.FacesExceptionpublic static java.lang.String getStackTraceString(java.lang.Throwable e)
Leverage the Throwable.getStackTrace() method to produce a String version of the stack trace, with a "\n" before each line.
public static java.lang.String getContentTypeFromResponse(java.lang.Object response)
PRECONDITION: argument response is non-null and
has a method called getContentType that takes no
arguments and returns a String, with no side-effects.
This method allows us to get the contentType in both the servlet and portlet cases, without introducing a compile-time dependency on the portlet api.
public static boolean prefixViewTraversal(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent root,
Util.TreeTraversalCallback action)
throws javax.faces.FacesException
javax.faces.FacesExceptionpublic static java.beans.FeatureDescriptor getFeatureDescriptor(java.lang.String name,
java.lang.String displayName,
java.lang.String desc,
boolean expert,
boolean hidden,
boolean preferred,
java.lang.Object type,
java.lang.Boolean designTime)
public static java.lang.String[] split(java.lang.String toSplit,
java.lang.String regex)
A slightly more efficient version of
String.split() which caches
the Patterns in an LRUMap instead of
creating a new Pattern on each
invocation.
toSplit - the string to splitregex - the regex used for splittingPattern.spit(String, int)public static java.lang.String getFacesMapping(javax.faces.context.FacesContext context)
Returns the URL pattern of the
FacesServlet that
is executing the current request. If there are multiple
URL patterns, the value returned by
HttpServletRequest.getServletPath() and
HttpServletRequest.getPathInfo() is
used to determine which mapping to return.
FacesServlet.context - the FacesContext of the current requestFacesServlet
or null if no mapping can be determinedjava.lang.NullPointerException - if context is nullpublic static boolean isPrefixMapped(java.lang.String mapping)
Returns true if the provided url-mapping is
a prefix path mapping (starts with /).
mapping - a url-pattern/Copyright ? 2002-2006 Sun Microsystems, Inc. All Rights Reserved.