Files
mono/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
T
Gonzalo Paniagua Javier 00cd44e83d 2002-10-08 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpApplication.cs: use handlers from configuration.
	* System.Web/HttpContext.cs: get handlers from ConfigurationSettings.

	* System.Web.Caching/Cache.cs: little fixes.

	* System.Web.Configuration/HttpHandlerTypeMapper.cs: removed.
	* System.Web.Configuration/HandlerFactoryConfiguration.cs: readded. I
	removed it by mistake.
	* System.Web.Configuration/HandlerItem.cs: only load the type if
	we gotta validate it. Implemented initial IsMatch.
	* System.Web.Configuration/HttpConfigurationContext.cs: New file.
	* System.Web.Configuration/HttpHandlersSectionHandler.cs: validate is
	optional (default true).  Use HttpHandlerTypeMapper.

	* System.Web.UI/SimpleHandlerFactory.cs: new handler for .ashx files.

svn path=/trunk/mcs/; revision=8053
2002-10-08 04:29:52 +00:00

76 lines
1.3 KiB
C#

//
// System.Web.Configuration.HandlerFactoryConfiguration
//
// Authors:
// Patrik Torstensson ([email protected])
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
using System.Collections;
namespace System.Web.Configuration
{
class HandlerFactoryConfiguration
{
ArrayList mappings;
public HandlerFactoryConfiguration () : this (null)
{
}
public HandlerFactoryConfiguration (HandlerFactoryConfiguration parent)
{
if (parent != null)
mappings = new ArrayList (parent.mappings);
else
mappings = new ArrayList ();
}
public void Add (HandlerItem mapping)
{
mappings.Add (mapping);
}
public HandlerItem Remove (string verb, string path)
{
int i = GetIndex (verb, path);
if (i == -1)
return null;
HandlerItem item = (HandlerItem) mappings [i];
mappings.RemoveAt (i);
return item;
}
public void Clear ()
{
mappings.Clear ();
}
public HandlerItem FindHandler (string verb, string path)
{
int i = GetIndex (verb, path);
if (i == -1)
return null;
return (HandlerItem) mappings [i];
}
int GetIndex (string verb, string path)
{
int end = mappings.Count;
for (int i = 0; i < end; i++) {
HandlerItem item = (HandlerItem) mappings [i];
if (item.IsMatch (verb, path))
return i;
}
return -1;
}
}
}