From 9595f7f83c12f6391b3fac368b8ecea9a7dec9f1 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 31 Jul 2017 13:29:07 +0200 Subject: [PATCH] Improve one time only runtime check if MyFaces is in use Issue: SWF-1705 --- .../springframework/faces/webflow/JsfRuntimeInformation.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfRuntimeInformation.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfRuntimeInformation.java index 8aee27f7..dc58bdb5 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfRuntimeInformation.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfRuntimeInformation.java @@ -17,6 +17,7 @@ package org.springframework.faces.webflow; import javax.faces.context.FacesContext; +import javax.faces.context.FacesContextWrapper; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; @@ -104,6 +105,9 @@ public class JsfRuntimeInformation { if (facesContext == null) { return false; } + while (facesContext instanceof FacesContextWrapper) { + facesContext = ((FacesContextWrapper) facesContext).getWrapped(); + } myFacesInUse = facesContext.getClass().getPackage().getName().startsWith("org.apache.myfaces."); } return myFacesInUse;