[Mono-dev] [PATCH] Add HttpNotFoundHandler and HttpNotImplementedHandler

Marek Habersack grendel at twistedcode.net
Mon Nov 2 03:31:48 EST 2009


Miguel de Icaza wrote:
Hello,

> Hello Kornél,
> 
>       I am not sure why we would include in Mono two classes that are  
> flagged as internal.   How would a user even use this?
There are a few internal classes we refer to outside System.Web (in the global web.config - e.g. 
StaticFileHandler, HttpForbiddenHandler, HttpMethodNotAllowedHandler, all the build providers etc) 
but I also don't see a point in including classes we do not use in any such way. Kornél, is there 
any known external use of those classes in .NET?

marek
> 
> On Nov 1, 2009, at 11:23 AM, Kornél Pál wrote:
> 
>> I've received no comments or approval please review and if you like  
>> it,
>> approve the patch.
>>
>> Thanks.
>>
>> Kornél
>>
>> Kornél Pál wrote:
>>> Hi,
>>> These two internal types are present in all .NET Framework versions.
>>> HttpNotFoundHandler is exposed by default Web.config in .NET  
>>> Framework 2.0.
>>> HttpNotImplementedHandler is documented in book Professional  
>>> ASP.NET 2.0 Security, Membership, and Role Management, page 66:
>>> http://books.google.com/books?id=Qt3TeJJkG5oC
>>> Kornél
>>
>> Index: mcs/class/System.Web/System.Web/HttpNotImplementedHandler.cs
>> ===================================================================
>> --- mcs/class/System.Web/System.Web/HttpNotImplementedHandler.cs	 
>> (revision 0)
>> +++ mcs/class/System.Web/System.Web/HttpNotImplementedHandler.cs	 
>> (revision 0)
>> @@ -0,0 +1,46 @@
>> +//
>> +// System.Web.HttpNotImplementedHandler.cs
>> +//
>> +// Author:
>> +//   Kornél Pál <http://www.kornelpal.com/>
>> +//
>> +// Copyright (C) 2009 Kornél Pál
>> +//
>> +
>> +//
>> +// 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.
>> +//
>> +
>> +namespace System.Web
>> +{
>> +	internal class HttpNotImplementedHandler : IHttpHandler
>> +	{
>> +		public void ProcessRequest (HttpContext context)
>> +		{
>> +			HttpRequest request = context.Request;
>> +
>> +			throw new HttpException (501, request.HttpMethod + " " +  
>> request.Path + " is not implemented.");
>> +		}
>> +
>> +		public bool IsReusable {
>> +			get { return true; }
>> +		}
>> +	}
>> +}
>>
>> Property changes on: mcs\class\System.Web\System.Web 
>> \HttpNotImplementedHandler.cs
>> ___________________________________________________________________
>> Name: svn:eol-style
>>   + native
>>
>> Index: mcs/class/System.Web/System.Web/HttpNotFoundHandler.cs
>> ===================================================================
>> --- mcs/class/System.Web/System.Web/HttpNotFoundHandler.cs	(revision  
>> 0)
>> +++ mcs/class/System.Web/System.Web/HttpNotFoundHandler.cs	(revision  
>> 0)
>> @@ -0,0 +1,46 @@
>> +//
>> +// System.Web.HttpNotFoundHandler.cs
>> +//
>> +// Author:
>> +//   Kornél Pál <http://www.kornelpal.com/>
>> +//
>> +// Copyright (C) 2009 Kornél Pál
>> +//
>> +
>> +//
>> +// 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.
>> +//
>> +
>> +namespace System.Web
>> +{
>> +	internal class HttpNotFoundHandler : IHttpHandler
>> +	{
>> +		public void ProcessRequest (HttpContext context)
>> +		{
>> +			string path = context.Request.Path;
>> +
>> +			throw new HttpException (404, "Path '" + path + "' was not  
>> found.", path);
>> +		}
>> +
>> +		public bool IsReusable {
>> +			get { return true; }
>> +		}
>> +	}
>> +}
>>
>> Property changes on: mcs\class\System.Web\System.Web 
>> \HttpNotFoundHandler.cs
>> ___________________________________________________________________
>> Name: svn:eol-style
>>   + native
>>
>> Index: mcs/class/System.Web/System.Web20.csproj
>> ===================================================================
>> --- mcs/class/System.Web/System.Web20.csproj	(revision 135657)
>> +++ mcs/class/System.Web/System.Web20.csproj	(working copy)
>> @@ -1091,6 +1091,8 @@
>>       <SubType>Code</SubType>
>>     </Compile>
>>     <Compile Include="System.Web\HttpModuleCollection.cs" />
>> +    <Compile Include="System.Web\HttpNotFoundHandler.cs" />
>> +    <Compile Include="System.Web\HttpNotImplementedHandler.cs" />
>>     <Compile Include="System.Web\HttpParseException.cs" />
>>     <Compile Include="System.Web\HttpPostedFile.cs" />
>>     <Compile Include="System.Web\HttpRequest.cs" />
>> Index: mcs/class/System.Web/System.Web.dll.sources
>> ===================================================================
>> --- mcs/class/System.Web/System.Web.dll.sources	(revision 135657)
>> +++ mcs/class/System.Web/System.Web.dll.sources	(working copy)
>> @@ -316,6 +316,8 @@
>> System.Web/HttpForbiddenHandler.cs
>> System.Web/HttpMethodNotAllowedHandler.cs
>> System.Web/HttpModuleCollection.cs
>> +System.Web/HttpNotFoundHandler.cs
>> +System.Web/HttpNotImplementedHandler.cs
>> System.Web/HttpParamsCollection.cs
>> System.Web/HttpParseException.cs
>> System.Web/HttpPostedFile.cs
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 



More information about the Mono-devel-list mailing list