You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2017/09/04 12:56:14 UTC
svn commit: r1807219 - in /myfaces/core/branches/2.3.x:
impl/src/main/java/org/apache/myfaces/config/
impl/src/main/java/org/apache/myfaces/ee/
impl/src/main/java/org/apache/myfaces/ee6/
impl/src/main/java/org/apache/myfaces/webapp/ impl/src/main/resou...
Author: tandraschko
Date: Mon Sep 4 12:56:13 2017
New Revision: 1807219
URL: http://svn.apache.org/viewvc?rev=1807219&view=rev
Log:
MYFACES-3250 Disabled ManagedbeanDestroyerListener
Added:
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee/
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java
- copied, changed from r1807218, myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java
Removed:
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee6/
Modified:
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/ManagedBeanDestroyerListener.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java
myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=1807219&r1=1807218&r2=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java Mon Sep 4 12:56:13 2017
@@ -1526,9 +1526,12 @@ public class FacesConfigurator
}
else
{
- log.log(Level.SEVERE, "No ManagedBeanDestroyerListener instance found, thus "
- + "@PreDestroy methods won't get called in every case. "
- + "This instance needs to be published before configuration is started.");
+ if (MyfacesConfig.getCurrentInstance(externalContext).isSupportManagedBeans())
+ {
+ log.log(Level.SEVERE, "No ManagedBeanDestroyerListener instance found, thus "
+ + "@PreDestroy methods won't get called in every case. "
+ + "This instance needs to be published before configuration is started.");
+ }
}
}
Copied: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java (from r1807218, myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java)
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java?p2=myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java&p1=myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java&r1=1807218&r2=1807219&rev=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java Mon Sep 4 12:56:13 2017
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.ee6;
+package org.apache.myfaces.ee;
import java.net.URL;
import java.util.Arrays;
@@ -63,9 +63,11 @@ import javax.servlet.annotation.HandlesT
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
import org.apache.myfaces.context.servlet.StartupServletExternalContextImpl;
+import org.apache.myfaces.shared.config.MyfacesConfig;
import org.apache.myfaces.shared_impl.webapp.webxml.DelegatedFacesServlet;
import org.apache.myfaces.spi.FacesConfigResourceProvider;
import org.apache.myfaces.spi.FacesConfigResourceProviderFactory;
+import org.apache.myfaces.webapp.ManagedBeanDestroyerListener;
/**
* This class is called by any Java EE 6 complaint container at startup.
@@ -135,10 +137,27 @@ public class MyFacesContainerInitializer
private static final Class<? extends Servlet> FACES_SERVLET_CLASS = FacesServlet.class;
private static final Class<?> DELEGATED_FACES_SERVLET_CLASS = DelegatedFacesServlet.class;
+ @Override
public void onStartup(Set<Class<?>> clazzes, ServletContext servletContext) throws ServletException
{
- boolean startDireclty = shouldStartupRegardless(servletContext);
+ log.log(Level.INFO, "Using " + MyFacesContainerInitializer.class.getName());
+
+ // No MyfacesConfig available yet, we must read the parameter directly:
+ String supportManagedBeans =
+ servletContext.getInitParameter(MyfacesConfig.INIT_PARAM_SUPPORT_MANAGED_BEANS);
+ if (supportManagedBeans == null || Boolean.TRUE.toString().equals(supportManagedBeans))
+ {
+ ManagedBeanDestroyerListener destroyListener = new ManagedBeanDestroyerListener();
+ servletContext.addListener(destroyListener);
+
+ // Publishes the ManagedBeanDestroyerListener instance into the servletContext.
+ // This allows the FacesConfigurator to access the instance and to set the
+ // correct ManagedBeanDestroyer instance on it.
+ // in < 2.3 it the ExternalContext#applicationMap was used but we have no access here
+ servletContext.setAttribute(ManagedBeanDestroyerListener.APPLICATION_MAP_KEY, destroyListener);
+ }
+ boolean startDireclty = shouldStartupRegardless(servletContext);
if (startDireclty)
{
// if the INITIALIZE_ALWAYS_STANDALONE param was set to true,
@@ -198,7 +217,6 @@ public class MyFacesContainerInitializer
log.log(Level.INFO, "Added FacesServlet with mappings="
+ Arrays.toString(mappings));
}
-
}
}
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java?rev=1807219&r1=1807218&r2=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java Mon Sep 4 12:56:13 2017
@@ -198,8 +198,10 @@ public abstract class AbstractFacesIniti
ManagedBeanDestroyerListener listener = (ManagedBeanDestroyerListener)
externalContext.getApplicationMap().get(
ManagedBeanDestroyerListener.APPLICATION_MAP_KEY);
-
- listener.setViewScopeHandler(viewScopeHandler);
+ if (listener != null)
+ {
+ listener.setViewScopeHandler(viewScopeHandler);
+ }
String useEncryption = servletContext.getInitParameter(StateUtils.USE_ENCRYPTION);
if (!"false".equals(useEncryption)) // the default value is true
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/ManagedBeanDestroyerListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/ManagedBeanDestroyerListener.java?rev=1807219&r1=1807218&r2=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/ManagedBeanDestroyerListener.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/ManagedBeanDestroyerListener.java Mon Sep 4 12:56:13 2017
@@ -62,17 +62,42 @@ public class ManagedBeanDestroyerListene
ServletContextListener, ServletContextAttributeListener,
ServletRequestListener, ServletRequestAttributeListener
{
-
/**
- * The instance of the ManagedBeanDestroyerListener created by
- * StartupServletContextListener is stored under this key in the
- * ApplicationMap.
+ * The instance of the ManagedBeanDestroyerListener created by StartupServletContextListener
+ * is stored under this key in the ApplicationMap.
*/
- public static final String APPLICATION_MAP_KEY = "org.apache.myfaces.ManagedBeanDestroyerListener";
+ public static final String APPLICATION_MAP_KEY = ManagedBeanDestroyerListener.class.getName();
private ManagedBeanDestroyer _destroyer = null;
-
private ViewScopeProvider _viewScopeHandler = null;
+
+ @Override
+ public void contextInitialized(ServletContextEvent event)
+ {
+
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ if (_destroyer != null)
+ {
+ ServletContext ctx = event.getServletContext();
+ Enumeration<String> attributes = ctx.getAttributeNames();
+ if (!attributes.hasMoreElements())
+ {
+ // nothing to do
+ return;
+ }
+
+ while (attributes.hasMoreElements())
+ {
+ String name = attributes.nextElement();
+ Object value = ctx.getAttribute(name);
+ _destroyer.destroy(name, value);
+ }
+ }
+ }
/**
* Sets the ManagedBeanDestroyer instance to use.
@@ -90,12 +115,13 @@ public class ManagedBeanDestroyerListene
}
/* Session related methods ***********************************************/
-
+ @Override
public void attributeAdded(HttpSessionBindingEvent event)
{
// noop
}
+ @Override
public void attributeRemoved(HttpSessionBindingEvent event)
{
if (_destroyer != null)
@@ -104,6 +130,7 @@ public class ManagedBeanDestroyerListene
}
}
+ @Override
public void attributeReplaced(HttpSessionBindingEvent event)
{
if (_destroyer != null)
@@ -112,12 +139,13 @@ public class ManagedBeanDestroyerListene
}
}
+ @Override
public void sessionCreated(HttpSessionEvent event)
{
// noop
}
- @SuppressWarnings("unchecked")
+ @Override
public void sessionDestroyed(HttpSessionEvent event)
{
// MYFACES-3040 @PreDestroy Has Called 2 times
@@ -180,12 +208,13 @@ public class ManagedBeanDestroyerListene
}
/* Context related methods ***********************************************/
-
+ @Override
public void attributeAdded(ServletContextAttributeEvent event)
{
// noop
}
+ @Override
public void attributeRemoved(ServletContextAttributeEvent event)
{
if (_destroyer != null)
@@ -194,6 +223,7 @@ public class ManagedBeanDestroyerListene
}
}
+ @Override
public void attributeReplaced(ServletContextAttributeEvent event)
{
if (_destroyer != null)
@@ -201,41 +231,15 @@ public class ManagedBeanDestroyerListene
_destroyer.destroy(event.getName(), event.getValue());
}
}
-
- public void contextInitialized(ServletContextEvent event)
- {
- // noop
- }
-
- @SuppressWarnings("unchecked")
- public void contextDestroyed(ServletContextEvent event)
- {
- if (_destroyer != null)
- {
- ServletContext ctx = event.getServletContext();
- Enumeration<String> attributes = ctx.getAttributeNames();
- if (!attributes.hasMoreElements())
- {
- // nothing to do
- return;
- }
-
- while (attributes.hasMoreElements())
- {
- String name = attributes.nextElement();
- Object value = ctx.getAttribute(name);
- _destroyer.destroy(name, value);
- }
- }
- }
/* Request related methods ***********************************************/
-
+ @Override
public void attributeAdded(ServletRequestAttributeEvent event)
{
// noop
}
+ @Override
public void attributeRemoved(ServletRequestAttributeEvent event)
{
if (_destroyer != null)
@@ -244,6 +248,7 @@ public class ManagedBeanDestroyerListene
}
}
+ @Override
public void attributeReplaced(ServletRequestAttributeEvent event)
{
if (_destroyer != null)
@@ -252,12 +257,13 @@ public class ManagedBeanDestroyerListene
}
}
+ @Override
public void requestInitialized(ServletRequestEvent event)
{
// noop
}
- @SuppressWarnings("unchecked")
+ @Override
public void requestDestroyed(ServletRequestEvent event)
{
if (_destroyer != null)
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java?rev=1807219&r1=1807218&r2=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java Mon Sep 4 12:56:13 2017
@@ -23,22 +23,11 @@ import org.apache.myfaces.config.annotat
import org.apache.myfaces.shared.util.ClassUtils;
import javax.faces.FactoryFinder;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.ServletRequestAttributeListener;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.http.HttpSessionAttributeListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -46,7 +35,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -69,10 +57,7 @@ import java.util.logging.Logger;
* @author Manfred Geiler (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class StartupServletContextListener implements ServletContextListener,
- HttpSessionAttributeListener, HttpSessionListener,
- ServletRequestListener, ServletRequestAttributeListener,
- ServletContextAttributeListener
+public class StartupServletContextListener implements ServletContextListener
{
static final String FACES_INIT_DONE = "org.apache.myfaces.webapp.StartupServletContextListener.FACES_INIT_DONE";
@@ -87,13 +72,12 @@ public class StartupServletContextListen
private static final byte FACES_INIT_PHASE_PREDESTROY = 2;
private static final byte FACES_INIT_PHASE_POSTDESTROY = 3;
- //private static final Log log = LogFactory.getLog(StartupServletContextListener.class);
private static final Logger log = Logger.getLogger(StartupServletContextListener.class.getName());
private FacesInitializer _facesInitializer;
private ServletContext _servletContext;
- private ManagedBeanDestroyerListener _detroyerListener = new ManagedBeanDestroyerListener();
+ @Override
public void contextInitialized(ServletContextEvent event)
{
if (_servletContext != null)
@@ -115,17 +99,11 @@ public class StartupServletContextListen
// Create startup FacesContext before initializing
FacesContext facesContext = _facesInitializer.initStartupFacesContext(_servletContext);
- // publish the ManagedBeanDestroyerListener instance in the application map
- _publishManagedBeanDestroyerListener(facesContext);
-
dispatchInitializationEvent(event, FACES_INIT_PHASE_PREINIT);
_facesInitializer.initFaces(_servletContext);
dispatchInitializationEvent(event, FACES_INIT_PHASE_POSTINIT);
_servletContext.setAttribute(FACES_INIT_DONE, Boolean.TRUE);
- // call contextInitialized on ManagedBeanDestroyerListener
- _detroyerListener.contextInitialized(event);
-
//Destroy startup FacesContext
_facesInitializer.destroyStartupFacesContext(facesContext);
@@ -139,21 +117,7 @@ public class StartupServletContextListen
}
}
- /**
- * Publishes the ManagedBeanDestroyerListener instance in the application map.
- * This allows the FacesConfigurator to access the instance and to set the
- * correct ManagedBeanDestroyer instance on it.
- *
- * @param facesContext
- */
- private void _publishManagedBeanDestroyerListener(FacesContext facesContext)
- {
- ExternalContext externalContext = facesContext.getExternalContext();
- Map<String, Object> applicationMap = externalContext.getApplicationMap();
-
- applicationMap.put(ManagedBeanDestroyerListener.APPLICATION_MAP_KEY, _detroyerListener);
- }
-
+ @Override
public void contextDestroyed(ServletContextEvent event)
{
if (_facesInitializer != null && _servletContext != null)
@@ -162,8 +126,6 @@ public class StartupServletContextListen
FacesContext facesContext = _facesInitializer.initShutdownFacesContext(_servletContext);
dispatchInitializationEvent(event, FACES_INIT_PHASE_PREDESTROY);
- // call contextDestroyed on ManagedBeanDestroyerListener to destroy the attributes
- _detroyerListener.contextDestroyed(event);
_facesInitializer.destroyFaces(_servletContext);
@@ -210,15 +172,16 @@ public class StartupServletContextListen
* @return false in case of a failed attempt or no listeners found
* which then will cause the jdk5 context.xml code to trigger
*/
- private boolean loadFacesInitPluginsJDK6()
+ private boolean loadFacesInitPluginsViaServiceLoader()
{
- String[] pluginEntries = null;
try
{
Class serviceLoader = ClassUtils.getContextClassLoader().loadClass("java.util.ServiceLoader");
Method m = serviceLoader.getDeclaredMethod("load", Class.class, ClassLoader.class);
+
Object loader = m.invoke(serviceLoader, StartupListener.class, ClassUtils.getContextClassLoader());
m = loader.getClass().getDeclaredMethod("iterator");
+
Iterator<StartupListener> it = (Iterator<StartupListener>) m.invoke(loader);
List<StartupListener> listeners = new LinkedList<StartupListener>();
if (!it.hasNext())
@@ -229,7 +192,7 @@ public class StartupServletContextListen
{
listeners.add(it.next());
}
- //StartupListener[] listeners1 = listeners.toArray(new StartupListener[listeners.size()]);
+
_servletContext.setAttribute(FACES_INIT_PLUGINS, listeners);
return true;
}
@@ -253,18 +216,17 @@ public class StartupServletContextListen
}
/**
- * loads the faces init plugins per reflection and Service loader
- * in a jdk6 environment
+ * loads the faces init plugins per reflection from the context param.
*/
- private void loadFacesInitPluginsJDK5()
+ private void loadFacesInitViaContextParam()
{
-
String plugins = (String) _servletContext.getInitParameter(FACES_INIT_PLUGINS);
if (plugins == null)
{
return;
}
log.info("MyFaces Plugins found");
+
String[] pluginEntries = plugins.split(",");
List<StartupListener> listeners = new ArrayList<StartupListener>(pluginEntries.length);
for (String pluginEntry : pluginEntries)
@@ -292,7 +254,7 @@ public class StartupServletContextListen
log.log(Level.SEVERE, e.getMessage(), e);
}
}
- // StartupListener[] listeners1 = listeners.toArray(new StartupListener[listeners.size()]);
+
_servletContext.setAttribute(FACES_INIT_PLUGINS, listeners);
}
@@ -306,12 +268,11 @@ public class StartupServletContextListen
*/
private void dispatchInitializationEvent(ServletContextEvent event, int operation)
{
-
if (operation == FACES_INIT_PHASE_PREINIT)
{
- if (!loadFacesInitPluginsJDK6())
+ if (!loadFacesInitPluginsViaServiceLoader())
{
- loadFacesInitPluginsJDK5();
+ loadFacesInitViaContextParam();
}
}
@@ -347,77 +308,4 @@ public class StartupServletContextListen
}
log.info("Processing MyFaces plugins done");
}
-
- /* the following methods are needed to serve ManagedBeanDestroyerListener */
- /* Session related methods ***********************************************/
-
- public void attributeAdded(HttpSessionBindingEvent event)
- {
- _detroyerListener.attributeAdded(event);
- }
-
- public void attributeRemoved(HttpSessionBindingEvent event)
- {
- _detroyerListener.attributeRemoved(event);
- }
-
- public void attributeReplaced(HttpSessionBindingEvent event)
- {
- _detroyerListener.attributeReplaced(event);
- }
-
- public void sessionCreated(HttpSessionEvent event)
- {
- _detroyerListener.sessionCreated(event);
- }
-
- public void sessionDestroyed(HttpSessionEvent event)
- {
- _detroyerListener.sessionDestroyed(event);
- }
-
- /* Context related methods ***********************************************/
-
- public void attributeAdded(ServletContextAttributeEvent event)
- {
- _detroyerListener.attributeAdded(event);
- }
-
- public void attributeRemoved(ServletContextAttributeEvent event)
- {
- _detroyerListener.attributeRemoved(event);
- }
-
- public void attributeReplaced(ServletContextAttributeEvent event)
- {
- _detroyerListener.attributeReplaced(event);
- }
-
- /* Request related methods ***********************************************/
-
- public void attributeAdded(ServletRequestAttributeEvent event)
- {
- _detroyerListener.attributeAdded(event);
- }
-
- public void attributeRemoved(ServletRequestAttributeEvent event)
- {
- _detroyerListener.attributeRemoved(event);
- }
-
- public void attributeReplaced(ServletRequestAttributeEvent event)
- {
- _detroyerListener.attributeReplaced(event);
- }
-
- public void requestInitialized(ServletRequestEvent event)
- {
- _detroyerListener.requestInitialized(event);
- }
-
- public void requestDestroyed(ServletRequestEvent event)
- {
- _detroyerListener.requestDestroyed(event);
- }
-
}
Modified: myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer?rev=1807219&r1=1807218&r2=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer Mon Sep 4 12:56:13 2017
@@ -1 +1 @@
-org.apache.myfaces.ee6.MyFacesContainerInitializer
\ No newline at end of file
+org.apache.myfaces.ee.MyFacesContainerInitializer
\ No newline at end of file
Modified: myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java?rev=1807219&r1=1807218&r2=1807219&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Mon Sep 4 12:56:13 2017
@@ -388,6 +388,13 @@ public class MyfacesConfig
public final static String INIT_PARAM_SUPPORT_JSP_AND_FACES_EL = "org.apache.myfaces.SUPPORT_JSP_AND_FACES_EL";
public final static boolean INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT = true;
+ @JSFWebConfigParam(since = "2.3", expectedValues="true,false", defaultValue="true",
+ desc="If set false, myfaces won't support ManagedBeans anymore. ManagedBeans are deprecated in " +
+ "JSF 2.3, Default value is true.",
+ group="EL", tags="performance ")
+ public static final String INIT_PARAM_SUPPORT_MANAGED_BEANS = "org.apache.myfaces.SUPPORT_MANAGED_BEANS";
+ public final static boolean INIT_PARAM_SUPPORT_MANAGED_BEANS_DEFAULT = true;
+
/**
* When the application runs inside Google Application Engine container (GAE),
* indicate which jar files should be scanned for files (faces-config, facelets taglib
@@ -565,6 +572,7 @@ public class MyfacesConfig
private boolean _viewUniqueIdsCacheEnabled;
private int _componentUniqueIdsCacheSize;
private boolean _supportJSPAndFacesEL;
+ private boolean _supportManagedBeans;
private String _gaeJsfJarFiles;
private String _gaeJsfAnnotationsJarFiles;
private boolean _strictJsf2ViewNotFound;
@@ -675,6 +683,7 @@ public class MyfacesConfig
setViewUniqueIdsCacheEnabled(INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT);
setComponentUniqueIdsCacheSize(INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
setSupportJSPAndFacesEL(INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT);
+ setSupportManagedBeans(INIT_PARAM_SUPPORT_MANAGED_BEANS_DEFAULT);
setGaeJsfJarFiles(INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT);
setGaeJsfAnnotationsJarFiles(INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT);
setStrictJsf2ViewNotFound(INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT);
@@ -790,6 +799,9 @@ public class MyfacesConfig
myfacesConfig.setSupportJSPAndFacesEL(WebConfigParamUtils.getBooleanInitParameter(extCtx,
INIT_PARAM_SUPPORT_JSP_AND_FACES_EL, INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT));
+ myfacesConfig.setSupportManagedBeans(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+ INIT_PARAM_SUPPORT_MANAGED_BEANS, INIT_PARAM_SUPPORT_MANAGED_BEANS_DEFAULT));
+
myfacesConfig.setGaeJsfJarFiles(WebConfigParamUtils.getStringInitParameter(extCtx,
INIT_PARAM_GAE_JSF_JAR_FILES, INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT));
myfacesConfig.setGaeJsfAnnotationsJarFiles(WebConfigParamUtils.getStringInitParameter(extCtx,
@@ -1364,12 +1376,21 @@ public class MyfacesConfig
return _supportJSPAndFacesEL;
}
- public void setSupportJSPAndFacesEL(
- boolean supportJSPANDFacesEL)
+ public void setSupportJSPAndFacesEL(boolean supportJSPANDFacesEL)
{
_supportJSPAndFacesEL = supportJSPANDFacesEL;
}
+ public boolean isSupportManagedBeans()
+ {
+ return _supportManagedBeans;
+ }
+
+ public void setSupportManagedBeans(boolean supportManagedBeans)
+ {
+ _supportManagedBeans = supportManagedBeans;
+ }
+
public int getComponentUniqueIdsCacheSize()
{
return _componentUniqueIdsCacheSize;