private LifecycleProvider lifecycleProvider;
public LifecycleProvider getLifecycleProvider(ExternalContext externalContext) {
if (lifecycleProvider == null) {
String webModuleName = (String) externalContext.getApplicationMap().get(WebApplicationConstants.WEB_APP_NAME);
MyFacesWebAppContext myFacesWebAppContext = MyFacesWebAppContext.getMyFacesWebAppContext(webModuleName);
lifecycleProvider = myFacesWebAppContext.getLifecycleProvider();
if (lifecycleProvider == null) {
throw new IllegalStateException("No LifecycleProvider registered for application " + webModuleName + " in the bundle: " + getBundle());
}
}
return lifecycleProvider;