Author: igorz
Date: 2007-12-10 10:19:51 -0500 (Mon, 10 Dec 2007)
New Revision: 91048

Modified:
   branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.cs
   branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.jvm.cs
Log:
fixed ResolveClientUrl and UniqueID

Modified: branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.cs
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.cs 
2007-12-10 15:01:58 UTC (rev 91047)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.cs 
2007-12-10 15:19:51 UTC (rev 91048)
@@ -453,14 +453,12 @@
                                EnsureIDInternal ();
 
                                string prefix = NamingContainer.UniqueID;
+                               if (NamingContainer == Page || prefix == null) {
+                                       uniqueID = _userId;
 #if TARGET_J2EE
-                               // For J2EE portlets we need to add the 
namespace to the ID.
-                               if (NamingContainer == Page && 
Page.PortletNamespace != null)
-                                       prefix = Page.PortletNamespace;
-                               else
+                                       if (getFacesContext () != null)
+                                               uniqueID = getFacesContext 
().getExternalContext ().encodeNamespace (uniqueID);
 #endif
-                               if (NamingContainer == Page || prefix == null) {
-                                       uniqueID = _userId;
                                        return uniqueID;
                                }
 
@@ -1305,18 +1303,37 @@
 #endif
                string ResolveClientUrl (string relativeUrl)
                {
-#if TARGET_J2EE
-                       return CreateResourceUrl (ResolveClientUrlInternal 
(relativeUrl));
-               }
-               
-               string ResolveClientUrlInternal (string relativeUrl) {
-#endif
                        if (relativeUrl == null)
                                throw new ArgumentNullException ("relativeUrl");
 
                        if (relativeUrl.Length == 0)
                                return String.Empty;
 
+#if TARGET_J2EE
+                       relativeUrl = ResolveClientUrlInternal (relativeUrl);
+
+                       javax.faces.context.FacesContext faces = 
getFacesContext ();
+                       if (faces == null)
+                               return relativeUrl;
+
+                       string url;
+                       if (relativeUrl.IndexOf (':') >= 0)
+                               url = ResolveAppRelativeFromFullPath 
(relativeUrl);
+                       else if (VirtualPathUtility.IsAbsolute (relativeUrl))
+                               url = VirtualPathUtility.ToAppRelative 
(relativeUrl);
+                       else
+                               return relativeUrl;
+
+                       if (VirtualPathUtility.IsAppRelative (url)) {
+                               url = url.Substring (1);
+                               url = url.Length == 0 ? "/" : url;
+                               return faces.getApplication ().getViewHandler 
().getResourceURL (faces, url);
+                       }
+                       return relativeUrl;
+               }
+               
+               string ResolveClientUrlInternal (string relativeUrl) {
+#endif
                        if (VirtualPathUtility.IsAbsolute (relativeUrl) || 
relativeUrl.IndexOf (':') >= 0)
                                return relativeUrl;
 

Modified: 
branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.jvm.cs
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.jvm.cs     
2007-12-10 15:01:58 UTC (rev 91047)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Control.jvm.cs     
2007-12-10 15:19:51 UTC (rev 91048)
@@ -53,14 +53,13 @@
                        }
                }
 
-               internal string CreateResourceUrl (string url) {
-                       FacesContext faces = getFacesContext ();
-                       if (faces == null)
-                               return url;
-
-                       url = Asp2Jsf (url);
-
-                       return faces.getApplication ().getViewHandler 
().getResourceURL (faces, url);
+               string ResolveAppRelativeFromFullPath (string url) {
+                       Uri uri = new Uri (url);
+                       if (String.Compare (uri.Scheme, 
Page.Request.Url.Scheme, StringComparison.OrdinalIgnoreCase) == 0 &&
+                               String.Compare (uri.Host, 
Page.Request.Url.Host, StringComparison.OrdinalIgnoreCase) == 0 &&
+                               uri.Port == Page.Request.Url.Port)
+                               return VirtualPathUtility.ToAppRelative 
(uri.PathAndQuery);
+                       return url;
                }
 
                internal string CreateActionUrl (string url) {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to