myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r1521532 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
Date Tue, 10 Sep 2013 15:58:27 GMT
Author: jwaldman
Date: Tue Sep 10 15:58:27 2013
New Revision: 1521532

URL: http://svn.apache.org/r1521532
Log:
TRINIDAD-2397 Provide API to discover location of document that contains tag definition for
a given component
Thanks to Prakash Udupa for the patch

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java?rev=1521532&r1=1521531&r2=1521532&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
Tue Sep 10 15:58:27 2013
@@ -34,6 +34,8 @@ import org.apache.myfaces.trinidad.chang
 import org.apache.myfaces.trinidad.change.InsertingComponentFragmentLocator;
 import org.apache.myfaces.trinidad.component.FlattenedComponent;
 import org.apache.myfaces.trinidad.component.UIXComponent;
+import org.apache.myfaces.trinidad.context.PageResolver;
+import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 /**
@@ -466,7 +468,7 @@ public final class ComponentUtils
     // if we are dealing with view root, look no further
     if (component == viewRoot)
     {
-      return viewRoot.getViewId();
+      return _getPhysicalURI(viewRoot.getViewId());
     }
     
     String location = null;
@@ -492,7 +494,7 @@ public final class ComponentUtils
       {
         if (currAncestor == viewRoot)
         {
-          return viewRoot.getViewId();
+          return _getPhysicalURI(viewRoot.getViewId());
         }
         
         // 2a. try to get the location where the tag for ancestor is defined
@@ -584,6 +586,16 @@ public final class ComponentUtils
   }
   
   /**
+   * Provides the physical URI of the page with supplied logical view id. The implementation
+   *  uses any registered page resolver to do the conversion.
+   */
+  private static String _getPhysicalURI(String logicalViewId)
+  {
+    PageResolver pageResolver =  RequestContext.getCurrentInstance().getPageResolver();
+    return pageResolver.getPhysicalURI(logicalViewId);
+  }
+
+  /**
    * Returns scoped id for a component
    * @param targetComponent The component for which the scoped id needs to be
    * determined.



Mime
View raw message