I am using spring frameworking following is the mapping of url to controller
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/controller.web">webController</prop>
<prop key="/robots.txt">robotsController</prop>
</props>
</property>
</bean>
When i hit controller.web control gets to the web controller but when i hit robots.txt control do not transfer to the robotsController instead it tries to find out resource robots.txt if i remove robots.txt from context dir it says resource not found.
if i change robots.txt to robots.web it works fine it means there is some thing fishy with robots.txt’s name any idea ?
I guess your
DispatcherServletis mapped as<url-pattern>*.web</url-pattern>, therefore it handles only requests to*.web.If you want
DispatcherServletto handle request with different extensions you have several options:Add several
url-patterns to<servlet-mapping>:Handle all requests with
DispatcherServletmapped as<url-pattern>/</url-pattern>. Note that this approach requires some effort to serve static content, see here.