SimpleUrlHandlerMapping not working for url with few extentions like dsm or ds

Viewed 847

I am trying to implement SimpleUrlHandlerMapping in Spring. I am using Spring 4.2.5 version.

Following is my mapping

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    .....

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <props>
            <prop key="/hello1.dsm">hc</prop>
        </props>
    </property>
</bean>

<bean id="hc" class="com.vaannila.HelloWorldController" >
    <property name="message" value="Hello World!" />
</bean>

....

</beans>

When I run tomcat, I get the info message on console saying

org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/hello1.dsm] onto handler 'hc'

But When I hit the url "http://localhost:8080/SpringExample5/hello1.dsm" in my browser I get the requested resource is not available error i.e 404.

Later when I change key to "/hello1.htm", it worked fine with respective url. I am wondering is there any rule on url extention while mapping url to controller.

1 Answers
Related