I have setup my spring-mvc servlet to match *.page requests. I have setup the welcome-file-list in web.xml to be index.page
This works when I go to the root of my webserver:
http://me.com does get redirected to http://me.com/index.page correctly.
However, it doesn’t redirect when I use subdirectoris:
http://me.com/dashboard does not get redirected to http://me.com/dashboard/index.page
Is there any way to get this mapping working?
My web.xml file (extract):
<welcome-file-list>
<welcome-file>index.page</welcome-file>
</welcome-file-list>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>*.page</url-pattern>
</servlet-mapping>
My webdefault.xml (from jetty):
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>welcomeServlets</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>redirectWelcome</param-name>
<param-value>false</param-value>
</init-param>
It will work only for real, physical directories, not won’t work for arbitrary servlet mappings simulating directory structure.
Spring MVC allows very complex URL mappings, so you’d better handle this scenario with
@RequestMapping