Add Mojarra present checks
For cases where isMyFacesInUse cannot properly detect due to issues in dependent libraries (e.g. Tomahawk) we also check if Mojarra is even present to strengthen those checks. Issue: SWF-1687
This commit is contained in:
@@ -44,7 +44,7 @@ public class FlowRenderKit extends RenderKitWrapper {
|
||||
}
|
||||
|
||||
private ResponseStateManager initResponseStateManager(ResponseStateManager wrapped) {
|
||||
if (!JsfRuntimeInformation.isMyFacesInUse()) {
|
||||
if (JsfRuntimeInformation.isMojarraPresent() && !JsfRuntimeInformation.isMyFacesInUse()) {
|
||||
return new FlowResponseStateManager(wrapped);
|
||||
}
|
||||
Constructor<?> constructor;
|
||||
|
||||
@@ -71,6 +71,9 @@ public class JsfRuntimeInformation {
|
||||
|
||||
}
|
||||
|
||||
private static final boolean mojarraPresent =
|
||||
ClassUtils.isPresent("com.sun.faces.context.FacesContextImpl", CLASSLOADER);
|
||||
|
||||
private static final boolean myFacesPresent =
|
||||
ClassUtils.isPresent("org.apache.myfaces.webapp.MyFacesServlet", CLASSLOADER);
|
||||
|
||||
@@ -109,6 +112,10 @@ public class JsfRuntimeInformation {
|
||||
}
|
||||
|
||||
|
||||
public static boolean isMojarraPresent() {
|
||||
return mojarraPresent;
|
||||
}
|
||||
|
||||
public static boolean isMyFacesPresent() {
|
||||
return myFacesPresent;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
|
||||
import static org.springframework.faces.webflow.JsfRuntimeInformation.isMojarraPresent;
|
||||
import static org.springframework.faces.webflow.JsfRuntimeInformation.isPortletRequest;
|
||||
|
||||
/**
|
||||
@@ -162,7 +163,7 @@ public class JsfViewFactory implements ViewFactory {
|
||||
private void processTree(FacesContext context, UIComponent component) {
|
||||
|
||||
Object mojarraTreeHandler = null;
|
||||
if (!JsfRuntimeInformation.isMyFacesInUse()) {
|
||||
if (isMojarraPresent() && !JsfRuntimeInformation.isMyFacesInUse()) {
|
||||
mojarraTreeHandler = new MojarraProcessTreeHandler().handleBefore(context, component);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,11 +127,12 @@ public class PortletExternalContextImpl extends ExternalContext {
|
||||
}
|
||||
|
||||
private Flash createFlash() {
|
||||
if (JsfRuntimeInformation.isMyFacesInUse()) {
|
||||
return new MyFacesFlashFactory().newFlash(this);
|
||||
} else {
|
||||
if (JsfRuntimeInformation.isMojarraPresent() && !JsfRuntimeInformation.isMyFacesInUse()) {
|
||||
return new MojarraFlashFactory().newFlash(this);
|
||||
}
|
||||
else {
|
||||
return new MyFacesFlashFactory().newFlash(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void dispatch(String path) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user