Refine check for use of MyFaces
Issue: SWF-1641
This commit is contained in:
@@ -44,7 +44,7 @@ public class FlowRenderKit extends RenderKitWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ResponseStateManager initResponseStateManager(ResponseStateManager wrapped) {
|
private ResponseStateManager initResponseStateManager(ResponseStateManager wrapped) {
|
||||||
if (!JsfRuntimeInformation.isMyFacesPresent()) {
|
if (!JsfRuntimeInformation.isMyFacesPresent() && !JsfRuntimeInformation.isMyFacesInUse()) {
|
||||||
return new FlowResponseStateManager(wrapped);
|
return new FlowResponseStateManager(wrapped);
|
||||||
}
|
}
|
||||||
Constructor<?> constructor;
|
Constructor<?> constructor;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2012 the original author or authors.
|
* Copyright 2004-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.springframework.faces.webflow;
|
package org.springframework.faces.webflow;
|
||||||
|
|
||||||
|
import javax.faces.FactoryFinder;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
@@ -62,6 +63,8 @@ public class JsfRuntimeInformation {
|
|||||||
|
|
||||||
private static final boolean myFacesPresent = ClassUtils.isPresent("org.apache.myfaces.webapp.MyFacesServlet", CLASS_LOADER);
|
private static final boolean myFacesPresent = ClassUtils.isPresent("org.apache.myfaces.webapp.MyFacesServlet", CLASS_LOADER);
|
||||||
|
|
||||||
|
private static final boolean myFacesInUse = checkMyFacesContextFactory();
|
||||||
|
|
||||||
private static boolean portletPresent = ClassUtils.isPresent("javax.portlet.Portlet", CLASS_LOADER);
|
private static boolean portletPresent = ClassUtils.isPresent("javax.portlet.Portlet", CLASS_LOADER);
|
||||||
|
|
||||||
private static boolean springPortletPresent = ClassUtils.isPresent("org.springframework.web.portlet.DispatcherPortlet", CLASS_LOADER);
|
private static boolean springPortletPresent = ClassUtils.isPresent("org.springframework.web.portlet.DispatcherPortlet", CLASS_LOADER);
|
||||||
@@ -78,6 +81,19 @@ public class JsfRuntimeInformation {
|
|||||||
} else {
|
} else {
|
||||||
jsfVersion = JSF_11;
|
jsfVersion = JSF_11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean checkMyFacesContextFactory() {
|
||||||
|
ClassLoader classLoader = JsfUtils.class.getClassLoader();
|
||||||
|
try {
|
||||||
|
Class<?> clazz = classLoader.loadClass("org.apache.myfaces.context.FacesContextFactoryImpl");
|
||||||
|
Object factory = FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
|
||||||
|
return clazz.isInstance(factory);
|
||||||
|
}
|
||||||
|
catch (Throwable ex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAtLeastJsf22() {
|
public static boolean isAtLeastJsf22() {
|
||||||
@@ -116,6 +132,10 @@ public class JsfRuntimeInformation {
|
|||||||
return myFacesPresent;
|
return myFacesPresent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isMyFacesInUse() {
|
||||||
|
return myFacesInUse;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the container has support for portlets and if Spring MVC portlet support is available
|
* Determines if the container has support for portlets and if Spring MVC portlet support is available
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user