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 2011/10/07 20:27:04 UTC
svn commit: r1180135 -
/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
Author: lu4242
Date: Fri Oct 7 18:27:04 2011
New Revision: 1180135
URL: http://svn.apache.org/viewvc?rev=1180135&view=rev
Log:
MYFACES-3313 Calculation of redirect URL does not preserve the extension used in Faces Servlet mapping
Modified:
myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java?rev=1180135&r1=1180134&r2=1180135&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java (original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java Fri Oct 7 18:27:04 2011
@@ -173,6 +173,7 @@ public class DefaultViewHandlerSupport i
{
if (mapping.isExtensionMapping())
{
+ //See JSF 2.0 section 7.5.2
String[] contextSuffixes = getContextSuffix(context);
boolean founded = false;
for (String contextSuffix : contextSuffixes)
@@ -187,15 +188,27 @@ public class DefaultViewHandlerSupport i
}
if (!founded)
{
- if(viewId.lastIndexOf(".") != -1 )
+ //See JSF 2.0 section 7.5.2
+ // - If the argument viewId has an extension, and this extension is mapping, the result is contextPath + viewId
+ //
+ // -= Leonardo Uribe =- It is evident that when the page is generated, the derived viewId will end with the
+ // right contextSuffix, and a navigation entry on faces-config.xml should use such id, this is just a workaroud
+ // for usability. There is a potential risk that change the mapping in a webapp make the same application fail,
+ // so use viewIds ending with mapping extensions is not a good practice.
+ if (viewId.endsWith(mapping.getExtension()))
+ {
+ builder.append(viewId);
+ }
+ else if(viewId.lastIndexOf(".") != -1 )
{
builder.append(viewId.substring(0,viewId.lastIndexOf(".")));
+ builder.append(contextSuffixes[0]);
}
else
{
builder.append(viewId);
+ builder.append(contextSuffixes[0]);
}
- builder.append(contextSuffixes[0]);
}
}
else