<?xml version="1.0" encoding="utf-8"?>
<configuration>

    <system.web>
        <httpHandlers>
<!-- 
	the lines below map *any* request ending with *.ashx or *.whatever to the global(!) MappingHandlerFactory. Further "specialication" 
	of which handler to map to is done within MappingHandlerFactory's configuration - use MappingHandlerFactoryConfigurer for this (see below)
-->
            <add verb="*" path="*.ashx" type="Spring.Web.Support.MappingHandlerFactory, Spring.Web" validate="true"/>
            <add verb="*" path="*.whatever" type="Spring.Web.Support.MappingHandlerFactory, Spring.Web" validate="false"/>
        </httpHandlers>
    </system.web>

    <spring>
        <context>
            <resource uri="config://spring/objects" />
        </context>
        <objects xmlns="http://www.springframework.net">

            <!-- configures the global GenericHandlerFactory instance -->
            <object name="mappingHandlerFactoryConfigurer" type="Spring.Web.Support.MappingHandlerFactoryConfigurer, Spring.Web">
                <property name="HandlerMap">
                    <dictionary>
                        <!-- map any request ending with *.whatever to NoOpHandler -->
                        <entry key="\.whatever$" value="myCustomHandler" />
                        <entry key="\.ashx$" value="standardHandlerFactory" />
                    </dictionary>
                </property>
            </object>

            <!-- 
                uses the original System.Web.UI.SimpleHandlerFactory to create handler instances 
                and configures each handler using objectdefinitions matching the requestl url's filename
            -->
            <object name="standardHandlerFactory" type="Spring.Web.Support.DefaultHandlerFactory, Spring.Web" />

            <!-- defines a standard singleton that will handle *.whatever requests -->
            <object name="myCustomHandler" type="MyCustomHttpHandler, App_Code">
                <property name="MessageText" value="This text is injected via Spring" />
            </object>
            
            <!-- 
                used for configuring ~/DemoHandler.ashx custom handler
                note, that this is an abstract definition because 'type' is not specified 
            -->
            <object name="DemoHandler.ashx">
                <property name="OutputText">
                    <value>This text is injected via Spring</value>
                </property>
            </object>
        </objects>
    </spring>
</configuration>
