I\'ve mapped the Spring MVC dispatcher as a global front controller servlet on /*
.
In section "12.2 Specification of Mappings" of the Servlet Specification, it says:
A string containing only the ’/’ character indicates the "default" servlet of the application.
So in theory, you could make your Servlet mapped to /*
do:
getServletContext().getNamedDispatcher("/").forward(req,res);
... if you didn't want to handle it yourself.
However, in practice, it doesn't work.
In both Tomcat and Jetty, the call to getServletContext().getNamedDispatcher('/')
returns null
if there is a servlet mapped to '/*'