[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...

Gavin King gavin.king at jboss.com
Thu Oct 19 16:58:19 EDT 2006


  User: gavin   
  Date: 06/10/19 16:58:19

  Modified:    src/main/org/jboss/seam/core  Pages.java
  Log:
  workaround for RI bug
  
  Revision  Changes    Path
  1.32      +20 -0     jboss-seam/src/main/org/jboss/seam/core/Pages.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Pages.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Pages.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -b -r1.31 -r1.32
  --- Pages.java	10 Oct 2006 22:37:06 -0000	1.31
  +++ Pages.java	19 Oct 2006 20:58:19 -0000	1.32
  @@ -13,6 +13,7 @@
   import java.util.SortedSet;
   import java.util.TreeSet;
   
  +import javax.faces.application.ViewHandler;
   import javax.faces.context.FacesContext;
   import javax.faces.convert.Converter;
   
  @@ -200,9 +201,20 @@
      private Page getPage(String viewId)
      {
         Page result = pagesByViewId.get(viewId);
  +      if (result==null)
  +      {
  +         //workaround for what I believe is a bug in the JSF RI
  +         result = pagesByViewId.get( replaceExtension(viewId) );
  +      }
         return result==null ? new Page(viewId) : result;
      }
      
  +   private static String replaceExtension(String viewId)
  +   {
  +      int loc = viewId.lastIndexOf('.');
  +      return loc<0 ? null : viewId.substring(0, loc) + getSuffix();
  +   }
  +   
      public boolean hasDescription(String viewId)
      {
         return getPage(viewId).description!=null;
  @@ -436,4 +448,12 @@
         }
      }
   
  +   public static String getSuffix()
  +   {
  +      String defaultSuffix = FacesContext.getCurrentInstance().getExternalContext()
  +            .getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
  +      return defaultSuffix == null ? ViewHandler.DEFAULT_SUFFIX : defaultSuffix;
  +   
  +   }
  +
   }
  
  
  



More information about the jboss-cvs-commits mailing list