diff options
Diffstat (limited to 'mcs/class/System.Web/System.Web.Compilation')
11 files changed, 26 insertions, 293 deletions
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs index a24439fc10b..4a2cb6502af 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs @@ -49,7 +49,7 @@ namespace System.Web.Compilation this.Location = location; } } - + class BuilderLocationStack : Stack { public override void Push (object o) @@ -138,7 +138,6 @@ namespace System.Web.Compilation bool inScript, javascript; ILocation location; bool isApplication; - StringBuilder tagInnerText = new StringBuilder (); static Hashtable emptyHash = new Hashtable (); public AspGenerator (TemplateParser tparser) @@ -320,8 +319,8 @@ namespace System.Web.Compilation if (isvirtual) { file = tparser.MapPath (file); - } else { - file = GetIncludeFilePath (tparser.BaseDir, file); + } else if (!Path.IsPathRooted (file)) { + file = UrlUtils.Combine (tparser.BaseVirtualDir, file); } InitParser (file); @@ -333,14 +332,6 @@ namespace System.Web.Compilation //PrintLocation (location); } - static string GetIncludeFilePath (string basedir, string filename) - { - if (Path.DirectorySeparatorChar == '/') - filename = filename.Replace ("\\", "/"); - - return Path.GetFullPath (Path.Combine (basedir, filename)); - } - void TextParsed (ILocation location, string text) { if (text.IndexOf ("<%") != -1 && !inScript) { @@ -368,11 +359,7 @@ namespace System.Web.Compilation if (tparser.DefaultDirectiveName == "application" && t.Trim () != "") throw new ParseException (location, "Content not valid for application file."); - ControlBuilder current = stack.Builder; - current.AppendLiteralString (t); - if (current.NeedsTagInnerText ()) { - tagInnerText.Append (t); - } + stack.Builder.AppendLiteralString (t); } bool ProcessTag (string tagid, TagAttributes atts, TagType tagtype) @@ -498,16 +485,6 @@ namespace System.Web.Compilation // if (current is TemplateBuilder) // pop from the id list - if (current.NeedsTagInnerText ()) { - try { - current.SetTagInnerText (tagInnerText.ToString ()); - } catch (Exception e) { - throw new ParseException (current.location, e.Message, e); - } - - tagInnerText.Length = 0; - } - current.CloseControl (); stack.Pop (); stack.Builder.AppendSubBuilder (current); diff --git a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs index 28c357ce3c5..8f199c12de8 100644 --- a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs +++ b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs @@ -184,15 +184,12 @@ namespace System.Web.Compilation str = str.Substring (2).Trim (); int len = str.Length; int lastQuote = str.LastIndexOf ('"'); - if (len < 10 || lastQuote != len - 1) - return false; - - if (!str.ToLower ().StartsWith ("#include ")) + if (len < 10 || lastQuote != len - 1 || !str.StartsWith ("#include ")) return false; str = str.Substring (9).Trim (); - bool isfile = (str.ToLower ().StartsWith ("file")); - if (!isfile && !str.ToLower ().StartsWith ("virtual")) + bool isfile = (str.StartsWith ("file")); + if (!isfile && !str.StartsWith ("virtual")) return false; pathType = (isfile) ? "file" : "virtual"; diff --git a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs index 07578009be5..5036f5db094 100644 --- a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs @@ -284,7 +284,7 @@ namespace System.Web.Compilation public virtual Type GetCompiledType () { - Type type = CachingCompiler.GetTypeFromCache (parser.InputFile); + Type type = CachingCompiler.GetTypeFromCache (parser.InputFile, parser.ClassName); if (type != null) return type; @@ -309,7 +309,7 @@ namespace System.Web.Compilation bool keepFiles = (Environment.GetEnvironmentVariable ("MONO_ASPNET_NODELETE") != null); TempFileCollection tempcoll = new TempFileCollection (config.TempDirectory, keepFiles); compilerParameters.TempFiles = tempcoll; - string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true)); + string dllfilename = tempcoll.AddExtension ("dll", true); if (!Directory.Exists (dynamicBase)) Directory.CreateDirectory (dynamicBase); diff --git a/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs b/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs deleted file mode 100644 index 3cd3ea5723a..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/BuildProviderResultFlags.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// System.Web.Compilation.BuildProviderResultFlags.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -using System.Resources; - -#if NET_2_0 -namespace System.Web.Compilation -{ - [Serializable, Flags] - public enum BuildProviderResultFlags - { - Default = 0, - ShutdownAppDomainOnChange = 1 - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs index 0e6f7d12bbf..bda584c306b 100644 --- a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs @@ -32,7 +32,6 @@ using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Specialized; -using System.IO; using System.Reflection; using System.Web.UI; using System.Web.Caching; @@ -44,20 +43,21 @@ namespace System.Web.Compilation { static object compilationLock = new object (); const string cachePrefix = "@@Assembly"; - const string cacheTypePrefix = "@@@Type"; - public static void InsertType (Type type, string filename) + public static Type GetTypeFromCache (string filename, string typename) { - string [] cacheKeys = new string [] { cachePrefix + filename }; - CacheDependency dep = new CacheDependency (null, cacheKeys); - HttpRuntime.Cache.Insert (cacheTypePrefix + filename, type, dep); - } + string key = CachingCompiler.cachePrefix + filename; + CompilerResults results = (CompilerResults) HttpRuntime.Cache [key]; + if (results == null) + return null; - public static Type GetTypeFromCache (string filename) - { - return (Type) HttpRuntime.Cache [cacheTypePrefix + filename]; - } + Assembly a = results.CompiledAssembly; + if (a == null) + return null; + return a.GetType (typename, false); + } + public static CompilerResults Compile (BaseCompiler compiler) { Cache cache = HttpRuntime.Cache; @@ -139,39 +139,12 @@ namespace System.Web.Compilation ICodeCompiler compiler = provider.CreateCompiler (); CompilerParameters options = GetOptions (assemblies); results = compiler.CompileAssemblyFromFile (options, file); - ArrayList realdeps = new ArrayList (assemblies.Count); - for (int i = assemblies.Count - 1; i >= 0; i--) { - string current = (string) assemblies [i]; - if (Path.IsPathRooted (current)) - realdeps.Add (current); - } - - string [] deps = (string []) realdeps.ToArray (typeof (string)); + string [] deps = (string []) assemblies.ToArray (typeof (string)); cache.Insert (cachePrefix + key, results, new CacheDependency (deps)); } return results; } - - public static Type CompileAndGetType (string typename, string language, string key, - string file, ArrayList assemblies) - { - CompilerResults result = CachingCompiler.Compile (language, key, file, assemblies); - if (result.NativeCompilerReturnValue != 0) { - StreamReader reader = new StreamReader (file); - throw new CompilationException (file, result.Errors, reader.ReadToEnd ()); - } - - Assembly assembly = result.CompiledAssembly; - if (assembly == null) { - StreamReader reader = new StreamReader (file); - throw new CompilationException (file, result.Errors, reader.ReadToEnd ()); - } - - Type type = assembly.GetType (typename, true); - InsertType (type, file); - return type; - } } } diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog index 80c8ae1ffbf..1bd493966e2 100644 --- a/mcs/class/System.Web/System.Web.Compilation/ChangeLog +++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog @@ -1,42 +1,3 @@ -2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * WebServiceCompiler.cs: fix buglet in my last commit. - -2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * BaseCompiler.cs: - * CachingCompiler.cs: - * WebServiceCompiler.cs: correctly cache Type instead of the assembly - for ashx/asmx. Otherwise we need to open the file and check for the - class name in there. Thanks to Ben for pointing this out. - -2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * CachingCompiler.cs: don't try to watch for changes in system - assemblies. Fixes bug #64871. - -2004-09-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * AspGenerator.cs: handle builders that need to process inner text - with tags. - - * Location.cs: added setters for the properties. - -2004-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * AspGenerator.cs: the path for file was treated as virtual, but it's - physical. Fixes bug #61524. - -2004-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * AspParser.cs: fixed case-sensitivity issues with #include and its - attributes. Closes #61429. - -2004-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * BaseCompiler.cs: - * WebServiceCompiler.cs: really create the dlls under DynamicBase - 2004-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateControlCompiler.cs: for system colors, use SystemColors class diff --git a/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs b/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs deleted file mode 100644 index 3e2c38ff5db..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/IImplicitResourceProvider.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// System.Web.Compilation.IImplicitResourceProvider.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -#if NET_2_0 - -using System.Collections; -using System.Globalization; - -namespace System.Web.Compilation -{ - public interface IImplicitResourceProvider - { - object GetObject (ImplicitResourceKey key, CultureInfo culture); - ICollection GetResources (string keyPrefix); - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs b/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs deleted file mode 100644 index 4cdb8b14784..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/IResourceReader.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// System.Web.Compilation.IResourceProvider.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -using System.Resources; - -#if NET_2_0 -namespace System.Web.Compilation -{ - public interface IResourceProvider - { - IResourceReader ResourceReader { get; } - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs b/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs deleted file mode 100644 index ac2bab3c256..00000000000 --- a/mcs/class/System.Web/System.Web.Compilation/ImplicitResourceKey.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// System.Web.Compilation.IImplicitResourceProvider.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// - -#if NET_2_0 -namespace System.Web.Compilation -{ - public class ImplicitResourceKey - { - public ImplicitResourceKey () - { - } - - public string Filter; - public string KeyPrefix; - public string Property; - } -} -#endif diff --git a/mcs/class/System.Web/System.Web.Compilation/Location.cs b/mcs/class/System.Web/System.Web.Compilation/Location.cs index 4a57b8055ac..e4a0cb775a1 100644 --- a/mcs/class/System.Web/System.Web.Compilation/Location.cs +++ b/mcs/class/System.Web/System.Web.Compilation/Location.cs @@ -65,27 +65,22 @@ namespace System.Web.Compilation public int BeginLine { get { return beginLine; } - set { beginLine = value; } } public int EndLine { get { return endLine; } - set { endLine = value; } } public int BeginColumn { get { return beginColumn; } - set { beginColumn = value; } } public int EndColumn { get { return endColumn; } - set { endColumn = value; } } public string PlainText { get { return plainText; } - set { plainText = value; } } } } diff --git a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs index 4df2b6b9a94..20b87415730 100644 --- a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs +++ b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs @@ -59,15 +59,12 @@ namespace System.Web.Compilation public override Type GetCompiledType () { - Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath); + Type type = CachingCompiler.GetTypeFromCache (parser.PhysicalPath, parser.ClassName); if (type != null) return type; - if (parser.Program.Trim () == "") { - type = parser.GetTypeFromBin (parser.ClassName); - CachingCompiler.InsertType (type, parser.PhysicalPath); - return type; - } + if (parser.Program.Trim () == "") + return parser.GetTypeFromBin (parser.ClassName); string lang = parser.Language; CompilationConfiguration config; @@ -96,7 +93,7 @@ namespace System.Web.Compilation sw.WriteLine (parser.Program); sw.Close (); - string dllfilename = Path.GetFileName (tempcoll.AddExtension ("dll", true)); + string dllfilename = tempcoll.AddExtension ("dll", true); if (!Directory.Exists (dynamicBase)) Directory.CreateDirectory (dynamicBase); @@ -109,9 +106,7 @@ namespace System.Web.Compilation "No assembly returned after compilation!?"); results.TempFiles.Delete (); - type = results.CompiledAssembly.GetType (parser.ClassName, true); - CachingCompiler.InsertType (type, parser.PhysicalPath); - return type; + return results.CompiledAssembly.GetType (parser.ClassName, true); } void CheckCompilerErrors (CompilerResults results) |