You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/10/30 02:19:46 UTC
svn commit: r1028956 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
Author: lu4242
Date: Sat Oct 30 00:19:46 2010
New Revision: 1028956
URL: http://svn.apache.org/viewvc?rev=1028956&view=rev
Log:
MYFACES-2952 Improve Atmosphere Meteor support of MyFaces (add org.apache.myfaces.INITIALIZE_ALWAYS param)
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java?rev=1028956&r1=1028955&r2=1028956&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java Sat Oct 30 00:19:46 2010
@@ -73,6 +73,12 @@ public abstract class AbstractFacesIniti
*/
@JSFWebConfigParam(since="1.2.7")
protected static final String EXPRESSION_FACTORY = "org.apache.myfaces.EXPRESSION_FACTORY";
+
+ /**
+ * If this param is set to true, the check for faces servlet mapping is not done
+ */
+ @JSFWebConfigParam(since="2.0.3", defaultValue="false")
+ protected static final String INITIALIZE_ALWAYS = "org.apache.myfaces.INITIALIZE_ALWAYS";
/**
* Performs all necessary initialization tasks like configuring this JSF
@@ -94,25 +100,29 @@ public abstract class AbstractFacesIniti
ExternalContext externalContext = facesContext.getExternalContext();
// Parse and validate the web.xml configuration file
- WebXml webXml = WebXml.getWebXml(externalContext);
- if (webXml == null) {
- if (log.isLoggable(Level.WARNING)) {
- log.warning("Couldn't find the web.xml configuration file. "
- + "Abort initializing MyFaces.");
- }
-
- return;
- } else if (webXml.getFacesServletMappings().isEmpty()) {
- // check if the FacesServlet has been added dynamically
- // in a Servlet 3.0 environment by MyFacesContainerInitializer
- Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
- if (mappingAdded == null || !mappingAdded)
- {
- if (log.isLoggable(Level.WARNING))
- {
- log.warning("No mappings of FacesServlet found. Abort initializing MyFaces.");
+
+ if (!WebConfigParamUtils.getBooleanInitParameter(externalContext, INITIALIZE_ALWAYS, false))
+ {
+ WebXml webXml = WebXml.getWebXml(externalContext);
+ if (webXml == null) {
+ if (log.isLoggable(Level.WARNING)) {
+ log.warning("Couldn't find the web.xml configuration file. "
+ + "Abort initializing MyFaces.");
}
+
return;
+ } else if (webXml.getFacesServletMappings().isEmpty()) {
+ // check if the FacesServlet has been added dynamically
+ // in a Servlet 3.0 environment by MyFacesContainerInitializer
+ Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
+ if (mappingAdded == null || !mappingAdded)
+ {
+ if (log.isLoggable(Level.WARNING))
+ {
+ log.warning("No mappings of FacesServlet found. Abort initializing MyFaces.");
+ }
+ return;
+ }
}
}
@@ -248,26 +258,29 @@ public abstract class AbstractFacesIniti
FacesContext facesContext = FacesContext.getCurrentInstance();
- //We need to check if the current application was initialized by myfaces
- WebXml webXml = WebXml.getWebXml(facesContext.getExternalContext());
- if (webXml == null) {
- if (log.isLoggable(Level.WARNING)) {
- log.warning("Couldn't find the web.xml configuration file. "
- + "Abort destroy MyFaces.");
- }
-
- return;
- } else if (webXml.getFacesServletMappings().isEmpty()) {
- // check if the FacesServlet has been added dynamically
- // in a Servlet 3.0 environment by MyFacesContainerInitializer
- Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
- if (mappingAdded == null || !mappingAdded)
- {
- if (log.isLoggable(Level.WARNING))
- {
- log.warning("No mappings of FacesServlet found. Abort destroy MyFaces.");
+ if (!WebConfigParamUtils.getBooleanInitParameter(facesContext.getExternalContext(), INITIALIZE_ALWAYS, false))
+ {
+ //We need to check if the current application was initialized by myfaces
+ WebXml webXml = WebXml.getWebXml(facesContext.getExternalContext());
+ if (webXml == null) {
+ if (log.isLoggable(Level.WARNING)) {
+ log.warning("Couldn't find the web.xml configuration file. "
+ + "Abort destroy MyFaces.");
}
+
return;
+ } else if (webXml.getFacesServletMappings().isEmpty()) {
+ // check if the FacesServlet has been added dynamically
+ // in a Servlet 3.0 environment by MyFacesContainerInitializer
+ Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
+ if (mappingAdded == null || !mappingAdded)
+ {
+ if (log.isLoggable(Level.WARNING))
+ {
+ log.warning("No mappings of FacesServlet found. Abort destroy MyFaces.");
+ }
+ return;
+ }
}
}