public final class Hacks extends Object
Modifier and Type | Method and Description |
---|---|
static long |
getDefaultResourceMaxAge()
Returns the default resource maximum age in milliseconds.
|
static PartialViewContext |
getRichFacesPartialViewContext()
RichFaces PartialViewContext implementation does not extend from PartialViewContextWrapper.
|
static Collection<String> |
getRichFacesRenderIds()
RichFaces PartialViewContext implementation does not have the getRenderIds() method properly implemented.
|
static Set<ResourceIdentifier> |
getRichFacesResourceLibraryResources(ResourceIdentifier id)
Returns an ordered set of all JSF resource identifiers for the given RichFaces resource library resources.
|
static PartialViewContext |
getRichFacesWrappedPartialViewContext()
RichFaces PartialViewContext implementation does not have any getWrapped() method to return the wrapped
PartialViewContext.
|
static boolean |
isCDIAvailableInGlassFish(ServletContext servletContext)
Returns
true if CDI is available in GlassFish. |
static boolean |
isJUELSupportingMethodExpression() |
static boolean |
isJUELUsed() |
static boolean |
isJUELUsed(ExpressionFactory factory) |
static boolean |
isMyFacesUsed()
Returns true if MyFaces is used.
|
static boolean |
isPrimeFacesDynamicResourceRequest(FacesContext context)
Returns true if the current request is a PrimeFaces dynamic resource request.
|
static boolean |
isRichFacesInstalled()
Returns true if RichFaces 4.0-4.3 is installed.
|
static boolean |
isRichFacesResourceLibraryRenderer(String rendererType)
Returns true if the given renderer type is recognizeable as RichFaces resource library renderer.
|
static boolean |
isScriptResourceRendered(FacesContext context,
ResourceIdentifier id)
Returns whether the given script resource is rendered.
|
static Method |
methodExpressionToStaticMethod(ELContext context,
MethodExpression methodExpression)
This method wraps a
MethodExpression in a Method which can be statically invoked. |
static void |
removeResourceDependencyState(FacesContext context)
Remove the resource dependency processing related attributes from the given faces context.
|
static void |
setScriptResourceRendered(FacesContext context,
ResourceIdentifier id)
Set the given script resource as rendered.
|
static void |
setStylesheetResourceRendered(FacesContext context,
ResourceIdentifier id)
Set the given stylesheet resource as rendered.
|
public static boolean isRichFacesInstalled()
Note: in RichFaces 4.5, this class has changed to ExtendedPartialViewContext which finally properly extends
PartialViewContextWrapper with among others the correct implementation for getRenderIds(), so the
getRichFacesPartialViewContext()
hack isn't anymore necessary for the purpose.
Also note that RichFaces 4.4 doesn't exist.
public static PartialViewContext getRichFacesPartialViewContext()
FacesContext.getPartialViewContext()
.public static Collection<String> getRichFacesRenderIds()
public static PartialViewContext getRichFacesWrappedPartialViewContext()
public static boolean isRichFacesResourceLibraryRenderer(String rendererType)
rendererType
- The renderer type to be checked.public static Set<ResourceIdentifier> getRichFacesResourceLibraryResources(ResourceIdentifier id)
id
- The resource identifier of the RichFaces resource library (e.g. org.richfaces:ajax.reslib).public static boolean isJUELUsed()
public static boolean isJUELUsed(ExpressionFactory factory)
public static boolean isJUELSupportingMethodExpression()
public static Method methodExpressionToStaticMethod(ELContext context, MethodExpression methodExpression)
MethodExpression
in a Method
which can be statically invoked.
Since Method is a final class with only a non-public constructor, various reflective tricks have been used to create an instance of this class and make sure it calls the given method expression. It has been tested on the Sun/Oracle JDK versions 6 and 7, and it should work on OpenJDK 6 and 7 as well. Other JDKs might not work.
context
- the context used for evaluation of the method expression when it's invoked later. NOTE, this reference
is retained by the returned method.methodExpression
- the method expression to be wrappedpublic static boolean isMyFacesUsed()
public static void setScriptResourceRendered(FacesContext context, ResourceIdentifier id)
context
- The involved faces context.id
- The resource identifier.public static boolean isScriptResourceRendered(FacesContext context, ResourceIdentifier id)
context
- The involved faces context.id
- The resource identifier.public static void setStylesheetResourceRendered(FacesContext context, ResourceIdentifier id)
context
- The involved faces context.id
- The resource identifier.public static void removeResourceDependencyState(FacesContext context)
context
- The involved faces context.public static long getDefaultResourceMaxAge()
public static boolean isPrimeFacesDynamicResourceRequest(FacesContext context)
context
- The involved faces context.public static boolean isCDIAvailableInGlassFish(ServletContext servletContext)
true
if CDI is available in GlassFish.servletContext
- The involved servlet context.true
if CDI is available in GlassFish.Copyright © 2012–2014 OmniFaces. All rights reserved.