diff options
author | Ben Maurer <benm@mono-cvs.ximian.com> | 2003-11-05 02:43:25 +0300 |
---|---|---|
committer | Ben Maurer <benm@mono-cvs.ximian.com> | 2003-11-05 02:43:25 +0300 |
commit | 4ff2d5114047521a03244a2153d6c21480a57962 (patch) | |
tree | 0bdcb5fcde5ce89f3b772c5d1dc0d0c85cf42e41 | |
parent | 5913de6f3fe2386fc0654c10a4cebde609a8b866 (diff) |
2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net>
* HttpContext.cs (IsCustomErrorEnabled): dont throw exception, just return false
(which makes sense, as the custom errors *arent* enabled; ie they dont work.
* HttpResponseStream.cs: you actually can write with len = 0
* AssemblyResourceLoader.cs: New file. New v2 handler.
* Control.cs (GetWebResourceUrl): new v2 function
* Page.cs (GetWebResourceUrl): ditto.
make the JS we generate work with moz if the form is not a child
of document.
* WebResourceAttribute.cs: Added, new v2 attribute.
svn path=/trunk/mcs/; revision=19631
-rw-r--r-- | mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs | 68 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web.Handlers/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/ChangeLog | 8 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/Control.cs | 10 | ||||
-rwxr-xr-x | mcs/class/System.Web/System.Web.UI/Page.cs | 17 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs | 28 | ||||
-rwxr-xr-x | mcs/class/System.Web/System.Web.dll.sources | 2 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/HttpContext.cs | 3 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/HttpResponseStream.cs | 2 |
10 files changed, 144 insertions, 4 deletions
diff --git a/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs b/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs new file mode 100644 index 00000000000..fd8acefe787 --- /dev/null +++ b/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs @@ -0,0 +1,68 @@ +// +// System.Web.Handlers.AssemblyResourceLoader +// +// Authors: +// Ben Maurer (bmaurer@users.sourceforge.net) +// +// (C) 2003 Ben Maurer +// + +using System.Web; +using System.Web.UI; +using System.Reflection; +using System.IO; + +namespace System.Web.Handlers { + [MonoTODO ("Should we cache stuff?")] + #if NET_1_2 + public + #else + internal // since this is in the .config file, we need to support it, since we dont have versoned support. + #endif + class AssemblyResourceLoader : IHttpHandler { + + internal static string GetResourceUrl (Type type, string resourceName) + { + return "WebResource.axd?assembly=" + + HttpUtility.UrlEncode (type.Assembly.GetName ().FullName) + + "&resource=" + + HttpUtility.UrlEncode (resourceName); + } + + + [MonoTODO ("Substitution not implemented")] + private void System.Web.IHttpHandler.ProcessRequest (HttpContext context) + { + string resourceName = context.Request.QueryString ["resource"]; + Assembly assembly = Assembly.Load (context.Request.QueryString ["assembly"]); + + bool found = false; + foreach (WebResourceAttribute wra in assembly.GetCustomAttributes (typeof (WebResourceAttribute), false)) { + if (wra.WebResource == resourceName) { + context.Response.ContentType = wra.ContentType; + + if (wra.PerformSubstitution) + throw new NotImplementedException ("Substitution not implemented"); + + found = true; + break; + } + } + if (!found) + return; + + Stream s = assembly.GetManifestResourceStream (resourceName); + + byte [] buf = new byte [1024]; + Stream output = context.Response.OutputStream; + int c; + do { + c = s.Read (buf, 0, 1024); + output.Write (buf, 0, c); + } while (c > 0); + } + + private bool System.Web.IHttpHandler.IsReusable { get { return true; } } + } +} + diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog index 63df449a29c..e228117d46c 100644 --- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog +++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog @@ -1,3 +1,7 @@ +2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net> + + * AssemblyResourceLoader.cs: New file. New v2 handler. + 2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> * ChangeLog: New file. diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index de05d6a1f74..f76f1d442a8 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,11 @@ +2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net> + + * Control.cs (GetWebResourceUrl): new v2 function + * Page.cs (GetWebResourceUrl): ditto. + make the JS we generate work with moz if the form is not a child + of document. + * WebResourceAttribute.cs: Added, new v2 attribute. + 2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> * DesignTimeTemplateParser.cs: added FIXME related to PageParser. diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs index ac1c62b17be..bc3b968b397 100644 --- a/mcs/class/System.Web/System.Web.UI/Control.cs +++ b/mcs/class/System.Web/System.Web.UI/Control.cs @@ -897,6 +897,14 @@ namespace System.Web.UI control._namingContainer = null;
}
- //TODO: I think there are some needed Interface implementations to do here.
+ //TODO: I think there are some needed Interface implementations to do here. + + #if NET_1_2 + protected string GetWebResourceUrl (string resourceName) + { + return Page.GetWebResourceUrl (GetType(), resourceName); + } + + #endif
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index 6e9bf32c07e..8a03f1a4d60 100755 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -437,7 +437,7 @@ public class Page : TemplateControl, IHttpHandler writer.WriteLine ("<script language=\"javascript\">"); writer.WriteLine ("<!--"); writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {"); - writer.WriteLine ("\t\tvar theform = document.{0};", formUniqueID); + writer.WriteLine ("\t\tvar theform = document.getElementById ('{0}');", formUniqueID); writer.WriteLine ("\t\ttheform.{0}.value = eventTarget;", postEventSourceID); writer.WriteLine ("\t\ttheform.{0}.value = eventArgument;", postEventArgumentID); writer.WriteLine ("\t\ttheform.submit();"); @@ -819,5 +819,20 @@ public class Page : TemplateControl, IHttpHandler } #endregion + + #if NET_1_2 + public string GetWebResourceUrl(Type type, string resourceName) + { + if (type == null) + throw new ArgumentNullException ("type"); + + if (resourceName == null || resourceName.Length == 0) + throw new ArgumentNullException ("type"); + + return System.Web.Handlers.AssemblyResourceLoader.GetResourceUrl (type, resourceName); + } + + + #endif } } diff --git a/mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs b/mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs new file mode 100644 index 00000000000..20081ec9767 --- /dev/null +++ b/mcs/class/System.Web/System.Web.UI/WebResourceAttribute.cs @@ -0,0 +1,28 @@ +// +// System.Web.UI.WebResourceAttribute +// +// Authors: +// Ben Maurer (bmaurer@users.sourceforge.net) +// +// (C) 2003 Ben Maurer +// +#if NET_1_2 +namespace System.Web.UI { + public sealed class WebResourceAttribute : Attribute { + public WebResourceAttribute (string webResource, string contentType) : this (webResource, contentType, false) {} + public WebResourceAttribute (string webResource, string contentType, bool performSubstitution) + { + this.webResource = webResource; + this.contentType = contentType; + this.performSubstitution = performSubstitution; + } + + public string ContentType { get { return contentType; } } + public bool PerformSubstitution { get { return performSubstitution; } } + public string WebResource { get { return webResource; } } + + bool performSubstitution; + string webResource, contentType; + } +} +#endif
\ No newline at end of file diff --git a/mcs/class/System.Web/System.Web.dll.sources b/mcs/class/System.Web/System.Web.dll.sources index 5ecb9218be3..97a1cbee1f7 100755 --- a/mcs/class/System.Web/System.Web.dll.sources +++ b/mcs/class/System.Web/System.Web.dll.sources @@ -113,6 +113,7 @@ System.Web.Configuration/AuthorizationConfig.cs System.Web.Configuration/GlobalizationConfigurationHandler.cs System.Web.Configuration/WebCompiler.cs System.Web.Configuration/WebControlsSectionHandler.cs +System.Web.Handlers/AssemblyResourceLoader.cs System.Web.Handlers/TraceHandler.cs System.Web.Hosting/AppDomainFactory.cs System.Web.Hosting/ApplicationHost.cs @@ -246,6 +247,7 @@ System.Web.UI/Utils.cs System.Web.UI/ValidationPropertyAttribute.cs System.Web.UI/ValidatorCollection.cs System.Web.UI/WebHandlerParser.cs +System.Web.UI/WebResourceAttribute.cs System.Web.UI/WebServiceParser.cs System.Web.UI/ObjectTagBuilder.cs System.Web.UI/LosFormatter.cs diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 93aca5c30c4..3c1c2c6dd4a 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,9 @@ +2003-11-04 Ben Maurer <bmaurer@users.sourceforge.net> + + * HttpContext.cs (IsCustomErrorEnabled): dont throw exception, just return false + (which makes sense, as the custom errors *arent* enabled; ie they dont work. + * HttpResponseStream.cs: you actually can write with len = 0 + 2003-11-03 Jackson Harper <jackson@ximian.com> * HttpResponse.cs (ContentEncoding): Throw diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs index 93283fcdd48..5813e6dfc92 100644 --- a/mcs/class/System.Web/System.Web/HttpContext.cs +++ b/mcs/class/System.Web/System.Web/HttpContext.cs @@ -153,7 +153,8 @@ namespace System.Web public bool IsCustomErrorEnabled { get { - throw new NotImplementedException (); + return false; + //throw new NotImplementedException (); } } diff --git a/mcs/class/System.Web/System.Web/HttpResponseStream.cs b/mcs/class/System.Web/System.Web/HttpResponseStream.cs index 831118b67ae..b659da76f28 100644 --- a/mcs/class/System.Web/System.Web/HttpResponseStream.cs +++ b/mcs/class/System.Web/System.Web/HttpResponseStream.cs @@ -43,7 +43,7 @@ namespace System.Web { throw new ArgumentOutOfRangeException("offset");
}
- if (length <= 0) {
+ if (length < 0) {
throw new ArgumentOutOfRangeException("length");
}
|