2009-06-05 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / WebConfigurationHost.cs
index 2cf97f5aa93174cfa7826340c4cf674c0d777365..24cd3b01150530ebcc5bbb35763415652ceff83f 100644 (file)
@@ -67,7 +67,7 @@ namespace System.Web.Configuration
                
                public virtual object CreateDeprecatedConfigContext (string configPath)
                {
-                       throw new NotImplementedException ();
+                       return new HttpConfigurationContext(configPath);
                }
                
                public virtual string DecryptSection (string encryptedXml, ProtectedConfigurationProvider protectionProvider,
@@ -216,6 +216,11 @@ namespace System.Web.Configuration
                
                public string MapPath (string virtualPath)
                {
+                       if (!String.IsNullOrEmpty (virtualPath)) {
+                               if (virtualPath.StartsWith (System.Web.Compilation.BuildManager.FAKE_VIRTUAL_PATH_PREFIX, StringComparison.Ordinal))
+                                       return HttpRuntime.AppDomainAppPath;
+                       }
+                       
                        if (map != null)
                                return MapPathFromMapper (virtualPath);
                        else if (HttpContext.Current != null && HttpContext.Current.Request != null)
@@ -275,7 +280,7 @@ namespace System.Web.Configuration
                        throw new HttpException ("Invalid virtual directory: " + virtualPath);
                }
 
-               string GetWebConfigFileName (string dir)
+               internal static string GetWebConfigFileName (string dir)
                {
 #if TARGET_J2EE
                        DirectoryInfo d = GetCaseSensitiveExistingDirectory (new DirectoryInfo (dir));
@@ -355,8 +360,11 @@ namespace System.Web.Configuration
                                        return configPath == MachinePath || configPath == MachineWebPath;
                                case ConfigurationAllowDefinition.MachineToWebRoot:
                                case ConfigurationAllowDefinition.MachineToApplication:
-                                       return configPath == MachinePath || configPath == MachineWebPath || configPath == "/" ||
-                                               configPath == HttpRuntime.AppDomainAppVirtualPath;
+                                       return (String.Compare (configPath, MachinePath, StringComparison.Ordinal) == 0) ||
+                                               (String.Compare (configPath, MachineWebPath, StringComparison.Ordinal) == 0) ||
+                                               (String.Compare (configPath, "/", StringComparison.Ordinal) == 0) ||
+                                               (String.Compare (configPath, "~", StringComparison.Ordinal) == 0) ||
+                                               (String.Compare (configPath, HttpRuntime.AppDomainAppVirtualPath) == 0);
                                default:
                                        return true;
                        }
@@ -383,7 +391,7 @@ namespace System.Web.Configuration
                                        java.lang.ClassLoader cl = (java.lang.ClassLoader) AppDomain.CurrentDomain.GetData ("GH_ContextClassLoader");
                                        if (cl != null) {
                                                java.io.InputStream inputStream = cl.getResourceAsStream (streamName);
-                                               return (Stream) vmw.common.IOUtils.getStream (inputStream);
+                                               return new System.Web.J2EE.J2EEUtils.InputStreamWrapper (inputStream);
                                        }
                                }
 #endif