I'm testing an upgrade from Spring 2.0 to Spring 3.0.5 on Tomcat and am having an issue where there is different mapping behavior for URLs that have a trailing slash versus an identical URL without the trailing slash.
For example, in my Spring 2.0 implementation, the following URLs would both map to the same controller class, per the Spring MVC XML configuration below:
However, in Spring 3.0.5, /search/categories/ (note trailing slash) is not mapped to the controller. Only /search/categories (no trailing slash) gets mapped.Code:<bean id="searchMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="order" value="1"/> <property name="mappings"> <props> <prop key="/search/categories">categoriesController</prop> </props> </property> </bean>
I know that the XML configuration is deprecated going forward and, unfortunately, I'm unable to move off of it just yet. But I am unsure as to why with Spring 3.0.5 there is new behavior for URLs with trailing slashes. Any suggestions or thoughts on a possible fix? Will I need to go as far as implementing an Apache Rewrite condition to remove trailing slashes on URLs?
Thanks for your help!