C# Class Spring.Web.Support.MappingHandlerFactory

MappingHandleryFactory allows for full Spring-managed <httpHandlers> configuration. It uses regular expressions for url matching.
The example below shows, how to map all url requests to spring and let MappingHandlerFactory resolve urls to container-managed IHttpHandlerFactory or IHttpHandler objects. // web.config <httpHandlers> <!-- map all requests to spring (just for demo - don't do this at home!) --> <add verb="*" path="*.*" type="Spring.Web.Support.MappingHandlerFactory, Spring.Web" /> </httpHandlers> // spring-objects.config <object type="Spring.Web.Support.MappingHandlerFactoryConfigurer, Spring.Web"> <property name="HandlerMap"> <dictionary> <entry key="\.ashx$" value="standardHandlerFactory" /> <!-- map any request ending with *.whatever to standardHandlerFactory --> <entry key="\.whatever$" value="specialHandlerFactory" /> </dictionary> </property> </object> <object name="standardHandlerFactory" type="Spring.Web.Support.DefaultHandlerFactory, Spring.Web" /> <object name="specialHandlerFactory" type="MySpecialHandlerFactoryImpl" />
Inheritance: Spring.Web.Support.AbstractHandlerFactory
Mostrar archivo Open project: spring-projects/spring-net

Public Methods

Method Description
ReleaseHandler ( IHttpHandler handler ) : void

Enables a factory to release an existing System.Web.IHttpHandler instance.

Protected Methods

Method Description
CreateHandlerInstance ( IConfigurableApplicationContext appContext, HttpContext context, string requestType, string rawUrl, string physicalPath ) : IHttpHandler

Create a handler instance for the given URL. Will try to find a match of rawUrl onto patterns in HandlerMap. If a match is found, delegates the call to the matching IHttpHandlerFactory.GetHandler method.

MapHandlerInstance ( IConfigurableApplicationContext appContext, HttpContext context, string requestType, string rawUrl, string physicalPath, HandlerMap handlerMappings, IDictionary handlerWithFactoryTable ) : IHttpHandler

Obtains a handler by mapping rawUrl to the list of patterns in handlerMappings.

ReleaseHandler ( IHttpHandler handler, IDictionary _handlerWithFactoryTable ) : void

Removes the handler from the handler/factory dictionary and releases the handler.

Method Details

CreateHandlerInstance() protected method

Create a handler instance for the given URL. Will try to find a match of rawUrl onto patterns in HandlerMap. If a match is found, delegates the call to the matching IHttpHandlerFactory.GetHandler method.
protected CreateHandlerInstance ( IConfigurableApplicationContext appContext, HttpContext context, string requestType, string rawUrl, string physicalPath ) : IHttpHandler
appContext IConfigurableApplicationContext the application context corresponding to the current request
context System.Web.HttpContext The instance for this request.
requestType string The HTTP data transfer method (GET, POST, ...)
rawUrl string The requested .
physicalPath string The physical path of the requested resource.
return IHttpHandler

MapHandlerInstance() protected method

Obtains a handler by mapping rawUrl to the list of patterns in handlerMappings.
protected MapHandlerInstance ( IConfigurableApplicationContext appContext, HttpContext context, string requestType, string rawUrl, string physicalPath, HandlerMap handlerMappings, IDictionary handlerWithFactoryTable ) : IHttpHandler
appContext IConfigurableApplicationContext the application context corresponding to the current request
context HttpContext The instance for this request.
requestType string The HTTP data transfer method (GET, POST, ...)
rawUrl string The requested .
physicalPath string The physical path of the requested resource.
handlerMappings HandlerMap
handlerWithFactoryTable IDictionary
return IHttpHandler

ReleaseHandler() public method

Enables a factory to release an existing System.Web.IHttpHandler instance.
public ReleaseHandler ( IHttpHandler handler ) : void
handler IHttpHandler /// The object to release. ///
return void

ReleaseHandler() protected method

Removes the handler from the handler/factory dictionary and releases the handler.
protected ReleaseHandler ( IHttpHandler handler, IDictionary _handlerWithFactoryTable ) : void
handler IHttpHandler the handler to be released
_handlerWithFactoryTable IDictionary a dictionary containing (, ) entries.
return void