The following modification to JsfRuntimeInformation seems to work correctly on websphere 7, 8 & 8.5 (and I imagine should work correctly on other platforms as well, though I've only tested on these). It test the implementation of the underlying faces ApplicationFactory to determine whether MyFaces is the implementer.
Code:
...
private static final boolean myFacesPresent;
static {
if (ReflectionUtils.findMethod(FacesContext.class, "isPostback") != null) {
jsfVersion = JSF_20;
} else if (ReflectionUtils.findMethod(FacesContext.class, "getELContext") != null) {
jsfVersion = JSF_12;
} else {
jsfVersion = JSF_11;
}
/*
* MyFaces is "present" if the ApplicationFactory implementation is provided by MyFaces
*/
ApplicationFactory appFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
boolean isMyFacesPresent = false;
while (appFactory != null) {
if (appFactory.getClass().getCanonicalName().startsWith("org.apache.myfaces")) {
isMyFacesPresent = true;
break;
} else {
/*
* A third-party library may have wrapped the factory; once we get down to the base
* implementation, null should be returned from getWrapped()
*/
appFactory = appFactory.getWrapped();
}
}
myFacesPresent = isMyFacesPresent;
}
...