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 2014/02/20 02:04:36 UTC
svn commit: r1570025 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
Author: lu4242
Date: Thu Feb 20 01:04:36 2014
New Revision: 1570025
URL: http://svn.apache.org/r1570025
Log:
MYFACES-3858 Faces Flow startNode is not defined by default for xml non empty files ending with -flow.xml
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java?rev=1570025&r1=1570024&r2=1570025&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java Thu Feb 20 01:04:36 2014
@@ -64,6 +64,7 @@ import javax.xml.transform.TransformerFa
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.config.element.FacesFlowDefinition;
import org.apache.myfaces.config.element.facelets.FaceletTagLibrary;
import org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl;
import org.apache.myfaces.config.impl.digester.elements.FacesFlowDefinitionImpl;
@@ -681,6 +682,7 @@ public class DefaultFacesConfigurationPr
log.severe("Faces config resource " + systemId + " not found");
return null;
}
+ String flowName = systemId.substring(systemId.lastIndexOf('/')+1, systemId.lastIndexOf("-flow.xml"));
int c = pbstream.read();
if (c != -1)
{
@@ -693,17 +695,16 @@ public class DefaultFacesConfigurationPr
//
FacesConfigImpl facesConfig = new FacesConfigImpl();
FacesFlowDefinitionImpl flow = new FacesFlowDefinitionImpl();
- String flowName = systemId.substring(systemId.lastIndexOf('/')+1, systemId.lastIndexOf("-flow.xml"));
flow.setId(flowName);
// In this case the defining document id is implicit associated
flow.setDefiningDocumentId(systemId);
String startNodePath = systemId.substring(0, systemId.lastIndexOf('/')+1)+flowName+".xhtml";
- URL startNodeUrl = ectx.getResource(startNodePath);
- if (startNodeUrl != null)
- {
- flow.setStartNode(startNodePath);
- }
+ //URL startNodeUrl = ectx.getResource(startNodePath);
+ //if (startNodeUrl != null)
+ //{
+ flow.setStartNode(startNodePath);
+ //}
// There is a default return node with name [flow-name]-return and
// that by default points to an outer /[flow-name]-return outcome
@@ -722,7 +723,25 @@ public class DefaultFacesConfigurationPr
{
log.info("Reading config " + systemId);
}
- return getUnmarshaller(ectx).getFacesConfig(pbstream, systemId);
+
+ FacesConfigImpl facesConfig = (FacesConfigImpl)
+ getUnmarshaller(ectx).getFacesConfig(pbstream, systemId);
+
+ // Set default start node when it is not present.
+ for (FacesFlowDefinition definition : facesConfig.getFacesFlowDefinitions())
+ {
+ if (flowName.equals(definition.getId()))
+ {
+ FacesFlowDefinitionImpl flow = (FacesFlowDefinitionImpl) definition;
+ if (flow.getStartNode() == null)
+ {
+ String startNodePath = systemId.substring(0,
+ systemId.lastIndexOf('/')+1)+flowName+".xhtml";
+ flow.setStartNode(startNodePath);
+ }
+ }
+ }
+ return facesConfig;
//getDispenser().feed(getUnmarshaller().getFacesConfig(stream, systemId));
}
catch (IOException e)