+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added WebEncoding.cs
+
2002-10-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* makefile.trace: used to build System.Web.dll with trace enabled.
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: tracing.
+ * TemplateFactory.cs: cache compiled types and tracing.
+ * WebServiceCompiler.cs: new parameter in GetTypeFromsource,
+
2002-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* AspComponentFoundry.cs: fixed typo.
using System;
using System.IO;
using System.Web.UI;
+using System.Web.Util;
namespace System.Web.Compilation
{
public static Type CompilePageType (PageParser pageParser)
{
string sourceFile = GenerateSourceFile (pageParser);
- Console.WriteLine ("Compiling {0}", sourceFile);
- return TemplateFactory.GetTypeFromSource (sourceFile);
+ WebTrace.WriteLine ("Compiling {0} ({1})", sourceFile, pageParser.InputFile);
+ return TemplateFactory.GetTypeFromSource (pageParser.InputFile, sourceFile);
}
private static string GenerateSourceFile (PageParser pageParser)
//FIXME: should get Tmp dir for this application
string csName = Path.GetTempFileName () + ".cs";
- Console.WriteLine ("Writing {0}", csName);
+ WebTrace.WriteLine ("Writing {0}", csName);
StreamWriter output = new StreamWriter (File.OpenWrite (csName));
output.Write (pageParser.Text);
output.Close ();
using System.Reflection;\r
using System.Text;\r
using System.Web.UI;\r
+using System.Web.Util;\r
\r
+//TODO: should use private bin to store dlls (when AppDomain and Assembly.Load know about it?)\r
namespace System.Web.Compilation\r
{\r
+ class CompiledTypeData\r
+ {\r
+ string csFile;\r
+ string aspxFile;\r
+ Type type;\r
+ DateTime since;\r
+ //TODO: ArrayList fileDependencies;\r
+\r
+ public CompiledTypeData (string aspxFile, string csFile, Type type, DateTime since)\r
+ {\r
+ this.aspxFile = aspxFile;\r
+ this.csFile = csFile;\r
+ this.type = type;\r
+ this.since = since;\r
+\r
+ }\r
+\r
+ public bool IsNewer (DateTime dt)\r
+ {\r
+ return (dt > since);\r
+ }\r
+ \r
+ public Type Type\r
+ {\r
+ get { return type; }\r
+ set { type = value; }\r
+ }\r
+\r
+ public DateTime Since\r
+ {\r
+ get { return since; }\r
+ set { since = value; }\r
+ }\r
+ }\r
+ \r
class TemplateFactory\r
{\r
internal class PageBuilder\r
}\r
}\r
\r
+\r
+ static object compiling = new object ();\r
+ static Hashtable compiledTypes = new Hashtable ();\r
+ \r
internal static string CompilationOutputFileName (string fileName)\r
{\r
string name = "xsp_" + Path.GetFileName (fileName).Replace (".aspx", ".txt");\r
{\r
}\r
\r
- internal static Type GetTypeFromSource (string fileName)\r
+ static Type AlreadyGotIt (string aspxFile, ref DateTime filedt)\r
{\r
- PageBuilder builder = new PageBuilder (fileName);\r
- return builder.Build ();\r
+ WebTrace.PushContext ("TemplateFactory.AlreadyGotIt");\r
+ WebTrace.WriteLine ("Start: {0}", aspxFile);\r
+ if (!compiledTypes.Contains (aspxFile)) {\r
+ WebTrace.WriteLine ("File {0} not already compiled", filedt);\r
+ WebTrace.PopContext ();\r
+ return null;\r
+ }\r
+\r
+ CompiledTypeData data = (CompiledTypeData) compiledTypes [aspxFile];\r
+ try {\r
+ filedt = File.GetLastWriteTime (aspxFile);\r
+ } catch {\r
+ WebTrace.WriteLine ("Error getting date for {0}", aspxFile);\r
+ WebTrace.PopContext ();\r
+ return null;\r
+ }\r
+ \r
+ if (data.IsNewer (filedt)) {\r
+ compiledTypes.Remove (aspxFile);\r
+ WebTrace.WriteLine ("aspx modified: {0}", filedt);\r
+ WebTrace.PopContext ();\r
+ return null;\r
+ }\r
+\r
+ WebTrace.WriteLine ("End: {0}", data.Type);\r
+ WebTrace.PopContext ();\r
+ return data.Type;\r
+ }\r
+\r
+ internal static Type GetTypeFromSource (string aspxFile, string csFile)\r
+ {\r
+ if (!File.Exists (csFile))\r
+ return null;\r
+\r
+ DateTime filedt = DateTime.Now;\r
+ Type type = AlreadyGotIt (aspxFile, ref filedt) as Type;\r
+ if (type != null)\r
+ return type;\r
+\r
+ PageBuilder builder = new PageBuilder (csFile);\r
+ lock (compiling) {\r
+ type = AlreadyGotIt (aspxFile, ref filedt) as Type;\r
+ if (type != null)\r
+ return type;\r
+ \r
+ type = builder.Build ();\r
+ }\r
+\r
+ if (type == null)\r
+ return null;\r
+\r
+ CompiledTypeData data = new CompiledTypeData (aspxFile, csFile, type, filedt);\r
+ compiledTypes.Add (aspxFile, data);\r
+\r
+ return type;\r
}\r
}\r
}\r
public static Type CompileIntoType (SimpleWebHandlerParser wService)
{
string sourceFile = GenerateSourceFile (wService);
- Type type = TemplateFactory.GetTypeFromSource (sourceFile);
+ Type type = TemplateFactory.GetTypeFromSource (wService.PhysicalPath, sourceFile);
if (type.FullName != wService.ClassName)
throw new ApplicationException (String.Format (
"Class={0}, but the class compiled is {1}",
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlersSectionHandler.cs: more null checks.
+
2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* HttpHandlersSectionHandler.cs: made a couple of static methods be
string name = child.Name;
if (name == "clear") {
- if (child.Attributes.Count != 0)
+ if (child.Attributes != null && child.Attributes.Count != 0)
HandlersUtil.ThrowException ("Unrecognized attribute", child);
mapper.Clear ();
if (name == "add") {
string type = HandlersUtil.ExtractAttributeValue ("type", child);
- if (child.Attributes.Count != 0)
+ if (child.Attributes != null && child.Attributes.Count != 0)
HandlersUtil.ThrowException ("Unrecognized attribute", child);
HandlerItem item = new HandlerItem (verb, path, type, validate);
}
if (name == "remove") {
- if (child.Attributes.Count != 0)
+ if (child.Attributes != null && child.Attributes.Count != 0)
HandlersUtil.ThrowException ("Unrecognized attribute", child);
if (validate && mapper.Remove (verb, path) == null)
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: Use WebEncoding.Encoding.
+
+ * Control.cs:
+ * Page.cs: fixed namespace.
+
2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Page.cs: set the context in ProcessRequest. Added a few trace calls.
using System.Collections;\r
using System.ComponentModel;\r
using System.Web;\r
-using System.Web.Utils;\r
+using System.Web.Util;\r
\r
namespace System.Web.UI\r
{\r
using System.IO;
using System.Text;
using System.Web.UI;
+using System.Web.Util;
namespace System.Web.UI
{
if (input == null)
throw new ArgumentNullException ("input");
- string real_input = Encoding.UTF8.GetString (Convert.FromBase64String (input));
+ string real_input = WebEncoding.Encoding.GetString (Convert.FromBase64String (input));
return DeserializeObject (real_input);
}
StringBuilder builder = new StringBuilder ();
StringWriter writer = new StringWriter (builder);
SerializeObject (writer, value);
- byte [] bytes = Encoding.UTF8.GetBytes (builder.ToString ());
+ byte [] bytes = WebEncoding.Encoding.GetBytes (builder.ToString ());
output.Write (Convert.ToBase64String (bytes));
}
using System.Web;
using System.Web.Caching;
using System.Web.SessionState;
-using System.Web.Utils;
+using System.Web.Util;
namespace System.Web.UI
{
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>\r
+\r
+ * WebTrace.cs: fixed namespace.\r
+\r
+ * WebEncoding.cs: new class that holds the default encoding for\r
+ System.Web.\r
+\r
2002-01-03 Nick Drochak <ndrochak@gol.com>\r
\r
* FileChangesMonitor.cs: remove redundant using statement; use int\r
2001-11-08\r
Gaurav Vaish <gvaish@iitk.ac.in>\r
* Namespace - Created the namespace for commonly used,\r
- otherwise not available functions
\ No newline at end of file
+ otherwise not available functions\r
--- /dev/null
+//
+// System.Web.Util.WebEncoding
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Text;
+
+namespace System.Web.Util
+{
+ internal class WebEncoding
+ {
+ static Encoding encoding = new UTF8Encoding (false);
+
+ static public Encoding Encoding
+ {
+ get { return encoding; }
+ }
+ }
+}
+
//
-// System.Web.Utils.WebTrace
+// System.Web.Util.WebTrace
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
using System.Collections;
using System.Diagnostics;
-namespace System.Web.Utils
+namespace System.Web.Util
{
internal class WebTrace
{
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: reenabled a few lines of code
+ (ThreadPool already fixed).
+
+ * HttpRequest.cs:
+ * HttpResponse.cs:
+ * HttpUtility.cs:
+ * HttpValueCollection.cs:
+ * HttpWriter.cs: Use WebEncoding.Encoding.
+
2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* HttpWriter.cs: changed encoding of the writer from Unicode to UTF8.
}\r
\r
internal void ExecuteNextAsync(Exception lasterror) {\r
- //FIXME: something is wrong with this: the socket is closed before compilation finishes.\r
- // if (!Thread.CurrentThread.IsThreadPoolThread) {\r
- // ThreadPool.QueueUserWorkItem(_asynchandler, lasterror);\r
- // } else {\r
+ if (!Thread.CurrentThread.IsThreadPoolThread) {\r
+ ThreadPool.QueueUserWorkItem(_asynchandler, lasterror);\r
+ } else {\r
ExecuteNext(lasterror);\r
- // }\r
+ }\r
}\r
\r
private void ExecuteNext(Exception lasterror) {\r
#endregion\r
\r
#region Constructor\r
- public HttpApplication() {\r
- }\r
+\r
+ public HttpApplication ()\r
+ {\r
+ }\r
+\r
#endregion\r
\r
#region Methods\r
}\r
\r
[MonoTODO()]\r
- internal void RecycleHandlers() {\r
+ internal void RecycleHandlers ()\r
+ {\r
// TODO: Recycle the created handlers (via factory?)\r
}\r
\r
using System.IO;\r
using System.Text;\r
using System.Web.Configuration;\r
+using System.Web.Util;\r
\r
namespace System.Web {\r
[MonoTODO("Review security in all path access function")]\r
public NameValueCollection QueryString {\r
get {\r
if (_oQueryString == null) {\r
- _oQueryString = new HttpValueCollection(QueryStringRaw, true, Encoding.UTF8);\r
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true,\r
+ WebEncoding.Encoding);\r
}\r
\r
return _oQueryString;\r
using System.IO;
using System.Text;
using System.Threading;
+using System.Web.Util;
namespace System.Web
{
{
get {
if (_ContentEncoding == null)
- _ContentEncoding = Encoding.UTF8;
+ _ContentEncoding = WebEncoding.Encoding;
return _ContentEncoding;
}
using System.Globalization;\r
using System.IO;\r
using System.Text;\r
+using System.Web.Util;\r
\r
namespace System.Web {\r
public sealed class HttpUtility {\r
\r
public static string UrlDecode (string str) \r
{\r
- return UrlDecode(str, Encoding.UTF8);\r
+ return UrlDecode(str, WebEncoding.Encoding);\r
}\r
\r
private static char [] GetChars (ArrayList b, Encoding e)\r
\r
public static byte [] UrlDecodeToBytes (string str)\r
{\r
- return UrlDecodeToBytes (str, Encoding.UTF8);\r
+ return UrlDecodeToBytes (str, WebEncoding.Encoding);\r
}\r
\r
public static byte [] UrlDecodeToBytes (string str, Encoding e)\r
\r
public static string UrlEncode(string str) \r
{\r
- return UrlEncode(str, Encoding.UTF8);\r
+ return UrlEncode(str, WebEncoding.Encoding);\r
}\r
\r
public static string UrlEncode (string s, Encoding Enc) \r
\r
public static byte [] UrlEncodeToBytes (string str)\r
{\r
- return UrlEncodeToBytes (str, Encoding.UTF8);\r
+ return UrlEncodeToBytes (str, WebEncoding.Encoding);\r
}\r
\r
public static byte [] UrlEncodeToBytes (string str, Encoding e)\r
using System.Collections.Specialized;\r
using System.Runtime.Serialization;\r
using System.Text;\r
+using System.Web.Util;\r
\r
namespace System.Web {\r
\r
}\r
\r
internal HttpValueCollection(string sData) {\r
- FillFromQueryString(sData, Encoding.UTF8);\r
+ FillFromQueryString(sData, WebEncoding.Encoding);\r
IsReadOnly = true;\r
}\r
\r
}\r
\r
internal void FillFromHeaders(string sData) {\r
- FillFromHeaders(sData, Encoding.UTF8);\r
+ FillFromHeaders(sData, WebEncoding.Encoding);\r
}\r
\r
// String = test=aaa&kalle=nisse\r
}\r
\r
internal void FillFromQueryString(string sData) {\r
- FillFromQueryString(sData, Encoding.UTF8);\r
+ FillFromQueryString(sData, WebEncoding.Encoding);\r
}\r
\r
internal void FillFromCookieString(string sData) {\r
- FillFromQueryString(sData, Encoding.UTF8);\r
+ FillFromQueryString(sData, WebEncoding.Encoding);\r
}\r
\r
internal void MakeReadOnly() {\r
using System;
using System.IO;
using System.Text;
+using System.Web.Util;
namespace System.Web
{
_Response = Response;
_OutputStream = new MemoryStream (32768);
- _OutputHelper = new StreamWriter (_OutputStream, Encoding.UTF8);
+ _OutputHelper = new StreamWriter (_OutputStream, WebEncoding.Encoding);
_ResponseStream = new HttpResponseStream (this);
Update ();
System.Web.Util/IISVersionInfo.cs
System.Web.Util/NativeFileChangeEventHandler.cs
System.Web.Util/UrlUtils.cs
+System.Web.Util/WebEncoding.cs
System.Web.Util/WebEqualComparer.cs
System.Web.Util/WebHashCodeProvider.cs
System.Web.Util/WebTrace.cs