2007-05-15 Igor Zelmanovich <igorz@mainsoft.com>
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Tue, 15 May 2007 14:58:27 +0000 (14:58 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Tue, 15 May 2007 14:58:27 +0000 (14:58 -0000)
* WebConfigurationManager.cs:
make configurations hashtable case-insensitive.
* WebConfigurationHost.cs: for TARGET_J2EE only:
GetStreamName returns file path in right case, that make it works
on case-sensitive file system.

* ConfigurationLocationCollection.cs: for TARGET_JVM only:
location path is case-insensitive.

* PageMapper.cs: reverted r77353, 77321
make it case-insensitive

svn path=/trunk/mcs/; revision=77415

mcs/class/System.Configuration/System.Configuration/ChangeLog
mcs/class/System.Configuration/System.Configuration/ConfigurationLocationCollection.cs
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs
mcs/class/System.Web/System.Web.J2EE/ChangeLog
mcs/class/System.Web/System.Web.J2EE/PageMapper.cs

index deb4492a1b5b14e1c0e389c69cc3666675983db8..48ca064c37cd2ca4f2ae4bcb58afbac4454e910d 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-15 Igor Zelmanovich <igorz@mainsoft.com>
+
+       * ConfigurationLocationCollection.cs: for TARGET_JVM only:
+       location path is case-insensitive.
+               
 2007-05-15  Marek Habersack  <mhabersack@novell.com>
 
        * ConfigurationElement.cs: added value validation on
index ded6567dd8d8c2b017e0317c83d6c638c8bde725..887f37fe51ee8c3b1f32e203f47447c99fd3e6c9 100644 (file)
@@ -50,7 +50,11 @@ namespace System.Configuration {
                internal ConfigurationLocation Find (string location)
                {
                        foreach (ConfigurationLocation loc in InnerList)
+#if TARGET_JVM\r
+                               if (String.Compare (loc.Path, location, StringComparison.OrdinalIgnoreCase) == 0)
+#else\r
                                if (loc.Path == location)
+#endif\r
                                        return loc;
                        return null;
                }
index b93e180caa8d58b61d88277c4231a670c5aa3360..9b5ebfb6886aa546a402b1189ae66d5d3b3104b4 100644 (file)
@@ -1,3 +1,11 @@
+2007-05-15  Igor Zelmanovich <igorz@mainsoft.com>
+
+       * WebConfigurationManager.cs: 
+       make configurations hashtable case-insensitive.
+       * WebConfigurationHost.cs: for TARGET_J2EE only:
+       GetStreamName returns file path in right case, that make it works 
+       on case-sensitive file system.
+
 2007-05-15  Marek Habersack  <mhabersack@novell.com>
 
        * BuildProviderCollection.cs: refactoring - use
index 59320d377e66949ee7262af76a440a3bab0b15de..9d85f4d00809a7c3c40ef5276a583a410257578d 100644 (file)
@@ -122,7 +122,17 @@ namespace System.Web.Configuration
 
                                if (map == null)
 #if TARGET_J2EE
+                               {
+                                       // check META-INF/web.config exists
+                                       java.lang.ClassLoader cl = (java.lang.ClassLoader) AppDomain.CurrentDomain.GetData ("GH_ContextClassLoader");
+                                       if (cl == null)
+                                               return null;
+                                       java.net.URL url = cl.getResource ("META-INF/web.config");
+                                       if (url == null)
+                                               return null;
+
                                        return "/META-INF/web.config";
+                               }
 #else
                                        mdir = Path.GetDirectoryName (System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile);
 #endif
@@ -173,7 +183,11 @@ namespace System.Web.Configuration
                        } else {
                                int i;
                                if (locationSubPath == null)
+                               {
                                        configPath = fullPath;
+                                       if (configPath.Length > 1)
+                                               configPath = VirtualPathUtility.RemoveTrailingSlash (configPath);
+                               }
                                else
                                        configPath = locationSubPath;
 
@@ -260,6 +274,18 @@ namespace System.Web.Configuration
 
                string GetWebConfigFileName (string dir)
                {
+#if TARGET_J2EE
+                       DirectoryInfo d = GetCaseSensitiveExistingDirectory (new DirectoryInfo (dir));
+                       if (d == null)
+                               return null;
+
+                       FileInfo file = (FileInfo) FindByName ("web.config", d.GetFiles ("W*"));
+                       if (file == null)
+                               file = (FileInfo) FindByName ("web.config", d.GetFiles ("w*"));
+
+                       if (file != null)
+                               return file.FullName;
+#else
                        string[] filenames = new string[] {"Web.Config", "Web.config", "web.config" };
 
                        foreach (string fn in filenames) {
@@ -267,10 +293,30 @@ namespace System.Web.Configuration
                                if (File.Exists (file))
                                        return file;
                        }
-
+#endif
                        return null;
                }
+#if TARGET_J2EE
+               static DirectoryInfo GetCaseSensitiveExistingDirectory (DirectoryInfo dir) {
+                       if (dir.Exists)
+                               return dir;
+
+                       DirectoryInfo parent = GetCaseSensitiveExistingDirectory (dir.Parent);
+                       if (parent == null)
+                               return null;
+
+                       return (DirectoryInfo) FindByName (dir.Name, parent.GetDirectories ());
+               }
                
+               static FileSystemInfo FindByName (string name, FileSystemInfo [] infos)
+               {
+                       for (int i = 0; i < infos.Length; i++) {
+                               if (String.Compare (name, infos [i].Name, StringComparison.OrdinalIgnoreCase) == 0)
+                                       return infos [i];
+                       }
+                       return null;
+               }
+#endif
                public virtual bool IsAboveApplication (string configPath)
                {
                        throw new NotImplementedException ();
index edab01d8d8d9d6ecab691069061dc481a47372c4..d0c45c8483a2faed436595f2b9c6239a688e40a7 100644 (file)
@@ -79,7 +79,7 @@ namespace System.Web.Configuration {
                                        lock (AppDomain.CurrentDomain){
                                                object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configurations.initialized");
                                                if (initialized == null){
-                                                       table = Hashtable.Synchronized (new Hashtable ());
+                                                       table = Hashtable.Synchronized (new Hashtable (StringComparer.OrdinalIgnoreCase));
                                                        configurations = table;
                                                }
                                        }
index 99deaae25c5abe12b8c57777bcfd02355d816fe6..5ec2eae915975eec6d2a5f3d6867814713573e7e 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-15  Igor Zelmanovich <igorz@mainsoft.com>\r
+\r
+       * PageMapper.cs: reverted r77353, 77321\r
+       make it case-insensitive\r
+\r
 2007-05-14  Igor Zelmanovich <igorz@mainsoft.com>\r
 \r
        * PageMapper.cs: \r
index 7c1f885ac9653accb6eb8e2484abd2ea5ffd12d8..841fa7b8da68b29aacd871eb068e708fd7ac30fe 100644 (file)
@@ -439,10 +439,6 @@ namespace System.Web.J2EE
                }
                internal string GetTypeFromResources()
                {
-                       string phisicalPath = _context.Request.MapPath (_url);
-                       if (!File.Exists (phisicalPath) && !Directory.Exists (phisicalPath))
-                               return null;
-
                        string typeName = null;
 
                        //if the desciptor exists in the war - get the type