incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r447457 - /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
Date Mon, 18 Sep 2006 16:27:15 GMT
Author: awiner
Date: Mon Sep 18 09:27:11 2006
New Revision: 447457

URL: http://svn.apache.org/viewvc?view=rev&rev=447457
Log:
Fix ADFFACES-177: selectInputDate fails when using JSF suffix mapping

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java?view=diff&rev=447457&r1=447456&r2=447457
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
Mon Sep 18 09:27:11 2006
@@ -31,6 +31,7 @@
 import javax.faces.FacesException;
 import javax.faces.application.ViewHandler;
 import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.context.RequestContext;
@@ -85,7 +86,7 @@
   {
     _initIfNeeded(context);
 
-    InternalView internal = _internalViews.get(viewId);
+    InternalView internal = _getInternalView(context, viewId);
     if (internal != null)
     {
       UIViewRoot root = internal.createView(context, viewId);
@@ -166,7 +167,8 @@
         if (service != null)
           service.encodeBegin(context);
 
-        InternalView internal = _internalViews.get(viewToRender.getViewId());
+        InternalView internal = _getInternalView(context,
+                                                 viewToRender.getViewId());
         if (internal != null)
         {
           internal.renderView(context, viewToRender);
@@ -207,7 +209,7 @@
       return launchView;
     }
 
-    InternalView internal = _internalViews.get(viewId);
+    InternalView internal = _getInternalView(context, viewId);
     if (internal != null)
     {
       return internal.restoreView(context, viewId);
@@ -274,7 +276,7 @@
   {
     String viewId = context.getViewRoot().getViewId();
     InternalView internal =
-       _internalViews.get(viewId);
+       _getInternalView(context, viewId);
 
     // As internal views whether they're stateless.  If they are, don't
     // bother writing anything out.
@@ -394,6 +396,38 @@
     }
   }
 
+
+  private InternalView _getInternalView(
+    FacesContext context, 
+    String       viewId)
+  {
+    InternalView internal = _internalViews.get(viewId);
+    if (internal == null)
+    {
+      // If we're using suffix-mapping, then any internal viewId will
+      // get affixed with ".jsp" or ".jspx";  try trimming that off
+      // if present
+      ExternalContext external = context.getExternalContext();
+      
+      // Only bother when using suffix-mapping (path info will always
+      // be non-null for prefix-mapping)
+      if (external.getRequestPathInfo() == null)
+      {
+        String suffix = external.getInitParameter("javax.faces.DEFAULT_SUFFIX");
+        if (suffix == null)
+          suffix = ".jspx";
+        
+        if (viewId.endsWith(suffix))
+        {
+          String viewIdWithoutSuffix = viewId.substring(
+             0, viewId.length() - suffix.length());
+          internal = _internalViews.get(viewIdWithoutSuffix);
+        }
+      }
+    }
+
+    return internal;
+  }
 
   //
   // Load the META-INF/org.apache.myfaces.trinidad.render.InternalView.properties



Mime
View raw message